保利威文档中心

帮助中心

weixinBookingService

更新时间:2025-09-11 15:18:09

1、查询微信预约数据

描述

查询微信预约数据
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/booking/list

调用约束

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

单元测试

    @Test
    public void testGetBookingStats() throws IOException, NoSuchAlgorithmException {
        LiveGetBookingStatsRequest liveGetBookingStatsRequest = new LiveGetBookingStatsRequest();
        LiveGetBookingStatsResponse liveGetBookingStatsResponse;
        try {
            String channelId = super.getAloneNewChannelId();
            liveGetBookingStatsRequest.setChannelId(channelId);
            liveGetBookingStatsResponse = new ILiveWeixinBookingServiceImpl().getBookingStats(
                    liveGetBookingStatsRequest);
            Assert.assertNotNull(liveGetBookingStatsResponse);
            if (liveGetBookingStatsResponse != null) {
                //to do something ......
                log.debug("测试查询微信预约数据成功 {}", JSON.toJSONString(liveGetBookingStatsResponse));
            }
        } 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、请求正确,返回LiveGetBookingStatsResponse对象,B端依据此对象处理业务逻辑;

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

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

请求入参描述

参数名 必选 类型 说明
channelId true String 频道号
startTime false Date 预约开始时间,13位毫秒级时间戳
endTime false Date 预约结束时间,13位毫秒级时间戳
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 当前页内容【详见BookingStatsList参数描述
pageSize Integer 每页显示的数据条数,默认每页显示20条数据
currentPage Integer 当前页【对应api文档的pageNumber字段】
totalItems Integer 记录总条数
totalPage Integer 总页数【对应api文档的totalPages字段】
BookingStatsList参数描述
参数名 类型 说明
channelId String 频道号
channelName String 频道名称
openId String 用户Id(微信openId)
createdTime Date 预约时间,13位毫秒级时间戳

联系客服,在线咨询