| | |
| | | * @return
|
| | | */
|
| | | public static PDDGoodsResult searchGoods(PDDSearchFilter sf) {
|
| | | Gson gson = new GsonBuilder().disableHtmlEscaping().create();
|
| | | Map<String, String> map = new HashMap<>();
|
| | | map.put("type", "pdd.ddk.goods.search");
|
| | | if (sf.getOptId() != null)
|
| | |
| | | map.put("goods_id_list", "[" + StringUtil.concat(sf.getGoodsIdList(), ",") + "]");
|
| | | if (sf.getMerchantType() != null)
|
| | | map.put("merchant_type", sf.getMerchantType() + "");
|
| | | |
| | | if (sf.getRangeList() != null && sf.getRangeList().size() > 0) {
|
| | | map.put("range_list",gson.toJson(sf.getRangeList()).toString());
|
| | | }
|
| | | |
| | | map.put("pid", PID_FANLI);
|
| | | String result = baseRequest(map);
|
| | | JSONObject json = JSONObject.fromObject(result);
|
| | |
| | | Type type = new TypeToken<List<PDDGoodsDetail>>() {
|
| | | }.getType();
|
| | |
|
| | | Gson gson = new GsonBuilder().disableHtmlEscaping().create();
|
| | | List<PDDGoodsDetail> goodsList = gson.fromJson(array.toString(), type);
|
| | | int totalCount = root.optInt("total_count");
|
| | | return new PDDGoodsResult(totalCount, goodsList);
|