保利威文档中心

帮助中心

channelViewdata

更新时间:2026-04-17 12:02:09

1、获取频道一定时间范围之内的历史最高并发人数

描述

获取频道一定时间范围之内的历史最高并发人数,粒度可以支持到分钟
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/statistics/get-max-history-concurrent

调用约束

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

单元测试

    @Test
    public void testGetMaxChannelHistoryConcurrent() throws Exception, NoSuchAlgorithmException {
        LiveChannelMaxHistoryConcurrentRequest liveChannelMaxHistoryConcurrentRequest =
                new LiveChannelMaxHistoryConcurrentRequest();
        Integer liveChannelMaxHistoryConcurrentResponse;
        try {
            long nowTime = System.currentTimeMillis();
            long startTime = nowTime - 30 * 24 * 60 * 60 * 1000l;
            liveChannelMaxHistoryConcurrentRequest.setChannelId(createChannel())
                    .setStartTime(super.getDate(startTime))
                    .setEndTime(super.getDate(nowTime));
            liveChannelMaxHistoryConcurrentResponse =
                    new LiveChannelViewdataServiceImpl().getMaxChannelHistoryConcurrent(
                    liveChannelMaxHistoryConcurrentRequest);
            Assert.assertNotNull(liveChannelMaxHistoryConcurrentResponse);
            if (liveChannelMaxHistoryConcurrentResponse != null) {
                //to do something ......
                log.debug("测试获取频道一定时间范围之内的历史最高并发人数成功,并发人数为:{}", liveChannelMaxHistoryConcurrentResponse);
            }
        } catch (PloyvSdkException e) {
            //参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage(),B
            log.error(e.getMessage(), e);
            // 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
            throw e;
        } catch (Exception e) {
            log.error("SDK调用异常", e);
            throw e;
        }
    }

单元测试说明

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

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

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

请求入参描述

参数名 必选 类型 说明
channelId true String 频道号
startTime true Date 开始时间
endTime true Date 结束时间
appId false String POLYV用户APP_ID,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)
appSecret false String POLYV用户APP_SECRET,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)

返回对象描述

返回时间区间内的最高并发人数




2、分页获取连麦情况使用详情

描述

分页获取连麦情况使用详情
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/statistics/mic/list

调用约束

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

单元测试

    @Test
    public void testListChannelMic() throws Exception, NoSuchAlgorithmException {
        LiveListChannelMicRequest liveListChannelMicRequest = new LiveListChannelMicRequest();
        LiveListChannelMicResponse liveListChannelMicResponse;
        try {
            liveListChannelMicRequest.setChannelIds("1951952,1958888")
                    .setStartDay(getDate(2020, 1, 1))
                    .setEndDay(getDate(2020, 11, 11));
            liveListChannelMicResponse = new LiveChannelViewdataServiceImpl().listChannelMic(liveListChannelMicRequest);
            Assert.assertNotNull(liveListChannelMicResponse);
            if (liveListChannelMicResponse != null) {
                //to do something ......
                log.debug("测试分页获取连麦情况使用详情成功,{}", JSON.toJSONString(liveListChannelMicResponse));
            }
        } catch (PloyvSdkException e) {
            //参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage(),B
            log.error(e.getMessage(), e);
            // 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
            throw e;
        } catch (Exception e) {
            log.error("SDK调用异常", e);
            throw e;
        }
    }

单元测试说明

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

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

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

请求入参描述

参数名 必选 类型 说明
channelIds false String 频道号,使用英文逗号分开,如:100000,100001
startDay false Date 开始时间,格式:yyyy-MM-dd
endDay false Date 结束时间,格式:yyyy-MM-dd
currentPage false Integer 页数,默认为1【对应api文档的page字段】
pageSize false Integer 每页显示的数据条数,默认每页显示20条数据【对应api文档的size字段】
appId false String POLYV用户APP_ID,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)
appSecret false String POLYV用户APP_SECRET,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)

返回对象描述

参数名 类型 说明
contents Array 列表信息【详见ChannelMic参数描述
pageSize Integer 每页显示的数据条数,默认每页显示20条数据
currentPage Integer 当前页【对应api文档的pageNumber字段】
totalItems Integer 记录总条数
totalPage Integer 总页数【对应api文档的totalPages字段】
ChannelMic参数描述
参数名 类型 说明
userId String 用户userId
channelId String 频道号
currentDay Date 当天,如:2019-10-25
history Integer 使用连麦分钟数,单位:分钟






