| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | */ |
| | | @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, "请传递正确平台参数")); |
| | |
| | | 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(); |
| | |
| | | |
| | | @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, "请传递正确平台参数")); |
| | |
| | | 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); |
| | | } |
| | | }); |
| | | |
| | |
| | | goodsId = id; |
| | | } |
| | | } |
| | | if (goodsId == null) { |
| | | //解析链接 |
| | | 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(); |
| | | } |
| | | } |
| | | |