From e74819e845de27735605c8116ee73768560e0fd9 Mon Sep 17 00:00:00 2001 From: yujian <yujian@163.com> Date: 星期三, 03 六月 2020 15:17:15 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/div' into div --- fanli/src/main/java/com/yeshi/fanli/util/vipshop/VipShopApiUtil.java | 31 +++++++++++++++++++++++++++++++ 1 files changed, 31 insertions(+), 0 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/util/vipshop/VipShopApiUtil.java b/fanli/src/main/java/com/yeshi/fanli/util/vipshop/VipShopApiUtil.java index d66c031..0e44b5a 100644 --- a/fanli/src/main/java/com/yeshi/fanli/util/vipshop/VipShopApiUtil.java +++ b/fanli/src/main/java/com/yeshi/fanli/util/vipshop/VipShopApiUtil.java @@ -165,6 +165,37 @@ } return null; } + + + + public static VIPSearchResult getGoodsList(int channelType,int page) { + Map<String, String> taskParams = new HashMap<>(); + taskParams.put("channelType",channelType+""); + taskParams.put("page", page+ ""); + taskParams.put("pageSize", 20 + ""); + taskParams.put("requestId", System.currentTimeMillis() + "_" + UUID.randomUUID()); + + + JSONObject root = new JSONObject(); + root.put("request", JSONObject.fromObject(taskParams)); + String result = baseRequest("com.vip.adp.api.open.service.UnionGoodsService", "goodsList", root); + System.out.println(result); + List<VIPGoodsInfo> goodsList = new ArrayList<>(); + JSONObject resultJson = JSONObject.fromObject(result); + Gson gson = new Gson(); + if (resultJson.optInt("returnCode") == 0) { + resultJson = resultJson.optJSONObject("result"); + int count = resultJson.optInt("total"); + JSONArray array = resultJson.optJSONArray("goodsInfoList"); + for (int i = 0; i < array.size(); i++) { + VIPGoodsInfo info = gson.fromJson(array.optJSONObject(i).toString(), VIPGoodsInfo.class); + if (info != null) + goodsList.add(info); + } + return new VIPSearchResult(goodsList, count); + } + return null; + } /** * 鍟嗗搧ID杞摼 -- Gitblit v1.8.0