|
@@ -10,10 +10,13 @@ import com.yonge.cooleshow.biz.dal.enums.MessageTypeEnum;
|
|
|
import com.yonge.cooleshow.biz.dal.service.SmsCodeService;
|
|
|
import com.yonge.cooleshow.biz.dal.service.SysConfigService;
|
|
|
import com.yonge.cooleshow.biz.dal.service.SysMessageService;
|
|
|
+import com.yonge.cooleshow.common.constant.SysConfigConstant;
|
|
|
+import com.yonge.cooleshow.common.security.SecurityConstants;
|
|
|
import com.yonge.toolset.base.exception.BizException;
|
|
|
import com.yonge.toolset.thirdparty.message.MessageSenderPluginContext;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.List;
|
|
@@ -27,6 +30,8 @@ public class SmsCodeServiceImpl implements SmsCodeService {
|
|
|
private SysUserFeignService sysUserFeignService;
|
|
|
@Autowired
|
|
|
private SysConfigService sysConfigService;
|
|
|
+ @Autowired
|
|
|
+ private RedisTemplate<String,String> redisTemplate;
|
|
|
|
|
|
@Override
|
|
|
public boolean verifyValidCode(String mobile, String authCode, String type) {
|
|
@@ -52,7 +57,22 @@ public class SmsCodeServiceImpl implements SmsCodeService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public boolean sendValidCode(String mobile, String type, ClientEnum platform) {
|
|
|
+ public boolean sendValidCode(String mobile, String type, ClientEnum platform, String code) {
|
|
|
+
|
|
|
+ String configValue = sysConfigService.findConfigValue(SysConfigConstant.SMS_SEND_VERIFY);
|
|
|
+ if(StringUtils.isNotEmpty(configValue) && "1".equals(configValue)) {
|
|
|
+ if (StringUtils.isEmpty(mobile) || StringUtils.isEmpty(code)) {
|
|
|
+ throw new BizException("图形验证码错误");
|
|
|
+ }
|
|
|
+ String redisKey = MessageTypeEnum.KAPTCHA_SESSION_KEY + mobile;
|
|
|
+ if (redisTemplate.hasKey(redisKey)) {
|
|
|
+ if (!StringUtils.equalsIgnoreCase(redisTemplate.opsForValue().get(redisKey), code)) {
|
|
|
+ throw new BizException("图形验证码错误");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ throw new BizException("图形验证码错误");
|
|
|
+ }
|
|
|
+ }
|
|
|
//SMS_VERIFY_CODE_LOGOFF
|
|
|
SysUser sysUser = sysUserFeignService.queryUserByMobile(mobile);
|
|
|
// 修改手机号 有用户了不许修改
|