更换短信验证码
This commit is contained in:
@@ -232,7 +232,6 @@ public class MyUserController {
|
||||
return R.error(500,"短信验证码频率过高,请稍后再试!");
|
||||
}
|
||||
}
|
||||
|
||||
//生成随机六位数
|
||||
Random random = new Random();
|
||||
String i = random.nextInt(999999) + "";
|
||||
@@ -242,14 +241,10 @@ public class MyUserController {
|
||||
}
|
||||
i = sb.toString() + i;
|
||||
String code = i + "_"+System.currentTimeMillis();
|
||||
|
||||
//redis 缓存验证码
|
||||
redisTemplate.opsForValue().set("RegistCode"+phone,code,5, TimeUnit.MINUTES);
|
||||
|
||||
//发送
|
||||
userService.sendCodeForRegister(phone,code,areacode);
|
||||
|
||||
return R.ok();
|
||||
return userService.sendCodeForRegister(phone,code,areacode);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.peanut.modules.book.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.common.entity.BookForumArticlesEntity;
|
||||
import com.peanut.modules.common.entity.MyUserEntity;
|
||||
import java.util.List;
|
||||
@@ -19,7 +20,7 @@ public interface MyUserService extends IService<MyUserEntity> {
|
||||
|
||||
PageUtils queryPage(Map<String, Object> params);
|
||||
|
||||
void sendCodeForRegister(String phone, String code,Integer areaCode) throws Exception;
|
||||
R sendCodeForRegister(String phone, String code, Integer areaCode) throws Exception;
|
||||
|
||||
List<BookForumArticlesEntity> getForumsLimit(Integer book_id, Integer limit);
|
||||
//充值花生币
|
||||
|
||||
@@ -30,6 +30,8 @@ public class MyUserServiceImpl extends ServiceImpl<MyUserDao, MyUserEntity> impl
|
||||
@Autowired
|
||||
private SMSConfig smsConfig;
|
||||
@Autowired
|
||||
private SmsUtil smsUtil;
|
||||
@Autowired
|
||||
private UserEbookBuyService userEbookBuyService;
|
||||
@Autowired
|
||||
private BookForumArticlesService bookForumArticlesService;
|
||||
@@ -45,9 +47,14 @@ public class MyUserServiceImpl extends ServiceImpl<MyUserDao, MyUserEntity> impl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendCodeForRegister(String phone, String code,Integer areaCode) throws Exception {
|
||||
public R sendCodeForRegister(String phone, String code,Integer areaCode) throws Exception {
|
||||
String scode = code.split("_")[0];
|
||||
sendCode(phone,scode,areaCode);
|
||||
// sendCode(phone,scode,areaCode);
|
||||
if (areaCode!=null&&areaCode>0&&areaCode!=86){
|
||||
return smsUtil.sendSmsAbroad(""+areaCode+phone,scode);
|
||||
}else {
|
||||
return smsUtil.sendSmsCode(phone,scode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user