| | |
| | | public static String getOpenId(String uid) { |
| | | Map<String, String> params = new HashMap<>(); |
| | | params.put("uid", uid); |
| | | String result = baseRequest("https://coapi.pptv.com/coapi-web/api/http/sopRequest", params, "pptv.channel.openid.get"); |
| | | // String result = baseRequest("https://coapi.pptv.com/coapi-web/api/http/sopRequest", params, "pptv.channel.openid.get"); |
| | | String result = baseRequest("http://coapiwebsit.cnsuning.com/coapi-web/api/http/sopRequest", params, "pptv.channel.openid.get"); |
| | | System.out.println(result); |
| | | JSONObject resultJSON = JSONObject.fromObject(result); |
| | | JSONObject response = resultJSON.optJSONObject("response"); |
| | |
| | | public static boolean buyGoods(String openId, String orderNo, String goodsNo, Date orderTime) { |
| | | Map<String, String> params = new HashMap<>(); |
| | | params.put("openId", openId); |
| | | params.put("canal", CANAL); |
| | | params.put("canal", CHANNEL_ID); |
| | | params.put("channel", "yeshi"); |
| | | params.put("goodsNo", goodsNo); |
| | | params.put("outOrderId", orderNo); |
| | | params.put("orderTime", TimeUtil.getGernalTime(orderTime.getTime(), "yyyy-MM-dd HH:mm:ss")); |
| | | params.put("sign", StringUtil.Md5(String.format("%s&%s&%s&%s", openId, params.get("channel"), orderNo, "2MnD8nCWu7EzbiJ"))); |
| | | String result = get("http://uc.test.pptv.com/cusp/jointMember", params); |
| | | String result = get("http://billing.api.pptv.com/cusp/jointMember", params); |
| | | System.out.println(result); |
| | | JSONObject data = JSONObject.fromObject(result); |
| | | if (data.optInt("errorCode") == 0) { |
| | |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | buyGoods("257dfd950c20ad25dee9f99ef926c0f8", "buwan_27", "DA7559531560894", new Date()); |
| | | //DA7559531560894 |
| | | buyGoods("257dfd950c20ad25dee9f99ef926c0f8", "buwan_100", "DA7559531560894", new Date()); |
| | | } |
| | | |
| | | |