登录部分

This commit is contained in:
2024-06-05 09:25:53 +08:00
parent fefb4c3a85
commit b7ce764bdb
4 changed files with 28 additions and 10 deletions

View File

@@ -98,7 +98,9 @@ public class LoginService {
}
}
else {
userInfo.setSearchWord(userInfo.getSearchWord() + "||微信用户");
if(!userInfo.getSearchWord().contains("微信用户")){
userInfo.setSearchWord(userInfo.getSearchWord() + "||微信用户");
}
userInfo.setMiniAppOpenId(openId);
userInfo.setUpdatedAt(System.currentTimeMillis());
tbUserInfoMapper.updateByPrimaryKeySelective(userInfo);
@@ -232,7 +234,7 @@ public class LoginService {
//生成token 信息
String token = null;
try {
token = TokenUtil.generateToken(userInfo.getId(), null, userInfo.getTelephone(), userInfo.getNickName());
token = TokenUtil.generateToken(userInfo.getId(), userInfo.getMiniAppOpenId(), userInfo.getTelephone(), userInfo.getNickName());
} catch (Exception e) {
throw new RuntimeException(e);
}
@@ -240,7 +242,12 @@ public class LoginService {
try {
map.put("token", token);
map.put("userInfo", userInfo);
redisUtil.saveMessage(RedisCst.ONLINE_APP_USER.concat(userInfo.getId() + ""), JSON.toJSONString(map));
if(StringUtils.isNotBlank(userInfo.getMiniAppOpenId())){
redisUtil.saveMessage(RedisCst.ONLINE_USER.concat(userInfo.getMiniAppOpenId()), JSON.toJSONString(map),60*60*24*30L);
}else {
redisUtil.saveMessage(RedisCst.ONLINE_USER.concat(userInfo.getId() + ""), JSON.toJSONString(map),60*60*24*30L);
}
// redisUtil.saveMessage(RedisCst.ONLINE_APP_USER.concat(userInfo.getId() + ""), JSON.toJSONString(map),60*60*24*30L);
return Result.success(CodeEnum.SUCCESS, map);
} catch (Exception e) {
e.printStackTrace();