Browse Source

fix:不使用验证码时的处理

caozixuan 3 years ago
parent
commit
d40c89234c

+ 6 - 3
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/SysUserServiceImpl.java

@@ -789,9 +789,12 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
     @Transactional
     @Override
     public void expiredVerifyCode(Long userId, String mobileNumber) {
-        int count = this.baseMapper.updateVerifyCodeExpiredTime(userId,mobileNumber);
-        if (count != 1){
-            throw ExceptionResultEnum.ERROR.exception("验证码过期失败");
+        SysConfig value = sysConfigService.getByKey("sys.code.enable");
+        if (Objects.nonNull(value) && value.getConfigValue().equals("true")) {
+            int count = this.baseMapper.updateVerifyCodeExpiredTime(userId, mobileNumber);
+            if (count != 1) {
+                throw ExceptionResultEnum.ERROR.exception("验证码过期失败");
+            }
         }
     }