| | |
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import com.sun.istack.NotNull;
|
| | | import org.apache.commons.httpclient.HttpClient;
|
| | | import org.apache.commons.httpclient.methods.PostMethod;
|
| | |
|
| | |
| | | return resultJson.optJSONObject("data").optString("clickURL");
|
| | | }
|
| | |
|
| | | public static String convertLinkWithSubUnionId(String materialId, String couponUrl, String positionId,
|
| | | public static String convertLinkWithSubUnionId(@NotNull String materialId, String couponUrl, String giftCouponKey, @NotNull String positionId,
|
| | | String subUnionId) {
|
| | | String log = "京东转链出错:";
|
| | | try {
|
| | | JSONObject json = new JSONObject();
|
| | | json.put("materialId", materialId);
|
| | |
|
| | | json.put("siteId", APP_ID);
|
| | | json.put("positionId", positionId);
|
| | | json.put("materialId", materialId);
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(giftCouponKey)) {
|
| | | json.put("giftCouponKey", giftCouponKey);
|
| | | }
|
| | | if (!StringUtil.isNullOrEmpty(couponUrl))
|
| | | json.put("couponUrl", couponUrl);
|
| | |
|
| | |
| | | /**
|
| | | * 关键词商品查询接口【申请】
|
| | | *
|
| | | * @param skuIdList
|
| | | * @param filter
|
| | | * @return
|
| | | */
|
| | | public static JDSearchResult queryByKey(JDFilter filter) {
|
| | |
| | | * @param page
|
| | | * @param pageSize
|
| | | * @param time
|
| | | * @param type
|
| | | * 时间类型 1-下单时间 2-完成时间 3-更新时间
|
| | | * @param type 时间类型 1-下单时间 2-完成时间 3-更新时间
|
| | | * @return
|
| | | */
|
| | | public static JDOrderResult getOrderList(int page, int pageSize, Date time, int type) {
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | |
|
| | | public static String createLiJin(String sku) {
|
| | | JSONObject json = new JSONObject();
|
| | | JSONObject couponReq = new JSONObject();
|
| | | couponReq.put("skuMaterialId", sku);
|
| | | couponReq.put("discount", 10);
|
| | | couponReq.put("amount", 5);
|
| | | couponReq.put("receiveStartTime", TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd HH"));
|
| | | couponReq.put("receiveEndTime", TimeUtil.getGernalTime(System.currentTimeMillis() + 1000 * 60 * 2, "yyyy-MM-dd HH"));
|
| | | couponReq.put("isSpu", 0);
|
| | | couponReq.put("expireType", 2);
|
| | | couponReq.put("useStartTime", TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd"));
|
| | | couponReq.put("useEndTime", TimeUtil.getGernalTime(System.currentTimeMillis() + 1000 * 60 * 60L * 24, "yyyy-MM-dd"));
|
| | | couponReq.put("share", 1);
|
| | | couponReq.put("contentMatch", 0);
|
| | |
|
| | | json.put("couponReq", couponReq);
|
| | | String result = baseRequest2("jd.union.open.coupon.gift.get", null, json);
|
| | | System.out.println(result);
|
| | | JSONObject root = JSONObject.fromObject(result).optJSONObject("jd_union_open_coupon_gift_get_response");
|
| | | if (root.optInt("code") == 0) {
|
| | | boolean hasMore = root.optBoolean("hasMore");
|
| | | root = JSONObject.fromObject(root.optString("result"));
|
| | | if (root.optInt("code") == 200 && root.optJSONObject("data") != null) {
|
| | | JSONObject data = root.optJSONObject("data");
|
| | | String giftCouponKey = data.optString("giftCouponKey");
|
| | | return giftCouponKey;
|
| | | }
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | |
|
| | | public static void toolConvert() {
|
| | | JSONObject json = new JSONObject();
|
| | | JSONObject couponReq = new JSONObject();
|
| | | couponReq.put("materialId", "https://item.jd.com/71751967284.html");
|
| | | couponReq.put("unionId", "2011217145");
|
| | | // couponReq.put("pid", "2011217145_4100059717_3003005722");
|
| | | couponReq.put("subUnionId", "123_437032");
|
| | | couponReq.put("giftCouponKey","123123123123");
|
| | | json.put("promotionCodeReq", couponReq);
|
| | | String result = baseRequest2("jd.union.open.promotion.byunionid.get", null, json);
|
| | | System.out.println(result);
|
| | | }
|
| | |
|
| | | public static void toolOrder() {
|
| | | JSONObject json = new JSONObject();
|
| | | JSONObject couponReq = new JSONObject();
|
| | | couponReq.put("pageIndex", 1);
|
| | | couponReq.put("pageSize", 20);
|
| | | couponReq.put("type", 3);
|
| | | couponReq.put("startTime", "2020-10-31 16:00:00");
|
| | | couponReq.put("endTime", "2020-10-31 16:55:00");
|
| | | // couponReq.put("key", "026eea846250e0dcbcacd750faf07de0");
|
| | |
|
| | |
|
| | | // couponReq.put("pid", "2011217145_4100059717_3003005722");
|
| | | couponReq.put("childUnionId", "2011217145");
|
| | | json.put("orderReq", couponReq);
|
| | | String result = baseRequest2("jd.union.open.order.row.query", null, json);
|
| | | System.out.println(result);
|
| | | }
|
| | |
|
| | |
|
| | | public static void test() {
|
| | | JSONObject json = new JSONObject();
|
| | | json.put("materialId", "https://item.jd.com/32376790478.html");
|