|
@@ -10,6 +10,7 @@ import com.caimei365.user.utils.ImageCaptchaUtil;
|
|
|
import com.caimei365.user.utils.ValidateUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
@@ -31,6 +32,8 @@ public class BaseServiceImpl implements BaseService {
|
|
|
private RedisService redisService;
|
|
|
@Resource
|
|
|
private BaseMapper baseMapper;
|
|
|
+ @Value("${spring.cloud.config.profile}")
|
|
|
+ private String profile;
|
|
|
|
|
|
/**
|
|
|
* 获取图片验证码
|
|
@@ -39,6 +42,7 @@ public class BaseServiceImpl implements BaseService {
|
|
|
*/
|
|
|
@Override
|
|
|
public ResponseJson<Map<String, Object>> getCaptchaImage(Integer platformType) {
|
|
|
+ log.info(profile);
|
|
|
Map<String, Object> result = new HashMap<>(2);
|
|
|
try {
|
|
|
ImageCaptchaUtil.Captcha captcha = null;
|
|
@@ -103,8 +107,17 @@ public class BaseServiceImpl implements BaseService {
|
|
|
// 验证手机号
|
|
|
String result = ValidateUtil.validateMobile(mobile);
|
|
|
if (result != null) {return ResponseJson.error(result);}
|
|
|
+ if (StringUtils.isNotBlank(profile)) {
|
|
|
+ // 开发 和 测试环境 固定短信验证码 666666
|
|
|
+ if("dev".equals(profile) || "beta".equals(profile)){
|
|
|
+ redisService.set("code:"+mobile, "666666", 1800L);
|
|
|
+ String codeType = activateCodeType == 1 ? "找回密码" : (activateCodeType == 2 ? "注册机构" : "注册供应商");
|
|
|
+ log.info(codeType + ",发送到:" + mobile + "的短信验证码("+ profile +")为: 666666");
|
|
|
+ return ResponseJson.success("发送验证码成功");
|
|
|
+ }
|
|
|
+ }
|
|
|
// 检查图片验证码
|
|
|
- if (null != isCheckCaptcha && isCheckCaptcha != 1){
|
|
|
+ if (null == isCheckCaptcha || 0 == isCheckCaptcha){
|
|
|
Boolean checkFlag = checkCaptchaImage(token, imgCode, platformType);
|
|
|
if (!checkFlag) {
|
|
|
return ResponseJson.error("图片验证码错误");
|
|
@@ -160,8 +173,16 @@ public class BaseServiceImpl implements BaseService {
|
|
|
// 验证手机号
|
|
|
String result = ValidateUtil.validateMobile(mobile);
|
|
|
if (result != null) {return ResponseJson.error(result);}
|
|
|
+ if (StringUtils.isNotBlank(profile)) {
|
|
|
+ // 开发 和 测试环境 固定短信验证码 666666
|
|
|
+ if("dev".equals(profile) || "beta".equals(profile)){
|
|
|
+ redisService.set("code:"+mobile, "666666", 1800L);
|
|
|
+ log.info("绑定账号,发送到:" + mobile + "的短信验证码("+ profile +")为: 666666");
|
|
|
+ return ResponseJson.success("发送验证码成功");
|
|
|
+ }
|
|
|
+ }
|
|
|
// 检查图片验证码
|
|
|
- if (null != isCheckCaptcha && isCheckCaptcha != 1){
|
|
|
+ if (null == isCheckCaptcha || 0 == isCheckCaptcha){
|
|
|
Boolean checkFlag = checkCaptchaImage(token, imgCode, platformType);
|
|
|
if (!checkFlag) {
|
|
|
return ResponseJson.error("图片验证码错误");
|