|
|
@@ -104,7 +104,7 @@ public class WxLoginService
|
|
|
loginUser.setUser(user);
|
|
|
Map<String,Object> map = new HashMap<>();
|
|
|
map.put(Constants.TOKEN,wxTokenService.createToken(loginUser));
|
|
|
- map.put("union_id",loginUser.getUser().getUnionId());
|
|
|
+ map.put("user_account",loginUser.getUser().getUserAccount());
|
|
|
map.put("full_info",Validator.isEmpty(user.getIdCard())?false:true); //是否完善身份信息
|
|
|
return map;
|
|
|
}
|
|
|
@@ -215,10 +215,13 @@ public class WxLoginService
|
|
|
JSONObject jsonObject = (JSONObject) JSONObject.parse(resultString);
|
|
|
String session_key = String.valueOf(jsonObject.get("session_key"));
|
|
|
String openId = String.valueOf(jsonObject.get("openid"));
|
|
|
- String unionId = String.valueOf(jsonObject.get("unionid"));
|
|
|
+ String unionId = null;
|
|
|
+ if(jsonObject.containsKey("unionid")){ //当没绑定开放平台
|
|
|
+ unionId = String.valueOf(jsonObject.get("unionid"));
|
|
|
+ }
|
|
|
String phoneNumber = obtainWxPhone(loginBody.getIv(),loginBody.getEncryptedData(),session_key);
|
|
|
if(Validator.isEmpty(phoneNumber)){
|
|
|
- throw new CustomException("该微信没有绑定手机号码");
|
|
|
+ throw new CustomException("该微信没有绑定手机号码"+resultString);
|
|
|
}
|
|
|
User user = iUserService.getOne(new LambdaQueryWrapper<User>()
|
|
|
.eq(User::getTelphone,phoneNumber).last("limit 1"));
|
|
|
@@ -227,7 +230,7 @@ public class WxLoginService
|
|
|
user.setUnionId(unionId);
|
|
|
user.setLastLoginTime(DateUtils.getNowTime());
|
|
|
user.setUpdateTime(DateUtils.getNowTime());
|
|
|
- iUserService.save(user);
|
|
|
+ iUserService.updateById(user);
|
|
|
}else{
|
|
|
//手机匹配不上再匹配openid
|
|
|
user = iUserService.getOne(new LambdaQueryWrapper<User>()
|
|
|
@@ -236,7 +239,7 @@ public class WxLoginService
|
|
|
user.setUnionId(unionId);
|
|
|
user.setUpdateTime(DateUtils.getNowTime());
|
|
|
user.setLastLoginTime(DateUtils.getNowTime());
|
|
|
- iUserService.save(user);
|
|
|
+ iUserService.updateById(user);
|
|
|
}
|
|
|
if(user==null){
|
|
|
if(!register_small(openId,unionId,phoneNumber,loginBody.getInviteCode())){
|