提高
This commit is contained in:
@@ -63,7 +63,11 @@ namespace ZR.Admin.WebApi.Controllers.System
|
||||
public IActionResult Login([FromBody] LoginBodyDto loginBody)
|
||||
{
|
||||
if (loginBody == null) { throw new CustomException("请求参数错误"); }
|
||||
// todo: HttpContext存了什么东西?????
|
||||
//todo: ControllerBase.HttpContext和httpContextAccessor.HttpContext 有啥区别啊???
|
||||
loginBody.LoginIP = HttpContextExtension.GetClientUserIp(HttpContext);
|
||||
|
||||
//todo 判断验证码
|
||||
SysConfig sysConfig = sysConfigService.GetSysConfigByKey("sys.account.captchaOnOff");
|
||||
if (sysConfig?.ConfigValue != "off" && !SecurityCodeHelper.Validate(loginBody.Uuid, loginBody.Code))
|
||||
{
|
||||
@@ -75,10 +79,14 @@ namespace ZR.Admin.WebApi.Controllers.System
|
||||
List<SysRole> roles = roleService.SelectUserRoleListByUserId(user.UserId);
|
||||
//权限集合 eg *:*:*,system:user:list
|
||||
List<string> permissions = permissionService.GetMenuPermission(user);
|
||||
|
||||
// 权限
|
||||
LoginUser loginUser = new(user, roles, permissions);
|
||||
//todo 把权限加到缓存里
|
||||
CacheService.SetUserPerms(GlobalConstant.UserPermKEY + user.UserId, permissions);
|
||||
|
||||
|
||||
Console.WriteLine("1 用户信息--》" + HttpContext.User.Identity.Name);
|
||||
|
||||
return SUCCESS(JwtUtil.GenerateJwtToken(JwtUtil.AddClaims(loginUser), jwtSettings.JwtSettings));
|
||||
}
|
||||
|
||||
@@ -168,7 +176,7 @@ namespace ZR.Admin.WebApi.Controllers.System
|
||||
Browser = clientInfo.ToString(),
|
||||
Os = clientInfo.OS.ToString(),
|
||||
Ipaddr = ipAddr,
|
||||
UserName = context.GetName(),
|
||||
UserName = context.GetName(),//空的 获取不到 null
|
||||
LoginLocation = ip_info?.Province + "-" + ip_info?.City
|
||||
};
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Text.Json;
|
||||
using ZR.Admin.WebApi.Extensions;
|
||||
using ZR.Admin.WebApi.Filters;
|
||||
using ZR.Model.mes.md;
|
||||
using ZR.Model.mes.pro;
|
||||
using ZR.Model.MES.pro.DTO;
|
||||
@@ -52,6 +53,7 @@ namespace ZR.Admin.WebApi.Controllers.MES.pro
|
||||
/// <param name="week"></param>
|
||||
/// <param name="date"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
[HttpGet("GetGanttList")]
|
||||
public IActionResult GetGanttList(int year = -1, int week = -1, int date = -1)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user