From e75b0d79535a6bcd147cca4a54632b70b42afdb9 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期六, 29 五月 2021 18:10:18 +0800
Subject: [PATCH] 特价完善

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserAccountController.java |   75 +++++++++++++++++++++++++------------
 1 files changed, 50 insertions(+), 25 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserAccountController.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserAccountController.java
index 2212815..5f22725 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserAccountController.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserAccountController.java
@@ -29,6 +29,7 @@
 import com.yeshi.fanli.util.*;
 import com.yeshi.fanli.util.account.UserUtil;
 import com.yeshi.fanli.util.wx.MyWXLoginUtil;
+import com.yeshi.fanli.vo.user.QQUserInfoVO;
 import net.sf.json.JSONObject;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -1080,7 +1081,7 @@
      * @param out
      */
     @RequestMapping(value = "loginNew", method = RequestMethod.POST)
-    public void loginNew(AcceptData acceptData, String vcode, String phone, String code, int loginType,
+    public void loginNew(AcceptData acceptData, String vcode, String phone, String code, String aliAccessToken, int loginType,
                          HttpServletRequest request, PrintWriter out) {
 
         // 2.0浠ヤ笅鐗堟湰涓嶅厑璁哥櫥褰�
@@ -1099,7 +1100,7 @@
             UserInfo userInfo = null;
             // 鎵嬫満鐧诲綍
             if (loginType == 1) {
-                userInfo = userAccountService.loginPhone(new ProxyIP(request.getRemoteHost(), request.getRemotePort()), loginType, vcode, phone, system);
+                userInfo = userAccountService.loginPhone(new ProxyIP(request.getRemoteHost(), request.getRemotePort()), loginType, vcode, phone, aliAccessToken, system);
             }
 
             // 寰俊鐧诲綍
@@ -1162,43 +1163,29 @@
      * @param out
      */
     @RequestMapping(value = "bindPhoneNew")
-    public void bindPhoneNew(AcceptData acceptData, Long uid, String vcode, String phone, PrintWriter out) {
+    public void bindPhoneNew(AcceptData acceptData, Long uid, String vcode, String phone, String aliAccessToken, PrintWriter out) {
 
         BusinessSystem system = getSystem(acceptData);
         if (system == null) {
             out.print(JsonUtil.loadFalseResult("绯荤粺涓嶅瓨鍦�"));
             return;
         }
-
-        if (StringUtil.isNullOrEmpty(vcode)) {
-            out.print(JsonUtil.loadFalseResult("楠岃瘉鐮佷笉鑳戒负绌�"));
+        String mobile = null;
+        try {
+            mobile = userAccountService.getMobile(vcode, phone, aliAccessToken, acceptData.getSystem(), SMSHistory.TYPE_BIND);
+        } catch (UserAccountException e) {
+            out.print(JsonUtil.loadFalseResult(e.getMsg()));
             return;
-        }
-
-        if (StringUtil.isNullOrEmpty(phone)) {
-            out.print(JsonUtil.loadFalseResult("鐢佃瘽鍙风爜涓嶈兘涓虹┖"));
-            return;
-        }
-
-        phone = phone.replaceAll(" ", "");
-
-        String oldVCode = redisManager.getSMSVCode(phone, SMSHistory.TYPE_BIND);
-        if (Constant.IS_OUTNET) {
-            if (!vcode.equalsIgnoreCase(oldVCode)) {
-                out.print(JsonUtil.loadFalseResult(9001, "楠岃瘉鐮侀敊璇紝閲嶆柊杈撳叆"));
-                return;
-            }
-            redisManager.clearSMSFrequencyLimit(phone, SMSHistory.TYPE_BIND);
         }
 
         try {
             // 缁戝畾鐢ㄦ埛
-            userAccountService.bindPhoneNew(uid, phone);
+            userAccountService.bindPhoneNew(uid, mobile);
 
             UserInfo user = userInfoService.getUserByIdWithMybatis(uid);
             // 鍒ゆ柇鐢佃瘽鍙风爜鏄惁宸茬粡灏佺
             ForbiddenUserIdentifyCode ic = forbiddenUserIdentifyCodeService
-                    .listByTypeAndIdentifyCode(ForbiddenUserIdentifyCodeTypeEnum.phone, phone);
+                    .listByTypeAndIdentifyCode(ForbiddenUserIdentifyCodeTypeEnum.phone, mobile);
             if (ic != null && ic.getEffective() != null && ic.getEffective()) {
                 out.print(JsonUtil.loadFalseResult(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC));
                 // 灏佺鐢ㄦ埛
@@ -1243,7 +1230,7 @@
         }
 
         try {
-            userAccountService.bindWeiXin(acceptData, uid, code);
+            userAccountService.bindWeiXin(system, uid, code);
 
             UserInfo user = userInfoService.getUserByIdWithMybatis(uid);
             // 鍒ゆ柇taoBaoUid鏄惁宸茬粡灏佺
@@ -1267,4 +1254,42 @@
         }
     }
 
+
+    /**
+     * 鏇存敼寰俊
+     *
+     * @param acceptData
+     * @param uid
+     * @param qqUser
+     * @param out
+     */
+    @RequestMapping(value = "bindQQ")
+    public void bindQQ(AcceptData acceptData, Long uid, String qqUser, PrintWriter out) {
+        BusinessSystem system = getSystem(acceptData);
+
+        if (system == null) {
+            out.print(JsonUtil.loadFalseResult("绯荤粺涓嶅瓨鍦�"));
+            return;
+        }
+
+        if (StringUtil.isNullOrEmpty(qqUser)) {
+            out.print(JsonUtil.loadFalseResult("璇蜂笂浼爍qUser"));
+            return;
+        }
+
+        String qqUserStr = StringUtil.getFromBase64(qqUser);
+        QQUserInfoVO qqUserInfo = new Gson().fromJson(qqUserStr, QQUserInfoVO.class);
+        try {
+            userAccountService.bindQQ(uid, qqUserInfo);
+
+            UserInfo user = userInfoService.getUserByIdWithMybatis(uid);
+
+            JSONObject data = new JSONObject();
+            data.put("userInfo", UserUtil.filterForClientUser(user));
+            out.print(JsonUtil.loadTrueResult(data));
+        } catch (UserAccountException e) {
+            out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
+        }
+    }
+
 }

--
Gitblit v1.8.0