3、分页查询频道观看日志

描述

分页查询频道观看日志
接口地址(仅做说明使用):https://api.polyv.net/live/v2/statistics/%s/viewlog

调用约束

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

2、如果查询一段时间的记录,可以传:startTime、endTime (startTime和endTime 必须在同一个月),如果查询某天的记录,则传currentDay

3、startTime、endTime 和 currentDay不能都不传

4、currentDay与startTime、endTime 同时传将使用 startTime、endTime 的值

单元测试

    @Test
    public void testListChannelViewlog() throws Exception, NoSuchAlgorithmException {
        LiveListChannelViewlogRequest liveListChannelViewlogRequest = new LiveListChannelViewlogRequest();
        LiveListChannelViewlogResponse liveListChannelViewlogResponse;
        try {
            liveListChannelViewlogRequest.setChannelId(createChannel()).setCurrentDay(getDate(2020, 11, 3));
            liveListChannelViewlogResponse = new LiveChannelViewdataServiceImpl().listChannelViewlog(
                    liveListChannelViewlogRequest);
            Assert.assertNotNull(liveListChannelViewlogResponse);
            if (liveListChannelViewlogResponse != null) {
                //to do something ......
                log.debug("测试分页查询频道观看日志成功,{}", JSON.toJSONString(liveListChannelViewlogResponse));
            }
        } catch (PloyvSdkException e) {
            //参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage(),B
            log.error(e.getMessage(), e);
            // 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
            throw e;
        } catch (Exception e) {
            log.error("SDK调用异常", e);
            throw e;
        }
    }

单元测试说明

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

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

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

请求入参描述

参数名 必选 类型 说明
channelId true String 频道号
currentDay false Date 查询日期,格式:yyyy-MM-dd
startTime false Date 查询开始时间
endTime false Date 查询结束时间
viewerId false String 观看用户ID【对应api文档的param1字段】
viewerName false String 观看用户名称【对应api文档的param2字段】
logType false String 观看日志类型,取值 vod 表示观看回放,取值live 表示直播【对应api文档的param3字段】
viewLogType false String 直播点播日志类型,默认为live
vod:查询点播列表观看数据
live:查询直播或回放列表观看数据
sessionIds false String 场次ID, 多个场次使用,分隔
param4 false String 自定义参数
currentPage false Integer 页数,默认为1【对应api文档的page字段】
pageSize false Integer 每页显示的数据条数,默认每页显示20条数据
appId false String POLYV用户APP_ID,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)
appSecret false String POLYV用户APP_SECRET,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)

返回对象描述

参数名 类型 说明
contents Array 频道观看日志【详见LiveChannelViewlog参数描述
pageSize Integer 每页显示的数据条数,默认每页显示20条数据
currentPage Integer 当前页【对应api文档的pageNumber字段】
totalItems Integer 记录总条数
totalPage Integer 总页数【对应api文档的totalPages字段】
LiveChannelViewlog参数描述
参数名 类型 说明
playId String 表示此次播放动作的ID
userId String 用户ID
channelId String 频道号
playDuration Integer 播放时长,单位:秒
stayDuration Integer 停留时长,单位:秒
flowSize Long 流量大小
sessionId String 直播的场次ID
viewerId String 观众id【对应api文档的param1字段】
viewerName String 观众名称,最多支持64个字符【对应api文档的param2字段】
logType String 观看类型:取值vod 表示观看回放,取值live 表示直播【对应api文档的param3字段】
param4 String POLYV系统参数
param5 String POLYV系统参数
ipAddress String IP地址
country String 国家
province String 省份
city String 城市
isp String ISP运营商
referer String 播放视频页面地址
userAgent String 用户设备
operatingSystem String 操作系统
browser String 浏览器
isMobile String 是否为移动端,Y:移动端,N:非移动端
currentDay Date 日志查询日期
createdTime Date 日志创建日期,近似观众观看直播的开始时间,会比实际观看时间略慢一点点,观看时长建议使用 createdTime + playDuration 得到
lastModified Date 日志更新日期
firstActiveTime Date 进入时间
lastActiveTime Date 退出时间






4、查询多个频道汇总的统计数据

描述

查询多个频道汇总的统计数据
接口地址(仅做说明使用):https://api.polyv.net/live/v2/statistics/%s/channel_summary

调用约束

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

