private static final Logger log = LoggerFactory.getLogger(ChannelOperateTest.class);
/**
* 修改商品信息
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void testUpdateChannelProduct() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId = super.appId;
String appSecret = super.appSecret;
String userId = super.userId;
String timestamp = String.valueOf(System.currentTimeMillis());
//业务参数
String url = "http://api.polyv.net/live/v3/channel/product/update";
String channelId = "1965681";
//http 调用逻辑
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
requestMap.put("channelId", channelId);
String body = "{\"productId\":27538,\"name\":\"开心豆\",\"price\":0.99,\"cover\":\"//liveimages.videocc.net/uploadimage/20200827/chat_img_1779741_15985125681801.jpeg?x-oss-process=image/crop,x_95,y_0,w_235,h_235\",\"link\":\"\",\"status\":1,\"realPrice\":1.99,\"linkType\":11,\"pcLink\":\"https://www.polyv.net\",\"mobileLink\":\"\",\"wxMiniprogramLink\":\"\",\"wxMiniprogramOriginalId\":\"\",\"mobileAppLink\":\"\",\"params\":\"{\\\"cc\\\": 11}\"}";
requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
url = HttpUtil.appendUrl(url, requestMap);
String response = HttpUtil.postJsonBody(url, body, null);
log.info("测试修改商品信息:{}", response);
//do somethings
}