|
|
@@ -81,6 +81,11 @@ public class TaskFrontController {
|
|
|
@NoSubmit
|
|
|
public Result<String> bindPhone(@RequestBody LoginPhoneReq phoneReq) {
|
|
|
Long userId = StpUserUtil.getLoginIdAsLong();
|
|
|
+ UserBindPhone other = userBindPhoneMapper.selectOne(Wrappers.lambdaQuery(UserBindPhone.class)
|
|
|
+ .eq(UserBindPhone::getPhone, phoneReq.getPhone()).ne(UserBindPhone::getUserId, userId).select(UserBindPhone::getId).last("limit 1"));
|
|
|
+ if (other != null) {
|
|
|
+ throw BusinessRuntimeException.getInstance("该手机号已被绑定");
|
|
|
+ }
|
|
|
UserBindPhone bindPhone = userBindPhoneMapper.selectOne(Wrappers.lambdaQuery(UserBindPhone.class)
|
|
|
.eq(UserBindPhone::getUserId, userId).last("limit 1"));
|
|
|
if (bindPhone != null) {
|
|
|
@@ -114,6 +119,11 @@ public class TaskFrontController {
|
|
|
if (bindPhone == null) {
|
|
|
throw BusinessRuntimeException.getInstance("您未绑定手机号");
|
|
|
}
|
|
|
+ UserBindPhone other = userBindPhoneMapper.selectOne(Wrappers.lambdaQuery(UserBindPhone.class)
|
|
|
+ .eq(UserBindPhone::getPhone, phoneReq.getPhone()).ne(UserBindPhone::getUserId, userId).select(UserBindPhone::getId).last("limit 1"));
|
|
|
+ if (other != null) {
|
|
|
+ throw BusinessRuntimeException.getInstance("该手机号已被绑定");
|
|
|
+ }
|
|
|
phoneCodeService.checkPhone(phoneReq.getPhone(), phoneReq.getCode());
|
|
|
bindPhone.setPhone(phoneReq.getPhone());
|
|
|
userBindPhoneMapper.updateById(bindPhone);
|