单元测试

    @Test
    public void testListChannelSummary() throws Exception, NoSuchAlgorithmException {
        LiveListChannelSummaryRequest liveListChannelSummaryRequest = new LiveListChannelSummaryRequest();
        LiveListChannelSummaryResponse liveListChannelSummaryResponse;
        try {
            liveListChannelSummaryRequest.setStartDate(getDate(2020, 01, 01))
                    .setEndDate(getDate(2020, 11, 11))
                    .setChannelIds("1951952,1958888");
            liveListChannelSummaryResponse = new LiveChannelViewdataServiceImpl().listChannelSummary(
                    liveListChannelSummaryRequest);
            Assert.assertNotNull(liveListChannelSummaryResponse);
            if (liveListChannelSummaryResponse != null) {
                //to do something ......
                log.debug("测试查询多个频道汇总的统计数据成功,{}", JSON.toJSONString(liveListChannelSummaryResponse));
            }
        } catch (PloyvSdkException e) {
            //参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage(),B
            log.error(e.getMessage(), e);
            // 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
            throw e;
        } catch (Exception e) {
            log.error("SDK调用异常", e);
            throw e;
        }
    }

单元测试说明

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

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

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

请求入参描述

参数名 必选 类型 说明
userId false String POLYV用户ID,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)
startDate true Date 查询的开始日期,格式为yyyy-MM-dd
endDate true Date 查询的结束日期,格式为yyyy-MM-dd
channelIds false String 要查询的频道号,不提交默认为查询所有频道,多个频道号以英文逗号“,”分开,如:105420,104400
appId false String POLYV用户APP_ID,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)
appSecret false String POLYV用户APP_SECRET,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)

返回对象描述

参数名 类型 说明
channelSummarys Array 统计数据【详见ChannelSummary参数描述
ChannelSummary参数描述
参数名 类型 说明
channelId String 频道号
name String 频道名称
pcPlayDuration Integer pc端播放时长,单位:分钟
pcFlowSize Long pc端播放流量,单位为Byte
pcVideoView Integer pc视频播放量
pcUniqueViewer Integer pc端唯一观众数
mobilePlayDuration Long 移动端播放时长,单位:分钟
mobileFlowSize Long 移动端播放流量,单位为Byte
mobileVideoView Integer 移动端播放量
mobileUniqueViewer Integer 移动端唯一观众数
livePcPlayDuration Integer PC直播播放时长,单位为分钟
playbackPcPlayDuration Long PC回放播放时长,单位为分钟
liveMobilePlayDuration Integer 移动端直播播放时长,单位为分钟
playbackMobilePlayDuration Long 移动端回放播放时长,单位为分钟
unknownPcPlayDuration Integer pc其他播放时长,单位为分钟
unknownMobilePlayDuration Integer 移动端其他播放时长,单位为分钟






5、查询多个频道的实时在线人数

描述

查询多个频道的实时在线人数
接口地址(仅做说明使用):https://api.polyv.net/live/v2/statistics/get-realtime-viewers

调用约束

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

单元测试

    @Test
    public void testListChannelViewerCount() throws Exception, NoSuchAlgorithmException {
        LiveListChannelViewerCountRequest liveListChannelViewerCountRequest = new LiveListChannelViewerCountRequest();
        LiveListChannelViewerCountResponse liveListChannelViewerCountResponse;
        try {
            liveListChannelViewerCountRequest.setChannelIds("1951952,1958888");
            liveListChannelViewerCountResponse = new LiveChannelViewdataServiceImpl().listChannelViewerCount(
                    liveListChannelViewerCountRequest);
            Assert.assertNotNull(liveListChannelViewerCountResponse);
            if (liveListChannelViewerCountResponse != null) {
                //to do something ......
                log.debug("测试查询多个频道的实时在线人数成功,{}", JSON.toJSONString(liveListChannelViewerCountResponse));
            }
        } catch (PloyvSdkException e) {
            //参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage(),B
            log.error(e.getMessage(), e);
            // 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
            throw e;
        } catch (Exception e) {
            log.error("SDK调用异常", e);
            throw e;
        }
    }

单元测试说明

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

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

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

请求入参描述

参数名 必选 类型 说明
channelIds true String 频道号,使用英文逗号分开,如:100000,100001
appId false String POLYV用户APP_ID,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)
appSecret false String POLYV用户APP_SECRET,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)

返回对象描述

参数名 类型 说明
channelViewerCounts Array 频道实时在线人数【详见ChannelViewerCount参数描述
ChannelViewerCount参数描述
参数名 类型 说明
channelId String 频道号
time String 统计的时间点(时间格式:24H),例:15:39:10
count String 某个时间点实时观看人数






