保利威文档中心

幫助中心

觀眾查詢獎勵明細分頁列表

更新時間:2025-09-25 11:46:33

介面描述

1、观众查询奖励明细分页列表
2、接口支持https协议

介面URL

https://api.polyv.net/live/v4/user/viewer-task-reward/page

請求方式

GET

介面限制

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

請求參數描述

參數名 必填 類型 說明
appId true String 帳號appId【詳見取得金鑰
timestamp true Long 目前13位元毫秒級時間戳記,3分鐘內有效
sign true String 簽名,為32位元大寫的MD5值,產生簽名的appSecret金鑰作為通訊資料安全的關鍵資訊,嚴禁儲存在用戶端直接使用,所有API都必須透過客戶自己伺服器中轉呼叫POLYV伺服器取得回應資料【詳見簽名產生規則
viewerId true String 觀眾id
pageSize false Integer 頁面大小(預設10,最大1000)
pageNumber false Integer 頁碼(目前限制最大值1000頁)

範例

https://api.polyv.net/live/v4/user/viewer-task-reward/page?viewerId=123&pageSize=10&pageNumber=1&appId=frlr1zazn3&sign=012332FBD8DBCFC068AFCB484A2ADECB&timestamp=1670550787318

回應體json:

{
    "code": 200,
    "status": "success",
    "requestId": "c2318da1-7dec-417a-9be4-25980b6372eb",
    "data": {
        "pageNumber": 1,
        "pageSize": 10,
        "totalPages": 1,
        "totalItems": 6,
        "contents": [
            {
                "id": 1693913,
                "viewerId": "2_844u9odbkqq8eum0rpotqbexwqlio6pq",
                "taskId": 10550,
                "sort": 1,
                "taskReach": {
                    "type": "online",
                    "amount": 1,
                    "questionnaireId": null,
                    "customEvent": null,
                    "customEventName": null,
                    "customIcon": null,
                    "customUnit": null,
                    "customButtonText": null,
                    "customReachText": "{customEventName}{amount}{customUnit}"
                },
                "taskReward": {
                    "type": "cash",
                    "amount": "0.3",
                    "limit": -1,
                    "customReward": ""
                },
                "acceptInfo": {
                    "activeAcceptEnabled": "Y",
                    "acceptType": "form",
                    "received": "N",
                    "formInfo": {
                        "field": "姓名",
                        "tips": "请输入您的名称",
                        "type": "userName",
                        "required": true
                    },
                    "prizeUrl": null,
                    "qrCode": null,
                    "qrCodeTips": null
                },
                "taskStatus": 1,
                "rewardStatus": 1,
                "finishTime": 1742284276000,
                "outTradeErrCode": null,
                "outTradeErrDesc": null,
                "participated": true
            }
        ]
    },
    "success": true
}

回應參數描述

參數名 類型 說明
code Integer 回應狀態碼,200為成功返回,非200為失敗
status String 回應結果,由業務決定,成功返回success,失敗返回error
success Boolean 回應結果,由業務決定,成功返回true,失敗返回false
data Object 觀眾任務獎勵明細【詳見Data欄位說明
error Object 狀態碼非200時的錯誤資訊【詳見Error欄位說明
requestId String 請求ID,每次請求產生的唯一UUID,僅可用於排查、除錯,不應與業務掛鉤

data參數描述

參數名 類型 說明
pageNumber Integer 頁碼
pageSize String 分頁大小
totalPages Boolean 總分頁數量
totalItems Object 總記錄數
contents Array 活動資料列表【詳見Contents欄位說明

contents參數描述

參數名 類型 說明
channelId Integer 頻道id
activityId Long 活動id
viewerId String 觀眾id
taskId Integer 任務id
sort Long 排序
taskStatus Long 達成狀態(0:未達成,1:已達成)
rewardStatus Long 獎勵發放狀態(-1:無需發放,0:待發放,1:已發放,2:名額已滿,3:發放失敗,4:發放中)
finishTime Long 達成時間
taskReach Object 達成條件 【詳見taskReach欄位說明
taskReward Object 獎勵資料 【詳見taskReward欄位說明
acceptInfo Object 領取資訊 【詳見acceptInfo欄位說明

taskReach參數描述

