Commit bfd26b2d by 伍思炜

修复redis问题

parent d423d718
...@@ -18,6 +18,7 @@ import org.apache.commons.lang3.StringUtils; ...@@ -18,6 +18,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
...@@ -59,7 +60,7 @@ public class codeManagerController extends BaseController { ...@@ -59,7 +60,7 @@ public class codeManagerController extends BaseController {
@Autowired @Autowired
private AuthCodeMapper authCodeMapper; private AuthCodeMapper authCodeMapper;
@Autowired @Autowired
@Qualifier("redisStringTemplate") // @Qualifier("redisStringTemplate")
private RedisTemplate redisTemplate; private RedisTemplate redisTemplate;
@Autowired @Autowired
private ProductMapper productMapper; private ProductMapper productMapper;
...@@ -75,6 +76,9 @@ public class codeManagerController extends BaseController { ...@@ -75,6 +76,9 @@ public class codeManagerController extends BaseController {
@Autowired @Autowired
private SaveAuthCodeUtil saveAuthCodeUtil; private SaveAuthCodeUtil saveAuthCodeUtil;
@Autowired
private StringRedisTemplate stringRedisTemplate;
private static String PATH1 = "StudentCard1"; private static String PATH1 = "StudentCard1";
private static String PATH2 = "StudentCard2"; private static String PATH2 = "StudentCard2";
...@@ -164,7 +168,7 @@ public class codeManagerController extends BaseController { ...@@ -164,7 +168,7 @@ public class codeManagerController extends BaseController {
try { try {
// 生成6位随机数 // 生成6位随机数
int veCode = (int) ((RandomUtil.getSecrityRandom() * 9 + 1) * 100000); int veCode = (int) ((RandomUtil.getSecrityRandom() * 9 + 1) * 100000);
redisTemplate.opsForValue().set(phone, String.valueOf(veCode), 30, TimeUnit.MINUTES); stringRedisTemplate.opsForValue().set(phone, String.valueOf(veCode), 30, TimeUnit.MINUTES);
saveAuthCodeUtil.saveAuthCode(phone, String.valueOf(veCode)); // 临时保存数据库 saveAuthCodeUtil.saveAuthCode(phone, String.valueOf(veCode)); // 临时保存数据库
SendSmsAndMail.sendSms(phone, veCode + "", null, "7"); SendSmsAndMail.sendSms(phone, veCode + "", null, "7");
log.info("验证码:" + veCode); log.info("验证码:" + veCode);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment