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