yujian
2019-04-22 b6c37e4bc38db88a360d0f2c6099183f9bb75bdc
fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java
@@ -224,6 +224,8 @@
         if (!StringUtil.isNullOrEmpty(item.optString("material_lib_type")))
            goods.setMaterialLibType(item.optInt("material_lib_type"));
         else
            goods.setMaterialLibType(0);
         return goods;
      }
@@ -337,7 +339,9 @@
               goods.setFreeShipment(1);
            if ("1".equalsIgnoreCase(item.optString("material_lib_type")))
               ;
               goods.setMaterialLibType(1);
            else
               goods.setMaterialLibType(0);
            goodsList.add(goods);
         }
@@ -365,6 +369,7 @@
            goods.getUserType());
      if (result != null && result.getTaoBaoGoodsBriefs() != null)
         for (TaoBaoGoodsBrief g : result.getTaoBaoGoodsBriefs()) {
            System.out.println(goods.getAuctionId() + ":" + g.getAuctionId());
            if (goods.getAuctionId().longValue() == g.getAuctionId()) {
               g.setId(goods.getAuctionId());
               // 判断是否有优惠券
@@ -384,6 +389,7 @@
                  g.setCouponStartFee(new BigDecimal(0));
               }
               g.setCreatetime(new Date());
               g.setMaterialLibType(goods.getMaterialLibType());
               return g;
            }
         }
@@ -451,6 +457,7 @@
                  g.setCouponStartFee(new BigDecimal(0));
               }
               g.setCreatetime(new Date());
               g.setMaterialLibType(goods.getMaterialLibType());
               return g;
            }
         }
@@ -1095,6 +1102,8 @@
               goods.setZkPrice(new BigDecimal(item.optString("zk_final_price")));
               goods.setAuctionUrl(item.optString("item_url"));
               goods.setPictUrl(item.optString("pict_url"));
               goods.setSalesCount(item.optString("volume"));
               goods.setUserType(item.optInt("user_type"));
               list.add(goods);
            }
      }
@@ -1655,8 +1664,14 @@
         String itemLink = resultJSON.optString("item_url");
         TaoBaoGoodsBrief goods = new TaoBaoGoodsBrief();
         goods.setAuctionUrl(itemLink);
         if (!StringUtil.isNullOrEmpty(resultJSON.optString("coupon_info")))
         if (!StringUtil.isNullOrEmpty(resultJSON.optString("coupon_info"))) {
            goods.setCouponLink(couponLink);
            goods.setCouponInfo(resultJSON.optString("coupon_info"));
         }
         String tkRate = resultJSON.optString("max_commission_rate");
         if (!StringUtil.isNullOrEmpty(tkRate)) {
            goods.setTkRate(new BigDecimal(tkRate));
         }
         return goods;
      } catch (TaoKeApiException e) {
         e.printStackTrace();
@@ -1669,15 +1684,30 @@
      Map<String, String> map = new HashMap<>();
      map.put("method", "taobao.ju.items.search");
      map.put("current_page", 1 + "");
      map.put("page_size", 100+"");
      map.put("page_size", 100 + "");
      map.put("pid", "mm_124933865_43788020_381938426");
      TaoKeAppInfo app = new TaoKeAppInfo();
      app.setAppKey("24838852");
      app.setAppSecret("bc8265e2bf8d8115329d652f9d3d4cd8");
      try {
         JSONObject json = TaoKeBaseUtil.baseRequest(map, app);
         System.out.println(json);
      } catch (TaoKeApiException e) {
         e.printStackTrace();
      }
   }
   public static void taoKeContent() {
      Map<String, String> map = new HashMap<>();
      map.put("method", "taobao.tbk.content.get");
      TaoKeAppInfo app = new TaoKeAppInfo();
      app.setAppKey("24838852");
      app.setAppSecret("bc8265e2bf8d8115329d652f9d3d4cd8");
      try {
         JSONObject json = TaoKeBaseUtil.baseRequest(map,app);
         System.out.println(json);
      } catch (TaoKeApiException e) {
         e.printStackTrace();
@@ -1775,6 +1805,7 @@
      }
      goods.setReservePrice(new BigDecimal(0));
      goods.setTotalFee(new BigDecimal("0"));
      goods.setPictUrlWhite(item.optString("white_image"));
      return goods;
   }