1、查询课节实时状态和在线人数
2、接口支持https协议
https://api.polyv.net/hi-class-api/open/lesson/v1/getLessonLiveInfo
http://api.polyv.net/hi-class-api/open/lesson/v1/getLessonLiveInfo?appId=fyirmfdak4×tamp=1638782295111&sign=4FFEE70C353D7F97F9D9057A8A72E453&lessonIds=1015,1016
/**
* 查询课节实时状态和在线人数
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void getLessonLiveInfo() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId = super.appId;
String appSecret = super.appSecret;
String userId = super.userId;
String timestamp = String.valueOf(System.currentTimeMillis());
//业务参数
String url = "https://api.polyv.net/hi-class-api/open/lesson/v1/getLessonLiveInfo";
String lessonIds = "1015,1016";
//http 调用逻辑
Map<String,String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp",timestamp);
requestMap.put("lessonIds",lessonIds);
requestMap.put("sign",LiveSignUtil.getSign(requestMap, appSecret));
String response = HttpUtil.get(url, requestMap);
log.info("查询课节实时状态和在线人数:{}",response);
//do somethings
}
{
"code": 200,
"status": "success",
"data": [{
"lessonId": 1015,
"timestamp": 1638782349207,
"teacherOnlineCount": 1,
"studentOnlineCount": 9,
"status": 1
}, {
"lessonId": 1016,
"timestamp": 1638782349207,
"teacherOnlineCount": 0,
"studentOnlineCount": 0,
"status": 11
}],
"success": true
}
{
"code": 400,
"status": "error",
"error": {
"code": 20046,
"desc": "参数输入超限"
},
"data": null,
"success": false
}