|
|
|
@ -19,6 +19,7 @@ using Furion.RemoteRequest.Extensions;
|
|
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using Myshipping.Core.Const;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
|
|
|
|
|
namespace Myshipping.Core.Service;
|
|
|
|
|
|
|
|
|
@ -488,7 +489,7 @@ public class AuthService : IAuthService, IDynamicApiController, ITransient
|
|
|
|
|
}
|
|
|
|
|
//将key写入到redis 并指定五秒过期
|
|
|
|
|
string key = Guid.NewGuid().ToString();
|
|
|
|
|
await _cache.SetTimeoutAsync( key, input.UserId, TimeSpan.FromSeconds(5));
|
|
|
|
|
await _cache.SetTimeoutAsync( key, JsonConvert.SerializeObject( input), TimeSpan.FromSeconds(5));
|
|
|
|
|
//将key返回
|
|
|
|
|
return key;
|
|
|
|
|
}
|
|
|
|
@ -508,11 +509,17 @@ public class AuthService : IAuthService, IDynamicApiController, ITransient
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("授权码无效");
|
|
|
|
|
}
|
|
|
|
|
//获取用户信息
|
|
|
|
|
var user = _sysUserRep.AsQueryable().Filter(null, true).First(u => u.DjyUserId == _cache.Get(input.Key));
|
|
|
|
|
//获取缓存数据
|
|
|
|
|
GetAuthorizationKeyInput data = JsonConvert.DeserializeObject<GetAuthorizationKeyInput>(_cache.Get(input.Key));
|
|
|
|
|
|
|
|
|
|
var datainfo = _sysUserRep.AsQueryable().Filter(null, true).First(u => u.DjyUserId == data.UserId);
|
|
|
|
|
|
|
|
|
|
//获取缓存的权限,将权限缓存
|
|
|
|
|
await _cache.SetAsync(datainfo.UserCode, data.Authority);
|
|
|
|
|
|
|
|
|
|
//获取对应租户
|
|
|
|
|
var tenant = _sysTenantRep.Single(user.TenantId);
|
|
|
|
|
var tenant = _sysTenantRep.Single(datainfo.TenantId);
|
|
|
|
|
//颁发token
|
|
|
|
|
return await GetLoginToken(user, tenant);
|
|
|
|
|
return await GetLoginToken(datainfo, tenant);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|