6、查询频道的历史并发人数

描述

查询频道的历史并发人数
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/statistics/concurrence

调用约束

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

单元测试

    @Test
    public void testGetChannelViewerConcurrence() throws Exception, NoSuchAlgorithmException {
        LiveChannelViewerConcurrenceRequest liveChannelViewerConcurrenceRequest =
                new LiveChannelViewerConcurrenceRequest();
        LiveChannelViewerConcurrenceResponse liveChannelViewerConcurrenceResponse;
        try {
            liveChannelViewerConcurrenceRequest.setChannelId(createChannel())
                    .setStartDate(getDate(2020, 10, 01))
                    .setEndDate(getDate(2020, 11, 11));
            liveChannelViewerConcurrenceResponse = new LiveChannelViewdataServiceImpl().getChannelViewerConcurrence(
                    liveChannelViewerConcurrenceRequest);
            Assert.assertNotNull(liveChannelViewerConcurrenceResponse);
            if (liveChannelViewerConcurrenceResponse != null) {
                //to do something ......
                log.debug("测试查询频道的历史并发人数成功,{}", JSON.toJSONString(liveChannelViewerConcurrenceResponse));
            }
        } catch (PloyvSdkException e) {
            //参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage(),B
            log.error(e.getMessage(), e);
            // 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
            throw e;
        } catch (Exception e) {
            log.error("SDK调用异常", e);
            throw e;
        }
    }

单元测试说明

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

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

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

请求入参描述

参数名 必选 类型 说明
channelId true String 频道号
startDate true Date 开始日期格式,yyyy-MM-dd,开始日期和结束日期的时间跨度:最多查两个月内的数据
endDate true Date 结束日期格式,yyyy-MM-dd,开始日期和结束日期的时间跨度:最多查两个月内的数据
appId false String POLYV用户APP_ID,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)
appSecret false String POLYV用户APP_SECRET,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)

返回对象描述

参数名 类型 说明
channelViewerConcurrences Array 频道并发在线人数【详见ChannelViewerConcurrence参数描述
ChannelViewerConcurrence参数描述
参数名 类型 说明
day Date 统计的日期(时间格式:yyyy-MM-dd,例:2019-04-10)
minute String 统计的时间点(时间格式:12H,例:10:30)
viewers String 某个时间点实时观看人数






7、查询时间内直播场次数据

描述

查询时间内直播场次数据
接口地址(仅做说明使用):https://api.polyv.net/live/v4/statistics/session-stats/list

调用约束

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

2、不填写查询时间段时,默认查询当前时间到前一个小时之间产生的场次报表数据;查询时间段最大间隔24小时

单元测试

    @Test
    public void testGetLiveSession() throws IOException, NoSuchAlgorithmException {
        LiveGetLiveSessionRequest liveGetLiveSessionRequest = new LiveGetLiveSessionRequest();
        LiveGetLiveSessionResponse liveGetLiveSessionResponse;
        try {
            liveGetLiveSessionRequest.setStartTime(super.getDate(2021, 10, 16, 0, 31, 15));
            liveGetLiveSessionRequest.setEndTime(super.getDate(2021, 10, 16, 20, 31, 15));
            liveGetLiveSessionResponse = new LiveChannelViewdataServiceImpl().getLiveSession(liveGetLiveSessionRequest);
            Assert.assertNotNull(liveGetLiveSessionResponse);
            if (liveGetLiveSessionResponse != null) {
                //to do something ......
                log.debug("测试查询时间内直播场次数据成功{}", JSON.toJSONString(liveGetLiveSessionResponse));
            }
        } 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、请求正确,返回LiveGetLiveSessionResponse对象,B端依据此对象处理业务逻辑;

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

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

请求入参描述

参数名 必选 类型 说明
startTime false Date 开始时间
endTime false Date 结束时间
currentPage false Integer 页数,默认为1【对应api文档的pageNumber字段】
pageSize false Integer 每页显示的数据条数,默认每页显示20条数据
appId false String POLYV用户APP_ID,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)
appSecret false String POLYV用户APP_SECRET,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)

返回对象描述

参数名 类型 说明
contents Array 直播场次数据【详见ChannelLiveSession参数描述
pageSize Integer 每页显示的数据条数,默认每页显示20条数据
currentPage Integer 当前页【对应api文档的pageNumber字段】
totalItems Integer 记录总条数
totalPage Integer 总页数【对应api文档的totalPages字段】
ChannelLiveSession参数描述
参数名 类型 说明
channelId String 频道ID
sessionId String 直播场次ID
name String 场次名称
startTime Date 直播开始时间,时间格式 yyyy-MM-dd HH:mm:ss
endTime Date 直播结束时间,时间格式 yyyy-MM-dd HH:mm:ss
userId String 用户ID






