| | |
| | | |
| | | static String jdGoodsJs = null; |
| | | static ScriptEngine engine = null; |
| | | |
| | | static { |
| | | if (jdGoodsJs == null) |
| | | jdGoodsJs = getJDGoodsJS(); |
| | |
| | | /** |
| | | * 获取类目 |
| | | * |
| | | * @param level |
| | | * 等级 |
| | | * @param parentId |
| | | * 上级id |
| | | * @param level 等级 |
| | | * @param parentId 上级id |
| | | * @return |
| | | */ |
| | | public static List<GoodsClassDTO> getCategoryList(int level, int parentId) { |
| | |
| | | /** |
| | | * 获取类目 |
| | | * |
| | | * @param level |
| | | * 等级 |
| | | * @param parentId |
| | | * 上级id |
| | | * @param level 等级 |
| | | * @param parentId 上级id |
| | | * @return |
| | | */ |
| | | public static List<GoodsClassDTO> getCategoryCommiPlus(int level, int parentId) { |
| | | try { |
| | | String body = "{\"funName\":\"getCategoryCommiPlus\",\"param\":{\"level\":" + level + ",\"parentId\":" + parentId + "}}"; |
| | | |
| | | // 请求地址 |
| | | String requestUrl = "https://union.jd.com/api/help/getCategoryCommiPlus?level=%s&parentId=%s"; |
| | | String requestUrl = "https://api.m.jd.com/api?functionId=union_help_center_logout&appid=unionpc&_=1613812219436&loginType=3&body=" + URLEncoder.encode(body); |
| | | // 执行请求 |
| | | String result = HttpUtil.get(String.format(requestUrl, level, parentId)); |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("cookie", "shshshfpa=329d2e56-7a79-19b5-0076-8c0b65ea461f-1547450580; shshshfpb=sS4IX%20CPaOczXlTOfurTlNw%3D%3D; abtest=20190619150948087_34; whwswswws=; __jdu=1547450598944823318591; jcap_dvzw_fp=4183dc16d888b5af62f3a2b1fc5e2d64$924110342461; commonAddress=2273642881; regionAddress=2273642881; pinId=2tU67_7e0-vDzUcicjyiuw; unpl=V2_ZzNtbUEDRUAnWkVWLx5YUmJTFA0RXkBHfQpDU3oRDwwyUBpaclRCFnUUR1dnGFwUZwMZXURcRxxFCEdkeBBVAWMDE1VGZxBFLV0CFSNGF1wjU00zQwBBQHcJFF0uSgwDYgcaDhFTQEJ2XBVQL0oMDDdRFAhyZ0AVRQhHZHsdWQNiBxNZSl5LEHABRVZ5GVUBbwMibUVncyV2CURVehhsBFcCIh8WC0AWcA1PUTYZWABhBhZcRl9KHXANT1d5G1wMYwsSbUNnQA%3d%3d; user-key=973b1365-9426-4c3f-8617-7c219d55f8be; unick=hexiaohui1011; _tp=yjKYjqrqLmDwvds6adwZZg%3D%3D; _pst=hexiaohui1011; shshshfp=b2b376c84d4d98fc6eefa16c183e3ecf; 3AB9D23F7A4B3C9B=HQOEEEVUVVKHO34WBW6L7LUQ4JICUD5UAQNK5WFDW3QLS5EEEOLXYJU2LJFHKI7HYA5HDNMAS53JKWR6H3HARY6VUM; ipLoc-djd=4-50950-88-0.529243028; ipLocation=%u91cd%u5e86; cn=11; __jdv=209449046|direct|-|none|-|1613812108092; TrackID=1wkaJObNR4rHfhHI9qTocAgfsjDkEzoYwJdM_UmonQDkjxkN4swvtM5uIjhnz4Z5AzYz3a_LnGX0vkEf47jroQ0RwyLe4DClJ03azrRMDZJU; thor=19CF5E87007461885622A30596B17A2F3C57C503EE774E94B972584FC02948D4D82E5B2B6336022DB5AA71BD4DFD63BE26D1E9E933D138913A74B2BAA94CFA501C2AB817E199FC195E6985F2C7B4B1E296C20453A72C294649EB97F0C8F58926D89D01B0962672F4C87B2E3BE4671E3955DB85389E4AF78FAC243DAC0CB77563996DFB7426157A070D70CFB88909FBA8; pin=hexiaohui1011; ceshi3.com=201; __jda=209449046.1547450598944823318591.1547450598.1612152289.1613812108.401; __jdb=209449046.5.1547450598944823318591|401.1613812108; __jdc=209449046; RT=\"z=1&dm=jd.com&si=mnu0prq1z7m&ss=kldi27s8&sl=2&tt=18e&ld=66y\""); |
| | | headers.put("origin", "https://union.jd.com"); |
| | | headers.put("referer", "https://union.jd.com/"); |
| | | String result = HttpUtil.get(requestUrl, headers); |
| | | |
| | | if (!StringUtil.isNullOrEmpty(result)) { |
| | | JSONObject json = JSONObject.fromObject(result); |
| | | JSONArray jsonArray = json.getJSONArray("data"); |
| | | JSONArray jsonArray = json.getJSONArray("result"); |
| | | if (jsonArray != null && jsonArray.size() > 0) { |
| | | List<GoodsClassDTO> list = new ArrayList<GoodsClassDTO>(); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | |
| | | /** |
| | | * 获取需要展示的券 |
| | | * |
| | | * @param couponInfoList |
| | | * 券列表 |
| | | * @param price |
| | | * 商品价格 |
| | | * @param couponInfoList 券列表 |
| | | * @param price 商品价格 |
| | | * @return |
| | | */ |
| | | public static JDCouponInfo getShowCouponInfo(List<JDCouponInfo> couponInfoList, BigDecimal price) { |