查詢抽獎活動
更新時間:2025-02-07 17:07:12
介面描述
1、查询抽奖活动
2、接口支持https协议
介面URL
http://api.polyv.net/live/v4/channel/lottery-activity/get
請求方式
GET
介面限制
1、介面同時支援HTTP、HTTPS,建議使用HTTPS確保介面安全,介面呼叫有頻率限制,詳細請查看 2、若參數不正確則會回應400異常
請求參數描述
| 參數名 | 必選 | 類型 | 說明 |
|---|---|---|---|
| appId | true | String | 帳號appId【詳見取得金鑰】 |
| timestamp | true | Long | 目前13位毫秒級時間戳,3分鐘內有效 |
| sign | true | String | 簽名,為32位大寫的MD5值,產生簽名的appSecret金鑰作為通訊資料安全的關鍵資訊,嚴禁儲存在用戶端直接使用,所有API都必須透過客戶自己伺服器中轉呼叫POLYV伺服器取得回應資料【詳見簽名產生規則】 |
| channelId | true | Integer | 頻道號 |
| id | true | Long | 抽獎活動ID |
範例
http://api.polyv.net/live//v4/channel/lottery-activity/get?appId=frlr1zazn3×tamp=1665629374000&sign=6CFA3141718E1AF0155889EEA2988206&channelId=2974342&id=1
回應描述
| 參數名 | 類型 | 說明 |
|---|---|---|
| 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回應描述
| 參數名 | 類型 | 說明 |
|---|---|---|
| id | Long | 抽獎活動ID |
| activityName | String | 抽獎活動名稱 |
| lotteryCondition | String | 抽獎類型 |
| status | String | 抽獎活動狀態 |
| amount | Integer | 中獎人數 |
| hiddenWinnerAmount | String | 是否隱藏中獎人數 |
| lotteryRange | String | 參與抽獎用戶類型:all:全部,customGroup:自訂分組 |
| customGroup | Array | 自訂分組資訊【詳見CustomGroup】 |
| customGroupLotteryType | String | 分組抽取方式,average:等額抽獎,random:隨機抽獎 |
| customGroupLotteryAmount | Integer | 每組抽取數量 |
| hiddenAttendeeNumber | String | 是否隱藏參與人數 |
| repeatWinEnabled | String | 允許重複中獎 |
| receiveEnabled | String | 是否填寫收貨資訊 |
| receiveInfo | Array | 收貨欄位資訊列表,無條件抽獎時填寫【詳見ReceiveInfo】 |
| prizeName | String | 獎品名稱 |
| thumbnail | String | 獎品圖片 |
| activityDuration | String | 活動時長(分鐘) |
| inviteType | String | 邀請方式 |
| externalListLink | String | 外部名單連結 |
| externalInviteNumLink | String | 取得邀請人數連結 |
| inviteNum | Integer | 邀請人數 |
| duration | Integer | 觀看時長 |
| comment | String | 評論內容 |
| acceptType | String | 領獎方式,form:表單,link:外鏈,qrCode:辨識QR Code |
| formInfo | Array | 領獎方式表單欄位資訊【詳見ReceiveInfo】 |
| prizeUrl | String | 領獎方式獎品連結 |
| qrCode | String | 領獎方式QR Code連結 |
| qrCodeTips | String | 領獎方式QR Code提示語 |
| realPrice | BigDecimal | 優惠價格 |
| price | BigDecimal | 獎品原價 |
| prizeInfo | Array | 獎品資訊【詳見PrizeInfo】 |
| questionGroupId | Long | 問答組模板ID |
| perAnswerDuration | Integer | 每道題的答題時長 |
| lotteryOnlineEnabled | String | 開獎時觀眾需在線,值:Y/N,預設Y(無條件分組抽獎時設定生效) |
CustomGroup回應描述
| 參數名 | 類型 | 說明 |
|---|---|---|
| id | Long | 分組ID |
| title | String | 分組標題 |
| type | String | 分組類型 |
| count | String | 分組人數 |
ReceiveInfo回應描述
| 參數名 | 類型 | 說明 |
|---|---|---|
| type | String | 類型,userName:姓名、userPhone:手機號、custom:自訂 |
| field | String | 欄位名 |
| tips | String | 提示語 |
| required | Boolean | 是否必填,true/false |
PrizeInfo回應描述
| 參數名 | 類型 | 說明 |
|---|---|---|
| prizeItem | String | 獎項名稱 |
| correctAnswerCount | Integer | 答對題目數 |
| prizeName | String | 獎品名稱 |
| thumbnail | String | 獎品圖片 |
| realPrice | BigDecimal | 優惠價格 |
| price | BigDecimal | 獎品原價 |
| acceptType | String | 領獎方式,form:表單,link:外鏈,qrCode:辨識QR Code |
| formInfo | Array | 領獎方式表單欄位資訊【詳見ReceiveInfo】 |
| prizeUrl | String | 領獎方式獎品連結 |
| qrCode | String | 領獎方式QR Code連結 |
| qrCodeTips | String | 領獎方式QR Code提示語 |
| amount | Integer | 中獎人數 |
| hiddenWinnerAmount | String | 是否隱藏中獎人數 |
Java請求範例
快速接入基礎程式碼請下載相關依賴原始碼,點擊下載原始碼,下載後加入到自己的原始碼工程中即可。測試案例中的HttpUtil.java 和 LiveSignUtil.java 都包含在下載檔案中。
強烈建議您使用直播Java SDK完成API的功能對接,直播Java SDK對API呼叫邏輯、異常處理、資料簽名、HTTP請求執行緒池進行了統一封裝和最佳化。
回應範例
系統全域錯誤說明詳見全域錯誤說明
成功範例
{
"code": 200,
"status": "success",
"requestId": "723ed01861804e9aa3dc1cf1aced83d5.72.17097790901718347",
"data": {
"id": 20521,
"activityName": "无条件抽奖",
"lotteryCondition": "none",
"amount": 1,
"receiveEnabled": "Y",
"receiveInfo": [
{
"type": "userName",
"field": "姓名",
"tips": "请输入您的名称",
"required": true
},
{
"type": "userPhone",
"field": "手机",
"tips": "请输入您的手机号码",
"required": true
}
],
"prizeName": "键盘",
"activityDuration": null,
"inviteType": "poster",
"inviteNum": null,
"duration": null,
"comment": null,
"externalListLink": null,
"externalInviteNumLink": null,
"acceptType": null,
"formInfo": null,
"prizeUrl": null,
"qrCode": null,
"qrCodeTips": null,
"thumbnail": null,
"realPrice": null,
"price": null,
"status": null,
"prizeInfo": null,
"questionGroupId": null,
"perAnswerDuration": null,
"lotteryRange": "all",
"repeatWinEnabled": "N",
"customGroup": [],
"hiddenWinnerAmount": "N",
"hiddenAttendeeNumber": "N",
"customGroupLotteryType": "random",
"customGroupLotteryAmount": null
},
"success": true
}
異常範例
{
"code": 400,
"status": "error",
"requestId": "d310b70bc329403f87f77f9203d50f89.128.16360831552223589",
"error": {
"code": 20001,
"desc": "application not found."
},
"success": false
}
