private static final Logger log = LoggerFactory.getLogger(LiveInteractionTest.class);
/**
* 发送打赏消息
* @throws IOException
*/
@Test
public void testSendRewardMsg() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId=super.appId;
String appSecret=super.appSecret;
String userId = super.userId;
String timestamp=String.valueOf(System.currentTimeMillis());
//业务参数
String channelId = "2191532";
String nickname = "rock";
String avatar = "https://livestatic.videocc.net/uploaded/images/webapp/avatar/default-teacher.png";
String viewerId = "1615772956066";
String donateType = "good";
String content = "鲜花";
String goodImage = "http://s1.videocc.net/default-img/donate/flower.png";
String url = "http://api.polyv.net/live/v3/channel/chat/send-reward-msg";
//http 调用逻辑
Map<String,String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp",timestamp);
requestMap.put("channelId",channelId);
requestMap.put("viewerId",viewerId);
requestMap.put("nickname",nickname);
requestMap.put("avatar",avatar);
requestMap.put("donateType",donateType);
requestMap.put("content",content);
requestMap.put("goodImage",goodImage);
requestMap.put("sign",LiveSignUtil.getSign(requestMap, appSecret));
String response = HttpUtil.postFormBody(url,requestMap);
log.info("测试发送打赏消息接口返回值:{}",response);
//do somethings
}