Polyv Help Center

Help Center

Get Channel Lottery Winner Records

Updated: 2022-09-02 18:08:07

Interface URL

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

Interface Description

1. Retrieve the winner records of a channel lottery.
2. The interface supports HTTPS.

Request Method

GET

Request Parameters

Parameter Required Type & Range Description
sign true String Signature, a 32-character uppercase MD5 value. The appSecret key used to generate the signature is critical for communication data security. It must not be used directly on the client side. All APIs must be called through your own server to relay requests to the POLYV server for response data. See Signature Generation Rules
appId true string The appId under the developer account.
timestamp true string Current time timestamp in 13-digit milliseconds.
channelId true int Channel ID.
startTime true long Start date timestamp in 13-digit milliseconds.
endTime true long End date timestamp in 13-digit milliseconds.
page false int Page number for query, default is 1.
limit false int Number of records per page, default is 10.

Error Response JSON Example

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

Success Response JSON Example

{
    "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
    }
}
}

Field Description

Field Type & Range Description
code int Interface request status code, 200 indicates success.
status string Interface request status, "success" indicates success.
message string Error message returned when the request fails.
data Paginator Paginated result of winner records.

Data Object Field Description

Paginator

Description: Paginated result of lottery records.

Field Type & Range Description
pageNumber int Current page number.
totalItems int Total number of records.
firstPage boolean Whether it is the first page, value: true/false.
lastPage boolean Whether it is the last page, value: true/false.
nextPageNumber int Next page number.
prePageNumber int Previous page number.
totalPages int Total number of pages.
startRow int Position of the first record on the current page in the total records.
endRow int Position of the last record on the current page in the total records.
limit int Number of records on the current page.
contents List List of winner records.
WinnerRecordModel

Description: Lottery winner record.

Field Type & Range Description
recordId string Winner record ID.
channelId int Channel ID.
sessionId string Live session ID at the time of the lottery.
lotteryId string Lottery ID.
viewerId string Winner user ID.
viewerName string Winner user nickname.
winnerCode string Winning code.
prize string Prize name.
createdTime long Winning time.
ext string JSON format string representing additional extension information for the winner record, corresponding to the model class: WinnerRecordModelExt.
WinnerRecordModelExt

Description: Extension information for the winner record.

Field Type & Range Description
receiveInfo List Prize claim information that the winner needs to fill in.
ReceiveInfoFieldModel

Description: Prize claim information filled in by the winner.

Field Type & Range Description
field string Field name to fill in.
value string Field value to fill in.

PHP Request Example

<?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;

?>
联系客服,在线咨询