private static final Logger log = LoggerFactory.getLogger(LiveInteractionTest.class);
/**
* 设修改频道问卷
* @throws IOException
*/
@Test
public void testAddEditQuestionnaire() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId=super.appId;
String appSecret=super.appSecret;
String userId = super.userId;
String timestamp=String.valueOf(System.currentTimeMillis());
//业务参数
String channelId = "1965681";
String temp = "https://api.polyv.net/live/v3/channel/questionnaire/add-edit-questionnaire";
//http 调用逻辑
Map<String,String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp",timestamp);
requestMap.put("channelId",channelId);
String body = "{\"questionnaireId\":\"fwnf2sbpf5\",\"customQuestionnaireId\":\"6a3ff44289f94a5fb1dd8341ac1c0100\",\"questionnaireTitle\":\"这里是问卷标题\",\"questions\":[{\"questionId\":\"feqfr13ftz\",\"name\":\"题目名称qwe\",\"type\":\"R\",\"answer\":\"A\",\"scoreEnabled\":\"Y\",\"score\":10,\"required\":\"Y\",\"options\":[\"选项1\",\"选项2\",\"选项3\"]}]}";
requestMap.put("sign",LiveSignUtil.getSign(requestMap, appSecret));
String url = HttpUtil.appendUrl(temp,requestMap);
String response = HttpUtil.postJsonBody(url, body, null);
log.info("测试修改频道问卷接口返回值:{}",response);
//do somethings
}