|
|
@@ -11,6 +11,7 @@ import com.YuyeTech.TPlat.game.TP_AppleInfo.projo.AppleInfo;
|
|
|
import com.YuyeTech.TPlat.game.TP_AppleInfo.service.AppleInfoService;
|
|
|
import com.YuyeTech.TPlat.game.TP_WxInfo.projo.WxInfo;
|
|
|
import com.YuyeTech.TPlat.game.TP_WxInfo.service.WxInfoService;
|
|
|
+import com.YuyeTech.TPlat.game.TP_WxInfo.vo.WxInfoVo;
|
|
|
import com.YuyeTech.TPlat.game.userinfo.projo.MainInfo;
|
|
|
import com.YuyeTech.TPlat.game.userinfo.projo.UserInfo;
|
|
|
import com.YuyeTech.TPlat.game.userinfo.service.MainInfoService;
|
|
|
@@ -141,7 +142,8 @@ public class LoginController {
|
|
|
//检查redis 的token 是否存在,存在则删除
|
|
|
String headToken = request.getHeader("token");
|
|
|
if (StringUtils.isNotBlank(headToken)) {
|
|
|
- Boolean bSuccess = redisTemplate.delete(String.format(RedisConstant.TOKEN_PREFIX, headToken));
|
|
|
+// Boolean bSuccess = redisTemplate.delete(String.format(RedisConstant.TOKEN_PREFIX, headToken));
|
|
|
+ Boolean bSuccess = redisSettingMap.deleteValue(RedisType.TOKEN,headToken);
|
|
|
if (!bSuccess) {
|
|
|
//删除不成功,redis不存在,是非法token
|
|
|
log.info("redis 没有对应的token");
|
|
|
@@ -165,7 +167,10 @@ public class LoginController {
|
|
|
wxInfo.setUserId(mainInfo.getUserId());
|
|
|
wxInfo.setOpenid(openid);
|
|
|
wxInfo.setUnionid(unionid);
|
|
|
+ wxInfo.setCreateTime(DateUtil.date());
|
|
|
+ wxInfo.setUpdateTime(DateUtil.date());
|
|
|
wxInfoService.addWxInfo(wxInfo);
|
|
|
+// wxInfoService.saveReturnVo(CopyUtil.copy(wxInfo, WxInfoVo.class));
|
|
|
} else {
|
|
|
mainInfo = mainInfoService.findMainInfoById(wxInfo.getUserId());
|
|
|
}
|
|
|
@@ -212,7 +217,7 @@ public class LoginController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 查询是否存在userInfo对应用户数据,如果存在。则判断为新用户
|
|
|
+ * 查询是否存在userInfo对应用户数据,如果不存在。则判断为新用户
|
|
|
* @param userId
|
|
|
* @return
|
|
|
*/
|
|
|
@@ -241,7 +246,8 @@ public class LoginController {
|
|
|
//检查redis 的token 是否存在,存在则删除
|
|
|
String headToken = request.getHeader("token");
|
|
|
if (StringUtils.isNotBlank(headToken)) {
|
|
|
- Boolean bSuccess = redisTemplate.delete(String.format(RedisConstant.TOKEN_PREFIX, headToken));
|
|
|
+// Boolean bSuccess = redisTemplate.delete(String.format(RedisConstant.TOKEN_PREFIX, headToken));
|
|
|
+ Boolean bSuccess = redisSettingMap.deleteValue(RedisType.TOKEN,headToken);
|
|
|
if (!bSuccess) {
|
|
|
//删除不成功,redis不存在,是非法token
|
|
|
// throw new WxInfoException(ResultEnum.TOKEN_IS_ILLEGAL.getCode(), ResultEnum.TOKEN_IS_ILLEGAL.getMessage());
|
|
|
@@ -272,7 +278,10 @@ public class LoginController {
|
|
|
wxInfo = new WxInfo();
|
|
|
wxInfo.setUserId(mainInfo.getUserId());
|
|
|
wxInfo.setOpenid(session.getOpenid());
|
|
|
+ wxInfo.setCreateTime(DateUtil.date());
|
|
|
+ wxInfo.setUpdateTime(DateUtil.date());
|
|
|
wxInfoService.addWxInfo(wxInfo);
|
|
|
+// wxInfoService.saveReturnVo(CopyUtil.copy(wxInfo, WxInfoVo.class));
|
|
|
}
|
|
|
|
|
|
//拿到微信对应的用户userid
|
|
|
@@ -601,7 +610,10 @@ public class LoginController {
|
|
|
wxInfo.setUnionid(unionid);
|
|
|
wxInfo.setOpenid(openid);
|
|
|
wxInfo.setUserId(userId);
|
|
|
+ wxInfo.setCreateTime(DateUtil.date());
|
|
|
+ wxInfo.setUpdateTime(DateUtil.date());
|
|
|
wxInfoService.addWxInfo(wxInfo);
|
|
|
+// wxInfoService.saveReturnVo(CopyUtil.copy(wxInfo, WxInfoVo.class));
|
|
|
} else {
|
|
|
//提示用户微信已被使用
|
|
|
return ResultVOUtil.error(UserEnum.USER_HAS_REGISTER_WX.getCode(), UserEnum.USER_HAS_REGISTER_WX.getMessage());
|
|
|
@@ -844,9 +856,15 @@ public class LoginController {
|
|
|
// }
|
|
|
//todo 假如删除了用户的main_info 信息(正常流程是不会删除),会导致客户的一直判断跳转新用户界面,
|
|
|
// 如果需要清空用户信息,清除main_info 信息后,要删除对应的token值,
|
|
|
- LoginVO loginVO = new LoginVO();
|
|
|
- loginVO.setNewUser(bUserInfoByUserId(userId));
|
|
|
- return ResultVOUtil.success(loginVO);
|
|
|
+ try {
|
|
|
+ mainInfoService.findMainInfoById(userId);
|
|
|
+ LoginVO loginVO = new LoginVO();
|
|
|
+ loginVO.setNewUser(bUserInfoByUserId(userId));
|
|
|
+ return ResultVOUtil.success(loginVO);
|
|
|
+ }catch (UserException e){
|
|
|
+ return ResultVOUtil.error(ResultEnum.TOKEN_FILTER_ERROR);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -860,7 +878,8 @@ public class LoginController {
|
|
|
|
|
|
String headToken = request.getHeader("token");
|
|
|
if (StringUtils.isNotBlank(headToken)) {
|
|
|
- Boolean bSuccess = redisTemplate.delete(String.format(RedisConstant.TOKEN_PREFIX, headToken));
|
|
|
+// Boolean bSuccess = redisTemplate.delete(String.format(RedisConstant.TOKEN_PREFIX, headToken));
|
|
|
+ Boolean bSuccess = redisSettingMap.deleteValue(RedisType.TOKEN,headToken);
|
|
|
if (!bSuccess) {
|
|
|
//删除不成功,redis不存在,是非法token
|
|
|
log.info("redis 没有对应的token");
|
|
|
@@ -882,7 +901,8 @@ public class LoginController {
|
|
|
//检查redis 的token 是否存在,存在则删除
|
|
|
String headToken = request.getHeader("token");
|
|
|
if (StringUtils.isNotBlank(headToken)) {
|
|
|
- Boolean bSuccess = redisTemplate.delete(String.format(RedisConstant.TOKEN_PREFIX, headToken));
|
|
|
+// Boolean bSuccess = redisTemplate.delete(String.format(RedisConstant.TOKEN_PREFIX, headToken));
|
|
|
+ Boolean bSuccess = redisSettingMap.deleteValue(RedisType.TOKEN,headToken);
|
|
|
if (!bSuccess) {
|
|
|
//删除不成功,redis不存在,是非法token
|
|
|
log.info("redis 没有对应的token");
|
|
|
@@ -925,6 +945,8 @@ public class LoginController {
|
|
|
appleInfo = new AppleInfo();
|
|
|
appleInfo.setUserId(mainInfo.getUserId());
|
|
|
appleInfo.setAppleId(json.getString("sub"));
|
|
|
+ appleInfo.setCreateTime(DateUtil.date());
|
|
|
+ appleInfo.setUpdateTime(DateUtil.date());
|
|
|
appleInfoService.addAppleInfo(appleInfo);
|
|
|
} else {
|
|
|
mainInfo = mainInfoService.findMainInfoById(appleInfo.getUserId());
|