😎优化代码
This commit is contained in:
parent
282788e82d
commit
24fd87e58f
@ -183,11 +183,11 @@ public class SysCommonService : IDynamicApiController, ITransient
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生成所有移动端接口 🔖
|
||||
/// 生成所有移动端接口文件 🔖
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[DisplayName("生成所有移动端接口")]
|
||||
[DisplayName("生成所有移动端接口文件")]
|
||||
public void GenerateAppApi([FromQuery] string groupName = "", [FromQuery] bool isAppApi = true)
|
||||
{
|
||||
var defaultRoutePrefix = App.GetOptions<DynamicApiControllerSettingsOptions>().DefaultRoutePrefix;
|
||||
|
||||
@ -100,18 +100,19 @@ namespace Admin.NET.Web.Core
|
||||
if (App.User.FindFirst(ClaimConst.AccountType)?.Value == ((int)AccountTypeEnum.SuperAdmin).ToString())
|
||||
return true;
|
||||
|
||||
var serviceScope = httpContext.RequestServices.CreateScope();
|
||||
|
||||
// 当前接口路由
|
||||
var path = httpContext.Request.Path.ToString();
|
||||
|
||||
// 移动端接口权限判断
|
||||
if (App.User.FindFirst(ClaimConst.LoginMode)?.Value == ((int)LoginModeEnum.APP).ToString())
|
||||
{
|
||||
var appApiList = App.GetRequiredService<SysCommonService>().GetAppApiList(); // 获取移动端所有接口
|
||||
var appApiList = serviceScope.ServiceProvider.GetRequiredService<SysCommonService>().GetAppApiList();
|
||||
return appApiList.Exists(u => path.EndsWith(u, StringComparison.CurrentCultureIgnoreCase));
|
||||
}
|
||||
|
||||
// 获取当前用户按钮权限集合和接口黑名单
|
||||
var serviceScope = httpContext.RequestServices.CreateScope();
|
||||
var sysRoleService = serviceScope.ServiceProvider.GetRequiredService<SysRoleService>();
|
||||
var roleApis = await sysRoleService.GetUserApiList();
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user