From 25dbf262113aaf404af00259efcfaae285d3a352 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期三, 17 七月 2019 10:05:01 +0800
Subject: [PATCH] 淘宝订单增加更新机制

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v1/DynamicRecommendController.java |   48 +++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 47 insertions(+), 1 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/DynamicRecommendController.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/DynamicRecommendController.java
index 7ce03fd..3aee959 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/DynamicRecommendController.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/DynamicRecommendController.java
@@ -20,6 +20,7 @@
 import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
 import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult;
 import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetail;
+import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
 import com.yeshi.fanli.log.LogHelper;
 import com.yeshi.fanli.service.inter.config.ConfigService;
 import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
@@ -29,6 +30,7 @@
 import com.yeshi.fanli.util.StringUtil;
 import com.yeshi.fanli.util.Utils;
 import com.yeshi.fanli.util.taobao.TaoBaoUtil;
+import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
 
 import net.sf.json.JSONObject;
 
@@ -159,7 +161,7 @@
 					text = text.substring(1, end);
 			}
 
-			LogHelper.test("鏍规嵁绮樿创鏉挎帹鑽�:"+text);
+			LogHelper.test("鏍规嵁绮樿创鏉挎帹鑽�:" + text);
 
 			if (text.length() > 80) {
 				out.print(JsonUtil.loadFalseResult("鍊艰繃闀�"));
@@ -257,4 +259,48 @@
 		out.print(JsonUtil.loadTrueResult(root));
 	}
 
+	/**
+	 * 瑙f瀽娣樺彛浠�
+	 * 
+	 * @param text
+	 * @param out
+	 * @return
+	 */
+	private boolean analysisTaoToken(String text, PrintWriter out) {
+		String token = StringUtil.picUpTaoToken(text);
+		if (!StringUtil.isNullOrEmpty(token)) {
+			Long auctionId = TaoKeApiUtil.tokenConvertAuctionId(token);
+			if (auctionId != null) {
+				TaoBaoGoodsBrief tb = null;
+				try {
+					tb = TaoKeApiUtil.getSimpleGoodsInfo(auctionId);
+				} catch (TaobaoGoodsDownException e) {
+					e.printStackTrace();
+				}
+
+				if (tb != null) {
+					JSONObject data = new JSONObject();
+					JSONObject taoBaoGoodsJSON = new JSONObject();
+					taoBaoGoodsJSON.put("title", tb.getTitle());
+					taoBaoGoodsJSON.put("zkPrice", tb.getZkPrice());
+					taoBaoGoodsJSON.put("auctionId", tb.getAuctionId());
+					taoBaoGoodsJSON.put("url", "http://item.taobao.com/item.htm?id=" + tb.getAuctionId());
+					data.put("taoBaoGoodsBrief", taoBaoGoodsJSON);
+					if (!StringUtil.isNullOrEmpty(tb.getPictUrl())) {
+						if (tb.getImgList() == null)
+							tb.setImgList(new ArrayList<>());
+						tb.getImgList().add(0, TbImgUtil.getTBSize220Img(tb.getPictUrl()));
+					}
+					data.put("tbImgs", tb.getImgList());
+					JSONObject root = new JSONObject();
+					root.put("type", 1);
+					root.put("data", data);
+					out.print(JsonUtil.loadTrueResult(root));
+					return true;
+				}
+			}
+		}
+		return false;
+	}
+
 }

--
Gitblit v1.8.0