保利威文档中心

帮助中心

lessonStatisticsService

更新时间:2024-10-21 09:33:43

1、基于课节维度查询用户信息

描述

基于课节维度查询用户信息,这里的数据只是纯业务统计数据,与计费无关
接口地址(仅做说明使用):https://api.polyv.net/hi-class-api/open/statistics/v1/list

调用约束

1、接口调用有频率限制,详细请查看,调用常见异常,详细请查看

单元测试

    @Test
    public void testListLessonStatistics() throws IOException, NoSuchAlgorithmException {
        VClassLessonStatisticsRequest vClassLessonStatisticsRequest = new VClassLessonStatisticsRequest();
        VClassLessonStatisticsResponse vClassLessonStatisticsResponse;
        try {
            vClassLessonStatisticsRequest.setLessonId(super.createLesson()).setPageSize(5);
            vClassLessonStatisticsResponse = new VClassLessonStatisticsServiceImpl().listLessonStatistics(
                    vClassLessonStatisticsRequest);
            Assert.assertNotNull(vClassLessonStatisticsResponse);
            if (vClassLessonStatisticsResponse != null) {
                //to do something ......
                log.debug("测试基于课节维度查询用户信息成功 {}", JSON.toJSONString(vClassLessonStatisticsResponse));
            }
        } catch (PloyvSdkException e) {
            //参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
            log.error(e.getMessage(), e);
            // 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
            throw e;
        } catch (Exception e) {
            log.error("SDK调用异常", e);
            throw e;
        }
    }
}

单元测试说明

1、请求正确,返回VClassLessonStatisticsResponse对象,B端依据此对象处理业务逻辑;

2、请求参数校验不合格,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 输入参数 [xxx.chat.LivexxxRequest]对象校验失败,失败字段 [pic不能为空 / msg不能为空] ]

3、服务器处理异常,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 保利威请求返回数据错误,请求流水号:66e7ad29fd04425a84c2b2b562d2025b,错误原因: invalid signature. ]

请求入参描述

参数名 必选 类型 说明
lessonId true Long 课节号
currentPage false Integer 页数,默认为1【对应api文档的pageNumber字段】
pageSize false Integer 每页显示的数据条数,默认每页显示10条数据

返回对象描述

参数名 类型 说明
contents Array 请求成功时的有关信息,请求失败时为空【详见LessonStatistics参数描述
pageSize Integer 每页显示的数据条数,默认每页显示10条数据
currentPage Integer 当前页【对应api文档的pageNumber字段】
totalItems Integer 记录总条数
totalPage Integer 总页数【对应api文档的totalPages字段】
LessonStatistics参数描述
参数名 类型 说明
viewerId String 用户ID
name String 用户昵称
startTime Date 进入时间,格式:年月日时分秒 yyyy-MM-dd HH:mm:ss
endTime Date 离开房间,格式:年月日时分秒 yyyy-MM-dd HH:mm:ss
joinDuration String 连麦时长,格式:时分秒 HH:mm:ss
ip String ip
userAgent String 用户设备
operatingSystem String 操作系统,是Windows 还是Mac;安卓,iOS;其他
browser String 浏览器,例如Chrome 93
country String 国家
province String 省份
city String 城市
isp String 运营商

联系客服,在线咨询