添加项目文件。
This commit is contained in:
@@ -0,0 +1,423 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
using SimpleAdmin.Core;
|
||||
|
||||
namespace SimpleAdmin.Plugin.Aop;
|
||||
|
||||
/// <summary>
|
||||
/// Aop
|
||||
/// 这里没有继承IGlobalDispatchProxy是因为IGlobalDispatchProxy会把一些没有必要的方法也aop了
|
||||
/// </summary>
|
||||
public class GlobalDispatchProxy : AspectDispatchProxy, IDispatchProxy
|
||||
{
|
||||
/// <summary>
|
||||
/// 当前服务实例
|
||||
/// </summary>
|
||||
public object Target { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 服务提供器,可以用来解析服务,如:Services.GetService()
|
||||
/// </summary>
|
||||
public IServiceProvider Services { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 方法
|
||||
/// </summary>
|
||||
/// <param name="method"></param>
|
||||
/// <param name="args"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public override object Invoke(MethodInfo method, object[] args)
|
||||
{
|
||||
//如果不带返回值
|
||||
if (method.ReturnType == typeof(void))
|
||||
{
|
||||
After(method, null, args);
|
||||
return method.Invoke(Target, args);//直接返回
|
||||
}
|
||||
var result = Before(method, args);//方法执行之前判断是否有缓存的数据
|
||||
if (result == null) result = method.Invoke(Target, args);//如果没有缓存就执行方法返回数据
|
||||
After(method, result, args);//方法执行之后干的事
|
||||
return result;//返回结果
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异步无返回值
|
||||
/// </summary>
|
||||
/// <param name="method"></param>
|
||||
/// <param name="args"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public override async Task InvokeAsync(MethodInfo method, object[] args)
|
||||
{
|
||||
var task = method.Invoke(Target, args) as Task;
|
||||
await task;
|
||||
After(method, null, args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异步带返回值
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="method"></param>
|
||||
/// <param name="args"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public override async Task<T> InvokeAsyncT<T>(MethodInfo method, object[] args)
|
||||
{
|
||||
var result = Before(method, args);//方法执行之前判断是否有缓存的数据
|
||||
if (result == null)
|
||||
{
|
||||
var taskT = method.Invoke(Target, args) as Task<T>;
|
||||
result = await taskT;//如果没有缓存就执行方法返回数据
|
||||
}
|
||||
After(method, result, args);//方法执行之后干的事
|
||||
return result;//返回结果
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 方法执行之后
|
||||
/// </summary>
|
||||
/// <param name="method">方法</param>
|
||||
/// <param name="returnValue">返回值</param>
|
||||
/// <param name="args">参数列表</param>
|
||||
private void After(MethodInfo method, object returnValue, object[] args)
|
||||
{
|
||||
RecordCache(method, args, returnValue);//记录返回值到缓存
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 方法执行之前
|
||||
/// </summary>
|
||||
/// <param name="method">方法</param>
|
||||
/// <param name="args">参数列表</param>
|
||||
/// <returns></returns>
|
||||
private dynamic Before(MethodInfo method, object[] args)
|
||||
{
|
||||
var cacheData = CheckCache(method, args);//检查缓存
|
||||
if (cacheData != null) { return cacheData; }//如果缓存有数据直接返回
|
||||
return null;//默认返回空
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查缓存里是否有数据
|
||||
/// </summary>
|
||||
/// <param name="method">方法</param>
|
||||
/// <param name="args">参数列表</param>
|
||||
private dynamic CheckCache(MethodInfo method, object[] args)
|
||||
{
|
||||
var cacheAttribute = method.GetActualCustomAttribute<CacheAttribute>(Target);//读取缓存特性
|
||||
//判断需不需要读取缓存
|
||||
if (cacheAttribute != null)
|
||||
{
|
||||
var redisManager = Services.GetService<ISimpleCacheService>();// 获取redis服务
|
||||
var cacheKey = cacheAttribute.CustomKeyValue
|
||||
?? CustomCacheKey(cacheAttribute.KeyPrefix, method, args);//如果redisKey值,如果有自定义值就用自定义Key,否则以前缀+系统自动生成的Key
|
||||
string cacheValue;
|
||||
if (cacheAttribute.StoreType == CacheConst.CACHE_HASH)//如果存的是Hash值
|
||||
{
|
||||
cacheValue = redisManager.HashGet<string>(cacheKey, args[0].ToString())[0];//从redis获取Hash数据取第一个,注意是 string 类型
|
||||
}
|
||||
else
|
||||
{
|
||||
cacheValue = redisManager.Get<string>(cacheKey);//注意是 string 类型,方法GetValue
|
||||
}
|
||||
if (!string.IsNullOrEmpty(cacheValue))//如果返回值不是空
|
||||
{
|
||||
//if (cacheAttribute.IsDelete)//判断是否是删除操作
|
||||
//{
|
||||
// if (cacheAttribute.StoreType == RedisConst.Cache_Hash)//如果是Hash
|
||||
// {
|
||||
// _redisManager.HashDel<string>(cacheKey, new string[] { args[0].ToString() });
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //删除Redis整个KEY
|
||||
// _redisManager.Remove(cacheKey);
|
||||
// }
|
||||
|
||||
//}
|
||||
//将当前获取到的缓存值,赋值给当前执行方法
|
||||
Type returnType;
|
||||
if (typeof(Task).IsAssignableFrom(method.ReturnType))
|
||||
{
|
||||
returnType = method.ReturnType.GenericTypeArguments.FirstOrDefault();
|
||||
}
|
||||
else
|
||||
{
|
||||
returnType = method.ReturnType;
|
||||
}
|
||||
if (!returnType.IsPrimitive && returnType != typeof(string))//判断返回类型是否原生类型并且不是string
|
||||
{
|
||||
dynamic result = JsonConvert.DeserializeObject(cacheValue, returnType);//序列化数据
|
||||
return result;
|
||||
}
|
||||
return cacheValue;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 写数据到缓存
|
||||
/// </summary>
|
||||
/// <param name="method">方法</param>
|
||||
/// <param name="args">参数列表</param>
|
||||
/// <param name="returnValue">返回值</param>
|
||||
private void RecordCache(MethodInfo method, object[] args, object returnValue)
|
||||
{
|
||||
var cacheAttribute = method.GetActualCustomAttribute<CacheAttribute>(Target);
|
||||
if (cacheAttribute != null)
|
||||
{
|
||||
//获取自定义缓存键
|
||||
var cacheKey = cacheAttribute.CustomKeyValue ?? CustomCacheKey(cacheAttribute.KeyPrefix, method, args);
|
||||
if (!string.IsNullOrWhiteSpace(cacheKey))//如果有key
|
||||
{
|
||||
var redisManager = Services.GetService<ISimpleCacheService>();// 获取redis服务
|
||||
if (cacheAttribute.IsDelete)//判断是否是删除操作
|
||||
{
|
||||
//删除Redis整个KEY
|
||||
redisManager.Remove(cacheKey);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (returnValue == null) { return; }
|
||||
if (cacheAttribute.StoreType == CacheConst.CACHE_HASH)//如果是hash类型的
|
||||
{
|
||||
//插入到hash,这里规定是方法的第一个参数
|
||||
redisManager.HashAdd(cacheKey, args[0].ToString(), returnValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cacheAttribute.AbsoluteExpiration != null)//如果有超时时间
|
||||
{
|
||||
redisManager.Set(cacheKey, returnValue, cacheAttribute.AbsoluteExpiration.Value);//插入redis
|
||||
}
|
||||
else
|
||||
{
|
||||
redisManager.Set(cacheKey, returnValue);//插入redis
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 自定义缓存Key
|
||||
/// </summary>
|
||||
/// <param name="prefix">前缀</param>
|
||||
/// <param name="method">方法</param>
|
||||
/// <param name="args">参数</param>
|
||||
/// <returns></returns>
|
||||
protected string CustomCacheKey(string prefix, MethodInfo method, object[] args)
|
||||
{
|
||||
var key = prefix;//前缀
|
||||
var methodArguments = args.Select(GetCacheKey.GetArgumentValue).Take(3).ToList();//获取参数列表,最多三个
|
||||
if (!string.IsNullOrEmpty(key))//如果制定了前缀
|
||||
{
|
||||
foreach (var param in methodArguments)//遍历参数列表
|
||||
{
|
||||
key = $"{key}{param}:";//生成KEY
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var typeName = Target.GetType().Name;//获取实例名
|
||||
var methodName = method.Name;//获取方法名
|
||||
key = $"{CacheConst.CACHE_PREFIX_WEB}{typeName}:{methodName}:";//生成Key
|
||||
foreach (var param in methodArguments)//遍历参数列表
|
||||
{
|
||||
key = $"{key}{param}:";//生成加上参数的KEY
|
||||
}
|
||||
}
|
||||
return key.TrimEnd(':');
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取缓存Key
|
||||
/// </summary>
|
||||
internal static class GetCacheKey
|
||||
{
|
||||
/// <summary>
|
||||
/// object 转 string
|
||||
/// </summary>
|
||||
/// <param name="arg"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetArgumentValue(object arg)
|
||||
{
|
||||
if (arg is DateTime || arg is DateTime)
|
||||
return ((DateTime)arg).ToString("yyyyMMddHHmmss");
|
||||
|
||||
if (arg is string || arg is ValueType || arg is Nullable)
|
||||
return arg.ToString();
|
||||
|
||||
if (arg != null)
|
||||
{
|
||||
if (arg is Expression)
|
||||
{
|
||||
var obj = arg as Expression;
|
||||
var result = Resolve(obj);
|
||||
return MD5Encryption.Encrypt(result);
|
||||
}
|
||||
if (arg.GetType().IsClass)
|
||||
{
|
||||
return MD5Encryption.Encrypt(JsonConvert.SerializeObject(arg));
|
||||
}
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
private static string Resolve(Expression expression)
|
||||
{
|
||||
if (expression is LambdaExpression)
|
||||
{
|
||||
var lambda = expression as LambdaExpression;
|
||||
expression = lambda.Body;
|
||||
return Resolve(expression);
|
||||
}
|
||||
if (expression is BinaryExpression)
|
||||
{
|
||||
var binary = expression as BinaryExpression;
|
||||
if (binary.Left is MemberExpression && binary.Right is ConstantExpression)//解析x=>x.Name=="123" x.Age==123这类
|
||||
return ResolveFunc(binary.Left, binary.Right, binary.NodeType);
|
||||
if (binary.Left is MethodCallExpression && binary.Right is ConstantExpression)//解析x=>x.Name.Contains("xxx")==false这类的
|
||||
{
|
||||
var value = (binary.Right as ConstantExpression).Value;
|
||||
return ResolveLinqToObject(binary.Left, value, binary.NodeType);
|
||||
}
|
||||
if (binary.Left is MemberExpression && binary.Right is MemberExpression
|
||||
|| binary.Left is MemberExpression && binary.Right is UnaryExpression)//解析x=>x.Date==DateTime.Now这种
|
||||
{
|
||||
var lambda = Expression.Lambda(binary.Right);
|
||||
var fn = lambda.Compile();
|
||||
var value = Expression.Constant(fn.DynamicInvoke(null), binary.Right.Type);
|
||||
return ResolveFunc(binary.Left, value, binary.NodeType);
|
||||
}
|
||||
}
|
||||
if (expression is UnaryExpression)
|
||||
{
|
||||
var unary = expression as UnaryExpression;
|
||||
if (unary.Operand is MethodCallExpression)//解析!x=>x.Name.Contains("xxx")或!array.Contains(x.Name)这类
|
||||
return ResolveLinqToObject(unary.Operand, false);
|
||||
if (unary.Operand is MemberExpression && unary.NodeType == ExpressionType.Not)//解析x=>!x.isDeletion这样的
|
||||
{
|
||||
var constant = Expression.Constant(false);
|
||||
return ResolveFunc(unary.Operand, constant, ExpressionType.Equal);
|
||||
}
|
||||
}
|
||||
if (expression is MemberExpression && expression.NodeType == ExpressionType.MemberAccess)//解析x=>x.isDeletion这样的
|
||||
{
|
||||
var member = expression as MemberExpression;
|
||||
var constant = Expression.Constant(true);
|
||||
return ResolveFunc(member, constant, ExpressionType.Equal);
|
||||
}
|
||||
if (expression is MethodCallExpression)//x=>x.Name.Contains("xxx")或array.Contains(x.Name)这类
|
||||
{
|
||||
var methodcall = expression as MethodCallExpression;
|
||||
return ResolveLinqToObject(methodcall, true);
|
||||
}
|
||||
//已经修改过代码body应该不会是null值了
|
||||
if (!(expression is BinaryExpression body))
|
||||
return string.Empty;
|
||||
var @operator = GetOperator(body.NodeType);
|
||||
var left = Resolve(body.Left);
|
||||
var right = Resolve(body.Right);
|
||||
var result = string.Format("({0} {1} {2})", left, @operator, right);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static string ResolveFunc(Expression left, Expression right, ExpressionType expressiontype)
|
||||
{
|
||||
var name = (left as MemberExpression).Member.Name;
|
||||
var value = (right as ConstantExpression).Value;
|
||||
var @operator = GetOperator(expressiontype);
|
||||
return name + @operator + value;
|
||||
}
|
||||
|
||||
private static string ResolveLinqToObject(Expression expression, object value, ExpressionType? expressiontype = null)
|
||||
{
|
||||
var methodCall = expression as MethodCallExpression;
|
||||
var methodName = methodCall.Method.Name;
|
||||
switch (methodName)
|
||||
{
|
||||
case "Contains":
|
||||
return methodCall.Object != null ? Like(methodCall) : In(methodCall, value);
|
||||
|
||||
case "Count":
|
||||
return Len(methodCall, value, expressiontype.Value);
|
||||
|
||||
case "LongCount":
|
||||
return Len(methodCall, value, expressiontype.Value);
|
||||
|
||||
default:
|
||||
throw new Exception(string.Format("不支持{0}方法的查找!", methodName));
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetOperator(ExpressionType expressiontype)
|
||||
{
|
||||
return expressiontype switch
|
||||
{
|
||||
ExpressionType.And => "and",
|
||||
ExpressionType.AndAlso => "and",
|
||||
ExpressionType.Or => "or",
|
||||
ExpressionType.OrElse => "or",
|
||||
ExpressionType.Equal => "=",
|
||||
ExpressionType.NotEqual => "<>",
|
||||
ExpressionType.LessThan => "<",
|
||||
ExpressionType.LessThanOrEqual => "<=",
|
||||
ExpressionType.GreaterThan => ">",
|
||||
ExpressionType.GreaterThanOrEqual => ">=",
|
||||
_ => throw new Exception(string.Format("不支持{0}此种运算符查找!" + expressiontype))
|
||||
};
|
||||
}
|
||||
|
||||
private static string In(MethodCallExpression expression, object isTrue)
|
||||
{
|
||||
var argument1 = (expression.Arguments[0] as MemberExpression).Expression as ConstantExpression;
|
||||
var argument2 = expression.Arguments[1] as MemberExpression;
|
||||
var fieldArray = argument1.Value.GetType().GetFields().First();
|
||||
var array = fieldArray.GetValue(argument1.Value) as object[];
|
||||
var setInPara = new List<string>();
|
||||
for (var i = 0; i < array.Length; i++)
|
||||
{
|
||||
var value = array[i].ToString();
|
||||
setInPara.Add(value);
|
||||
}
|
||||
var name = argument2.Member.Name;
|
||||
var @operator = Convert.ToBoolean(isTrue) ? "in" : " not in";
|
||||
var compName = string.Join(",", setInPara);
|
||||
var result = string.Format("{0} {1} ({2})", name, @operator, compName);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static string Like(MethodCallExpression expression)
|
||||
{
|
||||
var temp = expression.Arguments[0];
|
||||
var lambda = Expression.Lambda(temp);
|
||||
var fn = lambda.Compile();
|
||||
var tempValue = Expression.Constant(fn.DynamicInvoke(null), temp.Type);
|
||||
var value = string.Format("%{0}%", tempValue);
|
||||
var name = (expression.Object as MemberExpression).Member.Name;
|
||||
var result = string.Format("{0} like {1}", name, value);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static string Len(MethodCallExpression expression, object value, ExpressionType expressiontype)
|
||||
{
|
||||
object name = (expression.Arguments[0] as MemberExpression).Member.Name;
|
||||
var @operator = GetOperator(expressiontype);
|
||||
var result = string.Format("len({0}){1}{2}", name, @operator, value);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Plugin.Aop;
|
||||
|
||||
/// <summary>
|
||||
/// 缓存结果特性
|
||||
/// </summary>
|
||||
public class CacheAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// RedisKey前缀
|
||||
/// </summary>
|
||||
public string KeyPrefix { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 过期时间
|
||||
/// </summary>
|
||||
public TimeSpan? AbsoluteExpiration { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 自定义KEY
|
||||
/// </summary>
|
||||
public string CustomKeyValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否删除
|
||||
/// </summary>
|
||||
public bool IsDelete { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// 存储类型
|
||||
/// </summary>
|
||||
public string StoreType { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
global using MoYu.DataEncryption;
|
||||
global using MoYu.Reflection;
|
||||
global using MoYu.Reflection.Extensions;
|
||||
global using Microsoft.Extensions.DependencyInjection;
|
||||
global using Newtonsoft.Json;
|
||||
global using SimpleAdmin.Cache;
|
||||
global using System.Linq.Expressions;
|
||||
global using System.Reflection;
|
||||
@@ -0,0 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\SimpleAdmin.Cache\SimpleAdmin.Cache.csproj"/>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,134 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>SimpleAdmin.Plugin.Aop</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:SimpleAdmin.Plugin.Aop.GlobalDispatchProxy">
|
||||
<summary>
|
||||
Aop
|
||||
这里没有继承IGlobalDispatchProxy是因为IGlobalDispatchProxy会把一些没有必要的方法也aop了
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:SimpleAdmin.Plugin.Aop.GlobalDispatchProxy.Target">
|
||||
<summary>
|
||||
当前服务实例
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:SimpleAdmin.Plugin.Aop.GlobalDispatchProxy.Services">
|
||||
<summary>
|
||||
服务提供器,可以用来解析服务,如:Services.GetService()
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Aop.GlobalDispatchProxy.Invoke(System.Reflection.MethodInfo,System.Object[])">
|
||||
<summary>
|
||||
方法
|
||||
</summary>
|
||||
<param name="method"></param>
|
||||
<param name="args"></param>
|
||||
<returns></returns>
|
||||
<exception cref="T:System.NotImplementedException"></exception>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Aop.GlobalDispatchProxy.InvokeAsync(System.Reflection.MethodInfo,System.Object[])">
|
||||
<summary>
|
||||
异步无返回值
|
||||
</summary>
|
||||
<param name="method"></param>
|
||||
<param name="args"></param>
|
||||
<returns></returns>
|
||||
<exception cref="T:System.NotImplementedException"></exception>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Aop.GlobalDispatchProxy.InvokeAsyncT``1(System.Reflection.MethodInfo,System.Object[])">
|
||||
<summary>
|
||||
异步带返回值
|
||||
</summary>
|
||||
<typeparam name="T"></typeparam>
|
||||
<param name="method"></param>
|
||||
<param name="args"></param>
|
||||
<returns></returns>
|
||||
<exception cref="T:System.NotImplementedException"></exception>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Aop.GlobalDispatchProxy.After(System.Reflection.MethodInfo,System.Object,System.Object[])">
|
||||
<summary>
|
||||
方法执行之后
|
||||
</summary>
|
||||
<param name="method">方法</param>
|
||||
<param name="returnValue">返回值</param>
|
||||
<param name="args">参数列表</param>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Aop.GlobalDispatchProxy.Before(System.Reflection.MethodInfo,System.Object[])">
|
||||
<summary>
|
||||
方法执行之前
|
||||
</summary>
|
||||
<param name="method">方法</param>
|
||||
<param name="args">参数列表</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Aop.GlobalDispatchProxy.CheckCache(System.Reflection.MethodInfo,System.Object[])">
|
||||
<summary>
|
||||
检查缓存里是否有数据
|
||||
</summary>
|
||||
<param name="method">方法</param>
|
||||
<param name="args">参数列表</param>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Aop.GlobalDispatchProxy.RecordCache(System.Reflection.MethodInfo,System.Object[],System.Object)">
|
||||
<summary>
|
||||
写数据到缓存
|
||||
</summary>
|
||||
<param name="method">方法</param>
|
||||
<param name="args">参数列表</param>
|
||||
<param name="returnValue">返回值</param>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Aop.GlobalDispatchProxy.CustomCacheKey(System.String,System.Reflection.MethodInfo,System.Object[])">
|
||||
<summary>
|
||||
自定义缓存Key
|
||||
</summary>
|
||||
<param name="prefix">前缀</param>
|
||||
<param name="method">方法</param>
|
||||
<param name="args">参数</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:SimpleAdmin.Plugin.Aop.GetCacheKey">
|
||||
<summary>
|
||||
获取缓存Key
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Aop.GetCacheKey.GetArgumentValue(System.Object)">
|
||||
<summary>
|
||||
object 转 string
|
||||
</summary>
|
||||
<param name="arg"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:SimpleAdmin.Plugin.Aop.CacheAttribute">
|
||||
<summary>
|
||||
缓存结果特性
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:SimpleAdmin.Plugin.Aop.CacheAttribute.KeyPrefix">
|
||||
<summary>
|
||||
RedisKey前缀
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:SimpleAdmin.Plugin.Aop.CacheAttribute.AbsoluteExpiration">
|
||||
<summary>
|
||||
过期时间
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:SimpleAdmin.Plugin.Aop.CacheAttribute.CustomKeyValue">
|
||||
<summary>
|
||||
自定义KEY
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:SimpleAdmin.Plugin.Aop.CacheAttribute.IsDelete">
|
||||
<summary>
|
||||
是否删除
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:SimpleAdmin.Plugin.Aop.CacheAttribute.StoreType">
|
||||
<summary>
|
||||
存储类型
|
||||
</summary>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
@@ -0,0 +1,32 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Plugin.Mobile;
|
||||
|
||||
/// <summary>
|
||||
/// 移动端常量
|
||||
/// </summary>
|
||||
public class MobileConst
|
||||
{
|
||||
/// <summary>
|
||||
/// 资源表缓存Key
|
||||
/// </summary>
|
||||
public const string CACHE_MOBILE_RESOURCE = CacheConst.CACHE_PREFIX_WEB + "MobileResource:";
|
||||
|
||||
/// <summary>
|
||||
/// 用户有哪些移动端资源
|
||||
/// </summary>
|
||||
public const string RELATION_SYS_USER_HAS_MOBILE_RESOURCE = "SYS_USER_HAS_MOBILE_RESOURCE";
|
||||
|
||||
/// <summary>
|
||||
/// 角色有哪些移动端资源
|
||||
/// </summary>
|
||||
public const string RELATION_SYS_ROLE_HAS_MOBILE_RESOURCE = "SYS_ROLE_HAS_MOBILE_RESOURCE";
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Plugin.Mobile;
|
||||
|
||||
/// <summary>
|
||||
/// 移动端权限按钮控制器
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings("Mobile", Tag = "移动端权限按钮")]
|
||||
[Route("sys/mobile/Button")]
|
||||
[SuperAdmin]
|
||||
public class MobileButtonController : IDynamicApiController
|
||||
{
|
||||
private readonly IMobileButtonService _mobileButtonService;
|
||||
|
||||
public MobileButtonController(IMobileButtonService mobileButtonService)
|
||||
{
|
||||
_mobileButtonService = mobileButtonService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 按钮分页查询
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("page")]
|
||||
public async Task<dynamic> Page([FromQuery] ButtonPageInput input)
|
||||
{
|
||||
return await _mobileButtonService.Page(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加按钮
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("add")]
|
||||
[DisplayName("添加按钮")]
|
||||
public async Task Add([FromBody] MobileButtonAddInput input)
|
||||
{
|
||||
await _mobileButtonService.Add(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改按钮
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("edit")]
|
||||
[DisplayName("修改按钮")]
|
||||
public async Task Edit([FromBody] MobileButtonEditInput input)
|
||||
{
|
||||
await _mobileButtonService.Edit(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除按钮
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("delete")]
|
||||
[DisplayName("删除按钮")]
|
||||
public async Task Delete([FromBody] BaseIdListInput input)
|
||||
{
|
||||
await _mobileButtonService.Delete(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量新增
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("batch")]
|
||||
[DisplayName("新增按钮")]
|
||||
public async Task Batch([FromBody] MobileButtonAddInput input)
|
||||
{
|
||||
await _mobileButtonService.AddBatch(input);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Plugin.Mobile;
|
||||
|
||||
/// <summary>
|
||||
/// 移动端菜单管理控制器
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings("Mobile", Tag = "移动端菜单管理")]
|
||||
[Route("sys/mobile/Menu")]
|
||||
[SuperAdmin]
|
||||
public class MobileMenuController : IDynamicApiController
|
||||
{
|
||||
private readonly IMobileMenuService _mobileMenuService;
|
||||
private readonly IMobileResourceService _resourceService;
|
||||
private readonly ISysRoleService _roleService;
|
||||
|
||||
public MobileMenuController(IMobileMenuService mobileMenuService, IMobileResourceService resourceService, ISysRoleService roleService)
|
||||
{
|
||||
_mobileMenuService = mobileMenuService;
|
||||
_resourceService = resourceService;
|
||||
_roleService = roleService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 模块选择
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("moduleSelector")]
|
||||
public async Task<dynamic> ModuleSelector()
|
||||
{
|
||||
return await _resourceService.GetListByCategory(CateGoryConst.RESOURCE_MODULE);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取菜单树
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("tree")]
|
||||
public async Task<dynamic> Tree([FromQuery] MenuTreeInput input)
|
||||
{
|
||||
return await _mobileMenuService.Tree(input);
|
||||
;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取角色授权资源树
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("resourceTreeSelector")]
|
||||
public async Task<dynamic> ResourceTreeSelector()
|
||||
{
|
||||
return await _resourceService.ResourceTreeSelector();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取角色拥有移动端资源
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("roleOwnMobileMenu")]
|
||||
public async Task<dynamic> RoleOwnMobileMenu([FromQuery] BaseIdInput input)
|
||||
{
|
||||
return await _roleService.OwnResource(input, MobileConst.RELATION_SYS_ROLE_HAS_MOBILE_RESOURCE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取菜单树选择器
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("menuTreeSelector")]
|
||||
public async Task<dynamic> MenuTreeSelector([FromQuery] MenuTreeInput input)
|
||||
{
|
||||
return await _mobileMenuService.Tree(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 给角色授权移动端资源
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("grantRoleMobileResource")]
|
||||
[DisplayName("角色授权移动端资源")]
|
||||
public async Task GrantRoleMobileResource([FromBody] GrantResourceInput input)
|
||||
{
|
||||
await _mobileMenuService.GrantRoleMobileResource(input);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 添加菜单
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("add")]
|
||||
[DisplayName("添加菜单")]
|
||||
public async Task Add([FromBody] MobileMenuAddInput input)
|
||||
{
|
||||
await _mobileMenuService.Add(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 编辑菜单
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("edit")]
|
||||
[DisplayName("编辑菜单")]
|
||||
public async Task Edit([FromBody] MobileMenuEditInput input)
|
||||
{
|
||||
await _mobileMenuService.Edit(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取菜单详情
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("detail")]
|
||||
public async Task<dynamic> Detail([FromQuery] BaseIdInput input)
|
||||
{
|
||||
return await _mobileMenuService.Detail(input);
|
||||
;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除菜单
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("delete")]
|
||||
[DisplayName("删除菜单")]
|
||||
public async Task Delete([FromBody] BaseIdListInput input)
|
||||
{
|
||||
await _mobileMenuService.Delete(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更改模块
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("changeModule")]
|
||||
[DisplayName("更改模块")]
|
||||
public async Task ChangeModule([FromBody] MenuChangeModuleInput input)
|
||||
{
|
||||
await _mobileMenuService.ChangeModule(input);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Plugin.Mobile;
|
||||
|
||||
/// <summary>
|
||||
/// 移动端模块管理
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings("Mobile", Tag = "移动端模块管理")]
|
||||
[Route("sys/mobile/Module")]
|
||||
[SuperAdmin]
|
||||
public class MobileModuleController : IDynamicApiController
|
||||
{
|
||||
private readonly IMobileModuleService _moduleService;
|
||||
|
||||
public MobileModuleController(IMobileModuleService moduleService)
|
||||
{
|
||||
_moduleService = moduleService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 模块分页查询
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("page")]
|
||||
public async Task<dynamic> Page([FromQuery] ModulePageInput input)
|
||||
{
|
||||
return await _moduleService.Page(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加模块
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("add")]
|
||||
[DisplayName("添加模块")]
|
||||
public async Task Add([FromBody] MobileModuleAddInput input)
|
||||
{
|
||||
await _moduleService.Add(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改模块
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("edit")]
|
||||
[DisplayName("修改模块")]
|
||||
public async Task Edit([FromBody] MobileModuleEditInput input)
|
||||
{
|
||||
await _moduleService.Edit(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取模块详情
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("detail")]
|
||||
public async Task<dynamic> Detail([FromQuery] BaseIdInput input)
|
||||
{
|
||||
return await _moduleService.Detail(input);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 删除模块
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("delete")]
|
||||
[DisplayName("删除模块")]
|
||||
public async Task Delete([FromBody] BaseIdListInput input)
|
||||
{
|
||||
await _moduleService.Delete(input);
|
||||
}
|
||||
}
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Plugin.Mobile;
|
||||
|
||||
/// <summary>
|
||||
/// 用户个人信息控制器
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings("Mobile", Tag = "移动端用户个人信息控制器")]
|
||||
[Route("mobile/UserCenter")]
|
||||
public class MobileUserCenterController : IDynamicApiController
|
||||
{
|
||||
private readonly IMobileUserCenterService _mobileUserCenterService;
|
||||
private readonly IUserCenterService _userCenterService;
|
||||
|
||||
public MobileUserCenterController(IUserCenterService userCenterService, IMobileUserCenterService mobileUserCenterService)
|
||||
{
|
||||
_mobileUserCenterService = mobileUserCenterService;
|
||||
_userCenterService = userCenterService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取个人菜单
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("loginMobileMenu")]
|
||||
public async Task<dynamic> LoginMobileMenu()
|
||||
{
|
||||
return await _mobileUserCenterService.GetOwnMobileMenu();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("getLoginUser")]
|
||||
public async Task<dynamic> GetLoginUser()
|
||||
{
|
||||
return await _mobileUserCenterService.GetLoginUser();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 编辑个人信息
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("updateUserInfo")]
|
||||
[DisplayName("编辑个人信息")]
|
||||
public async Task UpdateUserInfo([FromBody] UpdateInfoInput input)
|
||||
{
|
||||
await _userCenterService.UpdateUserInfo(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改密码
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("updatePassword")]
|
||||
[DisplayName("修改密码")]
|
||||
public async Task UpdatePassword([FromBody] UpdatePasswordInput input)
|
||||
{
|
||||
await _userCenterService.UpdatePassword(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取登录用户的站内信分页
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("loginUnreadMessagePage")]
|
||||
public async Task<dynamic> LoginUnreadMessagePage([FromQuery] MessagePageInput input)
|
||||
{
|
||||
return await _userCenterService.LoginMessagePage(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 读取登录用户站内信详情
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("loginUnreadMessageDetail")]
|
||||
public async Task<dynamic> LoginUnreadMessageDetail([FromQuery] MessageDetailInput input)
|
||||
{
|
||||
return await _userCenterService.LoginMessageDetail(input);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Plugin.Mobile;
|
||||
|
||||
/// <summary>
|
||||
/// 资源
|
||||
///</summary>
|
||||
[SugarTable("mobile_resource", TableDescription = "移动资源")]
|
||||
[Tenant(SqlSugarConst.DB_DEFAULT)]
|
||||
[CodeGen]
|
||||
public class MobileResource : BaseEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 父id
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "ParentId", ColumnDescription = "父id", IsNullable = true)]
|
||||
public virtual long? ParentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标题
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "Title", ColumnDescription = "标题", Length = 200)]
|
||||
public virtual string Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 别名
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "Name", ColumnDescription = "别名", Length = 200, IsNullable = true)]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 描述
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "Description", ColumnDescription = "描述", Length = 200, IsNullable = true)]
|
||||
public string Description { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 编码
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "Code", ColumnDescription = "编码", Length = 200, IsNullable = true)]
|
||||
public virtual string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分类
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "Category", ColumnDescription = "分类", Length = 200)]
|
||||
public string Category { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 模块
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "Module", ColumnDescription = "所属模块Id", IsNullable = true)]
|
||||
public virtual long? Module { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 菜单类型
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "MenuType", ColumnDescription = "菜单类型", Length = 200, IsNullable = true)]
|
||||
public virtual string MenuType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 路径
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "Path", ColumnDescription = "路径", IsNullable = true)]
|
||||
public virtual string Path { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 图标
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "Icon", ColumnDescription = "图标", Length = 200, IsNullable = true)]
|
||||
public virtual string Icon { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 颜色
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "Color", ColumnDescription = "颜色", Length = 200, IsNullable = true)]
|
||||
public string Color { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序码
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "SortCode", ColumnDescription = "排序码", IsNullable = true)]
|
||||
public int? SortCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 颜色
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "RegType", ColumnDescription = "规则类型", Length = 200, IsNullable = true)]
|
||||
public string RegType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 菜单元标签
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public MobleMeta Meta { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 字节点
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public List<MobileResource> Children { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
global using MoYu;
|
||||
global using MoYu.DependencyInjection;
|
||||
global using MoYu.FriendlyException;
|
||||
global using MoYu.ViewEngine;
|
||||
global using Mapster;
|
||||
global using Microsoft.AspNetCore.Builder;
|
||||
global using Microsoft.AspNetCore.Hosting;
|
||||
global using Microsoft.AspNetCore.Mvc;
|
||||
global using Microsoft.Extensions.DependencyInjection;
|
||||
global using Microsoft.Extensions.Logging;
|
||||
global using SimpleAdmin.Core;
|
||||
global using SimpleAdmin.Core.Utils;
|
||||
global using SimpleTool;
|
||||
global using System.ComponentModel.DataAnnotations;
|
||||
global using System.Text;
|
||||
global using MoYu.DynamicApiController;
|
||||
global using System.ComponentModel;
|
||||
global using SimpleAdmin.SqlSugar;
|
||||
global using SqlSugar;
|
||||
global using SimpleAdmin.System;
|
||||
global using SimpleAdmin.Cache;
|
||||
global using System.Reflection;
|
||||
global using Masuit.Tools;
|
||||
global using NewLife.Serialization;
|
||||
global using NewLife;
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
//swagger分组设置
|
||||
"[openapi:Mobile]": {
|
||||
"Order": 89, //分组排序,int 类型,数字越大排前面,默认 0
|
||||
"Title": "移动端" //配置分组标题,string 类型
|
||||
},
|
||||
//代码生成器设置
|
||||
"MobileSettings": {
|
||||
"InitTable": false, //是否初始化表结构
|
||||
"InitSeedData": false, //是否初始化种子数据
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
//swagger分组设置
|
||||
"[openapi:Mobile]": {
|
||||
"Order": 89, //分组排序,int 类型,数字越大排前面,默认 0
|
||||
"Title": "移动端" //配置分组标题,string 类型
|
||||
},
|
||||
//代码生成器设置
|
||||
"MobileSettings": {
|
||||
"InitTable": false, //是否初始化表结构
|
||||
"InitSeedData": false, //是否初始化种子数据
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
using MoYu.ConfigurableOptions;
|
||||
|
||||
namespace SimpleAdmin.Plugin.Mobile;
|
||||
|
||||
/// <summary>
|
||||
/// 代码生成器配置
|
||||
/// </summary>
|
||||
public class MobileSettingsOptions : BaseOptions, IConfigurableOptions
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,604 @@
|
||||
{
|
||||
"RECORDS": [
|
||||
{
|
||||
"Id": "425458771095621",
|
||||
"ParentId": "",
|
||||
"Title": "业务",
|
||||
"Name": "",
|
||||
"Description": "业务",
|
||||
"Code": "system",
|
||||
"Category": "MODULE",
|
||||
"Module": "",
|
||||
"MenuType": "",
|
||||
"Path": "",
|
||||
"Icon": "zondicons:news-paper",
|
||||
"Color": "#1890ff",
|
||||
"SortCode": "99",
|
||||
"RegType": "",
|
||||
"Status": "ENABLE",
|
||||
"CreateTime": "2025-6-25 13:28:20.987",
|
||||
"UpdateTime": "2025-6-25 15:29:21.703",
|
||||
"CreateUserId": "212725263002001",
|
||||
"UpdateUserId": "212725263002001",
|
||||
"CreateUser": "superAdmin",
|
||||
"UpdateUser": "superAdmin",
|
||||
"IsDelete": "0",
|
||||
"ExtJson": ""
|
||||
},
|
||||
{
|
||||
"Id": "425458936266821",
|
||||
"ParentId": "",
|
||||
"Title": "移动办公",
|
||||
"Name": "",
|
||||
"Description": "移动办公",
|
||||
"Code": "",
|
||||
"Category": "MODULE",
|
||||
"Module": "",
|
||||
"MenuType": "",
|
||||
"Path": "",
|
||||
"Icon": "zondicons:dashboard",
|
||||
"Color": "#05a045",
|
||||
"SortCode": "99",
|
||||
"RegType": "",
|
||||
"Status": "ENABLE",
|
||||
"CreateTime": "2025-6-25 13:28:20.993",
|
||||
"UpdateTime": "2025-6-26 16:04:46.897",
|
||||
"CreateUserId": "212725263002001",
|
||||
"UpdateUserId": "212725263002001",
|
||||
"CreateUser": "superAdmin",
|
||||
"UpdateUser": "superAdmin",
|
||||
"IsDelete": "0",
|
||||
"ExtJson": ""
|
||||
},
|
||||
{
|
||||
"Id": "425472310554693",
|
||||
"ParentId": "0",
|
||||
"Title": "机构管理",
|
||||
"Name": "",
|
||||
"Description": "",
|
||||
"Code": "",
|
||||
"Category": "MENU",
|
||||
"Module": "425458771095621",
|
||||
"MenuType": "MENU",
|
||||
"Path": "/pages/biz/org/index",
|
||||
"Icon": "ep:data-board",
|
||||
"Color": "#f5511e",
|
||||
"SortCode": "1",
|
||||
"RegType": "true",
|
||||
"Status": "ENABLE",
|
||||
"CreateTime": "2025-6-25 13:28:20.997",
|
||||
"UpdateTime": "2025-6-30 10:42:19.273",
|
||||
"CreateUserId": "212725263002001",
|
||||
"UpdateUserId": "212725263002001",
|
||||
"CreateUser": "superAdmin",
|
||||
"UpdateUser": "superAdmin",
|
||||
"IsDelete": "0",
|
||||
"ExtJson": ""
|
||||
},
|
||||
{
|
||||
"Id": "425472601616453",
|
||||
"ParentId": "0",
|
||||
"Title": "岗位管理",
|
||||
"Name": "",
|
||||
"Description": "",
|
||||
"Code": "",
|
||||
"Category": "MENU",
|
||||
"Module": "425458936266821",
|
||||
"MenuType": "MENU",
|
||||
"Path": "/pages/biz/position/index",
|
||||
"Icon": "zondicons:store-front",
|
||||
"Color": "#9c28b1",
|
||||
"SortCode": "6",
|
||||
"RegType": "true",
|
||||
"Status": "ENABLE",
|
||||
"CreateTime": "2025-6-25 13:28:20.997",
|
||||
"UpdateTime": "2025-7-2 14:28:09.923",
|
||||
"CreateUserId": "212725263002001",
|
||||
"UpdateUserId": "212725263002001",
|
||||
"CreateUser": "superAdmin",
|
||||
"UpdateUser": "superAdmin",
|
||||
"IsDelete": "0",
|
||||
"ExtJson": ""
|
||||
},
|
||||
{
|
||||
"Id": "425472851824709",
|
||||
"ParentId": "0",
|
||||
"Title": "人员管理",
|
||||
"Name": "",
|
||||
"Description": "",
|
||||
"Code": "",
|
||||
"Category": "MENU",
|
||||
"Module": "425458771095621",
|
||||
"MenuType": "MENU",
|
||||
"Path": "/pages/biz/user/index",
|
||||
"Icon": "zondicons:location-restroom",
|
||||
"Color": "#26a59a",
|
||||
"SortCode": "9",
|
||||
"RegType": "true",
|
||||
"Status": "ENABLE",
|
||||
"CreateTime": "2025-6-25 13:28:20.997",
|
||||
"UpdateTime": "2025-6-30 10:43:23.757",
|
||||
"CreateUserId": "212725263002001",
|
||||
"UpdateUserId": "212725263002001",
|
||||
"CreateUser": "superAdmin",
|
||||
"UpdateUser": "superAdmin",
|
||||
"IsDelete": "0",
|
||||
"ExtJson": ""
|
||||
},
|
||||
{
|
||||
"Id": "425474847338565",
|
||||
"ParentId": "0",
|
||||
"Title": "更多",
|
||||
"Name": "",
|
||||
"Description": "",
|
||||
"Code": "",
|
||||
"Category": "MENU",
|
||||
"Module": "425458771095621",
|
||||
"MenuType": "CATALOG",
|
||||
"Path": "",
|
||||
"Icon": "zondicons:navigation-more",
|
||||
"Color": "#f1627e",
|
||||
"SortCode": "14",
|
||||
"RegType": "true",
|
||||
"Status": "ENABLE",
|
||||
"CreateTime": "2025-6-25 13:28:20.997",
|
||||
"UpdateTime": "2025-6-30 11:32:11.547",
|
||||
"CreateUserId": "212725263002001",
|
||||
"UpdateUserId": "212725263002001",
|
||||
"CreateUser": "superAdmin",
|
||||
"UpdateUser": "superAdmin",
|
||||
"IsDelete": "0",
|
||||
"ExtJson": ""
|
||||
},
|
||||
{
|
||||
"Id": "425476704763973",
|
||||
"ParentId": "0",
|
||||
"Title": "审批",
|
||||
"Name": "",
|
||||
"Description": "",
|
||||
"Code": "",
|
||||
"Category": "MENU",
|
||||
"Module": "425458936266821",
|
||||
"MenuType": "MENU",
|
||||
"Path": "/pages/flw/task/index",
|
||||
"Icon": "uiw:mobile",
|
||||
"Color": "#fcc02e",
|
||||
"SortCode": "18",
|
||||
"RegType": "true",
|
||||
"Status": "ENABLE",
|
||||
"CreateTime": "2025-6-25 13:28:20.997",
|
||||
"UpdateTime": "2025-6-30 11:32:51.867",
|
||||
"CreateUserId": "212725263002001",
|
||||
"UpdateUserId": "212725263002001",
|
||||
"CreateUser": "superAdmin",
|
||||
"UpdateUser": "superAdmin",
|
||||
"IsDelete": "0",
|
||||
"ExtJson": ""
|
||||
},
|
||||
{
|
||||
"Id": "425710965174341",
|
||||
"ParentId": "425472310554693",
|
||||
"Title": "新增机构",
|
||||
"Name": "",
|
||||
"Description": "",
|
||||
"Code": "mobileBizOrgAdd",
|
||||
"Category": "BUTTON",
|
||||
"Module": "",
|
||||
"MenuType": "",
|
||||
"Path": "",
|
||||
"Icon": "",
|
||||
"Color": "",
|
||||
"SortCode": "99",
|
||||
"RegType": "",
|
||||
"Status": "",
|
||||
"CreateTime": "2025-6-25 13:28:20.997",
|
||||
"UpdateTime": "2025-6-25 14:20:51.037",
|
||||
"CreateUserId": "212725263002001",
|
||||
"UpdateUserId": "",
|
||||
"CreateUser": "superAdmin",
|
||||
"UpdateUser": "",
|
||||
"IsDelete": "0",
|
||||
"ExtJson": ""
|
||||
},
|
||||
{
|
||||
"Id": "425711012839493",
|
||||
"ParentId": "425472310554693",
|
||||
"Title": "编辑机构",
|
||||
"Name": "",
|
||||
"Description": "",
|
||||
"Code": "mobileBizOrgEdit",
|
||||
"Category": "BUTTON",
|
||||
"Module": "",
|
||||
"MenuType": "",
|
||||
"Path": "",
|
||||
"Icon": "",
|
||||
"Color": "",
|
||||
"SortCode": "99",
|
||||
"RegType": "",
|
||||
"Status": "",
|
||||
"CreateTime": "2025-6-25 13:28:20.997",
|
||||
"UpdateTime": "2025-6-25 14:20:51.037",
|
||||
"CreateUserId": "212725263002001",
|
||||
"UpdateUserId": "",
|
||||
"CreateUser": "superAdmin",
|
||||
"UpdateUser": "",
|
||||
"IsDelete": "0",
|
||||
"ExtJson": ""
|
||||
},
|
||||
{
|
||||
"Id": "425711060901957",
|
||||
"ParentId": "425472310554693",
|
||||
"Title": "删除机构",
|
||||
"Name": "",
|
||||
"Description": "",
|
||||
"Code": "mobileBizOrgDelete",
|
||||
"Category": "BUTTON",
|
||||
"Module": "",
|
||||
"MenuType": "",
|
||||
"Path": "",
|
||||
"Icon": "",
|
||||
"Color": "",
|
||||
"SortCode": "99",
|
||||
"RegType": "",
|
||||
"Status": "",
|
||||
"CreateTime": "2025-6-25 13:28:20.997",
|
||||
"UpdateTime": "2025-6-25 14:20:51.037",
|
||||
"CreateUserId": "212725263002001",
|
||||
"UpdateUserId": "",
|
||||
"CreateUser": "superAdmin",
|
||||
"UpdateUser": "",
|
||||
"IsDelete": "0",
|
||||
"ExtJson": ""
|
||||
},
|
||||
{
|
||||
"Id": "425711343288389",
|
||||
"ParentId": "425472601616453",
|
||||
"Title": "新增岗位",
|
||||
"Name": "",
|
||||
"Description": "",
|
||||
"Code": "mobileBizPositionAdd",
|
||||
"Category": "BUTTON",
|
||||
"Module": "",
|
||||
"MenuType": "",
|
||||
"Path": "",
|
||||
"Icon": "",
|
||||
"Color": "",
|
||||
"SortCode": "99",
|
||||
"RegType": "",
|
||||
"Status": "",
|
||||
"CreateTime": "2025-6-25 13:28:20.997",
|
||||
"UpdateTime": "2025-6-25 14:20:51.037",
|
||||
"CreateUserId": "212725263002001",
|
||||
"UpdateUserId": "",
|
||||
"CreateUser": "superAdmin",
|
||||
"UpdateUser": "",
|
||||
"IsDelete": "0",
|
||||
"ExtJson": ""
|
||||
},
|
||||
{
|
||||
"Id": "425711397343301",
|
||||
"ParentId": "425472601616453",
|
||||
"Title": "编辑岗位",
|
||||
"Name": "",
|
||||
"Description": "",
|
||||
"Code": "mobileBizPositionEdit",
|
||||
"Category": "BUTTON",
|
||||
"Module": "",
|
||||
"MenuType": "",
|
||||
"Path": "",
|
||||
"Icon": "",
|
||||
"Color": "",
|
||||
"SortCode": "99",
|
||||
"RegType": "",
|
||||
"Status": "",
|
||||
"CreateTime": "2025-6-25 13:28:20.997",
|
||||
"UpdateTime": "2025-6-25 14:20:51.037",
|
||||
"CreateUserId": "212725263002001",
|
||||
"UpdateUserId": "",
|
||||
"CreateUser": "superAdmin",
|
||||
"UpdateUser": "",
|
||||
"IsDelete": "0",
|
||||
"ExtJson": ""
|
||||
},
|
||||
{
|
||||
"Id": "425711457501253",
|
||||
"ParentId": "425472601616453",
|
||||
"Title": "删除岗位",
|
||||
"Name": "",
|
||||
"Description": "",
|
||||
"Code": "mobileBizPositionDelete",
|
||||
"Category": "BUTTON",
|
||||
"Module": "",
|
||||
"MenuType": "",
|
||||
"Path": "",
|
||||
"Icon": "",
|
||||
"Color": "",
|
||||
"SortCode": "99",
|
||||
"RegType": "",
|
||||
"Status": "",
|
||||
"CreateTime": "2025-6-25 13:28:20.997",
|
||||
"UpdateTime": "2025-6-25 14:20:51.037",
|
||||
"CreateUserId": "212725263002001",
|
||||
"UpdateUserId": "",
|
||||
"CreateUser": "superAdmin",
|
||||
"UpdateUser": "",
|
||||
"IsDelete": "0",
|
||||
"ExtJson": ""
|
||||
},
|
||||
{
|
||||
"Id": "425711559307333",
|
||||
"ParentId": "425472851824709",
|
||||
"Title": "新增人员",
|
||||
"Name": "",
|
||||
"Description": "",
|
||||
"Code": "mobileBizUserAdd",
|
||||
"Category": "BUTTON",
|
||||
"Module": "",
|
||||
"MenuType": "",
|
||||
"Path": "",
|
||||
"Icon": "",
|
||||
"Color": "",
|
||||
"SortCode": "99",
|
||||
"RegType": "",
|
||||
"Status": "",
|
||||
"CreateTime": "2025-6-25 13:28:20.997",
|
||||
"UpdateTime": "2025-6-25 14:20:51.037",
|
||||
"CreateUserId": "212725263002001",
|
||||
"UpdateUserId": "",
|
||||
"CreateUser": "superAdmin",
|
||||
"UpdateUser": "",
|
||||
"IsDelete": "0",
|
||||
"ExtJson": ""
|
||||
},
|
||||
{
|
||||
"Id": "425711600533573",
|
||||
"ParentId": "425472851824709",
|
||||
"Title": "编辑人员",
|
||||
"Name": "",
|
||||
"Description": "",
|
||||
"Code": "mobileBizUserEdit",
|
||||
"Category": "BUTTON",
|
||||
"Module": "",
|
||||
"MenuType": "",
|
||||
"Path": "",
|
||||
"Icon": "",
|
||||
"Color": "",
|
||||
"SortCode": "99",
|
||||
"RegType": "",
|
||||
"Status": "",
|
||||
"CreateTime": "2025-6-25 13:28:20.997",
|
||||
"UpdateTime": "2025-6-25 14:20:51.037",
|
||||
"CreateUserId": "212725263002001",
|
||||
"UpdateUserId": "",
|
||||
"CreateUser": "superAdmin",
|
||||
"UpdateUser": "",
|
||||
"IsDelete": "0",
|
||||
"ExtJson": ""
|
||||
},
|
||||
{
|
||||
"Id": "425711647805509",
|
||||
"ParentId": "425472851824709",
|
||||
"Title": "删除人员",
|
||||
"Name": "",
|
||||
"Description": "",
|
||||
"Code": "mobileBizUserDelete",
|
||||
"Category": "BUTTON",
|
||||
"Module": "",
|
||||
"MenuType": "",
|
||||
"Path": "",
|
||||
"Icon": "",
|
||||
"Color": "",
|
||||
"SortCode": "99",
|
||||
"RegType": "",
|
||||
"Status": "",
|
||||
"CreateTime": "2025-6-25 13:28:20.997",
|
||||
"UpdateTime": "2025-6-25 14:20:51.037",
|
||||
"CreateUserId": "212725263002001",
|
||||
"UpdateUserId": "",
|
||||
"CreateUser": "superAdmin",
|
||||
"UpdateUser": "",
|
||||
"IsDelete": "0",
|
||||
"ExtJson": ""
|
||||
},
|
||||
{
|
||||
"Id": "693329840169029",
|
||||
"ParentId": "425474847338565",
|
||||
"Title": "文件管理",
|
||||
"Name": "",
|
||||
"Description": "",
|
||||
"Code": "",
|
||||
"Category": "MENU",
|
||||
"Module": "425458771095621",
|
||||
"MenuType": "MENU",
|
||||
"Path": "/pages/file/index",
|
||||
"Icon": "ep:files",
|
||||
"Color": "#ffb74e",
|
||||
"SortCode": "99",
|
||||
"RegType": "true",
|
||||
"Status": "ENABLE",
|
||||
"CreateTime": "2025-7-2 13:46:22.527",
|
||||
"UpdateTime": "",
|
||||
"CreateUserId": "212725263002001",
|
||||
"UpdateUserId": "",
|
||||
"CreateUser": "superAdmin",
|
||||
"UpdateUser": "",
|
||||
"IsDelete": "0",
|
||||
"ExtJson": ""
|
||||
},
|
||||
{
|
||||
"Id": "693342308134981",
|
||||
"ParentId": "693329840169029",
|
||||
"Title": "新增文件",
|
||||
"Name": "",
|
||||
"Description": "",
|
||||
"Code": "bizFileAdd",
|
||||
"Category": "BUTTON",
|
||||
"Module": "",
|
||||
"MenuType": "",
|
||||
"Path": "",
|
||||
"Icon": "",
|
||||
"Color": "",
|
||||
"SortCode": "1",
|
||||
"RegType": "",
|
||||
"Status": "",
|
||||
"CreateTime": "2025-7-2 14:37:10.51",
|
||||
"UpdateTime": "",
|
||||
"CreateUserId": "212725263002001",
|
||||
"UpdateUserId": "",
|
||||
"CreateUser": "superAdmin",
|
||||
"UpdateUser": "",
|
||||
"IsDelete": "0",
|
||||
"ExtJson": ""
|
||||
},
|
||||
{
|
||||
"Id": "693342308134982",
|
||||
"ParentId": "693329840169029",
|
||||
"Title": "编辑文件",
|
||||
"Name": "",
|
||||
"Description": "",
|
||||
"Code": "bizFileEdit",
|
||||
"Category": "BUTTON",
|
||||
"Module": "",
|
||||
"MenuType": "",
|
||||
"Path": "",
|
||||
"Icon": "",
|
||||
"Color": "",
|
||||
"SortCode": "2",
|
||||
"RegType": "",
|
||||
"Status": "",
|
||||
"CreateTime": "2025-7-2 14:37:10.51",
|
||||
"UpdateTime": "",
|
||||
"CreateUserId": "212725263002001",
|
||||
"UpdateUserId": "",
|
||||
"CreateUser": "superAdmin",
|
||||
"UpdateUser": "",
|
||||
"IsDelete": "0",
|
||||
"ExtJson": ""
|
||||
},
|
||||
{
|
||||
"Id": "693342308134983",
|
||||
"ParentId": "693329840169029",
|
||||
"Title": "删除文件",
|
||||
"Name": "",
|
||||
"Description": "",
|
||||
"Code": "bizFileDelete",
|
||||
"Category": "BUTTON",
|
||||
"Module": "",
|
||||
"MenuType": "",
|
||||
"Path": "",
|
||||
"Icon": "",
|
||||
"Color": "",
|
||||
"SortCode": "3",
|
||||
"RegType": "",
|
||||
"Status": "",
|
||||
"CreateTime": "2025-7-2 14:37:10.51",
|
||||
"UpdateTime": "",
|
||||
"CreateUserId": "212725263002001",
|
||||
"UpdateUserId": "",
|
||||
"CreateUser": "superAdmin",
|
||||
"UpdateUser": "",
|
||||
"IsDelete": "0",
|
||||
"ExtJson": ""
|
||||
},
|
||||
{
|
||||
"Id": "693342308134984",
|
||||
"ParentId": "693329840169029",
|
||||
"Title": "批量删除文件",
|
||||
"Name": "",
|
||||
"Description": "",
|
||||
"Code": "bizFileBatchDelete",
|
||||
"Category": "BUTTON",
|
||||
"Module": "",
|
||||
"MenuType": "",
|
||||
"Path": "",
|
||||
"Icon": "",
|
||||
"Color": "",
|
||||
"SortCode": "4",
|
||||
"RegType": "",
|
||||
"Status": "",
|
||||
"CreateTime": "2025-7-2 14:37:10.51",
|
||||
"UpdateTime": "",
|
||||
"CreateUserId": "212725263002001",
|
||||
"UpdateUserId": "",
|
||||
"CreateUser": "superAdmin",
|
||||
"UpdateUser": "",
|
||||
"IsDelete": "0",
|
||||
"ExtJson": ""
|
||||
},
|
||||
{
|
||||
"Id": "693342308134985",
|
||||
"ParentId": "693329840169029",
|
||||
"Title": "导入文件",
|
||||
"Name": "",
|
||||
"Description": "",
|
||||
"Code": "bizFileImport",
|
||||
"Category": "BUTTON",
|
||||
"Module": "",
|
||||
"MenuType": "",
|
||||
"Path": "",
|
||||
"Icon": "",
|
||||
"Color": "",
|
||||
"SortCode": "5",
|
||||
"RegType": "",
|
||||
"Status": "",
|
||||
"CreateTime": "2025-7-2 14:37:10.51",
|
||||
"UpdateTime": "",
|
||||
"CreateUserId": "212725263002001",
|
||||
"UpdateUserId": "",
|
||||
"CreateUser": "superAdmin",
|
||||
"UpdateUser": "",
|
||||
"IsDelete": "0",
|
||||
"ExtJson": ""
|
||||
},
|
||||
{
|
||||
"Id": "693342308134986",
|
||||
"ParentId": "693329840169029",
|
||||
"Title": "导出文件",
|
||||
"Name": "",
|
||||
"Description": "",
|
||||
"Code": "bizFileExport",
|
||||
"Category": "BUTTON",
|
||||
"Module": "",
|
||||
"MenuType": "",
|
||||
"Path": "",
|
||||
"Icon": "",
|
||||
"Color": "",
|
||||
"SortCode": "6",
|
||||
"RegType": "",
|
||||
"Status": "",
|
||||
"CreateTime": "2025-7-2 14:37:10.51",
|
||||
"UpdateTime": "",
|
||||
"CreateUserId": "212725263002001",
|
||||
"UpdateUserId": "",
|
||||
"CreateUser": "superAdmin",
|
||||
"UpdateUser": "",
|
||||
"IsDelete": "0",
|
||||
"ExtJson": ""
|
||||
},
|
||||
{
|
||||
"Id": "693342308134987",
|
||||
"ParentId": "693329840169029",
|
||||
"Title": "批量编辑文件",
|
||||
"Name": "",
|
||||
"Description": "",
|
||||
"Code": "bizFileBatchEdit",
|
||||
"Category": "BUTTON",
|
||||
"Module": "",
|
||||
"MenuType": "",
|
||||
"Path": "",
|
||||
"Icon": "",
|
||||
"Color": "",
|
||||
"SortCode": "7",
|
||||
"RegType": "",
|
||||
"Status": "",
|
||||
"CreateTime": "2025-7-2 14:37:10.51",
|
||||
"UpdateTime": "",
|
||||
"CreateUserId": "212725263002001",
|
||||
"UpdateUserId": "",
|
||||
"CreateUser": "superAdmin",
|
||||
"UpdateUser": "",
|
||||
"IsDelete": "0",
|
||||
"ExtJson": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"RECORDS": [
|
||||
{
|
||||
"Id": "425798456791109",
|
||||
"ObjectId": "212725263001001",
|
||||
"TargetId": "425472310554693",
|
||||
"Category": "SYS_ROLE_HAS_MOBILE_RESOURCE",
|
||||
"ExtJson": "{\"MenuId\":425472310554693,\"ButtonInfo\":[425710965174341,425711012839493,425711060901957]}"
|
||||
},
|
||||
{
|
||||
"Id": "425798456791110",
|
||||
"ObjectId": "212725263001001",
|
||||
"TargetId": "425472601616453",
|
||||
"Category": "SYS_ROLE_HAS_MOBILE_RESOURCE",
|
||||
"ExtJson": "{\"MenuId\":425472601616453,\"ButtonInfo\":[425711343288389,425711397343301,425711457501253]}"
|
||||
},
|
||||
{
|
||||
"Id": "425798456791111",
|
||||
"ObjectId": "212725263001001",
|
||||
"TargetId": "425472851824709",
|
||||
"Category": "SYS_ROLE_HAS_MOBILE_RESOURCE",
|
||||
"ExtJson": "{\"MenuId\":425472851824709,\"ButtonInfo\":[425711559307333,425711600533573,425711647805509]}"
|
||||
},
|
||||
{
|
||||
"Id": "425798456791112",
|
||||
"ObjectId": "212725263001001",
|
||||
"TargetId": "425474847338565",
|
||||
"Category": "SYS_ROLE_HAS_MOBILE_RESOURCE",
|
||||
"ExtJson": "{\"MenuId\":425474847338565,\"ButtonInfo\":[]}"
|
||||
},
|
||||
{
|
||||
"Id": "425798456791113",
|
||||
"ObjectId": "212725263001001",
|
||||
"TargetId": "425476704763973",
|
||||
"Category": "SYS_ROLE_HAS_MOBILE_RESOURCE",
|
||||
"ExtJson": "{\"MenuId\":425476704763973,\"ButtonInfo\":[]}"
|
||||
}
|
||||
]
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
{
|
||||
"RECORDS": [
|
||||
{
|
||||
"Id": "425378309881925",
|
||||
"ParentId": "0",
|
||||
"Title": "移动端管理",
|
||||
"Name": "",
|
||||
"Code": "",
|
||||
"Category": "MENU",
|
||||
"Module": "212725263003721",
|
||||
"MenuType": "CATALOG",
|
||||
"Path": "/7071669224309002240",
|
||||
"Component": "",
|
||||
"Icon": "mobile-outlined",
|
||||
"Color": "",
|
||||
"SortCode": "50",
|
||||
"CreateTime": "2023-6-6 10:08:48.457",
|
||||
"UpdateTime": "",
|
||||
"CreateUserId": "212725263002001",
|
||||
"UpdateUserId": "",
|
||||
"CreateUser": "superAdmin",
|
||||
"UpdateUser": "",
|
||||
"IsDelete": "0",
|
||||
"ExtJson": ""
|
||||
},
|
||||
{
|
||||
"Id": "425378520674373",
|
||||
"ParentId": "425378309881925",
|
||||
"Title": "模块管理",
|
||||
"Name": "mobileModuleIndex",
|
||||
"Code": "",
|
||||
"Category": "MENU",
|
||||
"Module": "212725263003721",
|
||||
"MenuType": "MENU",
|
||||
"Path": "/mobile/module/index",
|
||||
"Component": "mobile/resource/module/index",
|
||||
"Icon": "build-outlined",
|
||||
"Color": "",
|
||||
"SortCode": "51",
|
||||
"CreateTime": "2023-6-6 10:09:39.92",
|
||||
"UpdateTime": "",
|
||||
"CreateUserId": "212725263002001",
|
||||
"UpdateUserId": "",
|
||||
"CreateUser": "superAdmin",
|
||||
"UpdateUser": "",
|
||||
"IsDelete": "0",
|
||||
"ExtJson": ""
|
||||
},
|
||||
{
|
||||
"Id": "425378933755973",
|
||||
"ParentId": "425378309881925",
|
||||
"Title": "菜单管理",
|
||||
"Name": "mobileMenuIndex",
|
||||
"Code": "",
|
||||
"Category": "MENU",
|
||||
"Module": "212725263003721",
|
||||
"MenuType": "MENU",
|
||||
"Path": "/mobile/menu/index",
|
||||
"Component": "mobile/resource/menu/index",
|
||||
"Icon": "appstore-add-outlined",
|
||||
"Color": "",
|
||||
"SortCode": "52",
|
||||
"CreateTime": "2023-6-6 10:11:20.77",
|
||||
"UpdateTime": "",
|
||||
"CreateUserId": "212725263002001",
|
||||
"UpdateUserId": "",
|
||||
"CreateUser": "superAdmin",
|
||||
"UpdateUser": "",
|
||||
"IsDelete": "0",
|
||||
"ExtJson": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Plugin.Mobile;
|
||||
|
||||
/// <summary>
|
||||
/// 移动端资源表
|
||||
/// </summary>
|
||||
public class MobileResourceSeedData : ISqlSugarEntitySeedData<MobileResource>
|
||||
{
|
||||
public IEnumerable<MobileResource> SeedData()
|
||||
{
|
||||
return SeedDataUtil.GetSeedData<MobileResource>("seed_mobile_resource.json");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Plugin.Mobile;
|
||||
|
||||
/// <summary>
|
||||
/// 关系表种子数据
|
||||
/// </summary>
|
||||
public class SysRelationSeedData : ISqlSugarEntitySeedData<SysRelation>
|
||||
{
|
||||
public IEnumerable<SysRelation> SeedData()
|
||||
{
|
||||
return SeedDataUtil.GetSeedData<SysRelation>("seed_sys_relation_mobile.json");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Plugin.Mobile;
|
||||
|
||||
/// <summary>
|
||||
/// 资源表种子数据
|
||||
/// </summary>
|
||||
public class SysResourceSeedData : ISqlSugarEntitySeedData<SysResource>
|
||||
{
|
||||
public IEnumerable<SysResource> SeedData()
|
||||
{
|
||||
return SeedDataUtil.GetSeedData<SysResource>("seed_sys_resource_mobile.json");
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Plugin.Mobile;
|
||||
|
||||
/// <summary>
|
||||
/// 添加按钮参数
|
||||
/// </summary>
|
||||
public class MobileButtonAddInput : MobileResource
|
||||
{
|
||||
/// <summary>
|
||||
/// 父ID
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "ParentId不能为空")]
|
||||
public override long? ParentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标题
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "Title不能为空")]
|
||||
public override string Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 编码
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "Code不能为空")]
|
||||
public override string Code { get; set; }
|
||||
}
|
||||
|
||||
public class MobileButtonEditInput : MobileButtonAddInput
|
||||
{
|
||||
/// <summary>
|
||||
/// ID
|
||||
/// </summary>
|
||||
[IdNotNull(ErrorMessage = "Id不能为空")]
|
||||
public override long Id { get; set; }
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Plugin.Mobile;
|
||||
|
||||
/// <summary>
|
||||
/// 权限按钮服务
|
||||
/// </summary>
|
||||
public interface IMobileButtonService : ITransient
|
||||
{
|
||||
/// <summary>
|
||||
/// 添加按钮
|
||||
/// </summary>
|
||||
/// <param name="input">添加参数</param>
|
||||
/// <returns></returns>
|
||||
Task Add(MobileButtonAddInput input);
|
||||
|
||||
/// <summary>
|
||||
/// 批量添加
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<long>> AddBatch(MobileButtonAddInput input);
|
||||
|
||||
/// <summary>
|
||||
/// 删除按钮
|
||||
/// </summary>
|
||||
/// <param name="input">删除参数</param>
|
||||
/// <returns></returns>
|
||||
Task Delete(BaseIdListInput input);
|
||||
|
||||
/// <summary>
|
||||
/// 编辑按钮
|
||||
/// </summary>
|
||||
/// <param name="input">编辑参数</param>
|
||||
/// <returns></returns>
|
||||
Task Edit(MobileButtonEditInput input);
|
||||
|
||||
/// <summary>
|
||||
/// 按钮分页查询
|
||||
/// </summary>
|
||||
/// <param name="input">查询条件</param>
|
||||
/// <returns>按钮分页列表</returns>
|
||||
Task<SqlSugarPagedList<MobileResource>> Page(ButtonPageInput input);
|
||||
}
|
||||
+187
@@ -0,0 +1,187 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Plugin.Mobile;
|
||||
|
||||
/// <summary>
|
||||
/// <inheritdoc cref="IMobileButtonService"/>
|
||||
/// </summary>
|
||||
public class MobileMobileButtonService : DbRepository<MobileResource>, IMobileButtonService
|
||||
{
|
||||
private readonly ILogger<MobileMobileButtonService> _logger;
|
||||
private readonly IMobileResourceService _resourceService;
|
||||
private readonly IRelationService _relationService;
|
||||
|
||||
public MobileMobileButtonService(ILogger<MobileMobileButtonService> logger, IMobileResourceService resourceService,
|
||||
IRelationService relationService)
|
||||
{
|
||||
_logger = logger;
|
||||
_resourceService = resourceService;
|
||||
_relationService = relationService;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public async Task<SqlSugarPagedList<MobileResource>> Page(ButtonPageInput input)
|
||||
{
|
||||
var query = Context.Queryable<MobileResource>()
|
||||
.Where(it => it.ParentId == input.ParentId && it.Category == CateGoryConst.RESOURCE_BUTTON)
|
||||
.WhereIF(!string.IsNullOrEmpty(input.SearchKey), it => it.Title.Contains(input.SearchKey) || it.Path.Contains(input.SearchKey))//根据关键字查询
|
||||
.OrderByIF(!string.IsNullOrEmpty(input.SortField), $"{input.SortField} {input.SortOrder}")
|
||||
.OrderBy(it => it.SortCode);//排序
|
||||
var pageInfo = await query.ToPagedListAsync(input.PageNum, input.PageSize);//分页
|
||||
return pageInfo;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task Add(MobileButtonAddInput input)
|
||||
{
|
||||
await CheckInput(input);//检查参数
|
||||
var MobileResource = input.Adapt<MobileResource>();//实体转换
|
||||
if (await InsertAsync(MobileResource))//插入数据
|
||||
await _resourceService.RefreshCache(CateGoryConst.RESOURCE_BUTTON);//刷新缓存
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<List<long>> AddBatch(MobileButtonAddInput input)
|
||||
{
|
||||
var MobileResources = new List<MobileResource>();//按钮列表
|
||||
var codeList = new List<string> { "Add", "Edit", "Delete", "BatchDelete", "Import", "Export", "BatchEdit" };//code后缀
|
||||
var titleList = new List<string> { "新增", "编辑", "删除", "批量删除", "导入", "导出", "批量编辑" };//title前缀
|
||||
var idList = new List<long>();//Id列表
|
||||
for (var i = 0; i < codeList.Count; i++)
|
||||
{
|
||||
var id = CommonUtils.GetSingleId();
|
||||
MobileResources.Add(new MobileResource
|
||||
{
|
||||
Id = id,
|
||||
Title = titleList[i] + input.Title,//标题等于前缀输入的值
|
||||
Code = input.Code + codeList[i],//code等于输入的值加后缀
|
||||
ParentId = input.ParentId,
|
||||
SortCode = i + 1
|
||||
});
|
||||
idList.Add(id);
|
||||
}
|
||||
//遍历列表
|
||||
foreach (var MobileResource in MobileResources)
|
||||
{
|
||||
await CheckInput(MobileResource);//检查按钮参数
|
||||
}
|
||||
//添加到数据库
|
||||
if (await InsertRangeAsync(MobileResources))//插入数据
|
||||
{
|
||||
await _resourceService.RefreshCache(CateGoryConst.RESOURCE_BUTTON);//刷新缓存
|
||||
return MobileResources.Select(it => it.Id).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
return new List<long>();
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task Edit(MobileButtonEditInput input)
|
||||
{
|
||||
await CheckInput(input);//检查参数
|
||||
var MobileResource = input.Adapt<MobileResource>();//实体转换
|
||||
//事务
|
||||
var result = await Tenant.UseTranAsync(async () =>
|
||||
{
|
||||
await UpdateAsync(MobileResource);//更新按钮
|
||||
});
|
||||
if (result.IsSuccess)//如果成功了
|
||||
{
|
||||
await _resourceService.RefreshCache(CateGoryConst.RESOURCE_BUTTON);//资源表按钮刷新缓存
|
||||
}
|
||||
else
|
||||
{
|
||||
//写日志
|
||||
_logger.LogError(result.ErrorMessage, result.ErrorException);
|
||||
throw Oops.Oh(ErrorCodeEnum.A0002);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task Delete(BaseIdListInput input)
|
||||
{
|
||||
//获取所有ID
|
||||
var ids = input.Ids;
|
||||
//获取所有按钮集合
|
||||
var buttonList = await _resourceService.GetListByCategory(CateGoryConst.RESOURCE_BUTTON);
|
||||
|
||||
#region 处理关系表角色资源信息
|
||||
|
||||
//获取所有菜单集合
|
||||
var menuList = await _resourceService.GetListByCategory(CateGoryConst.RESOURCE_MENU);
|
||||
//获取按钮的父菜单id集合
|
||||
var parentIds = buttonList.Where(it => ids.Contains(it.Id)).Select(it => it.ParentId.Value.ToString()).ToList();
|
||||
//获取关系表分类为SYS_ROLE_HAS_RESOURCE数据
|
||||
var roleResources = await _relationService.GetRelationByCategory(CateGoryConst.RELATION_SYS_ROLE_HAS_RESOURCE);
|
||||
//获取相关关系表数据
|
||||
var relationList = roleResources
|
||||
.Where(it => parentIds.Contains(it.TargetId))//目标ID是父ID中
|
||||
.Where(it => it.ExtJson != null).ToList();//扩展信息不为空
|
||||
//遍历关系表
|
||||
relationList.ForEach(it =>
|
||||
{
|
||||
var relationRoleResuorce = it.ExtJson.ToJsonEntity<RelationRoleResource>();//拓展信息转实体
|
||||
var buttonInfo = relationRoleResuorce.ButtonInfo;//获取按钮信息
|
||||
if (buttonInfo.Count > 0)
|
||||
{
|
||||
var diffArr = buttonInfo.Where(it => !buttonInfo.Contains(it)).ToList();//找出不同的元素(即交集的补集)
|
||||
relationRoleResuorce.ButtonInfo = diffArr;//重新赋值按钮信息
|
||||
it.ExtJson = relationRoleResuorce.ToJson();//重新赋值拓展信息
|
||||
}
|
||||
});
|
||||
|
||||
#endregion 处理关系表角色资源信息
|
||||
|
||||
//事务
|
||||
var result = await Tenant.UseTranAsync(async () =>
|
||||
{
|
||||
await DeleteByIdsAsync(ids.Cast<object>().ToArray());//删除按钮
|
||||
if (relationList.Count > 0)
|
||||
{
|
||||
await Context.Updateable(relationList).UpdateColumns(it => it.ExtJson).ExecuteCommandAsync();//修改拓展信息
|
||||
}
|
||||
});
|
||||
if (result.IsSuccess)//如果成功了
|
||||
{
|
||||
await _resourceService.RefreshCache(CateGoryConst.RESOURCE_BUTTON);//资源表按钮刷新缓存
|
||||
await _relationService.RefreshCache(CateGoryConst.RELATION_SYS_ROLE_HAS_RESOURCE);//关系表刷新角色资源缓存
|
||||
}
|
||||
else
|
||||
{
|
||||
//写日志
|
||||
_logger.LogError(result.ErrorMessage, result.ErrorException);
|
||||
throw Oops.Oh(ErrorCodeEnum.A0002);
|
||||
}
|
||||
}
|
||||
|
||||
#region 方法
|
||||
|
||||
/// <summary>
|
||||
/// 检查输入参数
|
||||
/// </summary>
|
||||
/// <param name="MobileResource"></param>
|
||||
private async Task CheckInput(MobileResource MobileResource)
|
||||
{
|
||||
//获取所有按钮和菜单
|
||||
var buttonList = await _resourceService.GetListAsync(new List<string> { CateGoryConst.RESOURCE_BUTTON, CateGoryConst.RESOURCE_MENU });
|
||||
//判断code是否重复
|
||||
if (buttonList.Any(it => it.Code == MobileResource.Code && it.Id != MobileResource.Id))
|
||||
throw Oops.Bah($"存在重复的按钮编码:{MobileResource.Code}");
|
||||
//判断菜单是否存在
|
||||
if (!buttonList.Any(it => it.Id == MobileResource.ParentId))
|
||||
throw Oops.Bah($"不存在的父级菜单:{MobileResource.ParentId}");
|
||||
MobileResource.Category = CateGoryConst.RESOURCE_BUTTON;//设置分类为按钮
|
||||
}
|
||||
|
||||
#endregion 方法
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Plugin.Mobile;
|
||||
|
||||
/// <summary>
|
||||
/// 添加菜单参数
|
||||
/// </summary>
|
||||
public class MobileMenuAddInput : MobileResource
|
||||
{
|
||||
/// <summary>
|
||||
/// 父ID
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "ParentId不能为空")]
|
||||
public override long? ParentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标题
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "Title不能为空")]
|
||||
public override string Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 菜单类型
|
||||
/// </summary>
|
||||
public override string MenuType { get; set; } = SysResourceConst.MENU;
|
||||
|
||||
/// <summary>
|
||||
/// 模块
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "Module不能为空")]
|
||||
public override long? Module { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 图标
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "Icon不能为空")]
|
||||
public override string Icon { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 编辑菜单输入参数
|
||||
/// </summary>
|
||||
public class MobileMenuEditInput : MobileMenuAddInput
|
||||
{
|
||||
/// <summary>
|
||||
/// ID
|
||||
/// </summary>
|
||||
[IdNotNull(ErrorMessage = "Id不能为空")]
|
||||
public override long Id { get; set; }
|
||||
}
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Plugin.Mobile;
|
||||
|
||||
/// <summary>
|
||||
/// 菜单服务
|
||||
/// </summary>
|
||||
public interface IMobileMenuService : ITransient
|
||||
{
|
||||
/// <summary>
|
||||
/// 添加菜单
|
||||
/// </summary>
|
||||
/// <param name="input">添加参数</param>
|
||||
/// <returns></returns>
|
||||
Task Add(MobileMenuAddInput input);
|
||||
|
||||
/// <summary>
|
||||
/// 详情
|
||||
/// </summary>
|
||||
/// <param name="input">id</param>
|
||||
/// <returns>详细信息</returns>
|
||||
Task<MobileResource> Detail(BaseIdInput input);
|
||||
|
||||
/// <summary>
|
||||
/// 构建菜单树形结构
|
||||
/// </summary>
|
||||
/// <param name="resourceList">菜单列表</param>
|
||||
/// <param name="parentId">父ID</param>
|
||||
/// <returns>菜单形结构</returns>
|
||||
List<MobileResource> ConstructMenuTrees(List<MobileResource> resourceList, long parentId = 0);
|
||||
|
||||
/// <summary>
|
||||
/// 获取菜单树
|
||||
/// </summary>
|
||||
/// <param name="input">菜单树查询参数</param>
|
||||
/// <returns>菜单树列表</returns>
|
||||
Task<List<MobileResource>> Tree(MenuTreeInput input);
|
||||
|
||||
/// <summary>
|
||||
/// 编辑菜单
|
||||
/// </summary>
|
||||
/// <param name="input">菜单编辑参数</param>
|
||||
/// <returns></returns>
|
||||
Task Edit(MobileMenuEditInput input);
|
||||
|
||||
/// <summary>
|
||||
/// 删除菜单
|
||||
/// </summary>
|
||||
/// <param name="input">删除菜单参数</param>
|
||||
/// <returns></returns>
|
||||
Task Delete(BaseIdListInput input);
|
||||
|
||||
/// <summary>
|
||||
/// 改变菜单模块
|
||||
/// </summary>
|
||||
/// <param name="input">改变菜单模块参数</param>
|
||||
/// <returns></returns>
|
||||
Task ChangeModule(MenuChangeModuleInput input);
|
||||
|
||||
/// <summary>
|
||||
/// 角色授权移动端资源
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
Task GrantRoleMobileResource(GrantResourceInput input);
|
||||
}
|
||||
+250
@@ -0,0 +1,250 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
using MoYu.EventBus;
|
||||
|
||||
namespace SimpleAdmin.Plugin.Mobile;
|
||||
|
||||
/// <summary>
|
||||
/// <inheritdoc cref="IMobileMenuService"/>
|
||||
/// </summary>
|
||||
public class MobileMenuService : DbRepository<MobileResource>, IMobileMenuService
|
||||
{
|
||||
private readonly ILogger<MobileMenuService> _logger;
|
||||
private readonly IMobileResourceService _resourceService;
|
||||
private readonly IRelationService _relationService;
|
||||
private readonly IEventPublisher _eventPublisher;
|
||||
private readonly ISysRoleService _roleService;
|
||||
|
||||
public MobileMenuService(ILogger<MobileMenuService> logger, IMobileResourceService resourceService, IRelationService relationService,
|
||||
IEventPublisher eventPublisher, ISysRoleService roleService)
|
||||
{
|
||||
_logger = logger;
|
||||
_resourceService = resourceService;
|
||||
_relationService = relationService;
|
||||
_eventPublisher = eventPublisher;
|
||||
_roleService = roleService;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public List<MobileResource> ConstructMenuTrees(List<MobileResource> resourceList, long parentId = 0)
|
||||
{
|
||||
//找下级资源ID列表
|
||||
var resources = resourceList.Where(it => it.ParentId == parentId).OrderBy(it => it.SortCode).ToList();
|
||||
if (resources.Count > 0)//如果数量大于0
|
||||
{
|
||||
var data = new List<MobileResource>();
|
||||
foreach (var item in resources)//遍历资源
|
||||
{
|
||||
item.Children = ConstructMenuTrees(resourceList, item.Id);//添加子节点
|
||||
data.Add(item);//添加到列表
|
||||
}
|
||||
return data;//返回结果
|
||||
}
|
||||
return new List<MobileResource>();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<List<MobileResource>> Tree(MenuTreeInput input)
|
||||
{
|
||||
//获取所有菜单
|
||||
var mobileResources = await _resourceService.GetListByCategory(CateGoryConst.RESOURCE_MENU);
|
||||
mobileResources = mobileResources.WhereIF(input.Module != null, it => it.Module.Value == input.Module.Value)//根据模块查找
|
||||
.WhereIF(!string.IsNullOrEmpty(input.SearchKey), it => it.Title == input.SearchKey)//根据关键字查找
|
||||
.ToList();
|
||||
//构建菜单树
|
||||
var tree = ConstructMenuTrees(mobileResources);
|
||||
return tree;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task Add(MobileMenuAddInput input)
|
||||
{
|
||||
await CheckInput(input);//检查参数
|
||||
var mobileResource = input.Adapt<MobileResource>();//实体转换
|
||||
|
||||
if (await InsertAsync(mobileResource))//插入数据
|
||||
await _resourceService.RefreshCache(CateGoryConst.RESOURCE_MENU);//刷新菜单缓存
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task Edit(MobileMenuEditInput input)
|
||||
{
|
||||
await CheckInput(input);//检查参数
|
||||
var mobileResource = input.Adapt<MobileResource>();//实体转换
|
||||
if (await UpdateAsync(mobileResource))//更新数据
|
||||
await _resourceService.RefreshCache(CateGoryConst.RESOURCE_MENU);//刷新菜单缓存
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task Delete(BaseIdListInput input)
|
||||
{
|
||||
//获取所有ID
|
||||
var ids = input.Ids;
|
||||
if (ids.Count > 0)
|
||||
{
|
||||
//获取所有菜单和按钮
|
||||
var resourceList = await _resourceService.GetListAsync(new List<string> { CateGoryConst.RESOURCE_MENU, CateGoryConst.RESOURCE_BUTTON });
|
||||
//找到要删除的菜单
|
||||
var mobileResources = resourceList.Where(it => ids.Contains(it.Id)).ToList();
|
||||
//查找内置菜单
|
||||
var system = mobileResources.Where(it => it.Code == SysResourceConst.SYSTEM).FirstOrDefault();
|
||||
if (system != null)
|
||||
throw Oops.Bah($"不可删除系统菜单:{system.Title}");
|
||||
//需要删除的资源ID列表
|
||||
var resourceIds = new List<long>();
|
||||
//遍历菜单列表
|
||||
mobileResources.ForEach(it =>
|
||||
{
|
||||
//获取菜单所有子节点
|
||||
var child = _resourceService.GetChildListById(resourceList, it.Id, false);
|
||||
//将子节点ID添加到删除资源ID列表
|
||||
resourceIds.AddRange(child.Select(it => it.Id).ToList());
|
||||
resourceIds.Add(it.Id);//添加到删除资源ID列表
|
||||
});
|
||||
ids.AddRange(resourceIds);//添加到删除ID列表
|
||||
//事务
|
||||
var result = await Tenant.UseTranAsync(async () =>
|
||||
{
|
||||
await DeleteByIdsAsync(ids.Cast<object>().ToArray());//删除菜单和按钮
|
||||
await Context.Deleteable<SysRelation>()//关系表删除对应SYS_ROLE_HAS_RESOURCE
|
||||
.Where(it => it.Category == MobileConst.RELATION_SYS_ROLE_HAS_MOBILE_RESOURCE
|
||||
&& resourceIds.Contains(SqlFunc.ToInt64(it.TargetId))).ExecuteCommandAsync();
|
||||
});
|
||||
if (result.IsSuccess)//如果成功了
|
||||
{
|
||||
await _resourceService.RefreshCache(CateGoryConst.RESOURCE_MENU);//资源表菜单刷新缓存
|
||||
await _resourceService.RefreshCache(CateGoryConst.RESOURCE_BUTTON);//资源表按钮刷新缓存
|
||||
await _relationService.RefreshCache(MobileConst.RELATION_SYS_ROLE_HAS_MOBILE_RESOURCE);//关系表刷新缓存
|
||||
}
|
||||
else
|
||||
{
|
||||
//写日志
|
||||
_logger.LogError(result.ErrorMessage, result.ErrorException);
|
||||
throw Oops.Oh(ErrorCodeEnum.A0002);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<MobileResource> Detail(BaseIdInput input)
|
||||
{
|
||||
var mobileResources = await _resourceService.GetListByCategory(CateGoryConst.RESOURCE_MENU);
|
||||
var resource = mobileResources.Where(it => it.Id == input.Id).FirstOrDefault();
|
||||
return resource;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task ChangeModule(MenuChangeModuleInput input)
|
||||
{
|
||||
var mobileResource = await Detail(new BaseIdInput { Id = input.Id });
|
||||
if (mobileResource != null)
|
||||
{
|
||||
if (mobileResource.Module == input.Module)//如果模块ID没变直接返回
|
||||
return;
|
||||
if (mobileResource.ParentId != 0)
|
||||
throw Oops.Bah($"非顶级菜单不可修改所属模块");
|
||||
//获取所有菜单和模块
|
||||
var resourceList = await _resourceService.GetListAsync(new List<string> { CateGoryConst.RESOURCE_MENU, CateGoryConst.RESOURCE_MODULE });
|
||||
if (!resourceList.Any(it => it.Category == CateGoryConst.RESOURCE_MODULE && it.Id == input.Module.Value))
|
||||
throw Oops.Bah($"不存在的模块");
|
||||
//获取所有菜单
|
||||
var menuList = resourceList.Where(it => it.Category == CateGoryConst.RESOURCE_MENU).ToList();
|
||||
//获取需要改变模块菜单的所有子菜单
|
||||
var childList = _resourceService.GetChildListById(menuList, input.Id);
|
||||
childList.ForEach(it => it.Module = input.Module);
|
||||
//更新数据
|
||||
await UpdateRangeAsync(childList);
|
||||
//刷新菜单缓存
|
||||
await _resourceService.RefreshCache(CateGoryConst.RESOURCE_MENU);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task GrantRoleMobileResource(GrantResourceInput input)
|
||||
{
|
||||
var menuIds = input.GrantInfoList.Select(it => it.MenuId).ToList();//菜单ID
|
||||
var extJsons = input.GrantInfoList.Select(it => it.ToJson()).ToList();//拓展信息
|
||||
var relationRoles = new List<SysRelation>();//要添加的角色资源和授权关系表
|
||||
var sysRole = (await _roleService.GetListAsync()).Where(it => it.Id == input.Id).FirstOrDefault();//获取角色
|
||||
if (sysRole != null)
|
||||
{
|
||||
//遍历菜单列表
|
||||
for (var i = 0; i < menuIds.Count; i++)
|
||||
{
|
||||
//将角色资源添加到列表
|
||||
relationRoles.Add(new SysRelation
|
||||
{
|
||||
ObjectId = sysRole.Id,
|
||||
TargetId = menuIds[i].ToString(),
|
||||
Category = MobileConst.RELATION_SYS_ROLE_HAS_MOBILE_RESOURCE,
|
||||
ExtJson = extJsons?[i]
|
||||
});
|
||||
}
|
||||
//事务
|
||||
var result = await Tenant.UseTranAsync(async () =>
|
||||
{
|
||||
var relatioRep = ChangeRepository<DbRepository<SysRelation>>();//切换仓储
|
||||
//如果不是代码生成,就删除老的
|
||||
if (!input.IsCodeGen)
|
||||
await relatioRep.DeleteAsync(it =>
|
||||
it.ObjectId == sysRole.Id && (it.Category == MobileConst.RELATION_SYS_ROLE_HAS_MOBILE_RESOURCE
|
||||
|| it.Category == MobileConst.RELATION_SYS_USER_HAS_MOBILE_RESOURCE));
|
||||
await relatioRep.InsertRangeAsync(relationRoles);//添加新的
|
||||
});
|
||||
if (result.IsSuccess)//如果成功了
|
||||
{
|
||||
await _relationService.RefreshCache(MobileConst.RELATION_SYS_ROLE_HAS_MOBILE_RESOURCE);//刷新关系缓存
|
||||
await _relationService.RefreshCache(MobileConst.RELATION_SYS_USER_HAS_MOBILE_RESOURCE);//刷新关系缓存
|
||||
await _eventPublisher.PublishAsync(EventSubscriberConst.CLEAR_USER_CACHE, new List<long> { input.Id });//发送事件清除角色下用户缓存
|
||||
}
|
||||
else
|
||||
{
|
||||
//写日志
|
||||
_logger.LogError(result.ErrorMessage, result.ErrorException);
|
||||
throw Oops.Oh(ErrorCodeEnum.A0003);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region 方法
|
||||
|
||||
/// <summary>
|
||||
/// 检查输入参数
|
||||
/// </summary>
|
||||
/// <param name="mobileResource"></param>
|
||||
private async Task CheckInput(MobileResource mobileResource)
|
||||
{
|
||||
mobileResource.Category = mobileResource.MenuType;//设置为菜单
|
||||
//获取所有菜单列表
|
||||
var menList = await _resourceService.GetListByCategory(CateGoryConst.RESOURCE_MENU);
|
||||
//判断是否有同级且同名的菜单
|
||||
if (menList.Any(it => it.ParentId == mobileResource.ParentId && it.Title == mobileResource.Title && it.Id != mobileResource.Id))
|
||||
throw Oops.Bah($"存在重复的菜单名称:{mobileResource.Title}");
|
||||
if (mobileResource.ParentId != 0)
|
||||
{
|
||||
//获取父级,判断父级ID正不正确
|
||||
var parent = menList.Where(it => it.Id == mobileResource.ParentId).FirstOrDefault();
|
||||
if (parent != null)
|
||||
{
|
||||
if (parent.Module != mobileResource.Module)//如果父级的模块和当前模块不一样
|
||||
throw Oops.Bah($"模块与上级菜单不一致");
|
||||
if (parent.Id == mobileResource.Id)
|
||||
throw Oops.Bah($"上级菜单不能选择自己");
|
||||
}
|
||||
else
|
||||
{
|
||||
throw Oops.Bah($"上级菜单不存在:{mobileResource.ParentId}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion 方法
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Plugin.Mobile;
|
||||
|
||||
/// <summary>
|
||||
/// 添加模块输入
|
||||
/// </summary>
|
||||
public class MobileModuleAddInput : MobileResource
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 编辑模块输入
|
||||
/// </summary>
|
||||
public class MobileModuleEditInput : MobileModuleAddInput
|
||||
{
|
||||
/// <summary>
|
||||
/// ID
|
||||
/// </summary>
|
||||
[IdNotNull(ErrorMessage = "Id不能为空")]
|
||||
public override long Id { get; set; }
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Plugin.Mobile;
|
||||
|
||||
/// <summary>
|
||||
/// 模块管理服务
|
||||
/// </summary>
|
||||
public interface IMobileModuleService : ITransient
|
||||
{
|
||||
/// <summary>
|
||||
/// 添加模块
|
||||
/// </summary>
|
||||
/// <param name="input">添加参数</param>
|
||||
/// <returns></returns>
|
||||
Task Add(MobileModuleAddInput input);
|
||||
|
||||
/// <summary>
|
||||
/// 删除模块
|
||||
/// </summary>
|
||||
/// <param name="input">删除参数</param>
|
||||
/// <returns></returns>
|
||||
Task Delete(BaseIdListInput input);
|
||||
|
||||
/// <summary>
|
||||
/// 编辑模块
|
||||
/// </summary>
|
||||
/// <param name="input">编辑参数</param>
|
||||
/// <returns></returns>
|
||||
Task Edit(MobileModuleEditInput input);
|
||||
|
||||
/// <summary>
|
||||
/// 分页查询
|
||||
/// </summary>
|
||||
/// <param name="input">分页参数</param>
|
||||
/// <returns></returns>
|
||||
Task<SqlSugarPagedList<MobileResource>> Page(ModulePageInput input);
|
||||
|
||||
/// <summary>
|
||||
/// 详情
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
Task<MobileResource> Detail(BaseIdInput input);
|
||||
}
|
||||
+142
@@ -0,0 +1,142 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Plugin.Mobile;
|
||||
|
||||
/// <summary>
|
||||
/// <inheritdoc cref="IMobileModuleService"/>
|
||||
/// </summary>
|
||||
public class MobileModuleService : DbRepository<MobileResource>, IMobileModuleService
|
||||
{
|
||||
private readonly ILogger<MobileModuleService> _logger;
|
||||
private readonly ISimpleCacheService _simpleCacheService;
|
||||
private readonly IMobileResourceService _mobileResourceService;
|
||||
private readonly IRelationService _relationService;
|
||||
|
||||
public MobileModuleService(ILogger<MobileModuleService> logger, ISimpleCacheService simpleCacheService,
|
||||
IMobileResourceService mobileResourceService,
|
||||
IRelationService relationService)
|
||||
{
|
||||
_logger = logger;
|
||||
_simpleCacheService = simpleCacheService;
|
||||
_mobileResourceService = mobileResourceService;
|
||||
_relationService = relationService;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public async Task<SqlSugarPagedList<MobileResource>> Page(ModulePageInput input)
|
||||
{
|
||||
var query = Context.Queryable<MobileResource>()
|
||||
.Where(it => it.Category == CateGoryConst.RESOURCE_MODULE)//模块
|
||||
.WhereIF(!string.IsNullOrEmpty(input.SearchKey), it => it.Title.Contains(input.SearchKey))//根据关键字查询
|
||||
.OrderByIF(!string.IsNullOrEmpty(input.SortField), $"{input.SortField} {input.SortOrder}")
|
||||
.OrderBy(it => it.SortCode);//排序
|
||||
var pageInfo = await query.ToPagedListAsync(input.PageNum, input.PageSize);//分页
|
||||
return pageInfo;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task Add(MobileModuleAddInput input)
|
||||
{
|
||||
await CheckInput(input);//检查参数
|
||||
var sysResource = input.Adapt<MobileResource>();//实体转换
|
||||
if (await InsertAsync(sysResource))//插入数据
|
||||
await _mobileResourceService.RefreshCache(CateGoryConst.RESOURCE_MODULE);//刷新缓存
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task Edit(MobileModuleEditInput input)
|
||||
{
|
||||
await CheckInput(input);//检查参数
|
||||
var sysResource = input.Adapt<MobileResource>();//实体转换
|
||||
if (await UpdateAsync(sysResource))//更新数据
|
||||
await _mobileResourceService.RefreshCache(CateGoryConst.RESOURCE_MODULE);//刷新缓存
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task Delete(BaseIdListInput input)
|
||||
{
|
||||
//获取所有ID
|
||||
var ids = input.Ids;
|
||||
if (ids.Count > 0)
|
||||
{
|
||||
//获取所有
|
||||
var resourceList = await _mobileResourceService.GetListAsync();
|
||||
//找到要删除的模块
|
||||
var sysresources = resourceList.Where(it => ids.Contains(it.Id)).ToList();
|
||||
//查找内置模块
|
||||
var system = sysresources.Where(it => it.Code == SysResourceConst.SYSTEM).FirstOrDefault();
|
||||
if (system != null)
|
||||
throw Oops.Bah($"不可删除系统内置模块:{system.Title}");
|
||||
//获取模块下的所有菜单Id列表
|
||||
var menuIds = resourceList.Where(it => ids.Contains(it.Module.ToLong()) && it.ParentId.ToLong() == SimpleAdminConst.ZERO)
|
||||
.Select(it => it.Id).ToList();
|
||||
//需要删除的资源ID列表
|
||||
var resourceIds = new List<long>();
|
||||
//遍历列表
|
||||
menuIds.ForEach(it =>
|
||||
{
|
||||
//获取菜单所有子节点
|
||||
var child = _mobileResourceService.GetChildListById(resourceList, it, false);
|
||||
//将子节点ID添加到删除ID列表
|
||||
resourceIds.AddRange(child.Select(it => it.Id).ToList());
|
||||
resourceIds.Add(it);//添加到删除ID列表
|
||||
});
|
||||
ids.AddRange(resourceIds);
|
||||
//事务
|
||||
var result = await Tenant.UseTranAsync(async () =>
|
||||
{
|
||||
await DeleteByIdsAsync(ids.Cast<object>().ToArray());//删除菜单和按钮
|
||||
await Context.Deleteable<SysRelation>()//关系表删除对应SYS_ROLE_HAS_MOBILE_RESOURCE
|
||||
.Where(it => it.Category == MobileConst.RELATION_SYS_ROLE_HAS_MOBILE_RESOURCE
|
||||
&& resourceIds.Contains(SqlFunc.ToInt64(it.TargetId))).ExecuteCommandAsync();
|
||||
});
|
||||
if (result.IsSuccess)//如果成功了
|
||||
{
|
||||
await _mobileResourceService.RefreshCache();//资源表刷新缓存
|
||||
await _relationService.RefreshCache(MobileConst.RELATION_SYS_ROLE_HAS_MOBILE_RESOURCE);//关系表刷新缓存
|
||||
}
|
||||
else
|
||||
{
|
||||
//写日志
|
||||
_logger.LogError(result.ErrorMessage, result.ErrorException);
|
||||
throw Oops.Oh(ErrorCodeEnum.A0002);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<MobileResource> Detail(BaseIdInput input)
|
||||
{
|
||||
var mobileResource = await GetFirstAsync(it => it.Id == input.Id);
|
||||
return mobileResource;
|
||||
}
|
||||
|
||||
#region 方法
|
||||
|
||||
/// <summary>
|
||||
/// 检查输入参数
|
||||
/// </summary>
|
||||
/// <param name="sysResource"></param>
|
||||
private async Task CheckInput(MobileResource sysResource)
|
||||
{
|
||||
var sysResourceList = await _mobileResourceService.GetListByCategory(CateGoryConst.RESOURCE_MODULE);
|
||||
//判断是否从存在重复模块
|
||||
var hasSameName = sysResourceList.Any(it => it.Title == sysResource.Title && it.Id != sysResource.Id);
|
||||
if (hasSameName)
|
||||
{
|
||||
throw Oops.Bah($"存在重复的模块:{sysResource.Title}");
|
||||
}
|
||||
//设置为模块
|
||||
sysResource.Category = CateGoryConst.RESOURCE_MODULE;
|
||||
}
|
||||
|
||||
#endregion 方法
|
||||
}
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Plugin.Mobile;
|
||||
|
||||
/// <summary>
|
||||
/// 资源服务
|
||||
/// </summary>
|
||||
public interface IMobileResourceService : ITransient
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取所有的菜单和模块以及单页面列表,并按分类和排序码排序
|
||||
/// </summary>
|
||||
/// <returns>所有的菜单和模块以及单页面列表</returns>
|
||||
Task<List<MobileResource>> GetaModuleAndMenuAndSpaList();
|
||||
|
||||
/// <summary>
|
||||
/// 根据资源ID获取所有下级资源
|
||||
/// </summary>
|
||||
/// <param name="resId">资源ID</param>
|
||||
/// <param name="isContainOneself">是否包含自己</param>
|
||||
/// <returns>资源列表</returns>
|
||||
Task<List<MobileResource>> GetChildListById(long resId, bool isContainOneself = true);
|
||||
|
||||
/// <summary>
|
||||
/// 根据资源ID获取所有下级资源
|
||||
/// </summary>
|
||||
/// <param name="sysResources">资源列表</param>
|
||||
/// <param name="resId">资源ID</param>
|
||||
/// <param name="isContainOneself">是否包含自己</param>
|
||||
/// <returns>资源列表</returns>
|
||||
List<MobileResource> GetChildListById(List<MobileResource> sysResources, long resId, bool isContainOneself = true);
|
||||
|
||||
/// <summary>
|
||||
/// 获取ID获取Code列表
|
||||
/// </summary>
|
||||
/// <param name="ids">id列表</param>
|
||||
/// <param name="category">分类</param>
|
||||
/// <returns>Code列表</returns>
|
||||
Task<List<string>> GetCodeByIds(List<long> ids, string category);
|
||||
|
||||
/// <summary>
|
||||
/// 获取资源列表
|
||||
/// </summary>
|
||||
/// <param name="categorys">资源分类列表</param>
|
||||
/// <returns></returns>
|
||||
Task<List<MobileResource>> GetListAsync(List<string>? categorys = null);
|
||||
|
||||
/// <summary>
|
||||
/// 根据分类获取资源列表
|
||||
/// </summary>
|
||||
/// <param name="category">分类名称</param>
|
||||
/// <returns>资源列表</returns>
|
||||
Task<List<MobileResource>> GetListByCategory(string category);
|
||||
|
||||
/// <summary>
|
||||
/// 根据菜单ID获取菜单
|
||||
/// </summary>
|
||||
/// <param name="menuIds">菜单id列表</param>
|
||||
/// <returns>菜单列表</returns>
|
||||
Task<List<MobileResource>> GetMenuByMenuIds(List<long> menuIds);
|
||||
|
||||
/// <summary>
|
||||
/// 获取权限授权树
|
||||
/// </summary>
|
||||
/// <param name="routes">路由列表</param>
|
||||
/// <returns></returns>
|
||||
List<PermissionTreeSelector> PermissionTreeSelector(List<string> routes);
|
||||
|
||||
/// <summary>
|
||||
/// 刷新缓存
|
||||
/// </summary>
|
||||
/// <param name="category">分类名称</param>
|
||||
/// <returns></returns>
|
||||
Task RefreshCache(string category = null);
|
||||
|
||||
/// <summary>
|
||||
/// 角色授权资源树
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<ResTreeSelector>> ResourceTreeSelector();
|
||||
}
|
||||
+410
@@ -0,0 +1,410 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
using StringHelper = SimpleTool.StringHelper;
|
||||
|
||||
namespace SimpleAdmin.Plugin.Mobile;
|
||||
|
||||
/// <inheritdoc cref="IMobileResourceService"/>
|
||||
public class MobileResourceService : DbRepository<MobileResource>, IMobileResourceService
|
||||
{
|
||||
private readonly ISimpleCacheService _simpleCacheService;
|
||||
|
||||
public MobileResourceService(ISimpleCacheService simpleCacheService)
|
||||
{
|
||||
_simpleCacheService = simpleCacheService;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<List<string>> GetCodeByIds(List<long> ids, string category)
|
||||
{
|
||||
//根据分类获取所有
|
||||
var mobileResources = await GetListByCategory(category);
|
||||
//条件查询
|
||||
var result = mobileResources.Where(it => ids.Contains(it.Id)).Select(it => it.Code).ToList();
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public async Task<List<MobileResource>> GetListAsync(List<string>? categoryList = null)
|
||||
{
|
||||
//定义结果
|
||||
var mobileResources = new List<MobileResource>();
|
||||
|
||||
//定义资源分类列表,如果是空的则获取全部资源
|
||||
categoryList = categoryList != null
|
||||
? categoryList
|
||||
: new List<string>
|
||||
{ CateGoryConst.RESOURCE_MENU, CateGoryConst.RESOURCE_BUTTON, CateGoryConst.RESOURCE_SPA, CateGoryConst.RESOURCE_MODULE };
|
||||
//遍历列表
|
||||
foreach (var category in categoryList)
|
||||
{
|
||||
//根据分类获取到资源列表
|
||||
var data = await GetListByCategory(category);
|
||||
//添加到结果集
|
||||
mobileResources.AddRange(data);
|
||||
}
|
||||
return mobileResources;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public async Task<List<MobileResource>> GetaModuleAndMenuAndSpaList()
|
||||
{
|
||||
//获取所有的菜单和模块以及单页面列表,
|
||||
var mobileResources = await GetListAsync(new List<string>
|
||||
{ CateGoryConst.RESOURCE_MODULE, CateGoryConst.RESOURCE_MENU, CateGoryConst.RESOURCE_SPA });
|
||||
if (mobileResources != null)
|
||||
{
|
||||
//并按分类和排序码排序
|
||||
mobileResources = mobileResources.OrderBy(it => it.Category).ThenBy(it => it.SortCode).ToList();
|
||||
}
|
||||
return mobileResources;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public async Task RefreshCache(string category = null)
|
||||
{
|
||||
//如果分类是空的
|
||||
if (category == null)
|
||||
{
|
||||
//删除全部key
|
||||
_simpleCacheService.DelByPattern(MobileConst.CACHE_MOBILE_RESOURCE);
|
||||
await GetListAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
//否则只删除一个Key
|
||||
_simpleCacheService.Remove(MobileConst.CACHE_MOBILE_RESOURCE + category);
|
||||
await GetListByCategory(category);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<List<MobileResource>> GetChildListById(long resId, bool isContainOneself = true)
|
||||
{
|
||||
//获取所有机构
|
||||
var mobileResources = await GetListAsync();
|
||||
//查找下级
|
||||
var childLsit = GetResourceChilden(mobileResources, resId);
|
||||
if (isContainOneself)//如果包含自己
|
||||
{
|
||||
//获取自己的机构信息
|
||||
var self = mobileResources.Where(it => it.Id == resId).FirstOrDefault();
|
||||
if (self != null) childLsit.Insert(0, self);//如果机构不为空就插到第一个
|
||||
}
|
||||
return childLsit;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public List<MobileResource> GetChildListById(List<MobileResource> mobileResources, long resId, bool isContainOneself = true)
|
||||
{
|
||||
//查找下级
|
||||
var childLsit = GetResourceChilden(mobileResources, resId);
|
||||
if (isContainOneself)//如果包含自己
|
||||
{
|
||||
//获取自己的机构信息
|
||||
var self = mobileResources.Where(it => it.Id == resId).FirstOrDefault();
|
||||
if (self != null) childLsit.Insert(0, self);//如果机构不为空就插到第一个
|
||||
}
|
||||
return childLsit;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<List<MobileResource>> GetListByCategory(string category)
|
||||
{
|
||||
//先从Redis拿
|
||||
var mobileResources = _simpleCacheService.Get<List<MobileResource>>(MobileConst.CACHE_MOBILE_RESOURCE + category);
|
||||
if (mobileResources == null)
|
||||
{
|
||||
//redis没有就去数据库拿
|
||||
mobileResources = await base.GetListAsync(it => it.Category == category);
|
||||
if (mobileResources.Count > 0)
|
||||
{
|
||||
//插入Redis
|
||||
_simpleCacheService.Set(MobileConst.CACHE_MOBILE_RESOURCE + category, mobileResources);
|
||||
}
|
||||
}
|
||||
return mobileResources;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<List<ResTreeSelector>> ResourceTreeSelector()
|
||||
{
|
||||
var resourceTreeSelectors = new List<ResTreeSelector>();//定义结果
|
||||
//获取模块列表
|
||||
var moduleList = await GetListByCategory(CateGoryConst.RESOURCE_MODULE);
|
||||
//遍历模块
|
||||
foreach (var module in moduleList)
|
||||
{
|
||||
//将实体转换为ResourceTreeSelectorOutPut获取基本信息
|
||||
var resourceTreeSelector = module.Adapt<ResTreeSelector>();
|
||||
resourceTreeSelector.Menu = await GetRoleGrantResourceMenus(module.Id);
|
||||
resourceTreeSelectors.Add(resourceTreeSelector);
|
||||
}
|
||||
return resourceTreeSelectors;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public List<PermissionTreeSelector> PermissionTreeSelector(List<string> routes)
|
||||
{
|
||||
var permissions = new List<PermissionTreeSelector>();//权限列表
|
||||
|
||||
// 获取所有需要数据权限的控制器
|
||||
var controllerTypes =
|
||||
App.EffectiveTypes.Where(u => !u.IsInterface && !u.IsAbstract && u.IsClass && u.IsDefined(typeof(RolePermissionAttribute), false));
|
||||
foreach (var controller in controllerTypes)
|
||||
{
|
||||
//获取数据权限特性
|
||||
var routeAttributes = controller.GetCustomAttributes<RouteAttribute>().ToList();
|
||||
if (routeAttributes == null)
|
||||
continue;
|
||||
var route = routeAttributes[0];//取第一个值
|
||||
var routeName = GetRouteName(controller.Name, route.Template);//赋值路由名称
|
||||
//如果路由包含在路由列表中
|
||||
if (routes.Contains(routeName))
|
||||
{
|
||||
//获取所有方法
|
||||
var menthods = controller.GetMethods();
|
||||
//遍历方法
|
||||
foreach (var menthod in menthods)
|
||||
{
|
||||
//获取忽略数据权限特性
|
||||
var ignoreRolePermission = menthod.GetCustomAttribute<IgnoreRolePermissionAttribute>();
|
||||
if (ignoreRolePermission == null)//如果是空的代表需要数据权限
|
||||
{
|
||||
//获取接口描述
|
||||
var displayName = menthod.GetCustomAttribute<DisplayNameAttribute>();
|
||||
if (displayName != null)
|
||||
{
|
||||
//默认路由名称
|
||||
var apiRoute = StringHelper.FirstCharToLower(menthod.Name);
|
||||
//获取get特性
|
||||
var requestGet = menthod.GetCustomAttribute<HttpGetAttribute>();
|
||||
if (requestGet != null)//如果是get方法
|
||||
apiRoute = requestGet.Template;
|
||||
else
|
||||
{
|
||||
//获取post特性
|
||||
var requestPost = menthod.GetCustomAttribute<HttpPostAttribute>();
|
||||
if (requestPost != null)//如果是post方法
|
||||
apiRoute = requestPost.Template;
|
||||
}
|
||||
apiRoute = route.Template + $"/{apiRoute}";
|
||||
var apiName = displayName.DisplayName;//如果描述不为空则接口名称用描述的名称
|
||||
//合并
|
||||
var permissionName = apiRoute + $"[{apiName}]";
|
||||
//添加到权限列表
|
||||
permissions.Add(new PermissionTreeSelector
|
||||
{
|
||||
ApiName = apiName,
|
||||
ApiRoute = apiRoute,
|
||||
PermissionName = permissionName
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return permissions;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<List<MobileResource>> GetMenuByMenuIds(List<long> menuIds)
|
||||
{
|
||||
//获取所有菜单
|
||||
var menuList = await GetListByCategory(CateGoryConst.RESOURCE_MENU);
|
||||
//获取菜单信息
|
||||
var menus = menuList.Where(it => menuIds.Contains(it.Id)).ToList();
|
||||
return menus;
|
||||
}
|
||||
|
||||
#region 方法
|
||||
|
||||
/// <summary>
|
||||
/// 获取路由地址名称
|
||||
/// </summary>
|
||||
/// <param name="controllerName">控制器地址</param>
|
||||
/// <param name="template">路由名称</param>
|
||||
/// <returns></returns>
|
||||
private string GetRouteName(string controllerName, string template)
|
||||
{
|
||||
if (!template.StartsWith("/"))
|
||||
template = "/" + template;//如果路由名称不是/开头则加上/防止控制器没写
|
||||
if (template.Contains("[controller]"))
|
||||
{
|
||||
controllerName = controllerName.Replace("Controller", "");//去掉Controller
|
||||
controllerName = StringHelper.FirstCharToLower(controllerName);//转首字母小写写
|
||||
template = template.Replace("[controller]", controllerName);//替换[controller]
|
||||
}
|
||||
|
||||
return template;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取资源所有下级
|
||||
/// </summary>
|
||||
/// <param name="resourceList">资源列表</param>
|
||||
/// <param name="parentId">父ID</param>
|
||||
/// <returns></returns>
|
||||
public List<MobileResource> GetResourceChilden(List<MobileResource> resourceList, long parentId)
|
||||
{
|
||||
//找下级资源ID列表
|
||||
var resources = resourceList.Where(it => it.ParentId == parentId).ToList();
|
||||
if (resources.Count > 0)//如果数量大于0
|
||||
{
|
||||
var data = new List<MobileResource>();
|
||||
foreach (var item in resources)//遍历资源
|
||||
{
|
||||
var res = GetResourceChilden(resourceList, item.Id);
|
||||
data.AddRange(res);//添加子节点;
|
||||
data.Add(item);//添加到列表
|
||||
}
|
||||
return data;//返回结果
|
||||
}
|
||||
return new List<MobileResource>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取上级
|
||||
/// </summary>
|
||||
/// <param name="resourceList"></param>
|
||||
/// <param name="parentId"></param>
|
||||
/// <returns></returns>
|
||||
public List<MobileResource> GetResourceParent(List<MobileResource> resourceList, long parentId)
|
||||
{
|
||||
//找上级资源ID列表
|
||||
var resources = resourceList.Where(it => it.Id == parentId).FirstOrDefault();
|
||||
if (resources != null)//如果数量大于0
|
||||
{
|
||||
var data = new List<MobileResource>();
|
||||
var parents = GetResourceParent(resourceList, resources.ParentId.Value);
|
||||
data.AddRange(parents);//添加子节点;
|
||||
data.Add(resources);//添加到列表
|
||||
return data;//返回结果
|
||||
}
|
||||
return new List<MobileResource>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取授权菜单
|
||||
/// </summary>
|
||||
/// <param name="moduleId">模块ID</param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<ResTreeSelector.RoleGrantResourceMenu>> GetRoleGrantResourceMenus(long moduleId)
|
||||
{
|
||||
var roleGrantResourceMenus = new List<ResTreeSelector.RoleGrantResourceMenu>();//定义结果
|
||||
var allMenuList = (await GetListByCategory(CateGoryConst.RESOURCE_MENU)).Where(it => it.Module == moduleId).ToList();//获取所有菜单列表
|
||||
var allButtonList = await GetListByCategory(CateGoryConst.RESOURCE_BUTTON);//获取所有按钮列表
|
||||
var parentMenuList = allMenuList.Where(it => it.ParentId == SimpleAdminConst.ZERO).ToList();//获取一级目录
|
||||
|
||||
//遍历一级目录
|
||||
foreach (var parent in parentMenuList)
|
||||
{
|
||||
//如果是目录则去遍历下级
|
||||
if (parent.MenuType == SysResourceConst.CATALOG)
|
||||
{
|
||||
//获取所有下级菜单
|
||||
var menuList = GetChildListById(allMenuList, parent.Id, false);
|
||||
if (menuList.Count > 0)//如果有菜单
|
||||
{
|
||||
//遍历下级菜单
|
||||
foreach (var menu in menuList)
|
||||
{
|
||||
//如果菜单类型是菜单
|
||||
if (menu.MenuType == SysResourceConst.MENU)
|
||||
{
|
||||
//获取菜单下按钮集合并转换成对应实体
|
||||
var buttonList = allButtonList.Where(it => it.ParentId == menu.Id).ToList();
|
||||
var buttons = buttonList.Adapt<List<ResTreeSelector.RoleGrantResourceButton>>();
|
||||
roleGrantResourceMenus.Add(new ResTreeSelector.RoleGrantResourceMenu
|
||||
{
|
||||
Id = menu.Id,
|
||||
ParentId = parent.Id,
|
||||
ParentName = parent.Title,
|
||||
Module = moduleId,
|
||||
Title = GetRoleGrantResourceMenuTitle(menuList, menu),//菜单名称需要特殊处理因为有二级菜单
|
||||
Button = buttons
|
||||
});
|
||||
}
|
||||
else if (menu.MenuType == SysResourceConst.LINK || menu.MenuType == SysResourceConst.IFRAME)//如果是内链或者外链
|
||||
{
|
||||
//直接加到资源列表
|
||||
roleGrantResourceMenus.Add(new ResTreeSelector.RoleGrantResourceMenu
|
||||
{
|
||||
Id = menu.Id,
|
||||
ParentId = parent.Id,
|
||||
ParentName = parent.Title,
|
||||
Module = moduleId,
|
||||
Title = menu.Title
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//否则就将自己加到一级目录里面
|
||||
roleGrantResourceMenus.Add(new ResTreeSelector.RoleGrantResourceMenu
|
||||
{
|
||||
Id = parent.Id,
|
||||
ParentId = parent.Id,
|
||||
ParentName = parent.Title,
|
||||
Module = moduleId
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//就将自己加到一级目录里面
|
||||
var roleGrantResourcesButtons = new ResTreeSelector.RoleGrantResourceMenu
|
||||
{
|
||||
Id = parent.Id,
|
||||
ParentId = parent.Id,
|
||||
ParentName = parent.Title,
|
||||
Module = moduleId,
|
||||
Title = parent.Title
|
||||
};
|
||||
//如果菜单类型是菜单
|
||||
if (parent.MenuType == SysResourceConst.MENU)
|
||||
{
|
||||
//获取菜单下按钮集合并转换成对应实体
|
||||
var buttonList = allButtonList.Where(it => it.ParentId == parent.Id).ToList();
|
||||
roleGrantResourcesButtons.Button = buttonList.Adapt<List<ResTreeSelector.RoleGrantResourceButton>>();
|
||||
}
|
||||
roleGrantResourceMenus.Add(roleGrantResourcesButtons);
|
||||
}
|
||||
}
|
||||
return roleGrantResourceMenus;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取授权菜单类菜单名称
|
||||
/// </summary>
|
||||
/// <param name="menuList">菜单列表</param>
|
||||
/// <param name="menu">当前菜单</param>
|
||||
/// <returns></returns>
|
||||
private string GetRoleGrantResourceMenuTitle(List<MobileResource> menuList, MobileResource menu)
|
||||
{
|
||||
//查找菜单上级
|
||||
var parentList = GetResourceParent(menuList, menu.ParentId.Value);
|
||||
//如果有父级菜单
|
||||
if (parentList.Count > 0)
|
||||
{
|
||||
var titles = parentList.Select(it => it.Title).ToList();//提取出父级的name
|
||||
var title = string.Join("- ", titles) + $"-{menu.Title}";//根据-分割,转换成字符串并在最后加上菜单的title
|
||||
return title;
|
||||
}
|
||||
else
|
||||
{
|
||||
return menu.Title;//原路返回
|
||||
}
|
||||
}
|
||||
|
||||
#endregion 方法
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Plugin.Mobile;
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Plugin.Mobile;
|
||||
|
||||
/// <summary>
|
||||
/// 手机端登录用户信息
|
||||
/// </summary>
|
||||
public class MobileLoginUserOutput : LoginUserOutput
|
||||
{
|
||||
/// <summary>
|
||||
/// 移动端按钮码集合
|
||||
/// </summary>
|
||||
public List<string> MobileButtonCodeList { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 手机端
|
||||
/// </summary>
|
||||
public class MobleMeta : Meta
|
||||
{
|
||||
public string Type { get; set; }
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Plugin.Mobile;
|
||||
|
||||
/// <summary>
|
||||
/// 移动端用户个人信息服务
|
||||
/// </summary>
|
||||
public interface IMobileUserCenterService : ITransient
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取个人移动端菜单
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<MobileResource>> GetOwnMobileMenu();
|
||||
|
||||
/// <summary>
|
||||
/// 获取登录用户信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<MobileLoginUserOutput> GetLoginUser();
|
||||
}
|
||||
+233
@@ -0,0 +1,233 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Plugin.Mobile;
|
||||
|
||||
/// <inheritdoc cref="IMobileUserCenterService"/>
|
||||
public class MobileUserCenterService : IMobileUserCenterService
|
||||
{
|
||||
private readonly IMobileMenuService _menuService;
|
||||
private readonly IAuthService _authService;
|
||||
private readonly ISimpleCacheService _simpleCacheService;
|
||||
private readonly IRelationService _relationService;
|
||||
private readonly IMobileResourceService _resourceService;
|
||||
private readonly ISysUserService _userService;
|
||||
|
||||
public MobileUserCenterService(IRelationService relationService, IMobileResourceService resourceService, ISysUserService userService,
|
||||
IMobileMenuService menuService, IAuthService authService, ISimpleCacheService simpleCacheService)
|
||||
{
|
||||
_relationService = relationService;
|
||||
_resourceService = resourceService;
|
||||
_userService = userService;
|
||||
_menuService = menuService;
|
||||
_authService = authService;
|
||||
_simpleCacheService = simpleCacheService;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<List<MobileResource>> GetOwnMobileMenu()
|
||||
{
|
||||
var result = new List<MobileResource>();
|
||||
//获取用户信息
|
||||
var userInfo = await _userService.GetUserByAccount(UserManager.UserAccount);
|
||||
if (userInfo != null)
|
||||
{
|
||||
//获取用户所拥有的资源集合
|
||||
var resourceList =
|
||||
await _relationService.GetRelationListByObjectIdAndCategory(userInfo.Id, MobileConst.RELATION_SYS_USER_HAS_MOBILE_RESOURCE);
|
||||
if (resourceList.Count == 0)//如果没有就获取角色的
|
||||
//获取角色所拥有的资源集合
|
||||
resourceList = await _relationService.GetRelationListByObjectIdListAndCategory(userInfo.RoleIdList,
|
||||
MobileConst.RELATION_SYS_ROLE_HAS_MOBILE_RESOURCE);
|
||||
//定义菜单ID列表
|
||||
var menuIdList = new HashSet<long>();
|
||||
//获取菜单集合
|
||||
menuIdList.AddRange(resourceList.Select(r => r.TargetId.ToLong()).ToList());
|
||||
//获取所有的菜单和模块以及单页面列表,并按分类和排序码排序
|
||||
var allModuleAndMenuAndSpaList = await _resourceService.GetaModuleAndMenuAndSpaList();
|
||||
var allModuleList = new List<MobileResource>();//模块列表
|
||||
var allMenuList = new List<MobileResource>();//菜单列表
|
||||
//遍历菜单集合
|
||||
allModuleAndMenuAndSpaList.ForEach(it =>
|
||||
{
|
||||
switch (it.Category)
|
||||
{
|
||||
case CateGoryConst.RESOURCE_MODULE://模块
|
||||
allModuleList.Add(it);//添加到模块列表
|
||||
break;
|
||||
case CateGoryConst.RESOURCE_MENU://菜单
|
||||
allMenuList.Add(it);//添加到菜单列表
|
||||
break;
|
||||
}
|
||||
});
|
||||
//获取我的菜单列表
|
||||
var myMenus = allMenuList.Where(it => menuIdList.Contains(it.Id)).ToList();
|
||||
// 对获取到的角色对应的菜单列表进行处理,获取父列表
|
||||
var parentList = GetMyParentMenus(allMenuList, myMenus);
|
||||
myMenus.AddRange(parentList);//合并列表
|
||||
//获取我的模块信息Id列表
|
||||
var moduleIds = myMenus.Select(it => it.Module.Value).Distinct().ToList();
|
||||
//获取我的模块集合
|
||||
var myModules = GetMyModules(allModuleList, moduleIds, 0);
|
||||
myMenus.AddRange(myModules);//模块添加到菜单列表
|
||||
//构建meta
|
||||
ConstructMeta(myMenus);
|
||||
//构建菜单树
|
||||
result = _menuService.ConstructMenuTrees(myMenus);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<MobileLoginUserOutput> GetLoginUser()
|
||||
{
|
||||
var user = await _userService.GetUserById(UserManager.UserId);
|
||||
if (user != null)
|
||||
user.Avatar = await _userService.GetUserAvatar(user.Id);//获取头像
|
||||
var loginUser = user.Adapt<MobileLoginUserOutput>();
|
||||
loginUser.MobileButtonCodeList = await GetButtonCodeList(UserManager.UserId);//获取移动端按钮码集合
|
||||
return loginUser;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#region 方法
|
||||
|
||||
public async Task<List<string>> GetButtonCodeList(long userId)
|
||||
{
|
||||
var buttonCodeList = new List<string>();//按钮ID集合
|
||||
//获取用户移动资源集合
|
||||
var resourceList = await _relationService.GetRelationListByObjectIdAndCategory(userId, MobileConst.RELATION_SYS_USER_HAS_MOBILE_RESOURCE);
|
||||
var buttonIdList = new List<long>();//按钮ID集合
|
||||
if (resourceList.Count == 0)//如果有表示用户单独授权了不走用户角色
|
||||
{
|
||||
//获取用户角色关系集合
|
||||
var roleList = await _relationService.GetRelationListByObjectIdAndCategory(userId, CateGoryConst.RELATION_SYS_USER_HAS_ROLE);
|
||||
var roleIdList = roleList.Select(x => x.TargetId.ToLong()).ToList();//角色ID列表
|
||||
if (roleIdList.Count > 0)//如果该用户有角色
|
||||
{
|
||||
resourceList = await _relationService.GetRelationListByObjectIdListAndCategory(roleIdList,
|
||||
MobileConst.RELATION_SYS_ROLE_HAS_MOBILE_RESOURCE);//获取移动端资源集合
|
||||
}
|
||||
}
|
||||
resourceList.ForEach(it =>
|
||||
{
|
||||
if (!string.IsNullOrEmpty(it.ExtJson))
|
||||
buttonIdList.AddRange(it.ExtJson.ToJsonEntity<RelationRoleResource>().ButtonInfo);//如果有按钮权限,将按钮ID放到buttonIdList
|
||||
});
|
||||
if (buttonIdList.Count > 0)
|
||||
{
|
||||
buttonCodeList = await _resourceService.GetCodeByIds(buttonIdList, CateGoryConst.RESOURCE_BUTTON);
|
||||
}
|
||||
return buttonCodeList;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取父菜单集合
|
||||
/// </summary>
|
||||
/// <param name="allMenuList">所有菜单列表</param>
|
||||
/// <param name="myMenus">我的菜单列表</param>
|
||||
/// <returns></returns>
|
||||
private List<MobileResource> GetMyParentMenus(List<MobileResource> allMenuList, List<MobileResource> myMenus)
|
||||
{
|
||||
var parentList = new List<MobileResource>();
|
||||
myMenus.ForEach(it =>
|
||||
{
|
||||
//找到父ID对应的菜单
|
||||
var parent = allMenuList.Where(r => r.Id == it.ParentId.Value).FirstOrDefault();
|
||||
if (parent != null && !parentList.Contains(parent) && !myMenus.Contains(parent))//如果不为空且两个列表里没有
|
||||
{
|
||||
parentList.Add(parent);//添加到父列表
|
||||
}
|
||||
});
|
||||
return parentList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取我的模块集合
|
||||
/// </summary>
|
||||
/// <param name="allModuleList"></param>
|
||||
/// <param name="moduleIds"></param>
|
||||
/// <param name="spaCount"></param>
|
||||
/// <returns></returns>
|
||||
private List<MobileResource> GetMyModules(List<MobileResource> allModuleList, List<long> moduleIds, int spaCount)
|
||||
{
|
||||
//获取我的模块信息
|
||||
var myModules = allModuleList.Where(it => moduleIds.Contains(it.Id)).ToList();
|
||||
// 如果一个模块都没拥有
|
||||
if (myModules.Count == 0)
|
||||
{
|
||||
// 如果系统中无模块(极端情况)
|
||||
if (allModuleList.Count == 0)
|
||||
{
|
||||
if (spaCount == 0)// 如果系统中无单页面,则返回空列表
|
||||
{
|
||||
return new List<MobileResource>();
|
||||
}
|
||||
else
|
||||
{
|
||||
// 否则构造一个模块,并添加到拥有模块
|
||||
var mobileResource = new MobileResource();
|
||||
mobileResource.Id = CommonUtils.GetSingleId();
|
||||
mobileResource.Path = "/" + RandomHelper.CreateRandomString(10);
|
||||
mobileResource.Category = CateGoryConst.RESOURCE_MODULE;
|
||||
allModuleList.Add(mobileResource);
|
||||
myModules.Add(mobileResource);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 否则将系统中第一个模块作为拥有的模块
|
||||
myModules.Add(allModuleList[0]);
|
||||
}
|
||||
}
|
||||
return myModules;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 构建Meta
|
||||
/// </summary>
|
||||
/// <param name="myMenus">我的菜单集合</param>
|
||||
private void ConstructMeta(List<MobileResource> myMenus)
|
||||
{
|
||||
// 遍历myMenus列表
|
||||
myMenus.ForEach(it =>
|
||||
{
|
||||
// 将模块的父id设置为0,设置随机path
|
||||
if (it.Category == CateGoryConst.RESOURCE_MODULE)
|
||||
{
|
||||
it.ParentId = 0;
|
||||
it.Path = "/" + RandomHelper.CreateRandomString(10);
|
||||
}
|
||||
// 将根菜单的父id设置为模块的id
|
||||
if (it.Category == CateGoryConst.RESOURCE_MENU)
|
||||
{
|
||||
if (it.ParentId == SimpleAdminConst.ZERO)
|
||||
{
|
||||
it.ParentId = it.Module;
|
||||
}
|
||||
}
|
||||
//定义meta
|
||||
var meta = new MobleMeta { Icon = it.Icon, Title = it.Title, Type = it.Category.ToLower() };
|
||||
// 如果是菜单,则设置type菜单类型为小写
|
||||
if (it.Category == CateGoryConst.RESOURCE_MENU)
|
||||
{
|
||||
if (it.MenuType != SysResourceConst.CATALOG)//菜单类型不是目录
|
||||
{
|
||||
meta.Type = it.MenuType.ToLower();
|
||||
}
|
||||
}
|
||||
it.Meta = meta;
|
||||
});
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\SimpleAdmin.System\SimpleAdmin.System.csproj"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="SeedData\Json\seed_sys_resource_mobile.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Mobile.Development.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Mobile.Production.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="SeedData\Json\seed_mobile_resource.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Services\Resource\Resource\Dto\"/>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,865 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>SimpleAdmin.Plugin.Mobile</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:SimpleAdmin.Plugin.Mobile.MobileConst">
|
||||
<summary>
|
||||
移动端常量
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:SimpleAdmin.Plugin.Mobile.MobileConst.CACHE_MOBILE_RESOURCE">
|
||||
<summary>
|
||||
资源表缓存Key
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:SimpleAdmin.Plugin.Mobile.MobileConst.RELATION_SYS_USER_HAS_MOBILE_RESOURCE">
|
||||
<summary>
|
||||
用户有哪些移动端资源
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:SimpleAdmin.Plugin.Mobile.MobileConst.RELATION_SYS_ROLE_HAS_MOBILE_RESOURCE">
|
||||
<summary>
|
||||
角色有哪些移动端资源
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:SimpleAdmin.Plugin.Mobile.MobileButtonController">
|
||||
<summary>
|
||||
移动端权限按钮控制器
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileButtonController.Page(SimpleAdmin.System.ButtonPageInput)">
|
||||
<summary>
|
||||
按钮分页查询
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileButtonController.Add(SimpleAdmin.Plugin.Mobile.MobileButtonAddInput)">
|
||||
<summary>
|
||||
添加按钮
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileButtonController.Edit(SimpleAdmin.Plugin.Mobile.MobileButtonEditInput)">
|
||||
<summary>
|
||||
修改按钮
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileButtonController.Delete(SimpleAdmin.Core.BaseIdListInput)">
|
||||
<summary>
|
||||
删除按钮
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileButtonController.Batch(SimpleAdmin.Plugin.Mobile.MobileButtonAddInput)">
|
||||
<summary>
|
||||
批量新增
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:SimpleAdmin.Plugin.Mobile.MobileMenuController">
|
||||
<summary>
|
||||
移动端菜单管理控制器
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileMenuController.ModuleSelector">
|
||||
<summary>
|
||||
模块选择
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileMenuController.Tree(SimpleAdmin.System.MenuTreeInput)">
|
||||
<summary>
|
||||
获取菜单树
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileMenuController.ResourceTreeSelector">
|
||||
<summary>
|
||||
获取角色授权资源树
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileMenuController.RoleOwnMobileMenu(SimpleAdmin.Core.BaseIdInput)">
|
||||
<summary>
|
||||
获取角色拥有移动端资源
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileMenuController.MenuTreeSelector(SimpleAdmin.System.MenuTreeInput)">
|
||||
<summary>
|
||||
获取菜单树选择器
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileMenuController.GrantRoleMobileResource(SimpleAdmin.System.GrantResourceInput)">
|
||||
<summary>
|
||||
给角色授权移动端资源
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileMenuController.Add(SimpleAdmin.Plugin.Mobile.MobileMenuAddInput)">
|
||||
<summary>
|
||||
添加菜单
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileMenuController.Edit(SimpleAdmin.Plugin.Mobile.MobileMenuEditInput)">
|
||||
<summary>
|
||||
编辑菜单
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileMenuController.Detail(SimpleAdmin.Core.BaseIdInput)">
|
||||
<summary>
|
||||
获取菜单详情
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileMenuController.Delete(SimpleAdmin.Core.BaseIdListInput)">
|
||||
<summary>
|
||||
删除菜单
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileMenuController.ChangeModule(SimpleAdmin.System.MenuChangeModuleInput)">
|
||||
<summary>
|
||||
更改模块
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:SimpleAdmin.Plugin.Mobile.MobileModuleController">
|
||||
<summary>
|
||||
移动端模块管理
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileModuleController.Page(SimpleAdmin.System.ModulePageInput)">
|
||||
<summary>
|
||||
模块分页查询
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileModuleController.Add(SimpleAdmin.Plugin.Mobile.MobileModuleAddInput)">
|
||||
<summary>
|
||||
添加模块
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileModuleController.Edit(SimpleAdmin.Plugin.Mobile.MobileModuleEditInput)">
|
||||
<summary>
|
||||
修改模块
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileModuleController.Detail(SimpleAdmin.Core.BaseIdInput)">
|
||||
<summary>
|
||||
获取模块详情
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileModuleController.Delete(SimpleAdmin.Core.BaseIdListInput)">
|
||||
<summary>
|
||||
删除模块
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:SimpleAdmin.Plugin.Mobile.MobileUserCenterController">
|
||||
<summary>
|
||||
用户个人信息控制器
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileUserCenterController.LoginMobileMenu">
|
||||
<summary>
|
||||
获取个人菜单
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileUserCenterController.GetLoginUser">
|
||||
<summary>
|
||||
获取用户信息
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileUserCenterController.UpdateUserInfo(SimpleAdmin.System.UpdateInfoInput)">
|
||||
<summary>
|
||||
编辑个人信息
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileUserCenterController.UpdatePassword(SimpleAdmin.System.UpdatePasswordInput)">
|
||||
<summary>
|
||||
修改密码
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileUserCenterController.LoginUnreadMessagePage(SimpleAdmin.System.MessagePageInput)">
|
||||
<summary>
|
||||
获取登录用户的站内信分页
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileUserCenterController.LoginUnreadMessageDetail(SimpleAdmin.System.MessageDetailInput)">
|
||||
<summary>
|
||||
读取登录用户站内信详情
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:SimpleAdmin.Plugin.Mobile.MobileResource">
|
||||
<summary>
|
||||
资源
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:SimpleAdmin.Plugin.Mobile.MobileResource.ParentId">
|
||||
<summary>
|
||||
父id
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:SimpleAdmin.Plugin.Mobile.MobileResource.Title">
|
||||
<summary>
|
||||
标题
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:SimpleAdmin.Plugin.Mobile.MobileResource.Name">
|
||||
<summary>
|
||||
别名
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:SimpleAdmin.Plugin.Mobile.MobileResource.Description">
|
||||
<summary>
|
||||
描述
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:SimpleAdmin.Plugin.Mobile.MobileResource.Code">
|
||||
<summary>
|
||||
编码
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:SimpleAdmin.Plugin.Mobile.MobileResource.Category">
|
||||
<summary>
|
||||
分类
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:SimpleAdmin.Plugin.Mobile.MobileResource.Module">
|
||||
<summary>
|
||||
模块
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:SimpleAdmin.Plugin.Mobile.MobileResource.MenuType">
|
||||
<summary>
|
||||
菜单类型
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:SimpleAdmin.Plugin.Mobile.MobileResource.Path">
|
||||
<summary>
|
||||
路径
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:SimpleAdmin.Plugin.Mobile.MobileResource.Icon">
|
||||
<summary>
|
||||
图标
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:SimpleAdmin.Plugin.Mobile.MobileResource.Color">
|
||||
<summary>
|
||||
颜色
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:SimpleAdmin.Plugin.Mobile.MobileResource.SortCode">
|
||||
<summary>
|
||||
排序码
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:SimpleAdmin.Plugin.Mobile.MobileResource.RegType">
|
||||
<summary>
|
||||
颜色
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:SimpleAdmin.Plugin.Mobile.MobileResource.Meta">
|
||||
<summary>
|
||||
菜单元标签
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:SimpleAdmin.Plugin.Mobile.MobileResource.Children">
|
||||
<summary>
|
||||
字节点
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:SimpleAdmin.Plugin.Mobile.MobileSettingsOptions">
|
||||
<summary>
|
||||
代码生成器配置
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:SimpleAdmin.Plugin.Mobile.MobileResourceSeedData">
|
||||
<summary>
|
||||
移动端资源表
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:SimpleAdmin.Plugin.Mobile.SysRelationSeedData">
|
||||
<summary>
|
||||
关系表种子数据
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:SimpleAdmin.Plugin.Mobile.SysResourceSeedData">
|
||||
<summary>
|
||||
资源表种子数据
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:SimpleAdmin.Plugin.Mobile.MobileButtonAddInput">
|
||||
<summary>
|
||||
添加按钮参数
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:SimpleAdmin.Plugin.Mobile.MobileButtonAddInput.ParentId">
|
||||
<summary>
|
||||
父ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:SimpleAdmin.Plugin.Mobile.MobileButtonAddInput.Title">
|
||||
<summary>
|
||||
标题
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:SimpleAdmin.Plugin.Mobile.MobileButtonAddInput.Code">
|
||||
<summary>
|
||||
编码
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:SimpleAdmin.Plugin.Mobile.MobileButtonEditInput.Id">
|
||||
<summary>
|
||||
ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:SimpleAdmin.Plugin.Mobile.IMobileButtonService">
|
||||
<summary>
|
||||
权限按钮服务
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.IMobileButtonService.Add(SimpleAdmin.Plugin.Mobile.MobileButtonAddInput)">
|
||||
<summary>
|
||||
添加按钮
|
||||
</summary>
|
||||
<param name="input">添加参数</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.IMobileButtonService.AddBatch(SimpleAdmin.Plugin.Mobile.MobileButtonAddInput)">
|
||||
<summary>
|
||||
批量添加
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.IMobileButtonService.Delete(SimpleAdmin.Core.BaseIdListInput)">
|
||||
<summary>
|
||||
删除按钮
|
||||
</summary>
|
||||
<param name="input">删除参数</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.IMobileButtonService.Edit(SimpleAdmin.Plugin.Mobile.MobileButtonEditInput)">
|
||||
<summary>
|
||||
编辑按钮
|
||||
</summary>
|
||||
<param name="input">编辑参数</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.IMobileButtonService.Page(SimpleAdmin.System.ButtonPageInput)">
|
||||
<summary>
|
||||
按钮分页查询
|
||||
</summary>
|
||||
<param name="input">查询条件</param>
|
||||
<returns>按钮分页列表</returns>
|
||||
</member>
|
||||
<member name="T:SimpleAdmin.Plugin.Mobile.MobileMobileButtonService">
|
||||
<summary>
|
||||
<inheritdoc cref="T:SimpleAdmin.Plugin.Mobile.IMobileButtonService"/>
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileMobileButtonService.Page(SimpleAdmin.System.ButtonPageInput)">
|
||||
<inheritdoc/>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileMobileButtonService.Add(SimpleAdmin.Plugin.Mobile.MobileButtonAddInput)">
|
||||
<inheritdoc />
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileMobileButtonService.AddBatch(SimpleAdmin.Plugin.Mobile.MobileButtonAddInput)">
|
||||
<inheritdoc />
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileMobileButtonService.Edit(SimpleAdmin.Plugin.Mobile.MobileButtonEditInput)">
|
||||
<inheritdoc />
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileMobileButtonService.Delete(SimpleAdmin.Core.BaseIdListInput)">
|
||||
<inheritdoc />
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileMobileButtonService.CheckInput(SimpleAdmin.Plugin.Mobile.MobileResource)">
|
||||
<summary>
|
||||
检查输入参数
|
||||
</summary>
|
||||
<param name="MobileResource"></param>
|
||||
</member>
|
||||
<member name="T:SimpleAdmin.Plugin.Mobile.MobileMenuAddInput">
|
||||
<summary>
|
||||
添加菜单参数
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:SimpleAdmin.Plugin.Mobile.MobileMenuAddInput.ParentId">
|
||||
<summary>
|
||||
父ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:SimpleAdmin.Plugin.Mobile.MobileMenuAddInput.Title">
|
||||
<summary>
|
||||
标题
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:SimpleAdmin.Plugin.Mobile.MobileMenuAddInput.MenuType">
|
||||
<summary>
|
||||
菜单类型
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:SimpleAdmin.Plugin.Mobile.MobileMenuAddInput.Module">
|
||||
<summary>
|
||||
模块
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:SimpleAdmin.Plugin.Mobile.MobileMenuAddInput.Icon">
|
||||
<summary>
|
||||
图标
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:SimpleAdmin.Plugin.Mobile.MobileMenuEditInput">
|
||||
<summary>
|
||||
编辑菜单输入参数
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:SimpleAdmin.Plugin.Mobile.MobileMenuEditInput.Id">
|
||||
<summary>
|
||||
ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:SimpleAdmin.Plugin.Mobile.IMobileMenuService">
|
||||
<summary>
|
||||
菜单服务
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.IMobileMenuService.Add(SimpleAdmin.Plugin.Mobile.MobileMenuAddInput)">
|
||||
<summary>
|
||||
添加菜单
|
||||
</summary>
|
||||
<param name="input">添加参数</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.IMobileMenuService.Detail(SimpleAdmin.Core.BaseIdInput)">
|
||||
<summary>
|
||||
详情
|
||||
</summary>
|
||||
<param name="input">id</param>
|
||||
<returns>详细信息</returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.IMobileMenuService.ConstructMenuTrees(System.Collections.Generic.List{SimpleAdmin.Plugin.Mobile.MobileResource},System.Int64)">
|
||||
<summary>
|
||||
构建菜单树形结构
|
||||
</summary>
|
||||
<param name="resourceList">菜单列表</param>
|
||||
<param name="parentId">父ID</param>
|
||||
<returns>菜单形结构</returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.IMobileMenuService.Tree(SimpleAdmin.System.MenuTreeInput)">
|
||||
<summary>
|
||||
获取菜单树
|
||||
</summary>
|
||||
<param name="input">菜单树查询参数</param>
|
||||
<returns>菜单树列表</returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.IMobileMenuService.Edit(SimpleAdmin.Plugin.Mobile.MobileMenuEditInput)">
|
||||
<summary>
|
||||
编辑菜单
|
||||
</summary>
|
||||
<param name="input">菜单编辑参数</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.IMobileMenuService.Delete(SimpleAdmin.Core.BaseIdListInput)">
|
||||
<summary>
|
||||
删除菜单
|
||||
</summary>
|
||||
<param name="input">删除菜单参数</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.IMobileMenuService.ChangeModule(SimpleAdmin.System.MenuChangeModuleInput)">
|
||||
<summary>
|
||||
改变菜单模块
|
||||
</summary>
|
||||
<param name="input">改变菜单模块参数</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.IMobileMenuService.GrantRoleMobileResource(SimpleAdmin.System.GrantResourceInput)">
|
||||
<summary>
|
||||
角色授权移动端资源
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:SimpleAdmin.Plugin.Mobile.MobileMenuService">
|
||||
<summary>
|
||||
<inheritdoc cref="T:SimpleAdmin.Plugin.Mobile.IMobileMenuService"/>
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileMenuService.ConstructMenuTrees(System.Collections.Generic.List{SimpleAdmin.Plugin.Mobile.MobileResource},System.Int64)">
|
||||
<inheritdoc/>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileMenuService.Tree(SimpleAdmin.System.MenuTreeInput)">
|
||||
<inheritdoc />
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileMenuService.Add(SimpleAdmin.Plugin.Mobile.MobileMenuAddInput)">
|
||||
<inheritdoc />
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileMenuService.Edit(SimpleAdmin.Plugin.Mobile.MobileMenuEditInput)">
|
||||
<inheritdoc />
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileMenuService.Delete(SimpleAdmin.Core.BaseIdListInput)">
|
||||
<inheritdoc />
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileMenuService.Detail(SimpleAdmin.Core.BaseIdInput)">
|
||||
<inheritdoc />
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileMenuService.ChangeModule(SimpleAdmin.System.MenuChangeModuleInput)">
|
||||
<inheritdoc />
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileMenuService.GrantRoleMobileResource(SimpleAdmin.System.GrantResourceInput)">
|
||||
<inheritdoc />
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileMenuService.CheckInput(SimpleAdmin.Plugin.Mobile.MobileResource)">
|
||||
<summary>
|
||||
检查输入参数
|
||||
</summary>
|
||||
<param name="mobileResource"></param>
|
||||
</member>
|
||||
<member name="T:SimpleAdmin.Plugin.Mobile.MobileModuleAddInput">
|
||||
<summary>
|
||||
添加模块输入
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:SimpleAdmin.Plugin.Mobile.MobileModuleEditInput">
|
||||
<summary>
|
||||
编辑模块输入
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:SimpleAdmin.Plugin.Mobile.MobileModuleEditInput.Id">
|
||||
<summary>
|
||||
ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:SimpleAdmin.Plugin.Mobile.IMobileModuleService">
|
||||
<summary>
|
||||
模块管理服务
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.IMobileModuleService.Add(SimpleAdmin.Plugin.Mobile.MobileModuleAddInput)">
|
||||
<summary>
|
||||
添加模块
|
||||
</summary>
|
||||
<param name="input">添加参数</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.IMobileModuleService.Delete(SimpleAdmin.Core.BaseIdListInput)">
|
||||
<summary>
|
||||
删除模块
|
||||
</summary>
|
||||
<param name="input">删除参数</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.IMobileModuleService.Edit(SimpleAdmin.Plugin.Mobile.MobileModuleEditInput)">
|
||||
<summary>
|
||||
编辑模块
|
||||
</summary>
|
||||
<param name="input">编辑参数</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.IMobileModuleService.Page(SimpleAdmin.System.ModulePageInput)">
|
||||
<summary>
|
||||
分页查询
|
||||
</summary>
|
||||
<param name="input">分页参数</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.IMobileModuleService.Detail(SimpleAdmin.Core.BaseIdInput)">
|
||||
<summary>
|
||||
详情
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:SimpleAdmin.Plugin.Mobile.MobileModuleService">
|
||||
<summary>
|
||||
<inheritdoc cref="T:SimpleAdmin.Plugin.Mobile.IMobileModuleService"/>
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileModuleService.Page(SimpleAdmin.System.ModulePageInput)">
|
||||
<inheritdoc/>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileModuleService.Add(SimpleAdmin.Plugin.Mobile.MobileModuleAddInput)">
|
||||
<inheritdoc />
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileModuleService.Edit(SimpleAdmin.Plugin.Mobile.MobileModuleEditInput)">
|
||||
<inheritdoc />
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileModuleService.Delete(SimpleAdmin.Core.BaseIdListInput)">
|
||||
<inheritdoc />
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileModuleService.Detail(SimpleAdmin.Core.BaseIdInput)">
|
||||
<inheritdoc />
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileModuleService.CheckInput(SimpleAdmin.Plugin.Mobile.MobileResource)">
|
||||
<summary>
|
||||
检查输入参数
|
||||
</summary>
|
||||
<param name="sysResource"></param>
|
||||
</member>
|
||||
<member name="T:SimpleAdmin.Plugin.Mobile.IMobileResourceService">
|
||||
<summary>
|
||||
资源服务
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.IMobileResourceService.GetaModuleAndMenuAndSpaList">
|
||||
<summary>
|
||||
获取所有的菜单和模块以及单页面列表,并按分类和排序码排序
|
||||
</summary>
|
||||
<returns>所有的菜单和模块以及单页面列表</returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.IMobileResourceService.GetChildListById(System.Int64,System.Boolean)">
|
||||
<summary>
|
||||
根据资源ID获取所有下级资源
|
||||
</summary>
|
||||
<param name="resId">资源ID</param>
|
||||
<param name="isContainOneself">是否包含自己</param>
|
||||
<returns>资源列表</returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.IMobileResourceService.GetChildListById(System.Collections.Generic.List{SimpleAdmin.Plugin.Mobile.MobileResource},System.Int64,System.Boolean)">
|
||||
<summary>
|
||||
根据资源ID获取所有下级资源
|
||||
</summary>
|
||||
<param name="sysResources">资源列表</param>
|
||||
<param name="resId">资源ID</param>
|
||||
<param name="isContainOneself">是否包含自己</param>
|
||||
<returns>资源列表</returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.IMobileResourceService.GetCodeByIds(System.Collections.Generic.List{System.Int64},System.String)">
|
||||
<summary>
|
||||
获取ID获取Code列表
|
||||
</summary>
|
||||
<param name="ids">id列表</param>
|
||||
<param name="category">分类</param>
|
||||
<returns>Code列表</returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.IMobileResourceService.GetListAsync(System.Collections.Generic.List{System.String})">
|
||||
<summary>
|
||||
获取资源列表
|
||||
</summary>
|
||||
<param name="categorys">资源分类列表</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.IMobileResourceService.GetListByCategory(System.String)">
|
||||
<summary>
|
||||
根据分类获取资源列表
|
||||
</summary>
|
||||
<param name="category">分类名称</param>
|
||||
<returns>资源列表</returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.IMobileResourceService.GetMenuByMenuIds(System.Collections.Generic.List{System.Int64})">
|
||||
<summary>
|
||||
根据菜单ID获取菜单
|
||||
</summary>
|
||||
<param name="menuIds">菜单id列表</param>
|
||||
<returns>菜单列表</returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.IMobileResourceService.PermissionTreeSelector(System.Collections.Generic.List{System.String})">
|
||||
<summary>
|
||||
获取权限授权树
|
||||
</summary>
|
||||
<param name="routes">路由列表</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.IMobileResourceService.RefreshCache(System.String)">
|
||||
<summary>
|
||||
刷新缓存
|
||||
</summary>
|
||||
<param name="category">分类名称</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.IMobileResourceService.ResourceTreeSelector">
|
||||
<summary>
|
||||
角色授权资源树
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:SimpleAdmin.Plugin.Mobile.MobileResourceService">
|
||||
<inheritdoc cref="T:SimpleAdmin.Plugin.Mobile.IMobileResourceService"/>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileResourceService.GetCodeByIds(System.Collections.Generic.List{System.Int64},System.String)">
|
||||
<inheritdoc />
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileResourceService.GetListAsync(System.Collections.Generic.List{System.String})">
|
||||
<inheritdoc/>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileResourceService.GetaModuleAndMenuAndSpaList">
|
||||
<inheritdoc/>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileResourceService.RefreshCache(System.String)">
|
||||
<inheritdoc/>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileResourceService.GetChildListById(System.Int64,System.Boolean)">
|
||||
<inheritdoc />
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileResourceService.GetChildListById(System.Collections.Generic.List{SimpleAdmin.Plugin.Mobile.MobileResource},System.Int64,System.Boolean)">
|
||||
<inheritdoc />
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileResourceService.GetListByCategory(System.String)">
|
||||
<inheritdoc />
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileResourceService.ResourceTreeSelector">
|
||||
<inheritdoc />
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileResourceService.PermissionTreeSelector(System.Collections.Generic.List{System.String})">
|
||||
<inheritdoc />
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileResourceService.GetMenuByMenuIds(System.Collections.Generic.List{System.Int64})">
|
||||
<inheritdoc />
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileResourceService.GetRouteName(System.String,System.String)">
|
||||
<summary>
|
||||
获取路由地址名称
|
||||
</summary>
|
||||
<param name="controllerName">控制器地址</param>
|
||||
<param name="template">路由名称</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileResourceService.GetResourceChilden(System.Collections.Generic.List{SimpleAdmin.Plugin.Mobile.MobileResource},System.Int64)">
|
||||
<summary>
|
||||
获取资源所有下级
|
||||
</summary>
|
||||
<param name="resourceList">资源列表</param>
|
||||
<param name="parentId">父ID</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileResourceService.GetResourceParent(System.Collections.Generic.List{SimpleAdmin.Plugin.Mobile.MobileResource},System.Int64)">
|
||||
<summary>
|
||||
获取上级
|
||||
</summary>
|
||||
<param name="resourceList"></param>
|
||||
<param name="parentId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileResourceService.GetRoleGrantResourceMenus(System.Int64)">
|
||||
<summary>
|
||||
获取授权菜单
|
||||
</summary>
|
||||
<param name="moduleId">模块ID</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileResourceService.GetRoleGrantResourceMenuTitle(System.Collections.Generic.List{SimpleAdmin.Plugin.Mobile.MobileResource},SimpleAdmin.Plugin.Mobile.MobileResource)">
|
||||
<summary>
|
||||
获取授权菜单类菜单名称
|
||||
</summary>
|
||||
<param name="menuList">菜单列表</param>
|
||||
<param name="menu">当前菜单</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:SimpleAdmin.Plugin.Mobile.MobileLoginUserOutput">
|
||||
<summary>
|
||||
手机端登录用户信息
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:SimpleAdmin.Plugin.Mobile.MobileLoginUserOutput.MobileButtonCodeList">
|
||||
<summary>
|
||||
移动端按钮码集合
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:SimpleAdmin.Plugin.Mobile.MobleMeta">
|
||||
<summary>
|
||||
手机端
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:SimpleAdmin.Plugin.Mobile.IMobileUserCenterService">
|
||||
<summary>
|
||||
移动端用户个人信息服务
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.IMobileUserCenterService.GetOwnMobileMenu">
|
||||
<summary>
|
||||
获取个人移动端菜单
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.IMobileUserCenterService.GetLoginUser">
|
||||
<summary>
|
||||
获取登录用户信息
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:SimpleAdmin.Plugin.Mobile.MobileUserCenterService">
|
||||
<inheritdoc cref="T:SimpleAdmin.Plugin.Mobile.IMobileUserCenterService"/>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileUserCenterService.GetOwnMobileMenu">
|
||||
<inheritdoc />
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileUserCenterService.GetLoginUser">
|
||||
<inheritdoc />
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileUserCenterService.GetMyParentMenus(System.Collections.Generic.List{SimpleAdmin.Plugin.Mobile.MobileResource},System.Collections.Generic.List{SimpleAdmin.Plugin.Mobile.MobileResource})">
|
||||
<summary>
|
||||
获取父菜单集合
|
||||
</summary>
|
||||
<param name="allMenuList">所有菜单列表</param>
|
||||
<param name="myMenus">我的菜单列表</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileUserCenterService.GetMyModules(System.Collections.Generic.List{SimpleAdmin.Plugin.Mobile.MobileResource},System.Collections.Generic.List{System.Int64},System.Int32)">
|
||||
<summary>
|
||||
获取我的模块集合
|
||||
</summary>
|
||||
<param name="allModuleList"></param>
|
||||
<param name="moduleIds"></param>
|
||||
<param name="spaCount"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.MobileUserCenterService.ConstructMeta(System.Collections.Generic.List{SimpleAdmin.Plugin.Mobile.MobileResource})">
|
||||
<summary>
|
||||
构建Meta
|
||||
</summary>
|
||||
<param name="myMenus">我的菜单集合</param>
|
||||
</member>
|
||||
<member name="T:SimpleAdmin.Plugin.Mobile.Startup">
|
||||
<summary>
|
||||
AppStartup启动类
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Plugin.Mobile.Startup.ConfigureServices(Microsoft.Extensions.DependencyInjection.IServiceCollection)">
|
||||
<summary>
|
||||
ConfigureServices中不能解析服务,比如App.GetService(),尤其是不能在ConfigureServices中获取诸如缓存等数据进行初始化,应该在Configure中进行
|
||||
服务都还没初始化完成,会导致内存中存在多份 IOC 容器!!
|
||||
正确应该在 Configure 中,这个时候服务(IServiceCollection 已经完成 BuildServiceProvider() 操作了
|
||||
</summary>
|
||||
<param name="services"></param>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
@@ -0,0 +1,37 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Plugin.Mobile;
|
||||
|
||||
/// <summary>
|
||||
/// AppStartup启动类
|
||||
/// </summary>
|
||||
public class Startup : AppStartup
|
||||
{
|
||||
/// <summary>
|
||||
/// ConfigureServices中不能解析服务,比如App.GetService(),尤其是不能在ConfigureServices中获取诸如缓存等数据进行初始化,应该在Configure中进行
|
||||
/// 服务都还没初始化完成,会导致内存中存在多份 IOC 容器!!
|
||||
/// 正确应该在 Configure 中,这个时候服务(IServiceCollection 已经完成 BuildServiceProvider() 操作了
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
//移动端配置转实体
|
||||
services.AddConfigurableOptions<MobileSettingsOptions>();
|
||||
}
|
||||
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
var fullName = Assembly.GetExecutingAssembly().FullName;//获取程序集全名
|
||||
//通过 App.GetOptions<TOptions> 获取选项
|
||||
var settings = App.GetOptions<MobileSettingsOptions>();
|
||||
CodeFirstUtils.CodeFirst(settings, fullName);//CodeFirst
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user