提交 8634174a 作者: zhenjie

认证相关

上级 47f01b50
...@@ -21,5 +21,8 @@ public class LoginSuccessDTO implements Serializable { ...@@ -21,5 +21,8 @@ public class LoginSuccessDTO implements Serializable {
private String token; private String token;
private Integer userAccountId; private Integer userAccountId;
private String accountNo; private String accountNo;
private String uid;
private String phoneNum;
private String userName;
// private RoleInfoDTO roleInfo; // private RoleInfoDTO roleInfo;
} }
...@@ -104,8 +104,8 @@ public class AuthServiceImpl implements AuthService { ...@@ -104,8 +104,8 @@ public class AuthServiceImpl implements AuthService {
map.put(JwtConstant.TOKEN_TYPE, JwtConstant.IUAV_TOKEN); map.put(JwtConstant.TOKEN_TYPE, JwtConstant.IUAV_TOKEN);
String token = JwtUtil.createJwt(map); String token = JwtUtil.createJwt(map);
LoginSuccessDTO loginSuccessDTO = LoginSuccessDTO.builder().token(token).userAccountId(userAccountVO.getId()).accountNo(userAccountVO.getAccountNo()).uid(userAccountVO.getUid())
LoginSuccessDTO loginSuccessDTO = LoginSuccessDTO.builder().token(token).userAccountId(userAccountVO.getId()).accountNo(userAccountVO.getAccountNo()).build(); .userName(userAccountVO.getUserName()).phoneNum(userAccountVO.getPhoneNum()).build();
stringRedisTemplate.opsForValue().set( stringRedisTemplate.opsForValue().set(
token, JSONObject.toJSONString(loginSuccessDTO), token, JSONObject.toJSONString(loginSuccessDTO),
...@@ -140,9 +140,8 @@ public class AuthServiceImpl implements AuthService { ...@@ -140,9 +140,8 @@ public class AuthServiceImpl implements AuthService {
//map.put(JwtConstant.ROLE_ID, 0); //map.put(JwtConstant.ROLE_ID, 0);
map.put(JwtConstant.TOKEN_TYPE, JwtConstant.M_TOKEN); map.put(JwtConstant.TOKEN_TYPE, JwtConstant.M_TOKEN);
String token = JwtUtil.createJwt(map); String token = JwtUtil.createJwt(map);
LoginSuccessDTO loginSuccessDTO = LoginSuccessDTO.builder().token(token).userAccountId(user.getId()).accountNo(user.getAccountNo()).uid(user.getUid())
LoginSuccessDTO loginSuccessDTO = LoginSuccessDTO.builder().token(token).userAccountId(user.getId()).accountNo(user.getAccountNo()).build(); .userName(user.getUserName()).phoneNum(user.getPhoneNum()).build();
stringRedisTemplate.opsForValue().set( stringRedisTemplate.opsForValue().set(
token, JSONObject.toJSONString(loginSuccessDTO), token, JSONObject.toJSONString(loginSuccessDTO),
JwtConstant.EXPIRATION, TimeUnit.MILLISECONDS); JwtConstant.EXPIRATION, TimeUnit.MILLISECONDS);
...@@ -158,8 +157,8 @@ public class AuthServiceImpl implements AuthService { ...@@ -158,8 +157,8 @@ public class AuthServiceImpl implements AuthService {
map.put(JwtConstant.USER_ACCOUNT_ID, userAccountVO.getId()); map.put(JwtConstant.USER_ACCOUNT_ID, userAccountVO.getId());
map.put(JwtConstant.TOKEN_TYPE, JwtConstant.IUAV_TOKEN); map.put(JwtConstant.TOKEN_TYPE, JwtConstant.IUAV_TOKEN);
String token = JwtUtil.createJwt(map); String token = JwtUtil.createJwt(map);
LoginSuccessDTO loginSuccessDTO = LoginSuccessDTO.builder().token(token).userAccountId(userAccountVO.getId()).accountNo(userAccountVO.getAccountNo()).uid(userAccountVO.getUid())
LoginSuccessDTO loginSuccessDTO = LoginSuccessDTO.builder().token(token).userAccountId(userAccountVO.getId()).accountNo(userAccountVO.getAccountNo()).build(); .userName(userAccountVO.getUserName()).phoneNum(userAccountVO.getPhoneNum()).build();
stringRedisTemplate.opsForValue().set( stringRedisTemplate.opsForValue().set(
token, JSONObject.toJSONString(loginSuccessDTO), token, JSONObject.toJSONString(loginSuccessDTO),
JwtConstant.EXPIRATION, TimeUnit.MILLISECONDS); JwtConstant.EXPIRATION, TimeUnit.MILLISECONDS);
...@@ -167,6 +166,6 @@ public class AuthServiceImpl implements AuthService { ...@@ -167,6 +166,6 @@ public class AuthServiceImpl implements AuthService {
return ResultBody.success(AppUserSucVO.builder().token(token).uid(userAccountVO.getUid()).phoneNum(userAccountVO.getPhoneNum()) return ResultBody.success(AppUserSucVO.builder().token(token).uid(userAccountVO.getUid()).phoneNum(userAccountVO.getPhoneNum())
.nickName(userAccountVO.getNickName()).userAccountId(userAccountVO.getId()).build()); .nickName(userAccountVO.getNickName()).userAccountId(userAccountVO.getId()).build());
} }
return null; return ResultBody.error(ResultEnum.APPLET_LOGIN_ERROR);
} }
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论