Browse Source

修复登录注册验证码报错

qmj 1 week ago
parent
commit
1fc1685fc9

+ 5 - 9
ruoyi-admin/src/main/java/com/ruoyi/app/user/InfoUserController.java

@@ -35,7 +35,7 @@ import com.ruoyi.system.service.IVipUserService;
 import com.ruoyi.system.utils.Auth;
 import com.ruoyi.system.utils.JwtUtil;
 import com.ruoyi.system.utils.MobileSMS;
-import com.ruoyi.system.utils.RedisUtils;
+
 import eu.bitwalker.useragentutils.UserAgent;
 import org.apache.commons.lang3.RandomStringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -228,8 +228,7 @@ public class InfoUserController extends BaseController {
     @Anonymous
     @PostMapping("/addqishou")
     public AjaxResult addqishou(@RequestBody UserDTO userDTO) {
-        RedisUtils redisUtils = new RedisUtils();
-        String ncode = redisUtils.get(userDTO.getTelPhone().trim().replaceAll("\\+", ""));
+        String ncode = redisCache.getCacheObject(userDTO.getTelPhone().trim().replaceAll("\\+", ""));
         if (infoUserService.getinfouserName(userDTO.getUserName()) != null) {
             throw new ServiceException(MessageUtils.message("no.user.add") + userDTO.getUserName() + MessageUtils.message("no.user.login.exist"));
         }
@@ -281,8 +280,7 @@ public class InfoUserController extends BaseController {
     @Anonymous
     @PostMapping("/addshanghu")
     public AjaxResult addshanghu(@RequestBody UserDTO userDTO) {
-        RedisUtils jedis = new RedisUtils();
-        String ncode = jedis.get(userDTO.getTelPhone().trim().replaceAll("\\+", ""));
+        String ncode = redisCache.getCacheObject(userDTO.getTelPhone().trim().replaceAll("\\+", ""));
         if (infoUserService.getinfouserName(userDTO.getUserName()) != null) {
             throw new ServiceException(MessageUtils.message("no.user.add") + userDTO.getUserName() + MessageUtils.message("no.user.login.exist"));
         }
@@ -557,8 +555,7 @@ public class InfoUserController extends BaseController {
     public AjaxResult Bindingphone(@RequestHeader String token, @RequestBody UserDTO userDTO) {
         JwtUtil jwtUtil = new JwtUtil();
         String id = jwtUtil.getusid(token);
-        RedisUtils redisUtils = new RedisUtils();
-        String xcode = redisUtils.get(userDTO.getTelPhone().trim().replaceAll("\\+", ""));
+        String xcode = redisCache.getCacheObject(userDTO.getTelPhone().trim().replaceAll("\\+", ""));
         if (userDTO.getCode().equals(xcode)) {
             InfoUser user = infoUserService.getById(id);
             if (user == null) {
@@ -746,9 +743,8 @@ public class InfoUserController extends BaseController {
     @Anonymous
     @PostMapping("/lodeing")
     public AjaxResult lodeing(@RequestBody UserDTO userDTO) {
-        RedisUtils redisUtils = new RedisUtils();
         JwtUtil tokn = new JwtUtil();
-        String xcode = redisUtils.get(userDTO.getPhone().trim().replaceAll("\\+", ""));
+        String xcode = redisCache.getCacheObject(userDTO.getPhone().trim().replaceAll("\\+", ""));
         if (xcode == null) {
             if (userDTO.getCode().equals("8888")) {
                 InfoUser infoUser = infoUserService.getuser(userDTO.getPhone());