|
@@ -147,8 +147,12 @@ public class LoginServiceImpl implements ILoginService {
|
|
LoginByCodeVo result = new LoginByCodeVo();
|
|
LoginByCodeVo result = new LoginByCodeVo();
|
|
String[] ids = weChatUtil.getMpOpenid(dto.getCode());
|
|
String[] ids = weChatUtil.getMpOpenid(dto.getCode());
|
|
if (ids == null) throw new MyException("code无效");
|
|
if (ids == null) throw new MyException("code无效");
|
|
- User user = userService.getOne(Wrappers.lambdaQuery(User.class).eq(User::getUnionId, ids[1]));
|
|
|
|
- if (user == null) throw new MyException("code无效");
|
|
|
|
|
|
+ if (StrUtil.isEmpty(ids[1])) {
|
|
|
|
+ throw new MyException("无法获取Uid"+ids[0]+"-"+ids[1]);
|
|
|
|
+ }
|
|
|
|
+ List<User> userList = userService.list(Wrappers.lambdaQuery(User.class).eq(User::getUnionId, ids[1]));
|
|
|
|
+ if (userList == null || userList.size() == 0) throw new MyException("code无效");
|
|
|
|
+ User user = userList.get(0);
|
|
user.setOpenId(ids[0]);
|
|
user.setOpenId(ids[0]);
|
|
userService.updateById(user);
|
|
userService.updateById(user);
|
|
result.setToken(ids[0]);
|
|
result.setToken(ids[0]);
|