8、分页查询账号直播观看详情数据

描述

分页获取账号下所有频道观看详情数据
接口地址(仅做说明使用):https://api.polyv.net/live/v3/user/statistics/viewlog

调用约束

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

单元测试

    @Test
    public void testGetChannelViewLog() throws IOException, NoSuchAlgorithmException {
        LiveGetChannelViewLogRequest liveGetChannelViewLogRequest = new LiveGetChannelViewLogRequest();
        LiveGetChannelViewLogResponse liveGetChannelViewLogResponse;
        try {
            String channelId = super.createChannel();
            liveGetChannelViewLogRequest.setChannelId(channelId)
                    .setStartDate(super.getDate(1606924800000L))
                    .setEndDate(super.getDate(1607011200000L));
            liveGetChannelViewLogResponse = new LiveChannelViewdataServiceImpl().getChannelViewLog(
                    liveGetChannelViewLogRequest);
            Assert.assertNotNull(liveGetChannelViewLogResponse);
            if (liveGetChannelViewLogResponse != null) {
                //to do something ......
                log.debug("测试分页查询账号直播观看详情数据成功 {}", JSON.toJSONString(liveGetChannelViewLogResponse));
            }
        } 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、请求正确,返回LiveGetChannelViewLogResponse对象,B端依据此对象处理业务逻辑;

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

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

请求入参描述

参数名 必选 类型 说明
startDate true Date 查询开始时间,格式:yyyy-MM-dd HH:mm:ss
endDate true Date 查询结束时间,格式:yyyy-MM-dd HH:mm:ss
channelId false String 频道ID,不传查询所有频道
watchType false String 观看类型, live:直播, vod:回放
currentPage false Integer 页数,默认为1【对应api文档的page字段】
pageSize false Integer 每页显示的数据条数,默认每页显示20条数据
appId false String POLYV用户APP_ID,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)
appSecret false String POLYV用户APP_SECRET,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)

返回对象描述

参数名 类型 说明
contents Array 观看详情数据列表【详见ViewLogList参数描述
pageSize Integer 每页显示的数据条数,默认每页显示20条数据
currentPage Integer 当前页【对应api文档的pageNumber字段】
totalItems Integer 记录总条数
totalPage Integer 总页数【对应api文档的totalPages字段】
ViewLogList参数描述
参数名 类型 说明
playId String 表示此次播放动作的ID
userId String POLYV用户ID,和保利威官网一致,获取路径:官网->登录->直播(开发设置)
channelId String 频道号
playDuration Integer 播放时长,单位:秒
stayDuration Integer 停留时长,单位:秒
flowSize Long 流量大小,单位:bytes
sessionId String 直播场次ID
viewerId String 使用POLYV观看页的观众ID【对应api文档的param1字段】
viewerName String 使用POLYV观看页的观众昵称【对应api文档的param2字段】
logType String 观看日志类型,默认为live vod:观看回放 live:直播【对应api文档的param3字段】
param4 String POLYV系统参数
param5 String POLYV系统参数
ipAddress String IP地址
country String 国家
province String 省份
city String 城市
isp String ISP运营商
referer String 播放视频页面地址
userAgent String 用户设备
operatingSystem String 操作系统
browser String 浏览器
isMobile String 是否为移动端
currentDay Date 查询日期,格式:yyyy-MM-dd
createdTime Date 日志创建日期,13位毫秒级时间戳
lastModified Date 日志更新日期,13位毫秒级时间戳
pType Integer 1:无延迟观看 0:普通观看【对应api文档的ptype字段】
firstActiveTime Date 进入页面时间,部分情况返回为null,非特殊说明,请使用createdTime替代
lastActiveTime Date 退出页面时间,部分情况返回为null,非特殊说明,请使用createdTime+stayDuration替代






9、查询频道多场次概览统计数据

描述

接口用于统计直播间内多场次的直播的观看数据,数据会根据场次号进行汇总,返回观看UV、观看PV等。
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/statistics/get-session-stats

调用约束

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

