⚡ 优化功能

This commit is contained in:
不做码农
2023-11-12 10:08:42 +08:00
parent 2bc2911718
commit f78ccc2b4c
9 changed files with 61 additions and 42 deletions
@@ -19,6 +19,7 @@ namespace Infrastructure
types.GetProperty("CreateBy", flag)?.SetValue(source, context.GetName(), null);
types.GetProperty("Create_by", flag)?.SetValue(source, context.GetName(), null);
types.GetProperty("UserId", flag)?.SetValue(source, context.GetUId(), null);
types.GetProperty("DeptId", flag)?.SetValue(source, context.GetDeptId(), null);
return source;
}
@@ -80,6 +80,17 @@ namespace Infrastructure.Extensions
return !string.IsNullOrEmpty(uid) ? long.Parse(uid) : 0;
}
/// <summary>
/// 获取部门id
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public static long GetDeptId(this HttpContext context)
{
var deptId = context.User.FindFirstValue(ClaimTypes.GroupSid);
return !string.IsNullOrEmpty(deptId) ? long.Parse(deptId) : 0;
}
/// <summary>
/// 获取登录用户名
/// </summary>