查詢頻道抽獎記錄
更新時間:2022-09-27 11:32:05
舊版介面位址查詢頻道抽獎記錄(舊版)
介面描述
1、查询频道发起抽奖记录
2、接口支持https协议
介面URL
http://api.polyv.net/live/v4/channel/lottery/list
請求方式
GET
介面限制
1、介面同時支援HTTP、HTTPS,建議使用HTTPS以確保介面安全,介面呼叫有頻率限制,詳細請查看
2、未傳入lotteryId抽獎Id時,startTime、endTime為必填
3、傳入lotteryId抽獎Id時,startTime、endTime可不傳,即使傳入也不生效
4、startTime、endTime查詢時間跨度最大為365天
請求參數說明
| 參數名 | 必填 | 類型 | 說明 |
|---|---|---|---|
| appId | true | String | 帳號appId【詳見取得金鑰】 |
| timestamp | true | Long | 當前13位毫秒級時間戳,3分鐘內有效 |
| sign | true | String | 簽名,為32位大寫的MD5值,產生簽名的appSecret金鑰作為通訊資料安全的關鍵資訊,嚴禁儲存在用戶端直接使用,所有API都必須透過客戶自己伺服器中轉呼叫POLYV伺服器取得回應資料【詳見簽名產生規則】 |
| channelId | true | String | 頻道號 |
| lotteryId | false | String | 抽獎ID |
| sessionId | false | String | 場次ID |
| startTime | false | Long | 開始時間,13位毫秒級時間戳 |
| endTime | false | Long | 結束時間,13位毫秒級時間戳 |
| pageNumber | false | Integer | 當前頁碼 |
| pageSize | false | Integer | 每頁資料筆數,預設10筆資料,最大1000筆 |
範例
http://api.polyv.net/live/v4/channel/lottery/list?appId=frlr1zazn3&sign=CD02AC6E60EE047E7B491C8CB32D23AD&startTime=1629679376000&endTime=1661215376000&channelId=2974342×tamp=1661480931047
回應參數說明
| 參數名 | 類型 | 說明 |
|---|---|---|
| code | Integer | 狀態碼,與http狀態碼相同,用於確定基本的回應狀態 |
| status | String | 回應結果,由業務決定,成功回傳success,失敗回傳error |
| success | Boolean | 是否成功回應 |
| requestId | String | 請求ID,每次請求產生的唯一UUID,僅可用於排查、除錯,不應與業務掛鉤 |
| error | Object | 狀態碼非200時的錯誤資訊【詳見Error欄位說明】 |
| data | Object | 中獎記錄列表【詳見data欄位說明】 |
Error參數說明
| 參數名 | 類型 | 說明 |
|---|---|---|
| code | Integer | 錯誤代碼,用於確定具體的錯誤原因 |
| desc | String | 錯誤描述,與error.code對應 |
data參數說明
| 參數名 | 類型 | 說明 |
|---|---|---|
| pageNumber | Integer | 當前頁碼 |
| pageSize | Integer | 每頁資料量 |
| totalPages | Long | 頁面總數 |
| totalItems | Long | 總資料量 |
| contents | Array | 當前頁內容【詳見contents欄位說明】 |
contents參數說明
| 參數名 | 類型 | 說明 |
|---|---|---|
| winnerCount | Integer | 實際中獎人數 |
| totalUsers | Integer | 參與抽獎的人數 |
| lotteryId | String | 抽獎場次ID |
| channelId | Integer | 頻道號 |
| userId | String | 帳號userId |
| sessionId | String | 抽獎時的直播場次ID |
| lotteryRange | String | 抽獎候選人範圍 |
| actor | String | 按頭銜抽獎時的頭銜名稱 |
| prize | String | 獎品名稱 |
| amount | Integer | 中獎人數 |
| preset | String | 預設中獎者,以英文逗號分隔 |
| lotteryExt | Object | 抽獎的額外擴充資訊【詳見lotteryExt欄位說明】 |
| createdTime | Long | 抽獎時間,十三位時間戳 |
lotteryExt參數說明
| 參數名 | 類型 | 說明 |
|---|---|---|
| collectInfo | Array | 中獎用戶領獎收集資訊列表 |
collectInfo參數說明
| 參數名 | 類型 | 說明 |
|---|---|---|
| field | String | 欄位名稱 |
| tips | String | 填寫提示 |
Java請求範例
快速接入基礎程式碼請下載相關依賴原始碼, 點擊下載原始碼 ,下載後加入到自己的原始碼工程中即可。測試案例中的HttpUtil.java 和 LiveSignUtil.java 都包含在下載檔案中。
強烈建議您使用直播Java SDK完成API的功能對接,直播Java SDK 對API呼叫邏輯、異常處理、資料簽名、HTTP請求執行緒池進行了統一封裝和最佳化。
private static final Logger log = LoggerFactory.getLogger(getClass());
/**
* 查询频道中奖统计记录
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void getLotteryListTest() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId = super.appId;
String appSecret = super.appSecret;
String timestamp = String.valueOf(System.currentTimeMillis());
//业务参数
String url = "http://api.polyv.net/live/v4/channel/lottery/list";
String channelId = "2974342";
String lotteryId = "gcfflpd4ex";
String sessionId = "";
String startTime = "";
String endTime = "";
//http 调用逻辑
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
requestMap.put("channelId", channelId);
requestMap.put("lotteryId", lotteryId);
requestMap.put("sessionId", sessionId);
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",
"requestId": "c4a7fb9af5624cbabeb47a4d04c4e13b.72.16614809866840885",
"data": {
"pageNumber": 1,
"pageSize": 10,
"totalPages": 1,
"totalItems": 1,
"contents": [
{
"winnerCount": 2,
"totalUsers": 11,
"lotteryId": "gcfflpd4ex",
"channelId": 2974342,
"userId": "1b448be323",
"sessionId": "gcfd814thr",
"lotteryRange": "all",
"actor": null,
"prize": "一等奖",
"amount": 3,
"preset": "",
"lotteryExt": {
"collectInfo": [
{
"field": "姓名:",
"tips": "请输入您的真实姓名"
},
{
"field": "手机:",
"tips": "请输入您的手机号码"
}
]
},
"createdTime": 1660022052000
}
]
},
"success": true
}
異常範例
{
"code": 400,
"status": "error",
"requestId": "d310b70bc329403f87f77f9203d50f89.128.16360831552223589",
"error": {
"code": 20001,
"desc": "application not found."
},
"success": false
}