单元测试

    @Test
    public void testGetSessionStats() throws IOException, NoSuchAlgorithmException {
        LiveGetSessionStatsRequest liveGetSessionStatsRequest = new LiveGetSessionStatsRequest();
        LiveGetSessionStatsResponse liveGetSessionStatsResponse;
        try {
            String channelId = super.createChannel();
            liveGetSessionStatsRequest.setChannelId(channelId)
                    .setStartTime(getDate(1610273359000L))
                    .setEndTime(getDate(1612001359000L));
            liveGetSessionStatsResponse = new LiveChannelViewdataServiceImpl().getSessionStats(
                    liveGetSessionStatsRequest);
            Assert.assertNotNull(liveGetSessionStatsResponse);
            if (liveGetSessionStatsResponse != null) {
                //to do something ......
                log.debug("测试查询频道多场次概览统计数据成功 {}", JSON.toJSONString(liveGetSessionStatsResponse));
            }
        } 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、请求正确,返回LiveGetSessionStatsResponse对象,B端依据此对象处理业务逻辑;

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

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

请求入参描述

参数名 必选 类型 说明
channelId true String 频道号
sessionIds false String 场次ID,多个场次使用逗号分隔,如:fw82mayhuy,fvipafupmh,场次ID和直播开始结束时间必填一项,场次ID和直播开始结束时间同时存在时,使用场次ID进行查询
startTime false Date 直播开始时间,开始时间和结束时间相隔不可以超过30天
endTime false Date 直播结束时间,场次ID和直播开始结束时间必填一项
appId false String POLYV用户APP_ID,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)
appSecret false String POLYV用户APP_SECRET,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)

返回对象描述

参数名 类型 说明
list Array 直播间内多场次的观看数据列表【详见ChannelSessionStats参数描述
ChannelSessionStats参数描述
参数名 类型 说明
channelId String 频道号
sessionId String 场次ID
name String 场次名称
startTime Date 场次开始时间
endTime Date 场次结束时间
duration Integer 直播时长,单位秒
liveUV Integer 直播观看用户数
livePV Integer 直播观看次数
playbackUV Integer 回放观看用户数
playbackPV Integer 回放观看次数
totalPlayDuration Integer 观看直播总时长,单位秒
totalPlaybackDuration Integer 观看回放总时长,单位秒






10、查询时间范围内频道直播观看详情数据

描述

通过频道号获取该频道某段时间的直播观看的统计数据
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/statistics/daily/summary

调用约束

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

单元测试

    @Test
    public void testGetDailySummary() throws IOException, NoSuchAlgorithmException {
        LiveDailySummaryRequest liveDailySummaryRequest = new LiveDailySummaryRequest();
        List<LiveDailySummaryResponse> liveDailySummaryResponse;
        try {
            String channelId = super.createChannel();
            liveDailySummaryRequest.setChannelId(channelId);
            liveDailySummaryRequest.setStartDay(super.getDate(2021, 3, 01));
            liveDailySummaryRequest.setEndDay(super.getDate(2021, 3, 30));
            liveDailySummaryResponse = new LiveChannelViewdataServiceImpl().getDailySummary(liveDailySummaryRequest);
            Assert.assertNotNull(liveDailySummaryResponse);
            if (liveDailySummaryResponse != null) {
                //to do something ......
                log.debug("测试查询时间范围内频道直播观看详情数据成功 {}", JSON.toJSONString(liveDailySummaryResponse));
            }
        } 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、请求正确,返回LiveDailySummaryResponse对象,B端依据此对象处理业务逻辑;

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

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

请求入参描述

参数名 必选 类型 说明
channelId true String 频道号
startDay true Date 开始日期,格式:yyyy-MM-dd
endDay true Date 结束日期,格式:yyyy-MM-dd
appId false String POLYV用户APP_ID,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)
appSecret false String POLYV用户APP_SECRET,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)

返回对象描述

返回对象是List<LiveDailySummaryResponse>,LiveDailySummaryResponse具体元素内容如下:

参数名 类型 说明
currentDay Date 查询日期
channelId String 频道号
userId String 直播账号ID
pcPlayDuration Integer PC端播放时长,单位:分钟
pcVideoView Integer PC端总播放量,类似PV
pcUniqueViewer Integer PC端唯一观众数,类似UV
mobilePlayDuration Integer 移动端播放时长,单位:分钟
mobileVideoView Integer 移动端总播放量,类似PV
mobileUniqueViewer Integer 移动端唯一观众数,类似UV
createdTime Date 记录添加的时间
lastModified Date 记录修改的时间
creatorId String 创建账号的子账号用户ID(为空则为主账号创建)
creatorName String 创建频道的子账号名称(主账号创建的则显示"主账号")






