保利威文档中心

幫助中心

取得頻道抽獎的中獎記錄

更新時間: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;

?>
联系客服,在线咨询