Polyv Help Center

Help Center

lessonStatisticsService

Updated: 2024-10-21 09:33:43

1. Query User Information by Lesson Dimension

Description

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

Call Constraints

  1. The API call has a frequency limit. Click here for details. For common call exceptions, click here for details.

Unit Test

    @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;
        }
    }
}

Unit Test Description

  1. If the request is correct, a VClassLessonStatisticsResponse object is returned. The B-end processes business logic based on this object.

  2. If the request parameter validation fails, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [ Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty] ]

  3. If the server encounters an exception during processing, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]

Request Parameter Description

Parameter Required Type Description
lessonId true Long Lesson ID
currentPage false Integer Page number, default is 1 [Corresponds to the pageNumber field in the API documentation]
pageSize false Integer Number of data items displayed per page, default is 10

Return Object Description

Parameter Type Description
contents Array Relevant information when the request is successful, empty when the request fails [See LessonStatistics Parameter Description for details]
pageSize Integer Number of data items displayed per page, default is 10
currentPage Integer Current page [Corresponds to the pageNumber field in the API documentation]
totalItems Integer Total number of records
totalPage Integer Total number of pages [Corresponds to the totalPages field in the API documentation]
LessonStatistics Parameter Description
Parameter Type Description
viewerId String User ID
name String User nickname
startTime Date Entry time, format: yyyy-MM-dd HH:mm:ss
endTime Date Exit time, format: yyyy-MM-dd HH:mm:ss
joinDuration String Co-broadcast duration, format: HH:mm:ss
ip String IP address
userAgent String User device
operatingSystem String Operating system, e.g., Windows, Mac, Android, iOS, or others
browser String Browser, e.g., Chrome 93
country String Country
province String Province
city String City
isp String Internet Service Provider

联系客服,在线咨询