11、查询频道连麦详情数据

描述

接口用于查询某个频道的一段时间区间内的连麦详情数据,支持分页
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/mic/log/list-detail

调用约束

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

单元测试

    @Test
    public void testListLinkMicDetail() throws IOException, NoSuchAlgorithmException {
        LiveListLinkMicDetailRequest liveListLinkMicDetailRequest = new LiveListLinkMicDetailRequest();
        LiveListLinkMicDetailResponse liveListLinkMicDetailResponse;
        try {
            String channelId = super.createChannel();
            liveListLinkMicDetailRequest.setChannelId(channelId);
            liveListLinkMicDetailRequest.setStartDate(super.getDate(2020, 11, 1));
            liveListLinkMicDetailRequest.setEndDate(super.getDate(2020, 11, 03));
            liveListLinkMicDetailResponse = new LiveChannelViewdataServiceImpl().listLinkMicDetail(
                    liveListLinkMicDetailRequest);
            Assert.assertNotNull(liveListLinkMicDetailResponse);
            if (liveListLinkMicDetailResponse != null) {
                //to do something ......
                log.debug("测试查询频道连麦详情数据成功 {}", JSON.toJSONString(liveListLinkMicDetailResponse));
            }
        } 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、请求正确,返回LiveListLinkMicDetailResponse对象,B端依据此对象处理业务逻辑;

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

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

请求入参描述

参数名 必选 类型 说明
channelId true String 频道号
startDate true Date 开始日期,格式:yyyy-MM-dd,如2020-10-01,时间范围不能超过30天
endDate true Date 结束日期,格式:yyyy-MM-dd,如2020-10-01,时间范围不能超过30天
page false Integer 当前页码,默认为1
pageSize false Integer 每页数据大小,默认500条,最大5000条,超过5000条可以分多批拉取,每次page加1,直到返回列表contents为空为止
appId false String POLYV用户APP_ID,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)
appSecret false String POLYV用户APP_SECRET,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)

返回对象描述

参数名 类型 说明
page Integer 当前页码,默认为1
contents Array 查询的结果列表【详见MicDetail参数描述
pageSize Integer 每页显示的数据条数,默认每页显示20条数据
currentPage Integer 当前页【对应api文档的pageNumber字段】
totalItems Integer 记录总条数
totalPage Integer 总页数【对应api文档的totalPages字段】
MicDetail参数描述
参数名 类型 说明
channelId String 频道号
sessionId String 场次号
viewerId String 观众ID
identity String 身份 guest:嘉宾 student:学员
nickname String 昵称
joinTime Date 进入 rtc 的时间,13位毫秒时间戳
leaveTime Date 离开 rtc 的时间,13位毫秒时间戳
duration Integer 连麦时长(分钟数)






12、查询频道实时并发数据

描述

在直播中,查询频道实时在线人数
接口地址(仅做说明使用):https://api.polyv.net/live/v1/statistics/%s/realtime

调用约束

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

单元测试

    @Test
    public void testGetRealviewers() throws IOException, NoSuchAlgorithmException {
        LiveRealviewersRequest liveRealviewersRequest = new LiveRealviewersRequest();
        List<LiveRealviewersResponse> liveRealviewersResponse;
        try {
            String channelId = super.createChannel();
            liveRealviewersRequest.setChannelId(channelId);
            liveRealviewersRequest.setUserId(LiveGlobalConfig.getUserId());
            liveRealviewersResponse = new LiveChannelViewdataResultServiceImpl().getRealviewers(liveRealviewersRequest);
            Assert.assertNotNull(liveRealviewersResponse);
            if (liveRealviewersResponse != null) {
                //to do something ......
                log.debug("测试查询频道实时并发数据成功 {}", JSON.toJSONString(liveRealviewersResponse));
            }
        } 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、请求正确,返回LiveRealviewersResponse对象,B端依据此对象处理业务逻辑;

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

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

请求入参描述

参数名 必选 类型 说明
userId true String 直播账号ID
channelId true String 直播频道ID
appId false String POLYV用户APP_ID,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)
appSecret false String POLYV用户APP_SECRET,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)

返回对象描述

返回对象是List<LiveRealviewersResponse>,LiveRealviewersResponse具体元素内容如下:

参数名 类型 说明
time String 统计的时间,格式:HH:mm:ss
count String 某个时间,实时观看人数






13、查询后台频道统计信息

