From 6b75391e97aa770e12965ec6e542856df79e6de0 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期五, 27 九月 2019 15:14:02 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/div' into div --- fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java | 40 ++++++++++++++++++++++++++++++++++++---- 1 files changed, 36 insertions(+), 4 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 fe2098a..67d202c 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 @@ -176,12 +176,11 @@ return; } - if (analysisTaoToken(text, out)) { + if (analysisTaoToken(acceptData, text, out)) { return; } JSONObject root = new JSONObject(); - root.put("type", 2); JSONObject data = new JSONObject(); data.put("title", text); @@ -253,8 +252,15 @@ String pddId = PinDuoDuoUtil.getPDDGoodsId(text); if (!StringUtil.isNullOrEmpty(pddId)) { PDDGoodsDetail goods = PinDuoDuoApiUtil.getGoodsDetail(Long.parseLong(pddId)); - if (goods != null) + if (goods != null) { commonGoods = CommonGoodsFactory.create(goods); + } else { + type = 4; + goods = PinDuoDuoUtil.getPDDGoodsInfo("26478646158"); + commonGoods = new CommonGoods(); + commonGoods.setTitle(goods.getGoodsName()); + commonGoods.setPicture(goods.getGoodsThumbnailUrl()); + } } } } @@ -353,7 +359,7 @@ out.print(JsonUtil.loadTrueResult(root)); } - private boolean analysisTaoToken(String text, PrintWriter out) { + private boolean analysisTaoToken(AcceptData acceptData, String text, PrintWriter out) { String token = StringUtil.picUpTaoToken(text); if (!StringUtil.isNullOrEmpty(token)) { Long auctionId = TaoKeApiUtil.tokenConvertAuctionId(token); @@ -366,6 +372,32 @@ } if (tb != null) { + if (VersionUtil.greaterThan_1_6_5(acceptData.getPlatform(), acceptData.getVersion())) { + TaoBaoGoodsBrief goodsBrief = null; + try { + goodsBrief = TaoKeApiUtil.searchGoodsDetail(tb.getAuctionId()); + } catch (TaobaoGoodsDownException e) { + e.printStackTrace(); + } + + if (goodsBrief == null) { + out.println(JsonUtil.loadFalseResult("鏆傛湭鎵惧埌璇ュ晢鍝侊紝璇风◢鍚庡啀璇曪紒")); + return false; + } + + BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); + BigDecimal shareRate = hongBaoManageService.getShareRate(); + Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()) + .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create(); + + JSONObject data = new JSONObject(); + data.put("type", 3); + data.put("goods", gson.toJson(GoodsDetailVOFactory.convertTaoBao(goodsBrief, null, fanLiRate, shareRate))); + out.print(JsonUtil.loadTrueResult(data)); + return true; + } + + JSONObject data = new JSONObject(); JSONObject taoBaoGoodsJSON = new JSONObject(); taoBaoGoodsJSON.put("title", tb.getTitle()); -- Gitblit v1.8.0