Compare commits
2 Commits
6ca9550f30
...
ee82c44c7f
| Author | SHA1 | Date |
|---|---|---|
|
|
ee82c44c7f | |
|
|
72d4e8c298 |
|
|
@ -1,6 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using Infrastructure;
|
||||
using OpenAuth.Repository.Domain;
|
||||
using SqlSugar;
|
||||
|
||||
namespace OpenAuth.App.Response
|
||||
{
|
||||
|
|
@ -70,6 +71,10 @@ namespace OpenAuth.App.Response
|
|||
/// 模块中的元素
|
||||
/// </summary>
|
||||
public List<SysModuleElement> Elements { get; set; }
|
||||
|
||||
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public List<ModuleView> Children { get; set; }
|
||||
|
||||
public static implicit operator ModuleView(SysModule module)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,16 +1,13 @@
|
|||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Dynamic;
|
||||
using System.Dynamic;
|
||||
using System.Text;
|
||||
using Infrastructure.Cache;
|
||||
using Infrastructure.CloudSdk;
|
||||
using Infrastructure.CloudSdk.minio;
|
||||
using Infrastructure.CloudSdk.wayline;
|
||||
using Infrastructure.Extensions;
|
||||
using Infrastructure.Helpers;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MQTTnet.Client;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using OpenAuth.App.ServiceApp;
|
||||
using OpenAuth.Repository.Domain;
|
||||
using OpenAuth.WebApi;
|
||||
|
|
@ -19,7 +16,6 @@ using SixLabors.ImageSharp;
|
|||
using SixLabors.ImageSharp.Processing;
|
||||
using SqlSugar;
|
||||
|
||||
|
||||
namespace OpenAuth.App.BaseApp.Subscribe;
|
||||
|
||||
public class ConfigSubscribe : IJob
|
||||
|
|
@ -44,7 +40,10 @@ public class ConfigSubscribe : IJob
|
|||
_minioService = minioService;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public async Task Execute(IJobExecutionContext context)
|
||||
{
|
||||
await Subscribe();
|
||||
}
|
||||
private async Task Subscribe()
|
||||
{
|
||||
// 或者 thing/product/#
|
||||
|
|
@ -69,10 +68,7 @@ public class ConfigSubscribe : IJob
|
|||
});
|
||||
}
|
||||
|
||||
public async Task Execute(IJobExecutionContext context)
|
||||
{
|
||||
await Subscribe();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private async Task HandleTopic(MqttApplicationMessageReceivedEventArgs args, string topic,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using Infrastructure;
|
||||
using System.Collections;
|
||||
using Infrastructure;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using OpenAuth.App;
|
||||
|
|
@ -35,6 +36,7 @@ namespace OpenAuth.WebApi.Controllers
|
|||
#region 当前登录用户资源
|
||||
|
||||
#region 用户信息
|
||||
|
||||
/// <summary>
|
||||
/// 获取登录用户资料
|
||||
/// </summary>
|
||||
|
|
@ -60,9 +62,11 @@ namespace OpenAuth.WebApi.Controllers
|
|||
|
||||
return resp;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 角色
|
||||
|
||||
/// <summary>
|
||||
/// 获取登录用户的所有可访问的角色
|
||||
/// </summary>
|
||||
|
|
@ -88,14 +92,15 @@ namespace OpenAuth.WebApi.Controllers
|
|||
? "OpenAuth.WebAPI数据库访问失败:" + ex.InnerException.Message
|
||||
: "OpenAuth.WebAPI数据库访问失败:" + ex.Message;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 部门
|
||||
|
||||
/// <summary>
|
||||
/// 获取登录用户的所有可访问的组织信息
|
||||
/// </summary>
|
||||
|
|
@ -121,14 +126,15 @@ namespace OpenAuth.WebApi.Controllers
|
|||
? "OpenAuth.WebAPI数据库访问失败:" + ex.InnerException.Message
|
||||
: "OpenAuth.WebAPI数据库访问失败:" + ex.Message;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 菜单
|
||||
|
||||
/// <summary>
|
||||
/// 获取登录用户的所有可访问的模块及菜单,以列表形式返回结果
|
||||
/// </summary>
|
||||
|
|
@ -155,6 +161,76 @@ namespace OpenAuth.WebApi.Controllers
|
|||
: "OpenAuth.WebAPI数据库访问失败:" + ex.Message;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IEnumerable<ModuleView> BuildModelTree(IEnumerable<ModuleView> modules)
|
||||
{
|
||||
var modulesMap = modules.ToDictionary(f => f.Id, f => new ModuleView
|
||||
{
|
||||
Id = f.Id,
|
||||
CascadeId = f.CascadeId,
|
||||
Name = f.Name,
|
||||
Url = f.Url,
|
||||
ParentId = f.ParentId,
|
||||
ParentName = f.ParentName,
|
||||
IconName = f.IconName,
|
||||
Status = f.Status,
|
||||
Checked = f.Checked,
|
||||
SortNo = f.SortNo,
|
||||
Elements = f.Elements,
|
||||
Children = new List<ModuleView>()
|
||||
}
|
||||
);
|
||||
|
||||
var rootNodes = new List<ModuleView>();
|
||||
|
||||
foreach (var module in modules)
|
||||
{
|
||||
if (string.IsNullOrEmpty(module.ParentId) ||module.ParentId == "0")
|
||||
{
|
||||
rootNodes.Add(modulesMap[module.Id]);
|
||||
}
|
||||
else if (modulesMap.TryGetValue(module.ParentId, out var parentNode))
|
||||
{
|
||||
parentNode.Children.Add(modulesMap[module.Id]);
|
||||
}
|
||||
}
|
||||
|
||||
return rootNodes.OrderBy(a => a.SortNo);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public Response<IEnumerable<ModuleView>> GetModulesTreeNew(string typeid)
|
||||
{
|
||||
var result = new Response<IEnumerable<ModuleView>>();
|
||||
try
|
||||
{
|
||||
result.Result = BuildModelTree(_authStrategyContext.Modules
|
||||
.WhereIF(!string.IsNullOrEmpty(typeid), a => a.ModuleTypeId == typeid));
|
||||
/*result.Result = _authStrategyContext.Modules
|
||||
.WhereIF(!string.IsNullOrEmpty(typeid), a => a.ModuleTypeId == typeid)
|
||||
.OrderBy(a => a.SortNo)
|
||||
.GenerateTree(u => u.Id, u => u.ParentId, "0");*/
|
||||
}
|
||||
catch (CommonException ex)
|
||||
{
|
||||
if (ex.Code == Define.INVALID_TOKEN)
|
||||
{
|
||||
result.Code = ex.Code;
|
||||
result.Message = ex.Message;
|
||||
}
|
||||
else
|
||||
{
|
||||
result.Code = 500;
|
||||
result.Message = ex.InnerException != null
|
||||
? "OpenAuth.WebAPI数据库访问失败:" + ex.InnerException.Message
|
||||
: "OpenAuth.WebAPI数据库访问失败:" + ex.Message;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -184,16 +260,17 @@ namespace OpenAuth.WebApi.Controllers
|
|||
? "OpenAuth.WebAPI数据库访问失败:" + ex.InnerException.Message
|
||||
: "OpenAuth.WebAPI数据库访问失败:" + ex.Message;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region 登录
|
||||
|
||||
/// <summary>
|
||||
/// 登录接口
|
||||
/// </summary>
|
||||
|
|
@ -228,11 +305,13 @@ namespace OpenAuth.WebApi.Controllers
|
|||
|
||||
return resp;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 未启用/后台使用
|
||||
|
||||
#region 检验token是否有效
|
||||
|
||||
/// <summary>
|
||||
/// 检验token是否有效
|
||||
/// </summary>
|
||||
|
|
@ -255,6 +334,7 @@ namespace OpenAuth.WebApi.Controllers
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 图片验证token
|
||||
/// </summary>
|
||||
|
|
@ -271,9 +351,11 @@ namespace OpenAuth.WebApi.Controllers
|
|||
return BadRequest();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 根据token获取用户名称
|
||||
|
||||
/// <summary>
|
||||
/// 根据token获取用户名称
|
||||
/// </summary>
|
||||
|
|
@ -297,16 +379,18 @@ namespace OpenAuth.WebApi.Controllers
|
|||
{
|
||||
result.Code = 500;
|
||||
result.Message = ex.InnerException != null
|
||||
? ex.InnerException.Message : ex.Message;
|
||||
? ex.InnerException.Message
|
||||
: ex.Message;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 加载机构的全部下级机构
|
||||
|
||||
/// <summary>
|
||||
/// 加载机构的全部下级机构
|
||||
/// </summary>
|
||||
|
|
@ -328,6 +412,7 @@ namespace OpenAuth.WebApi.Controllers
|
|||
code = 500,
|
||||
};
|
||||
}
|
||||
|
||||
cascadeId = org.CascadeId;
|
||||
}
|
||||
|
||||
|
|
@ -341,6 +426,7 @@ namespace OpenAuth.WebApi.Controllers
|
|||
count = query.Count(),
|
||||
};
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
|
|
|||
|
|
@ -301,10 +301,7 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers
|
|||
#endregion
|
||||
|
||||
#region 航线管理
|
||||
|
||||
// todo 创建文件夹
|
||||
// todo 删除文件夹
|
||||
// todo 文件夹列表
|
||||
|
||||
[HttpPost]
|
||||
public async Task<Response<bool>> CreateAirLineFolder(FolderCreateReq req)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue