private static final Logger log = LoggerFactory.getLogger(ChatMessageTest.class);
/**
* 发送图文信息
* @throws IOException
*/
@Test
public void testSendMessage() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId = super.appId;
String appSecret = super.appSecret;
String timestamp = String.valueOf(System.currentTimeMillis());
//业务参数
String url = "http://api.polyv.net/live/v3/channel/chat/send-admin-msg";
String channelId = "2191569";
Integer adminIndex = 1;
String msg = "测试发送图文信息";
String pic = "https://thirdwx.qlogo.cn/mmopen/vi_32/3lMXVJoLMLJibnkFuA23lyqj5MOQufhW5ATvHuB8byssutficHKU0u7OMx5OQgg9WNVuHf44AXfbAMMAZejuYFTg/132";
String nickName = "西瓜籽";
String actor = "大管理员";
String freeReview = "";
String apiVersion = "3.2";
//http 调用逻辑
Map<String,String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp",timestamp);
requestMap.put("channelId",channelId);
requestMap.put("adminIndex",adminIndex.toString());
requestMap.put("msg",msg);
requestMap.put("pic",pic);
requestMap.put("nickName",nickName);
requestMap.put("actor",actor);
requestMap.put("freeReview",freeReview);
requestMap.put("apiVersion",apiVersion);
requestMap.put("sign",LiveSignUtil.getSign(requestMap, appSecret));
String response = HttpUtil.postFormBody(url, requestMap);
log.info("测试发送聊天室消息接口返回值:{}",response);
}