From 30d8e227e8d823b6c38c3b9c90ac2df03b63befe Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 25 二月 2025 16:41:22 +0800
Subject: [PATCH] 淘宝转链接口更新

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserAccountControllerV2.java |  131 ++++++++++++++++++++++++++++---------------
 1 files changed, 86 insertions(+), 45 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserAccountControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserAccountControllerV2.java
index cb1669d..70dd0ba 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserAccountControllerV2.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserAccountControllerV2.java
@@ -13,12 +13,15 @@
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 
+import com.ks.push.service.BDeviceTokenService;
 import com.yeshi.fanli.entity.SystemEnum;
 import com.yeshi.fanli.entity.SystemFunction;
 import com.yeshi.fanli.exception.user.UserExtraTaoBaoInfoException;
 import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService;
 import com.yeshi.fanli.util.*;
 import com.yeshi.fanli.vo.taobao.TaoBaoUser;
+import com.yeshi.fanli.vo.user.QQUserInfoVO;
+import org.apache.dubbo.config.annotation.Reference;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
@@ -177,20 +180,25 @@
     @Resource
     private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService;
 
+    @Reference(version = "1.0", check = false)
+    private BDeviceTokenService bDeviceTokenService;
+
 
     /**
      * 鏂扮増鐧诲綍 V1.5.3
      *
      * @param acceptData
+     * @param loginType      鐧诲綍鏂瑰紡锛� 1-鎵嬫満鐧诲綍 2-寰俊鐧诲綍 3-鎵嬫満  4-qq
      * @param vcode
      * @param phone
      * @param code
-     * @param loginType  鐧诲綍鏂瑰紡锛� 1-鎵嬫満鐧诲綍 2-寰俊鐧诲綍
+     * @param aliAccessToken
+     * @param qqUser
      * @param request
      * @param out
      */
     @RequestMapping(value = "login", method = RequestMethod.POST)
