|
@@ -25,6 +25,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.util.ObjectUtils;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.text.SimpleDateFormat;
|
|
@@ -343,11 +344,19 @@ public class BaseServiceImpl implements BaseService {
|
|
|
*/
|
|
|
@Override
|
|
|
public ResponseJson getLoginCode(String mobile) {
|
|
|
+
|
|
|
// 验证手机号
|
|
|
String result = ValidateUtil.validateMobile(mobile);
|
|
|
if (result != null) {
|
|
|
return ResponseJson.error(result);
|
|
|
}
|
|
|
+
|
|
|
+ Object resCode = redisService.get("code:" + mobile);
|
|
|
+ long expireTime = redisService.getExpireTime("code:" + mobile);
|
|
|
+ if (!ObjectUtils.isEmpty(resCode) || expireTime >= 0) {
|
|
|
+ return ResponseJson.error("验证码已发送,请勿重复操作");
|
|
|
+ }
|
|
|
+
|
|
|
Integer dbUserId = null;
|
|
|
// 根据手机号查询用户Id
|
|
|
dbUserId = baseMapper.getUserIdByMobile(mobile);
|
|
@@ -390,6 +399,12 @@ public class BaseServiceImpl implements BaseService {
|
|
|
if (result != null) {
|
|
|
return ResponseJson.error(result);
|
|
|
}
|
|
|
+ Object resCode = redisService.get("code:" + mobile);
|
|
|
+ long expireTime = redisService.getExpireTime("code:" + mobile);
|
|
|
+ if (!ObjectUtils.isEmpty(resCode) || expireTime >= 0) {
|
|
|
+ return ResponseJson.error("验证码已发送,请勿重复操作");
|
|
|
+ }
|
|
|
+
|
|
|
Integer dbUserId = null;
|
|
|
// 根据手机号查询用户Id
|
|
|
dbUserId = baseMapper.getUserIdByMobile(mobile);
|