feat 补充漏掉的微信小程序绑定手机号的接口

This commit is contained in:
damonyuan 2024-11-14 18:09:50 +08:00
parent 74a11a02c7
commit 3eebfae99d
2 changed files with 12 additions and 1 deletions

View File

@ -94,7 +94,7 @@ public class UserController {
return AjaxResult.success(); return AjaxResult.success();
} }
@PostMapping("/mnpMobile") @PostMapping("/getMobileByMnp")
@ApiOperation(value="微信手机号") @ApiOperation(value="微信手机号")
public AjaxResult<Object> mnpMobile(@Validated @RequestBody UserPhoneMnpValidate mobileValidate) { public AjaxResult<Object> mnpMobile(@Validated @RequestBody UserPhoneMnpValidate mobileValidate) {
iUserService.mnpMobile(mobileValidate.getCode().trim()); iUserService.mnpMobile(mobileValidate.getCode().trim());

View File

@ -307,6 +307,17 @@ public class UserServiceImpl implements IUserService {
WxMaPhoneNumberInfo wxMaPhoneNumberInfo = wxMaService.getUserService().getNewPhoneNoInfo(code); WxMaPhoneNumberInfo wxMaPhoneNumberInfo = wxMaService.getUserService().getNewPhoneNoInfo(code);
Integer userId = LikeFrontThreadLocal.getUserId(); Integer userId = LikeFrontThreadLocal.getUserId();
User userCheck = userMapper.selectOne(new QueryWrapper<User>()
.select("id,account,mobile")
.eq("mobile", wxMaPhoneNumberInfo.getPhoneNumber())
.isNull("delete_time")
.last("limit 1"));
if (StringUtils.isNotNull(userCheck) && userCheck.getId().equals(userId) == false) {
throw new OperateException("手机号已被其它账号绑定!");
}
User user = new User(); User user = new User();
user.setId(userId); user.setId(userId);
user.setMobile(wxMaPhoneNumberInfo.getPhoneNumber()); user.setMobile(wxMaPhoneNumberInfo.getPhoneNumber());