參數名 類型 說明
type String 達成條件(sign:簽到,online:線上時長)
amount Integer 達成數值

taskReward參數描述

參數名 類型 說明
type String cash:現金,custom:自訂,nothing:無獎勵,externalPoint:外部積分
amount Integer 獎勵數值(type為cash時,現金單位是分)
limit Integer 獎勵限制份額
customReward String 自訂獎勵,非必填

acceptInfo參數描述

參數名 類型 說明
activeAcceptEnabled String 自訂領取資訊(Y:開啟,N:關閉)
acceptType String 領取方式(form,link,qrCode)
received String 是否已領取(Y:是,N:否)
formInfo Array 領取表單資訊【詳見formInfo欄位說明
prizeUrl String 跳轉連結
qrCode String 二維碼連結
qrCodeTips String 二維碼提示

formInfo參數描述

參數名 類型 說明
type String 類型,userName:姓名、userPhone:手機號碼、custom:自訂
field String 欄位名稱
tips String 提示語
required Boolean 是否必填,true/false
value String 填寫內容

error參數描述

參數名 類型 說明
code Integer 錯誤代碼,用於確定具體的錯誤原因
desc String 錯誤描述,與 error.code 對應

Java請求範例

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

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

private final Logger log = LoggerFactory.getLogger(getClass());
/**
 * 查询任务奖励活动观众奖励明细分页列表
 * @throws IOException
 * @throws NoSuchAlgorithmException
 */
@Test
public void pageTaskRewardTest() throws IOException, NoSuchAlgorithmException {
        //公共参数,填写自己的实际参数
        String appId = super.appId;
        String appSecret = super.appSecret;
        String timestamp = String.valueOf(System.currentTimeMillis());
        String viewerId = "123";
        Integer pageNumber = 1;
        Integer pageSize = 10;
        //业务参数
        String url = "https://api.polyv.net/live/v4/channel/task-reward-activity/page";
        
        //http 调用逻辑
        Map<String, String> requestMap = new HashMap<>();
        requestMap.put("appId", appId);
        requestMap.put("timestamp", timestamp);
        requestMap.put("viewerId", viewerId);
        requestMap.put("pageSize", pageSize);
        requestMap.put("pageNumber", pageNumber);
        requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
        String response = HttpUtil.get(url, requestMap);
        log.info("测试查询任务奖励活动观众奖励明细分页列表成功:{}", response);
        //do somethings
}

回應範例

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

成功範例

{
    "code": 200,
    "status": "success",
    "requestId": "c2318da1-7dec-417a-9be4-25980b6372eb",
    "data": {
        "pageNumber": 1,
        "pageSize": 10,
        "totalPages": 1,
        "totalItems": 6,
        "contents": [
            {
                "id": 1693913,
                "viewerId": "2_844u9odbkqq8eum0rpotqbexwqlio6pq",
                "taskId": 10550,
                "sort": 1,
                "taskReach": {
                    "type": "online",
                    "amount": 1,
                    "questionnaireId": null,
                    "customEvent": null,
                    "customEventName": null,
                    "customIcon": null,
                    "customUnit": null,
                    "customButtonText": null,
                    "customReachText": "{customEventName}{amount}{customUnit}"
                },
                "taskReward": {
                    "type": "cash",
                    "amount": "0.3",
                    "limit": -1,
                    "customReward": ""
                },
                "acceptInfo": {
                    "activeAcceptEnabled": "Y",
                    "acceptType": "form",
                    "received": "N",
                    "formInfo": {
                        "field": "姓名",
                        "tips": "请输入您的名称",
                        "type": "userName",
                        "required": true
                    },
                    "prizeUrl": null,
                    "qrCode": null,
                    "qrCodeTips": null
                },
                "taskStatus": 1,
                "rewardStatus": 1,
                "finishTime": 1742284276000,
                "outTradeErrCode": null,
                "outTradeErrDesc": null,
                "participated": true
            }
        ]
    },
    "success": true
}

異常範例

{
    "code": 400,
    "status": "error",
    "requestId": "d310b70bc329403f87f77f9203d50f89.128.16360831552223589",
    "error": {
        "code": 20001,
        "desc": "application not found."
    },
    "success": false
}
联系客服,在线咨询