From 91ddd96c12ec25aaf6d0cb38d54288d863ab2b58 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期六, 10 七月 2021 18:10:38 +0800
Subject: [PATCH] 礼金红包兼容

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java |   59 ++++++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 38 insertions(+), 21 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java
index f0fbcda..2d7b931 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java
@@ -7,10 +7,12 @@
 import java.util.List;
 
 import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpSession;
 
 import com.yeshi.fanli.entity.SystemEnum;
 import com.yeshi.fanli.entity.SystemPIDInfo;
+import com.yeshi.fanli.entity.bus.search.HistorySearch;
 import com.yeshi.fanli.exception.pdd.PDDApiException;
 import com.yeshi.fanli.exception.taobao.TaoBaoTokenParseException;
 import com.yeshi.fanli.lijin.manager.GoodsLijinMnager;
@@ -25,6 +27,7 @@
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.yeshi.utils.HttpUtil;
+import org.yeshi.utils.IPUtil;
 import org.yeshi.utils.JsonUtil;
 
 import com.google.gson.Gson;
@@ -528,7 +531,7 @@
      */
     @RequestMapping(value = "searchGoods")
     public void searchGoods(AcceptData acceptData, Integer goodsType, String key, Integer page, String filter,
-                            Integer order, Long uid, String notifyType, HttpSession session, PrintWriter out) {
+                            Integer order, Long uid, String notifyType, HttpSession session,HttpServletRequest request, PrintWriter out) {
 
         if (goodsType == null || goodsType < 1 || goodsType > 5) {
             out.print(JsonUtil.loadFalseResult(1, "璇蜂紶閫掓纭钩鍙板弬鏁�"));
@@ -567,18 +570,17 @@
         executor.execute(new Runnable() {
             @Override
             public void run() {
-                StringBuffer sb = new StringBuffer();
-                String link = "#$$$#";
-                String platform = acceptData.getPlatform();
-                String packages = acceptData.getPackages();
-                String device = acceptData.getDevice();
-                sb.append(platform).append(link).append(packages).append(link).append(device);
-                String bid = StringUtil.Md5(sb.toString());
-
-                // 鍔犲叆鎼滅储鍘嗗彶璁板綍
-                historySearchService.addHistorySearch(searchkey, bid);
+                HistorySearch search = new HistorySearch();
+                search.setDevice(StringUtil.isNullOrEmpty(acceptData.getUtdid()) ? acceptData.getDevice() : acceptData.getUtdid());
+                search.setKey(key);
+                search.setSystem(acceptData.getSystem());
+                search.setUid(uid);
+                search.setGoodsType(goodsType);
+                search.setIpInfo(IPUtil.getRemotIP(request) + ":" + request.getRemotePort());
+                historySearchService.addHistorySearch(search);
             }
         });
+
 
         if (searchkey.startsWith("http://") || searchkey.startsWith("https://")) {
             JSONObject data = new JSONObject();
@@ -635,7 +637,7 @@
 
     @RequestMapping(value = "searchGoodsTJ")
     public void searchGoodsTJ(AcceptData acceptData, Integer goodsType, String key, Integer page, String filter,
-                              Integer order, Long uid, String notifyType, HttpSession session, PrintWriter out) {
+                              Integer order, Long uid, String notifyType, HttpSession session, HttpServletRequest request, PrintWriter out) {
 
         if (goodsType == null || goodsType < 1 || goodsType > 5) {
             out.print(JsonUtil.loadFalseResult(1, "璇蜂紶閫掓纭钩鍙板弬鏁�"));
@@ -657,15 +659,14 @@
         executor.execute(new Runnable() {
             @Override
             public void run() {
-                StringBuffer sb = new StringBuffer();
-                String link = "#$$$#";
-                String platform = acceptData.getPlatform();
-                String packages = acceptData.getPackages();
-                String device = acceptData.getDevice();
-                sb.append(platform).append(link).append(packages).append(link).append(device);
-                String bid = StringUtil.Md5(sb.toString());
-                // 鍔犲叆鎼滅储鍘嗗彶璁板綍
-                historySearchService.addHistorySearch(searchkey, bid);
+                HistorySearch search = new HistorySearch();
+                search.setDevice(StringUtil.isNullOrEmpty(acceptData.getUtdid()) ? acceptData.getDevice() : acceptData.getUtdid());
+                search.setKey(key);
+                search.setSystem(acceptData.getSystem());
+                search.setUid(uid);
+                search.setGoodsType(goodsType);
+                search.setIpInfo(IPUtil.getRemotIP(request) + ":" + request.getRemotePort());
+                historySearchService.addHistorySearch(search);
             }
         });
 
@@ -748,6 +749,22 @@
                         goodsId = id;
                     }
                 }
+                if (goodsId == null) {
+                    //瑙f瀽閾炬帴
+                    if (linkList != null && linkList.size() > 0) {
+                        String tempGoodsId = clipboardAnalysisManager.parseTBAuctionIdFromLink(linkList.get(0));
+                        if (!StringUtil.isNullOrEmpty(tempGoodsId)) {
+                            goodsId = Long.parseLong(tempGoodsId);
+                        }
+                    }
+                }
+            }
+
+            //鍟嗗搧ID涓虹┖锛屼笖鏄彛浠ょ殑褰㈠紡灏变互鏈姞鍏ユ窐瀹濊仈鐩熺殑鍟嗗搧澶勭悊
+            if (goodsId == null && (linkList != null && linkList.size() > 0) && TaoBaoUtil.isHaveNewVersionTaoBaoToken(key)) {
+                String[] ks = key.trim().split("  ");
+                if (ks.length > 1)
+                    key = ks[1].trim();
             }
         }
 

--
Gitblit v1.8.0