保利威文档中心

帮助中心

获取频道抽奖的中奖记录

更新时间:2022-09-02 18:08:07

接口URL

http://api.polyv.net/live/v3/channel/lottery/list

接口说明

1.获取频道抽奖的中奖记录
2.接口支持https

请求方式

GET

请求参数

参数名 必选 类型及范围 说明
sign true String 签名,为32位大写的MD5值,生成签名的appSecret密钥作为通信数据安全的关键信息,严禁保存在客户端直接使用,所有API都必须通过客户自己服务器中转调用POLYV服务器获取响应数据【详见签名生成规则
appId true string 开发者账号下的appId
timestamp true string 13位当前时间的时间戳
channelId true int 频道号
startTime true long 查询的开始日期的13位时间戳
endTime true long 查询的结束日期的13位时间戳
page false int 查询的页数,默认为1
limit false int 查询的每页大小,默认为10

返回错误结果JSON示例

签名错误:
{
    "code": 403,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}
时间戳错误:
{
    "code": 400,
    "status": "error",
    "message": "invalid timestamp.",
    "data": ""
}

返回正确结果JSON示例

{
    "code": 200,
    "status": "success",
    "message": "",
    "data": {
        "pageSize": 10,
        "pageNumber": 1,
        "totalItems": 1,
        "contents": [
            {
                "recordId": "69aacfc0b7",
                "channelId": 108888,
                "lotteryId": "feb34vwxyd",
                "sessionId": "f6pxc1w8yb",
                "viewerId": "plk",
                "viewerName": "测试测试",
                "winnerCode": "789",
                "prize": "测试奖品",
                "name": null,
                "telephone": null,
                "createdTime": 1563763798000,
                "lastModified": 1563765266000,
                "address": null,
                "ext": "{\"receiveInfo\":[{\"field\":\"尊姓大名\",\"value\":\"测试测试\"},{\"field\":\"年龄\",\"value\":\"111\"},{\"field\":\"挖掘机技术哪家强\",\"value\":\"blueshit\"}]}"
            }
        ],
        "offset": 0,
        "limit": 1,
        "nextPageNumber": 1,
        "startRow": 1,
        "lastPage": true,
        "prePageNumber": 1,
        "firstPage": true,
        "totalPages": 1,
        "endRow": 1
    }
}
}

字段说明

字段 类型及范围 说明
code int 接口请求状态码,200表示成功
status string 接口请求状态,"success"表示成功
message string 请求失败时返回的错误信息
data Paginator 中间记录的分页结果

数据对象字段说明

Paginator

说明:抽奖记录的分页结果

字段 类型及范围 说明
pageNumber int 当前的页数
totalItems int 总记录数
firstPage boolean 是否为第一页,值为:true/false
lastPage boolean 是否为最后一页,值为:true/false
nextPageNumber int 下一页编号
prePageNumber int 上一页编号
totalPages int 总页数
startRow int 当前页第一条记录在总记录中的位置
endRow int 当前页最后一个记录在总记录中的位置
limit int 当前页记录个数
contents List 中间记录列表
WinnerRecordModel

说明:抽奖记录

字段 类型及范围 说明
recordId string 中奖记录ID
channelId int 频道号
sessionId string 抽奖时的直播场次ID
lotteryId string 抽奖ID
viewerId string 中奖用户ID
viewerName string 中奖用户昵称
winnerCode string 中奖码
prize string 奖品名称
createdTime long 中奖时间
ext string json 格式的字符串,表示中奖记录的额外拓展信息,对应模型类:WinnerRecordModelExt
WinnerRecordModelExt

说明:中奖记录的拓展信息

字段 类型及范围 说明
receiveInfo List 领奖人需要填写的兑奖信息
ReceiveInfoFieldModel

说明:中奖记录填写的领奖信息

字段 类型及范围 说明
field string 填写的字段名
value string 填写的字段值

PHP请求示例

<?php

//引用config.php
include 'config.php';

$channelId = "322120";
$params = array(
        'appId'=>$appId,
        'lotteryId'=>"ff9yv31sud",
        'channelId'=>$channelId,
        'timestamp'=>$timestamp
    );

//生成sign
$sign = getSign($params); //详细查看config.php文件
$params['sign'] = $sign;

$url="http://api.polyv.net/live/v3/channel/lottery/list?".http_build_query($params);

$ch = curl_init() or die ( curl_error() );
curl_setopt( $ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 360);
$response = curl_exec ( $ch );
curl_close ( $ch );
echo $response;

?>
联系客服,在线咨询