1212121
This commit is contained in:
@@ -280,6 +280,34 @@ namespace Application.Web.Controllers.Login
|
||||
return PoAction.Ok(new
|
||||
{ token = token, refToken = userInfo.token, userId = userInfo.userId });
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<IPoAction> RefreshTokenByBook([FromBody] RefreshTokenParms parms)
|
||||
{
|
||||
if (string.IsNullOrEmpty(parms.refToken))
|
||||
{
|
||||
return PoAction.Message("刷新失败");
|
||||
}
|
||||
|
||||
string Key = App.Configuration["JwtTokenOptions:SecurityKey"].ToString();
|
||||
string Issuer = App.Configuration["JwtTokenOptions:Issuer"].ToString();
|
||||
string Audience = App.Configuration["JwtTokenOptions:Audience"].ToString();
|
||||
|
||||
var userInfo = await _userService.GetUserInfoByToken(parms.refToken);
|
||||
if (userInfo == null)
|
||||
{
|
||||
return PoAction.Message("刷新失败,用户不存在!");
|
||||
}
|
||||
|
||||
Dictionary<string, object> loadData = new Dictionary<string, object>();
|
||||
loadData.Add("userId", userInfo.userId);
|
||||
loadData.Add("accId", userInfo.accId);
|
||||
loadData.Add("areaId", userInfo.areaId);
|
||||
string token = JwtHelper.CreateToken(Key, Issuer, Audience, loadData, TokenConfig.TokenTime);
|
||||
|
||||
return PoAction.Ok(new
|
||||
{ token = token, refToken = userInfo.token, userId = userInfo.userId });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 注册角色信息
|
||||
|
||||
Reference in New Issue
Block a user