1
0
mirror of synced 2025-12-24 02:57:55 +08:00

🆕 #2698【企业微信】增加家校应用-上课直播相关接口

This commit is contained in:
0katekate0
2022-06-20 16:25:10 +08:00
committed by GitHub
parent 5ac2e690c0
commit d5c6803260
12 changed files with 446 additions and 20 deletions

View File

@@ -84,7 +84,7 @@ public class WxCpLivingTest {
log.info(livingInfo.toJson());
// 直播观看明细
WxCpWatchStat watchStat = wxCpService.getLivingService().getWatchStat("lvOQpTDwAAcP9wNOSSxTwpbni-TMPNSg", 0);
WxCpWatchStat watchStat = wxCpService.getLivingService().getWatchStat("lvOQpTDwAAcP9wNOSSxTwpbni-TMPNSg", "0");
log.info(watchStat.toJson());
final String watchStateJson = "{\"errcode\":0,\"errmsg\":\"ok\",\"ending\":1,\"next_key\":\"NEXT_KEY\",\"stat_info\":{\"users\":[{\"userid\":\"userid\",\"watch_time\":30,\"is_comment\":1,\"is_mic\":1}],\"external_users\":[{\"external_userid\":\"external_userid1\",\"type\":1,\"name\":\"user name\",\"watch_time\":30,\"is_comment\":1,\"is_mic\":1},{\"external_userid\":\"external_userid2\",\"type\":2,\"name\":\"user_name\",\"watch_time\":30,\"is_comment\":1,\"is_mic\":1}]}}";

View File

@@ -4,10 +4,8 @@ import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.cp.api.impl.WxCpServiceImpl;
import me.chanjar.weixin.cp.bean.school.WxCpCustomizeHealthInfo;
import me.chanjar.weixin.cp.bean.school.WxCpPaymentResult;
import me.chanjar.weixin.cp.bean.school.WxCpResultList;
import me.chanjar.weixin.cp.bean.school.WxCpTrade;
import me.chanjar.weixin.cp.bean.living.WxCpLivingResult;
import me.chanjar.weixin.cp.bean.school.*;
import me.chanjar.weixin.cp.config.WxCpConfigStorage;
import me.chanjar.weixin.cp.demo.WxCpDemoInMemoryConfigStorage;
import org.testng.annotations.Test;
@@ -46,6 +44,60 @@ public class WxCpSchoolTest {
String date = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
/**
* 上课直播
*/
String livingId = "lvOQpTDwAAh0hxHsSeSwTQcmH0nWUC_Q";
/**
* 获取老师直播ID列表
* https://developer.work.weixin.qq.com/document/path/93739
*/
WxCpLivingResult.LivingIdResult result = cpService.getSchoolService().getUserAllLivingId("WangKai", null, 20);
log.info("result{}", result.toJson());
/**
* 删除直播回放
* https://developer.work.weixin.qq.com/document/path/93743
*/
WxCpLivingResult livingResult = cpService.getSchoolService().deleteReplayData(livingId);
log.info("livingResult{}", livingResult.toJson());
/**
* 获取未观看直播统计
* https://developer.work.weixin.qq.com/document/path/93742
*/
String str3 = "{\"errcode\":0,\"errmsg\":\"ok\",\"ending\":1,\"next_key\":\"NEXT_KEY\",\"stat_info\":{\"students\":[{\"student_userid\":\"zhansan_child\",\"parent_userid\":\"zhangsan\",\"partyids\":[10,11]},{\"student_userid\":\"lisi_child\",\"parent_userid\":\"lisi\",\"partyids\":[5]}]}}";
WxCpSchoolUnwatchStat schoolUnwatchStat = WxCpSchoolUnwatchStat.fromJson(str3);
log.info("unwatchStat{}", schoolUnwatchStat.toJson());
WxCpSchoolUnwatchStat unwatchStat = cpService.getSchoolService().getUnwatchStat(livingId, "0");
log.info("unwatchStat{}", unwatchStat.toJson());
/**
* 获取观看直播统计
* https://developer.work.weixin.qq.com/document/path/93741
*/
String str2 = "{\"errcode\":0,\"errmsg\":\"ok\",\"ending\":1,\"next_key\":\"NEXT_KEY\",\"stat_infoes\":{\"students\":[{\"student_userid\":\"zhansan_child\",\"parent_userid\":\"zhangsan\",\"partyids\":[10,11],\"watch_time\":30,\"enter_time\":1586433904,\"leave_time\":1586434000,\"is_comment\":1},{\"student_userid\":\"lisi_child\",\"parent_userid\":\"lisi\",\"partyids\":[10,11],\"watch_time\":30,\"enter_time\":1586433904,\"leave_time\":1586434000,\"is_comment\":0}],\"visitors\":[{\"nickname\":\"wx_nickname1\",\"watch_time\":30,\"enter_time\":1586433904,\"leave_time\":1586434000,\"is_comment\":1},{\"nickname\":\"wx_nickname2\",\"watch_time\":30,\"enter_time\":1586433904,\"leave_time\":1586434000,\"is_comment\":0}]}}";
WxCpSchoolWatchStat wxCpSchoolWatchStat = WxCpSchoolWatchStat.fromJson(str2);
log.info("wxCpSchoolWatchStat{}", wxCpSchoolWatchStat.toJson());
WxCpSchoolWatchStat watchStat = cpService.getSchoolService().getWatchStat(livingId, "0");
log.info("watchStat{}", watchStat.toJson());
String str1 = "{\"errcode\":0,\"errmsg\":\"ok\",\"living_info\":{\"theme\":\"直角三角形讲解\",\"living_start\":1586405229,\"living_duration\":1800,\"anchor_userid\":\"zhangsan\",\"living_range\":{\"partyids\":[1,4,9],\"group_names\":[\"group_name1\",\"group_name2\"]},\"viewer_num\":100,\"comment_num\":110,\"open_replay\":1,\"push_stream_url\":\"https://www.qq.test.com\"}}";
WxCpSchoolLivingInfo wxCpSchoolLivingInfo = WxCpSchoolLivingInfo.fromJson(str1);
log.info("str1{}", wxCpSchoolLivingInfo.toJson());
/**
* 获取直播详情
* https://developer.work.weixin.qq.com/document/path/93740
*/
WxCpSchoolLivingInfo schoolLivingInfo = cpService.getSchoolService().getLivingInfo(livingId);
log.info("schoolLivingInfo{}", schoolLivingInfo.toJson());
/**
* 获取学生付款结果
* https://developer.work.weixin.qq.com/document/path/94553