-    public void login(AcceptData acceptData, int loginType, String vcode, String phone, String code,
+    public void login(AcceptData acceptData, int loginType, String vcode, String phone, String code, String aliAccessToken, String qqUser,
                       HttpServletRequest request, PrintWriter out) {
         try {
             BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
@@ -201,27 +209,48 @@
             }
 
             UserInfo userInfo = null;
-            // 鎵嬫満鐧诲綍
-            if (loginType == 1) {
-                userInfo = userAccountService.loginPhone(new ProxyIP(request.getRemoteHost(), request.getRemotePort()), loginType, vcode, phone, system);
+
+
+            switch (loginType) {
+                //鐢佃瘽鍙风爜鐧诲綍
+                case 1: {
+                    if (!StringUtil.isNullOrEmpty(aliAccessToken)) {
+                        long now = System.currentTimeMillis();
+                        String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.oneKeyLoginCount, StringUtil.Md5(StringUtil.isNullOrEmpty(acceptData.getUtdid()) ? acceptData.getDevice() : acceptData.getUtdid()));
+                        ;
+                        redisManager.increase(key);
+                        int expire = (int) ((TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(now + 1000 * 60 * 60 * 24L, "yyyyMMdd"), "yyyyMMdd") - now) / 1000);
+                        redisManager.expire(key, expire);
+                    }
+                    userInfo = userAccountService.loginPhone(new ProxyIP(request.getRemoteHost(), request.getRemotePort()), loginType, vcode, phone, aliAccessToken, system);
+                }
+                break;
+                //寰俊鐧诲綍
+                case 2: {
+                    //闇�瑕佺粦瀹氱數璇濆彿鐮�
+                    if (SystemInfoUtil.hasFunctions(system.getSystem(), SystemFunction.bindPhone))
+                        userInfo = userAccountService.loginWeiXinNew(new ProxyIP(request.getRemoteHost(), request.getRemotePort()), loginType, code, system);
+                        //涓嶉渶瑕佺粦瀹氱數璇濆彿鐮�
+                    else
+                        userInfo = userAccountService.loginWeiXin(new ProxyIP(request.getRemoteHost(), request.getRemotePort()), loginType, code, system);
+                }
+                break;
+                case 4: {
+                    QQUserInfoVO qqUserInfo = UserUtil.parseQQUser(qqUser);
+                    userInfo = userAccountService.loginQQ(new ProxyIP(request.getRemoteHost(), request.getRemotePort()), loginType, qqUserInfo, system);
+                }
+                break;
             }
 
-            // 寰俊鐧诲綍
-            if (loginType == 2) {
-                //闇�瑕佺粦瀹氱數璇濆彿鐮�
-                if (SystemInfoUtil.hasFunctions(system.getSystem(), SystemFunction.bindPhone))
-                    userInfo = userAccountService.loginWeiXinNew(new ProxyIP(request.getRemoteHost(), request.getRemotePort()), loginType, code, system);
-                    //涓嶉渶瑕佺粦瀹氱數璇濆彿鐮�
-                else
-                    userInfo = userAccountService.loginWeiXin(new ProxyIP(request.getRemoteHost(), request.getRemotePort()), loginType, code, system);
-            }
 
             if (userInfo == null) {
                 out.print(JsonUtil.loadFalseResult("鐧诲綍澶辫触"));
             } else {
                 JSONObject data = new JSONObject();
                 data.put("userInfo", UserUtil.filterForClientUser(userInfo));
-                data.put("inviteCode", userInfoExtraService.getInviteCodeByUid(userInfo.getId()));
+                if (SystemInfoUtil.hasFunctions(acceptData.getSystem(), SystemFunction.inviteCode)) {
+                    data.put("inviteCode", userInfoExtraService.getInviteCodeByUid(userInfo.getId()));
+                }
                 out.print(JsonUtil.loadTrueResult(data));
 
                 final UserInfo uuser = userInfo;
@@ -235,27 +264,33 @@
                             LogHelper.errorDetailInfo(e);
                         }
 
-                        // 缁戝畾oppo,VIVO鎺ㄩ��
-                        DeviceActive active = deviceActiveService.getFirstActiveInfo(acceptData.getDevice());
-                        if (active != null) {
-                            deviceTokenOPPOService.bindUid(uuser.getId(), active.getId());
-                            deviceTokenVIVOService.bindUid(uuser.getId(), active.getId());
-                            deviceTokenXMService.bindUid(active.getId(), uuser.getId());
+                        if (acceptData.getSystem().isNewPush()) {
+                            bDeviceTokenService.bindUid(acceptData.getSystem().name(), StringUtil.isNullOrEmpty(acceptData.getUtdid()) ? acceptData.getDevice() : acceptData.getUtdid(), uuser.getId() + "");
+                        } else {
+                            // 缁戝畾oppo,VIVO鎺ㄩ��
+                            DeviceActive active = deviceActiveService.getFirstActiveInfo(acceptData.getDevice());
+                            if (active != null) {
+                                deviceTokenOPPOService.bindUid(uuser.getId(), active.getId());
+                                deviceTokenVIVOService.bindUid(uuser.getId(), active.getId());
+                                deviceTokenXMService.bindUid(active.getId(), uuser.getId());
+                            }
                         }
+
+
                     }
                 });
             }
 
         } catch (UserAccountException e) {
             int errorCode = e.getCode();
-            if (errorCode == 101) { // 闇�瑕佺粦瀹氭墜鏈哄彿
+            if (errorCode == UserAccountException.CODE_NEED_BIND_PHONE) { // 闇�瑕佺粦瀹氭墜鏈哄彿
                 JSONObject data = new JSONObject();
                 data.put("key", e.getMsg());
                 JSONObject object = new JSONObject();
                 object.put("code", errorCode);
                 object.put("data", data);
                 out.print(object.toString());
-            } else if (errorCode == 102) { // 闇�瑕佺粦瀹氬井淇″彿
+            } else if (errorCode == UserAccountException.CODE_NEED_BIND_WX) { // 闇�瑕佺粦瀹氬井淇″彿
                 JSONObject data = new JSONObject();
                 data.put("key", e.getMsg());
                 JSONObject object = new JSONObject();
@@ -323,7 +358,7 @@
     }
 
     /**
-     * 缁戝畾鐢佃瘽鍙风爜 V2.0.1 寰俊鐧诲綍
+     * 缁戝畾鐢佃瘽鍙风爜 V2.0.1 涓夋柟鐧诲綍
      *
      * @param acceptData
      * @param vcode
@@ -332,7 +367,7 @@
      */
     @RequestSerializableByKey(key = "'bindPhoneLogin-'+#phone")
     @RequestMapping(value = "bindPhoneLogin")
-    public void bindPhoneLogin(AcceptData acceptData, String vcode, String phone, String key,
+    public void bindPhoneLogin(AcceptData acceptData, String vcode, String phone, String key, String aliAccessToken,
                                HttpServletRequest request, PrintWriter out) {
         BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
                 acceptData.getPackages(), acceptData.getSystem());
@@ -341,35 +376,31 @@
             return;
         }
 
-        if (StringUtil.isNullOrEmpty(vcode)) {
-            out.print(JsonUtil.loadFalseResult("楠岃瘉鐮佷笉鑳戒负绌�"));
-            return;
-        }
-
-        if (StringUtil.isNullOrEmpty(phone)) {
-            out.print(JsonUtil.loadFalseResult("鐢佃瘽鍙风爜涓嶈兘涓虹┖"));
-            return;
-        }
 
         if (StringUtil.isNullOrEmpty(key)) {
             out.print(JsonUtil.loadFalseResult("key鍊间笉鑳戒负绌�"));
             return;
         }
 
-        phone = phone.replaceAll(" ", "");
+        if (!StringUtil.isNullOrEmpty(aliAccessToken)) {
+            long now = System.currentTimeMillis();
+            String redisKey = RedisKeyEnum.getRedisKey(RedisKeyEnum.oneKeyLoginCount, StringUtil.Md5(StringUtil.isNullOrEmpty(acceptData.getUtdid()) ? acceptData.getDevice() : acceptData.getUtdid()));
+            ;
+            redisManager.increase(redisKey);
+            int expire = (int) ((TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(now + 1000 * 60 * 60 * 24L, "yyyyMMdd"), "yyyyMMdd") - now) / 1000);
+            redisManager.expire(redisKey, expire);
+        }
 
-        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);
+        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;
         }
 
         try {
-            UserInfo userInfo = userAccountService.bindPhoneToLogin(new ProxyIP(request.getRemoteHost(), request.getRemotePort()), acceptData, phone, key);
-
+            UserInfo userInfo = userAccountService.bindPhoneToLogin(new ProxyIP(request.getRemoteHost(), request.getRemotePort()), acceptData, mobile, key);
             JSONObject data = new JSONObject();
             data.put("userInfo", UserUtil.filterForClientUser(userInfo));
             out.print(JsonUtil.loadTrueResult(data));
@@ -411,6 +442,7 @@
             out.print(JsonUtil.loadFalseResult("key鍊间笉鑳戒负绌�"));
             return;
         }
