From 2f2860b50f24e5e3598d223db03d43df61d95c97 Mon Sep 17 00:00:00 2001 From: yj <Administrator@192> Date: 星期五, 13 三月 2020 16:31:30 +0800 Subject: [PATCH] Merge branch 'div' of ssh://193.112.35.168:29418/fanli-server into div --- fanli/src/main/java/com/yeshi/fanli/util/taobao/DaTaoKeUtil.java | 63 +++++++++++++++++++++++++++++-- 1 files changed, 59 insertions(+), 4 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/util/taobao/DaTaoKeUtil.java b/fanli/src/main/java/com/yeshi/fanli/util/taobao/DaTaoKeUtil.java index 450dd31..7075b9d 100644 --- a/fanli/src/main/java/com/yeshi/fanli/util/taobao/DaTaoKeUtil.java +++ b/fanli/src/main/java/com/yeshi/fanli/util/taobao/DaTaoKeUtil.java @@ -17,6 +17,7 @@ import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; +import org.yeshi.utils.HttpUtil; import com.yeshi.fanli.dto.dataoke.DingDongQiangDTO; import com.yeshi.fanli.dto.dataoke.DingDongTime; @@ -130,6 +131,41 @@ "馃暒",// 鍗佷竴鐐瑰崐 }; + static final String[] evaluateEmojis = new String[] { + "馃挓", + "馃尭", + "馃嵏", + "馃嵑", + "馃摙", + "鉂�", + "馃挐", + "馃拫", + "馃憶", + "馃惥", + "馃尮", + "馃敟", + "馃帀", + "馃巵", + "馃崶", + "馃嵀", + "馃尯", + "馃憫", + "鉁�", + "馃挮", + "馃嵒", + "馃巿", + "馃挜", + "馃挄", + "馃挒", + "馃挵", + "馃拰", + "馃挱", + "馃尲", + "馃崁" + }; + + + public static List<GoodsClass> goodsClasses; static { goodsClasses = new ArrayList<>(); @@ -519,18 +555,22 @@ return commonEmojis[(int) (Math.random() * commonEmojis.length)]; } + + public static String getEvaluateEmojis() { + return evaluateEmojis[(int) (Math.random() * evaluateEmojis.length)]; + } + public static String getDesc(DaTaoKeDetailV2 detail) { // 鏍囬+鍒稿悗浠�+鍖呴偖+鎻忚堪 String desc = detail.getDtitle(); desc += "\n"; desc += String.format("鍒稿悗浠�%s銆�%s鍏冦�戝寘閭鏉� ", Math.random() > 0.5 ? "馃挵" : "", - MoneyBigDecimalUtil.getWithNoZera(detail.getActualPrice() ).toString()) + MoneyBigDecimalUtil.getWithNoZera(detail.getActualPrice()).toString()) + (Math.random() > 0.5 ? getRandomCommonEmoji() : ""); desc += "\n"; // desc += detail.getIntroduce(); - String introduce = detail.getDesc().replace("锛�", ",").replace("銆�", ",").replace("锛�", ",").replace(",", - ","); + String introduce = detail.getDesc().replace("锛�", ",").replace("銆�", ",").replace("锛�", ",").replace(",", ","); introduce = introduce.replace(",,,", ",").replace(",,", ","); String[] sts = introduce.split(","); @@ -545,7 +585,6 @@ desc += introduce; return desc; } - public static TaoBaoGoodsBrief filterTaoBaoGoods(TaoBaoGoodsBrief goods, DaTaoKeDetailV2 detail) { if (detail != null && goods != null) { @@ -636,4 +675,20 @@ return list; } + // 鑾峰彇鎺ㄥ箍鏂囨 + public static void getPublishDoc(String id) { + String url = String.format("http://www.dataoke.com/detailtpl?gid=%s&type=1", id); + String response = HttpUtil.get(url); + try { + JSONObject json = JSONObject.fromObject(new String(response.getBytes("ISO-8859-1"), "UTF-8")); + JSONObject data = json.optJSONObject("data"); + String tpl2 = data.optString("tpl2"); + tpl2 = tpl2.substring(0, tpl2.indexOf("---------")); + System.out.println(tpl2.replace("</br>", "\n").trim()); + } catch (Exception e) { + + } + + } + } -- Gitblit v1.8.0