From 4936fa79494c5a2111664b63576340da245e6580 Mon Sep 17 00:00:00 2001
From: yujian <yujian@123.com>
Date: 星期五, 23 八月 2019 17:27:25 +0800
Subject: [PATCH] 添加记录
---
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/SMSController.java | 71 +++++++++++++++++------------------
1 files changed, 35 insertions(+), 36 deletions(-)
diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/SMSController.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/SMSController.java
index 3090f2d..a88ac48 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/SMSController.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/SMSController.java
@@ -10,8 +10,6 @@
import org.yeshi.utils.JsonUtil;
import com.yeshi.fanli.entity.accept.AcceptData;
-import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode;
-import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode.ForbiddenUserIdentifyCodeTypeEnum;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.exception.SMSException;
import com.yeshi.fanli.service.inter.user.ForbiddenUserIdentifyCodeService;
@@ -33,18 +31,18 @@
@Resource
private UserInfoService userInfoService;
-
+
@Resource
private ForbiddenUserIdentifyCodeService forbiddenUserIdentifyCodeService;
// 鍙戦�佺煭淇�
+ @RequestSerializableByKey(key = "#phone+'-'+#uid+'-'+#type")
@RequestMapping(value = "sendSMS", method = RequestMethod.POST)
public void sendMSM(AcceptData acceptData, String phone, Long uid, Integer type, PrintWriter out) {
sendMSM(acceptData, phone, uid, type, StringUtil.Md5(phone + "-" + "-" + uid + "-" + type), out);
}
- @RequestSerializableByKey(key = "key")
public void sendMSM(AcceptData acceptData, String phone, Long uid, Integer type, String key, PrintWriter out) {
try {
if (phone.contains("**") && uid != null && uid > 0) {
@@ -70,10 +68,10 @@
out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
}
}
-
-
+
/**
- * 1.5.3 鐧诲綍鍙戦�佺煭淇�
+ * 1.5.3 鐧诲綍鍙戦�佺煭淇�
+ *
* @param acceptData
* @param phone
* @param uid
@@ -86,18 +84,19 @@
return;
}
phone = phone.replaceAll(" ", "");
-
- sendMSNnew(phone,slideVerify, 1, StringUtil.Md5(phone + "-" + acceptData.getDevice()), out);
+
+ sendMSNnew(phone, slideVerify, 1, StringUtil.Md5(phone + "-" + acceptData.getDevice()), out);
}
-
/**
* 1.5.3 缁戝畾鍙戦�佺煭淇�
+ *
* @param acceptData
* @param phone
* @param uid
* @param out
*/
+ @RequestSerializableByKey(key = "#acceptData.device+'-'+#phone")
@RequestMapping(value = "sendMSMBind", method = RequestMethod.POST)
public void sendMSMBind(AcceptData acceptData, String phone, boolean slideVerify, PrintWriter out) {
if (phone == null || !StringUtil.isMobile(phone.replaceAll(" ", ""))) {
@@ -105,27 +104,28 @@
return;
}
phone = phone.replaceAll(" ", "");
-
+
// 鍒ゆ柇鎵嬫満鍙风爜鏄惁琚皝绂�
- ForbiddenUserIdentifyCode identifyCode1 = forbiddenUserIdentifyCodeService
- .listByTypeAndIdentifyCode(ForbiddenUserIdentifyCodeTypeEnum.phone, phone);
- if (identifyCode1 != null && identifyCode1.getEffective() != null && identifyCode1.getEffective()) {
- out.print(JsonUtil.loadFalseResult(9001,"璇ョ數璇濆彿鐮佽鍗犵敤"));
- return;
- }
-
+ // ForbiddenUserIdentifyCode identifyCode1 =
+ // forbiddenUserIdentifyCodeService
+ // .listByTypeAndIdentifyCode(ForbiddenUserIdentifyCodeTypeEnum.phone,
+ // phone);
+ // if (identifyCode1 != null && identifyCode1.getEffective() != null &&
+ // identifyCode1.getEffective()) {
+ // out.print(JsonUtil.loadFalseResult(9001,"璇ョ數璇濆彿鐮佽鍗犵敤"));
+ // return;
+ // }
+ //
// 鍒ゆ柇鎵嬫満鍙风爜鏄惁琚皝绂�
UserInfo phoneUser = userInfoService.getEffectiveUserInfoByPhone(phone);
if (phoneUser != null) {
- out.print(JsonUtil.loadFalseResult(9001,"璇ョ數璇濆彿鐮佽鍗犵敤"));
+ out.print(JsonUtil.loadFalseResult(9001, "璇ョ數璇濆彿鐮佽鍗犵敤"));
return;
}
-
- sendMSNnew(phone,slideVerify, 2, StringUtil.Md5(phone + "-" + acceptData.getDevice()), out);
+
+ sendMSNnew(phone, slideVerify, 2, StringUtil.Md5(phone + "-" + acceptData.getDevice()), out);
}
-
-
- @RequestSerializableByKey(key = "key")
+
public void sendMSNnew(String phone, boolean slideVerify, int type, String key, PrintWriter out) {
try {
int count = 0;
@@ -137,31 +137,30 @@
// 缁戝畾楠岃瘉鐮�
cachekey = "sendMSNBindCount" + phone;
}
-
+
if (cachekey == null) {
- out.print(JsonUtil.loadFalseResult(1,"鍙戦�佸け璐�"));
+ out.print(JsonUtil.loadFalseResult(1, "鍙戦�佸け璐�"));
return;
}
-
+
String cacheValue = redisManager.getCommonString(cachekey);
if (!StringUtil.isNullOrEmpty(cacheValue)) {
count = Integer.parseInt(cacheValue);
// 闄愬埗3娆�
if (count >= 3) {
- out.print(JsonUtil.loadFalseResult(3,"楠岃瘉鐮佹鏁拌秴闄�,璇风◢鍚庡啀璇�"));
+ out.print(JsonUtil.loadFalseResult(3, "楠岃瘉鐮佹鏁拌秴闄�,璇风◢鍚庡啀璇�"));
return;
}
}
-
+
if (count == 2 && !slideVerify) {
- out.print(JsonUtil.loadFalseResult(2,"闇�瑕佹粦鍔ㄩ獙璇�"));
+ out.print(JsonUtil.loadFalseResult(2, "闇�瑕佹粦鍔ㄩ獙璇�"));
return;
- }
+ }
// 缂撳瓨涓�涓皬鏃�
- count ++;
+ count++;
redisManager.cacheCommonString(cachekey, count + "", 60 * 60);
-
-
+
if (type == 1) {
// 鐧诲綍楠岃瘉鐮�
smsService.sendLoginVCode(phone, 4);
@@ -169,9 +168,9 @@
// 缁戝畾楠岃瘉鐮�
smsService.sendBindVCode(phone, 4);
}
-
+
out.print(JsonUtil.loadTrueResult("鍙戦�佹垚鍔�"));
-
+
} catch (SMSException e) {
out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
} catch (Exception e) {
--
Gitblit v1.8.0