Browse Source

修复短信发送bug

杨杰 6 years ago
parent
commit
a84106d1a6
1 changed files with 3 additions and 3 deletions
  1. 3 3
      src/main/java/com/llisoft/sms/service/SmsService.java

+ 3 - 3
src/main/java/com/llisoft/sms/service/SmsService.java

@@ -44,7 +44,7 @@ public class SmsService {
 		}
 		if (!debug && !aliyunService.afs(appkey, scene, token, sessionId, sig, ip)) {
 			logger.warn("人机验证失败:{}", token);
-			throw new MtaException("人机验证失败");
+			throw new MtaException("人机验证失败,请刷新页面后重试");
 		}
 		// 检查号码
 		logger.info("检查手机号: {}", phone);
@@ -84,7 +84,7 @@ public class SmsService {
 				logger.warn("每小时限制5条: {}", phone);
 				return false;
 			}
-			RedisUtil.set(key, count, 1, TimeUnit.HOURS);
+			RedisUtil.set(key, count+1, 1, TimeUnit.HOURS);
 		}else {
 			RedisUtil.set(key, 1, 1, TimeUnit.HOURS);
 		}
@@ -97,7 +97,7 @@ public class SmsService {
 				logger.warn("每天限制10条: {}", phone);
 				return false;
 			}
-			RedisUtil.set(key, count, 1, TimeUnit.DAYS);
+			RedisUtil.set(key, count+1, 1, TimeUnit.DAYS);
 		}else {
 			RedisUtil.set(key, 1, 1, TimeUnit.DAYS);
 		}