描述

查询后台频道统计信息
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/statistics/channel-statistic

调用约束

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

单元测试

    @Test
    public void testGetChannelStatistic() throws IOException, NoSuchAlgorithmException {
        LiveChannelStatisticRequest liveChannelStatisticRequest = new LiveChannelStatisticRequest();
        LiveChannelStatisticResponse liveChannelStatisticResponse;
        try {
            String channelId = super.createChannel();
            liveChannelStatisticRequest.setChannelId(channelId)
                    .setStartDate(super.getDate(2023, 10, 1))
                    .setEndDate(super.getDate(2023, 10, 30));
            liveChannelStatisticResponse = new LiveChannelViewdataServiceImpl().getChannelStatistic(
                    liveChannelStatisticRequest);
            Assert.assertNotNull(liveChannelStatisticResponse);
            if (liveChannelStatisticResponse != null) {
                log.info("uniqueVisitor is "+ liveChannelStatisticResponse.getUniqueVisitor());
                //to do something ......
                log.debug("测试查询后台频道统计信息成功 {}", JSON.toJSONString(liveChannelStatisticResponse));
            }
        } 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、请求正确,返回LiveChannelStatisticResponse对象,B端依据此对象处理业务逻辑;

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

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

请求入参描述

参数名 必选 类型 说明
channelId true String 频道号
startDate true Date 查询的开始日期 格式为yyyy-MM-dd
endDate true Date 查询的结束日期 格式为yyyy-MM-dd
appId false String POLYV用户APP_ID,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)
appSecret false String POLYV用户APP_SECRET,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)

返回对象描述

参数名 类型 说明
averagePlayDuration Integer 人均观看时长,为(观看时长/观看人数)向下取整,单位:分钟
averageTime Float 人均观看次数,为(观看次数/观看人数)*10后向下取整后再除10,所以有一位小数,单位:次
ips Integer 观看人数(根据ip地址去重)
viewers Integer 观看人数(根据viewerId计算)
playDuration Integer 观看时长,单位:分钟
plays Integer 观看次数
uniqueVisitor Integer 访问人数






14、查询账号观看记录

描述

查询账号观看记录
接口地址(仅做说明使用):https://api.polyv.net/live/v4/user/viewlog/list

调用约束

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

单元测试

    @Test
    public void testGetViewLogList() throws IOException, NoSuchAlgorithmException {
        LiveListAccountViewlogRequest liveListAccountViewlogRequest = new LiveListAccountViewlogRequest();
        LiveListAccountViewlogResponse liveListAccountViewlogResponse;
        try {
            liveListAccountViewlogRequest
                    .setStartDate(super.getDate(2023, 10, 1))
                    .setEndDate(super.getDate(2023, 10, 30));
            liveListAccountViewlogResponse = new LiveChannelViewdataServiceImpl().listAccountViewlog(
                    liveListAccountViewlogRequest);
            Assert.assertNotNull(liveListAccountViewlogResponse);
            if (liveListAccountViewlogResponse != null) {
                //to do something ......
                log.debug("测试查询账号观看记录成功 {}", JSON.toJSONString(liveListAccountViewlogResponse));
            }
        } 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、请求正确,返回LiveListAccountViewlogResponse对象,B端依据此对象处理业务逻辑;

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

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

请求入参描述

参数名 必选 类型 说明
startDate false Date 查询的开始日期,不传查询当月,格式为yyyy-MM-dd
endDate false Date 查询的结束日期,必须和开始日期在同一个月,格式为yyyy-MM-dd
viewerId false String 观众ID
channelId false String 频道ID
currentPage false Integer 页数,默认为1【对应api文档的page字段】
pageSize false Integer 每页显示的数据条数,默认每页显示20条数据
appId false String POLYV用户APP_ID,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)
appSecret false String POLYV用户APP_SECRET,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)

返回对象描述

参数名 类型 说明
contents Array 查询的结果列表【详见ViewlogDetail参数描述
pageSize Integer 每页显示的数据条数,默认每页显示20条数据
currentPage Integer 当前页【对应api文档的pageNumber字段】
totalItems Integer 记录总条数
totalPage Integer 总页数【对应api文档的totalPages字段】
ViewlogDetail参数描述
参数名 类型 说明
avgDuration String 平均观看时长
nick String 昵称
totalDuration String 总观看时长
viewCount Integer 观看次数
viewerId String 用户Id
param4 String 自定义参数param4
param5 String 自定义参数param5

联系客服,在线咨询