admin
2018-12-25 4cb15e222cd7d099d533ccbeb7f9a8cd99bf180c
fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoBaoUtil.java
@@ -928,12 +928,14 @@
      tg.setId(tb.getId());
      tg.setAuctionId(tb.getAuctionId());
      tg.setBiz30day(tb.getBiz30day());
      tg.setSalesCount(TaoBaoUtil.getSaleCount(tb.getBiz30day()));
      tg.setTitle(tb.getTitle());
      tg.setPictUrl(tb.getPictUrl() + "_200x200");
      tg.setPictUrl(tb.getPictUrl());
      tg.setZkPrice(tb.getZkPrice());
      tg.setAuctionUrl(tb.getAuctionUrl());
      tg.setReservePrice(tb.getReservePrice());
      tg.setUserType(tb.getUserType());
      tg.setImgList(tb.getImgList());
      if (tb.getCouponAmount().compareTo(BigDecimal.valueOf(0)) == 1) {
         TaoBaoQuanInfo quanInfo = new TaoBaoQuanInfo();
@@ -1550,34 +1552,30 @@
      long startTime = System.currentTimeMillis();
      JSONObject data = new JSONObject();
      data.put("itemNumId", auctionId + "");
      data.put("id", auctionId + "");
      String url = "";
      try {
         url = String.format(
               "https://acs.m.taobao.com/h5/mtop.taobao.detail.getdetail/6.0/?data=%s&qq-pf-to=pcqq.group",
               URLEncoder.encode(data.toString(), "UTF-8"));
               "https://h5api.m.taobao.com/h5/mtop.taobao.detail.getdesc/6.0/?data=%s&callback=GoodsLogic.showTuwen&_=%s",
               URLEncoder.encode(data.toString(), "UTF-8"), System.currentTimeMillis() + "");
      } catch (UnsupportedEncodingException e) {
         e.printStackTrace();
      }
      String result = HttpUtil.get(url);
      result = result.replace("GoodsLogic.showTuwen(", "").replace(")", "");
      data = JSONObject.fromObject(result);
      String moduleDescUrl = data.optJSONObject("data").optJSONObject("item").optString("moduleDescUrl");
      if (!StringUtil.isNullOrEmpty(moduleDescUrl)) {
      String pcDescContent = data.optJSONObject("data").optString("pcDescContent");
      System.out.println(pcDescContent);
      if (!StringUtil.isNullOrEmpty(pcDescContent)) {
         try {
            result = HttpUtil.get("http:" + moduleDescUrl);
            JSONObject resultJSON = JSONObject.fromObject(result);
            JSONArray itemsArray = resultJSON.optJSONObject("data").optJSONArray("children");
            for (int i = 0; i < itemsArray.size(); i++) {
               // picUrl
               JSONObject params = itemsArray.optJSONObject(i).optJSONObject("params");
               if (params.keySet().contains("picUrl")) {
                  String pictureUrl = params.optString("picUrl");
                  JSONObject sizeJSON = params.optJSONObject("size");
                  int width = sizeJSON.optInt("width");
                  int height = sizeJSON.optInt("height");
                  if (!StringUtil.isNullOrEmpty(pictureUrl))
                     imgList.add(new ImageInfo(pictureUrl, width, height));
            Document doc = Jsoup.parse(pcDescContent);
            Elements eles = doc.getElementsByTag("img");
            for (int i = 0; i < eles.size(); i++) {
               String imgSrc = eles.get(i).attr("src");
               if (imgSrc.endsWith(".jpg")) {
                  if (!imgSrc.startsWith("http"))
                     imgSrc = "https:" + imgSrc;
                  imgList.add(new ImageInfo(imgSrc, 0, 0));
               }
            }
         } catch (Exception e) {