+
 
         try {
             UserInfo userInfo = userAccountService.bindWXToLogin(new ProxyIP(request.getRemoteHost(), request.getRemotePort()), acceptData, code, system.getAppid(), key);
@@ -606,6 +638,15 @@
             return;
         }
 
+        //鍗囬珮绾э紝闃叉娑堟伅闃熷垪鏃犳晥锛屾病鑷姩鐢宠楂樼骇
+        try {
+            userVIPPreInfoService.upgradeVipByMyOrder(uid);
+        } catch (Exception e) {
+        }
+        try {
+            userVIPPreInfoService.upgradeVipByTeamNum(uid);
+        } catch (Exception e) {
+        }
         try {
             userVIPInfoService.applyVIP(uid);
         } catch (UserVIPInfoException e) {
@@ -919,7 +960,7 @@
             redisManager.clearSMSVCode(phone, SMSHistory.TYPE_REMVOE);
         }
 
-        userAccountService.forbiddenUserAll(uid, "鐢ㄦ埛涓诲姩娉ㄩ攢璐︽埛");
+        userAccountService.unRegisterUser(uid, "鐢ㄦ埛涓诲姩娉ㄩ攢璐︽埛");
         JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("娉ㄩ攢鎴愬姛"));
     }
 

--
Gitblit v1.8.0