调整aspnetuser

usertest
zhangxiaofeng 4 months ago
parent 0a178d0478
commit bde64b271f

@ -79,14 +79,22 @@ public class AspNetUser : IUser
} }
public long GetTenantId() public long GetTenantId()
{ {
var token = GetToken();
if (string.IsNullOrEmpty(token))
{
return 0;
}
var jwtHandler = new JwtSecurityTokenHandler();
if (string.IsNullOrEmpty(_tenantId)) if (!jwtHandler.CanReadToken(token))
{ {
var claimValue = GetClaimValueByType("TenantId").FirstOrDefault(); return 0;
_tenantId = claimValue != null ? claimValue : "0";
} }
return long.Parse(_tenantId);
JwtSecurityToken jwtToken = jwtHandler.ReadJwtToken(token);
var tenantIdClaim = jwtToken.Claims.FirstOrDefault(x => x.Type == "TenantId");
return tenantIdClaim != null ? Convert.ToInt64(tenantIdClaim.Value) : 0;
} }
//public long GetTenantId() //public long GetTenantId()

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<NameOfLastUsedPublishProfile>D:\Code\ds8-solution-pro\ds-wms-service\DS.WMS.MainApi\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile> <NameOfLastUsedPublishProfile>D:\Code\ds8-solution-pro\ds-wms-service\DS.WMS.MainApi\Properties\PublishProfiles\FolderProfile1.pubxml</NameOfLastUsedPublishProfile>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<_PublishTargetUrl>D:\Publish\DS8\Main</_PublishTargetUrl> <_PublishTargetUrl>D:\Publish\DS8\Main</_PublishTargetUrl>
<History>True|2024-08-05T00:47:56.4462670Z;True|2024-06-07T15:21:06.7600490+08:00;True|2024-06-07T15:17:45.6855676+08:00;True|2024-05-31T13:57:26.8256021+08:00;True|2024-05-30T16:18:14.8047074+08:00;True|2024-05-30T09:30:24.9756841+08:00;True|2024-05-29T17:46:22.9869679+08:00;True|2024-05-29T17:20:28.9621862+08:00;True|2024-05-29T17:18:16.4688274+08:00;True|2024-05-29T16:33:42.5152962+08:00;False|2024-05-29T16:33:09.8393409+08:00;False|2024-05-29T16:31:07.7569208+08:00;True|2024-05-28T18:00:39.2399003+08:00;True|2024-05-28T08:47:53.8630073+08:00;True|2024-05-23T17:51:45.6784172+08:00;True|2024-05-21T17:32:52.9294009+08:00;</History> <History>True|2024-08-05T01:17:28.1699596Z;True|2024-08-05T08:47:56.4462670+08:00;True|2024-06-07T15:21:06.7600490+08:00;True|2024-06-07T15:17:45.6855676+08:00;True|2024-05-31T13:57:26.8256021+08:00;True|2024-05-30T16:18:14.8047074+08:00;True|2024-05-30T09:30:24.9756841+08:00;True|2024-05-29T17:46:22.9869679+08:00;True|2024-05-29T17:20:28.9621862+08:00;True|2024-05-29T17:18:16.4688274+08:00;True|2024-05-29T16:33:42.5152962+08:00;False|2024-05-29T16:33:09.8393409+08:00;False|2024-05-29T16:31:07.7569208+08:00;True|2024-05-28T18:00:39.2399003+08:00;True|2024-05-28T08:47:53.8630073+08:00;True|2024-05-23T17:51:45.6784172+08:00;True|2024-05-21T17:32:52.9294009+08:00;</History>
<LastFailureDetails /> <LastFailureDetails />
</PropertyGroup> </PropertyGroup>
</Project> </Project>
Loading…
Cancel
Save