修改UserContext

master
xiaochanghai 1 year ago
parent 863a2010a8
commit 18652c7177
  1. 8
      Tiobon.Core.Common/UserManager/UserContext.cs

@ -22,7 +22,7 @@
}
}
private static Microsoft.AspNetCore.Http.HttpContext Context
public static Microsoft.AspNetCore.Http.HttpContext Context
{
get
{
@ -33,7 +33,7 @@
/// <summary>
/// 用户ID
/// </summary>
public long? User_Id
public int User_Id
{
get
{
@ -41,11 +41,11 @@
{
//string aa = Context.User.FindFirstValue(ClaimTypes.NameIdentifier);
string userId = Context?.User?.Identity?.Name;
return string.IsNullOrEmpty(userId) ? null : long.Parse(userId);
return string.IsNullOrEmpty(userId) ? 0 : int.Parse(userId);
}
catch (Exception)
{
return null; //匿名访问
return 0; //匿名访问
}
}
}

Loading…
Cancel
Save