保利威文档中心

幫助中心

查詢頻道抽獎記錄(舊版)

更新時間:2022-09-27 11:32:05

介面描述

1、获取一段时间内的直播频道抽奖记录列表
2、接口支持https协议

介面URL

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

請求方式

GET

介面限制

1、介面同時支援HTTP、HTTPS,建議使用HTTPS以確保介面安全,介面呼叫有頻率限制,詳細請查看

請求參數描述

參數名 必選 類型 說明
appId true String 帳號appId【詳見取得金鑰
timestamp true Long 目前13位毫秒級時間戳,3分鐘內有效
sign true String 簽名,為32位大寫的MD5值,產生簽名的appSecret金鑰作為通訊資料安全的關鍵資訊,嚴禁儲存在用戶端直接使用,所有API都必須透過客戶自己伺服器中轉呼叫POLYV伺服器取得回應資料【詳見簽名產生規則
channelId true String 頻道號
sessionId false String 要查詢的直播場次ID,預設查詢該頻道中所有場次
startTime true Long 查詢的開始日期的13位時間戳
endTime true Long 查詢的結束日期的13位時間戳
page false Integer 查詢的頁數,預設為1
limit false Integer 查詢的每頁大小,預設為10

範例

http://api.polyv.net/live/v3/channel/lottery/list-lottery?appId=frlr1zazn3&sign=CFD9DDABAD30A5F2CFA1E1FCD26E2FC7&startTime=1615772426000&endTime=1615773566000&channelId=2191532&timestamp=1621844928632

回應參數描述

參數名 類型 說明
code Integer 回應狀態碼,200為成功返回,非200為失敗【詳見全域錯誤說明
status String 回應狀態文字資訊
message String 回應描述資訊,當code為400或500時,輔助描述錯誤原因
data Object 抽獎記錄的分頁結果 【詳見data欄位說明

data欄位說明

參數名 類型 說明
pageSize Integer 總頁數
pageNumber Integer 目前的頁數
totalItems Integer 總記錄數
contents List<LotteryListModel> 抽獎記錄列表 【詳見contents欄位說明
offset Integer 分頁起始記錄
limit Integer 目前頁記錄個數
nextPageNumber Integer 下一頁編號
startRow Integer 目前頁第一條記錄在總記錄中的位置
lastPage Boolean 是否為最後一頁,值為:true/false
prePageNumber Integer 上一頁編號
firstPage Boolean 是否為第一頁,值為:true/false
totalPages Integer 總頁數
endRow Integer 目前頁最後一個記錄在總記錄中的位置

contents欄位說明

參數名 類型 說明
lotteryId String 抽獎場次ID
channelId String 頻道號
sessionId String 抽獎時的直播場次ID
userId String 帳號userId
lotteryRange String 抽獎範圍
all:所有觀眾
notWinning:當場直播未中獎用戶
signed:已簽到用戶
actor:頭銜
questionnaire:已填問卷用戶
actor String 抽獎範圍為按頭銜抽獎時的頭銜
prize String 獎品名稱
amount Integer 預設中獎人數
preset String 預設中獎觀眾ID,多個ID用英文逗號分開
createdTime Long 抽獎時間
lastModified Long 最後修改時間
winnerCount String 實際中獎人數
ext String json格式的字串,表示抽獎的額外擴展資訊,對應模型類別:LotteryListModelExt欄位說明

LotteryListModelExt欄位說明

說明:抽獎記錄的擴展資訊

欄位 類型 說明
collectInfo Array 領獎人需要填寫的兌獎資訊,對應模型類別:CollectInfoFieldModel欄位說明

CollectInfoFieldModel欄位說明

說明:領獎人需要填寫的領獎資訊

欄位 類型及範圍 說明
field String 填寫的欄位名稱
tips String 填寫的欄位提示

Java請求範例

快速接入基礎程式碼請下載相關依賴原始碼點擊下載原始碼 ,下載後加入到自己的原始碼工程中即可。測試案例中的HttpUtil.java 和 LiveSignUtil.java 都包含在下載檔案中。

強烈建議您使用直播Java SDK完成API的功能對接,直播Java SDK 對API呼叫邏輯、異常處理、資料簽名、HTTP請求執行緒池進行了統一封裝和最佳化。

private static final Logger log = LoggerFactory.getLogger(LiveInteractionTest.class);
/**
 * 查询频道中奖记录
 * @throws IOException
 */
@Test
public void testListLottery() throws IOException, NoSuchAlgorithmException {
    //公共参数,填写自己的实际参数
    String appId=super.appId;
    String appSecret=super.appSecret;
    String userId = super.userId;
    String timestamp=String.valueOf(System.currentTimeMillis());
    //业务参数
    String url = "http://api.polyv.net/live/v3/channel/lottery/list-lottery";
    String channelId = "1965681";
    String startTime = "1601481600000";
    String endTime = "1615357743000";

    //http 调用逻辑
    Map<String,String> requestMap = new HashMap<>();
    requestMap.put("appId", appId);
    requestMap.put("timestamp",timestamp);

    requestMap.put("channelId",channelId);
    requestMap.put("startTime",startTime);
    requestMap.put("endTime",endTime);

    requestMap.put("sign",LiveSignUtil.getSign(requestMap, appSecret));
    String response = HttpUtil.get(url,requestMap);
    log.info("测试查询频道中奖记录接口返回值:{}",response);
    //do somethings
}

回應範例

系統全域錯誤說明詳見全域錯誤說明

成功範例

{
    "code": 200,
    "status": "success",
    "message": "",
    "data": {
        "pageSize": 10,
        "pageNumber": 1,
        "totalItems": 2,
        "contents": [{
            "lotteryId": "fv3mao43u6",
            "channelId": 1965681,
            "userId": "1b448be323",
            "sessionId": "fv3ma84e63",
            "lotteryRange": "all",
            "actor": null,
            "prize": "特等奖",
            "amount": 1,
            "preset": "",
            "createdTime": 1611137383000,
            "lastModified": 1611137383000,
            "ext": "{\"collectInfo\":[{\"field\":\"姓名:\",\"tips\":\"请输入您的真实姓名\"},{\"field\":\"手机:\",\"tips\":\"请输入您的手机号码\"}]}",
            "winnerCount": "0"
        }, {
            "lotteryId": "fv3hogjmh3",
            "channelId": 1965681,
            "userId": "1b448be323",
            "sessionId": "fv3hmq3qml",
            "lotteryRange": "all",
            "actor": null,
            "prize": "10元现金红包",
            "amount": 1,
            "preset": "",
            "createdTime": 1611127333000,
            "lastModified": 1611127333000,
            "ext": "{\"collectInfo\":[{\"field\":\"姓名:\",\"tips\":\"请输入您的真实姓名\"},{\"field\":\"手机:\",\"tips\":\"请输入您的手机号码\"}]}",
            "winnerCount": "1"
        }],
        "startRow": 1,
        "firstPage": true,
        "lastPage": true,
        "prePageNumber": 1,
        "limit": 2,
        "nextPageNumber": 1,
        "totalPages": 1,
        "endRow": 2,
        "offset": 0
    }
}

異常範例

{
    "code": 400,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}
联系客服,在线咨询