From 5a80c35e42ba1ed7340097ea9b156016e52a23f2 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期一, 26 八月 2019 17:05:05 +0800
Subject: [PATCH] 京东订单修改

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 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 a782295..c5a53c0 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
@@ -16,6 +16,7 @@
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.yeshi.utils.JsonUtil;
+import org.yeshi.utils.NumberUtil;
 import org.yeshi.utils.taobao.TbImgUtil;
 
 import com.google.gson.Gson;
@@ -123,19 +124,18 @@
 		// 鍘婚櫎鍓嶅悗绌烘牸
 		text = text.trim();
 
-		if (text.length() > 256) {
-			out.print(JsonUtil.loadFalseResult("鍊艰繃闀�"));
-			return;
-		}
-
 		TaoBaoGoodsBrief tb = null;
 		String URL_REGEX = "(((http|https)://)|(www\\.))[a-zA-Z0-9\\._-]+\\.[a-zA-Z]{2,6}(:[0-9]{1,4})?(/[a-zA-Z0-9\\&%_\\./-~-]*)?";
 
 		Pattern p = Pattern.compile(URL_REGEX);
 		Matcher matcher = p.matcher(text);
 		if (!matcher.find()) {// 涓嶅寘鍚摼鎺�
+			if (text.length() > 256) {
+				out.print(JsonUtil.loadFalseResult("鍊艰繃闀�"));
+				return;
+			}
 			String pattern = "^[A-Za-z0-9-]+$";
-			if (Pattern.matches(pattern, text.replace(" ", ""))) {//鍒犻櫎绌烘牸
+			if (Pattern.matches(pattern, text.replace(" ", ""))) {// 鍒犻櫎绌烘牸
 				out.println(JsonUtil.loadFalseResult("涓嶆敮鎸佹帹鑽�"));
 				return;
 			}
@@ -163,7 +163,14 @@
 
 		CommonGoods commonGoods = null;
 		text = matcher.group();
-		if (text.contains("ju.taobao.com") || text.contains(".juhuasuan.com")) {// 鑱氬垝绠�
+
+		if (text.startsWith("https://a.m.taobao.com/i"))// 娣樺疂璐﹀彿鏈櫥褰曠姸鎬�
+		{
+			text = text.substring("https://a.m.taobao.com/i".length(), text.indexOf(".htm"));
+			if (NumberUtil.isNumeric(text)) {
+				tb = TaoBaoUtil.isAlimama(text);
+			}
+		} else if (text.contains("ju.taobao.com") || text.contains(".juhuasuan.com")) {// 鑱氬垝绠�
 			int index = text.indexOf("item_id");
 			if (index < 0) {
 				out.println(JsonUtil.loadFalseResult("鏆傛湭鎵惧埌璇ュ晢鍝侊紝璇风◢鍚庡啀璇曪紒"));

--
Gitblit v1.8.0