| | |
| | | public WebResponseContent SerializeJwt(string code) |
| | | { |
| | | return WebResponseContent.Instance.OK(data: JwtHelper.SerializeJwt(code)); |
| | | } |
| | | [HttpPost, Route("replaceToken")] |
| | | public WebResponseContent ReplaceToken() |
| | | { |
| | | WebResponseContent responseContent = new WebResponseContent(); |
| | | try |
| | | { |
| | | string token = App.User.GetToken(); |
| | | if (string.IsNullOrEmpty(token)) |
| | | { |
| | | return responseContent = WebResponseContent.Instance.Error("token无效,请重新登录!"); |
| | | } |
| | | TokenModelJwt tokenModelJwt = new TokenModelJwt() |
| | | { |
| | | RoleId = App.User.RoleId, |
| | | TenantId = App.User.TenantId, |
| | | UserId = App.User.UserId, |
| | | UserName = App.User.UserName |
| | | }; |
| | | string newToken = JwtHelper.IssueJwt(tokenModelJwt); |
| | | return responseContent = WebResponseContent.Instance.OK(data: newToken); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return responseContent.Error(ex.Message); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |