Bladeren bron

Merge remote-tracking branch 'origin/master'

lyx 3 maanden geleden
bovenliggende
commit
b39d78330c

+ 5 - 2
alien-store/src/main/java/shop/alien/store/controller/StoreUserController.java

@@ -114,8 +114,11 @@ public class StoreUserController {
     @GetMapping("/changePhoneVerification")
     public R<Map<String, String>> changePhoneVerification(String phone, String oldPassword, String verificationCode) {
         log.info("StoreUserController.changePhoneVerification?phone={}&oldPassword={}&verificationCode={}", phone,  oldPassword,  verificationCode);
-        return R.data(storeUserService.changePhoneVerification(phone, oldPassword, verificationCode));
-
+        try {
+            return R.data(storeUserService.changePhoneVerification(phone, oldPassword, verificationCode));
+        } catch (Exception e) {
+            return R.fail(e.getMessage());
+        }
     }
 
     @ApiOperation("修改用户信息")

+ 5 - 2
alien-store/src/main/java/shop/alien/store/service/impl/StoreUserServiceImpl.java

@@ -260,6 +260,9 @@ public class StoreUserServiceImpl extends ServiceImpl<StoreUserMapper, StoreUser
             String oldPhoneVerification = "verification_" + phone;
             //获取新手机号验证码
             String redisVerificationCode = baseRedisService.getString(oldPhoneVerification);
+            if(StringUtils.isEmpty(redisVerificationCode)){
+                throw new RuntimeException("验证码已失效 请重新获取验证码");
+            }
             if (redisVerificationCode.equals(verificationCode)) {
                 changePhoneMap.put("verificationStatus", "1");
                 return changePhoneMap;
@@ -285,8 +288,8 @@ public class StoreUserServiceImpl extends ServiceImpl<StoreUserMapper, StoreUser
             wrapperFans.eq(StoreUser::getPassword, password);
             StoreUser storeUserPw = this.getOne(wrapperFans);
             if (storeUserPw == null || storeUserPw.getPassword().equals("")) {
-                log.info("密码输入错误 请重新输入");
-                throw new RuntimeException("密码输入错误 请重新输入");
+                log.info("密码错误");
+                throw new RuntimeException("密码错误");
             }
         }
     }