admin
2019-08-21 63071c735b873ea2e5cb89f908348b2ed2725f96
淘宝根据链接推荐搜索
1个文件已修改
14 ■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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,8 +124,6 @@
        // 去除前后空格
        text = text.trim();
        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\\&%_\\./-~-]*)?";
@@ -136,7 +135,7 @@
                return;
            }
            String pattern = "^[A-Za-z0-9-]+$";
            if (Pattern.matches(pattern, text.replace(" ", ""))) {//删除空格
            if (Pattern.matches(pattern, text.replace(" ", ""))) {// 删除空格
                out.println(JsonUtil.loadFalseResult("不支持推荐"));
                return;
            }
@@ -164,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("暂未找到该商品,请稍后再试!"));