修正字段写入

This commit is contained in:
黎润豪 2026-01-04 16:53:23 +08:00
parent 0ae5974dc6
commit ccceffe7c4
1 changed files with 5 additions and 5 deletions

View File

@ -523,14 +523,14 @@ public class OAuth2Controller extends BaseController {
@ApiOperation("获取一个加密登录的登录用数据串")
@GetMapping("sm4/encrypted/data")
public RestResult<String> getSm4EncryptedData(HttpServletRequest request) {
LoginMessage loginMessage = getLoginMessage(request);
if (loginMessage == null) {
AICUser loginUser = getLoginUser(request);
if (loginUser == null) {
return RestResult.error(ResultCode.USER_NOT_LOGGED_IN);
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("userId", loginMessage.getUserId());
jsonObject.put("username", loginMessage.getUsername());
jsonObject.put("nickname", loginMessage.getNickName());
jsonObject.put("userId", loginUser.getPrimaryKey());
jsonObject.put("username", loginUser.getEname());
jsonObject.put("nickname", loginUser.getName());
jsonObject.put("expired", System.currentTimeMillis() + 1000 * 60 * 5);// 增加有效期
return RestResult.ok(SM4Utils.encrypt(jsonObject.toJSONString(), sm4Key));
}