feat: user update mobile

This commit is contained in:
zzw
2026-10-21 13:55:38 +08:00
parent 2aac448925
commit 8f1e63c95a
5 changed files with 30 additions and 9 deletions
@@ -75,6 +75,14 @@ func (l *UpdateLogic) Update(in *user.UpdateReq) (*user.Response, error) {
return failResponse(utils.ErrorEncryptAesError), nil
}
if enc != row.Mobile {
ok, verifyErr := verifyAndConsumeSmsCode(l.ctx, dao.SmsSceneRebindMobile, req.Mobile, req.SmsCode)
if verifyErr != nil {
l.Errorf("update verify sms: %v", verifyErr)
return failResponse(utils.Fail), nil
}
if !ok {
return outResponse(utils.ErrorParams, "验证码错误或已过期"), nil
}
occupied, occErr := findUserByMobile(enc)
if occErr != nil {
l.Errorf("update mobile unique: %v", occErr)