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