private static final Logger log = LoggerFactory.getLogger(ChannelOperateTest.class);
/**
* 更新角色信息
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void testUpdateChannelAccount() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId = super.appId;
String appSecret = super.appSecret;
String timestamp = String.valueOf(System.currentTimeMillis());
//业务参数
String url = "http://api.polyv.net/live/v4/channel/account/update";
String channelId = "2824409";
String account = "0062824409";
String nickName = "测试修改昵称";
//http 调用逻辑
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
requestMap.put("channelId", channelId);
List<Map<String, String>> purviewList = new ArrayList<>();
Map<String, String> purviewMap1 = new HashMap<>();
purviewMap1.put("code", "chatListEnabled");
purviewMap1.put("enabled", "Y");
purviewList.add(purviewMap1);
Map<String, String> purviewMap2 = new HashMap<>();
purviewMap2.put("code", "pageTurnEnabled");
purviewMap2.put("enabled", "Y");
purviewList.add(purviewMap2);
Map<String, String> purviewMap3 = new HashMap<>();
purviewMap3.put("code", "monitorEnabled");
purviewMap3.put("enabled", "N");
purviewList.add(purviewMap3);
Map<String, Object> jsonMap = new HashMap<>();
jsonMap.put("account", account);
jsonMap.put("nickName", nickName);
jsonMap.put("purviewList", purviewList);
requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
url = HttpUtil.appendUrl(url, requestMap);
String response = HttpUtil.postJsonBody(url, JSON.toJSONString(jsonMap), null);
log.info("测试更新角色信息成功:{}", response);
//do somethings
}