Query Channel Lottery Records (Legacy)
Updated: 2022-09-27 11:32:05
API Description
1、获取一段时间内的直播频道抽奖记录列表
2、接口支持https协议
API URL
http://api.polyv.net/live/v3/channel/lottery/list-lottery
Request Method
GET
API Constraints
- The API supports both HTTP and HTTPS. HTTPS is recommended for security. API calls are subject to rate limits. See details
Request Parameters
| Parameter | Required | Type | Description |
|---|---|---|---|
| appId | true | String | Account appId See: Get Secret Key |
| timestamp | true | Long | Current 13-digit millisecond timestamp, valid for 3 minutes |
| sign | true | String | Signature, a 32-character uppercase MD5 value. The appSecret key used to generate the signature is critical for communication data security. It must never be stored or used directly on the client side. All API calls must be relayed through your own server to the POLYV server for response data. See: Signature Generation Rules |
| channelId | true | String | Channel ID |
| sessionId | false | String | Live session ID to query. Defaults to all sessions in the channel. |
| startTime | true | Long | Start date for the query (13-digit timestamp) |
| endTime | true | Long | End date for the query (13-digit timestamp) |
| page | false | Integer | Page number to query. Defaults to 1. |
| limit | false | Integer | Number of records per page. Defaults to 10. |
Example
http://api.polyv.net/live/v3/channel/lottery/list-lottery?appId=frlr1zazn3&sign=CFD9DDABAD30A5F2CFA1E1FCD26E2FC7&startTime=1615772426000&endTime=1615773566000&channelId=2191532×tamp=1621844928632
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Response status code. 200 indicates success, non-200 indicates failure. See: Global Error Codes |
| status | String | Response status text |
| message | String | Response description. Provides error details when code is 400 or 500. |
| data | Object | Paginated lottery records. See: data field description |
data Field Description
| Parameter | Type | Description |
|---|---|---|
| pageSize | Integer | Total number of pages |
| pageNumber | Integer | Current page number |
| totalItems | Integer | Total number of records |
| contents | List<LotteryListModel> | List of lottery records See: contents field description |
| offset | Integer | Pagination starting record |
| limit | Integer | Number of records on the current page |
| nextPageNumber | Integer | Next page number |
| startRow | Integer | Position of the first record on the current page within the total records |
| lastPage | Boolean | Whether it is the last page. Values: true/false |
| prePageNumber | Integer | Previous page number |
| firstPage | Boolean | Whether it is the first page. Values: true/false |
| totalPages | Integer | Total number of pages |
| endRow | Integer | Position of the last record on the current page within the total records |
contents Field Description
| Parameter | Type | Description |
|---|---|---|
| lotteryId | String | Lottery session ID |
| channelId | String | Channel ID |
| sessionId | String | Live session ID at the time of the lottery |
| userId | String | Account userId |
| lotteryRange | String | Lottery scope all: All viewers notWinning: Users who did not win in the current live session signed: Users who checked in actor: Title questionnaire: Users who completed the questionnaire |
| actor | String | Title used when the lottery scope is by title |
| prize | String | Prize name |
| amount | Integer | Preset number of winners |
| preset | String | Preset winner user IDs, multiple IDs separated by commas |
| createdTime | Long | Lottery creation time |
| lastModified | Long | Last modification time |
| winnerCount | String | Actual number of winners |
| ext | String | JSON string representing additional lottery information. Corresponding model class: LotteryListModelExt field description |
LotteryListModelExt Field Description
Description: Additional information for lottery records
| Field | Type | Description |
|---|---|---|
| collectInfo | Array | Prize claim information required from winners. Corresponding model class: CollectInfoFieldModel field description |
CollectInfoFieldModel Field Description
Description: Prize claim information required from winners
| Field | Type and Range | Description |
|---|---|---|
| field | String | Field name to fill in |
| tips | String | Field prompt text |
Java Request Example
For quick integration of the base code, please download the relevant dependency source code. Click here to download the source code. After downloading, add it to your own source project. The test cases include HttpUtil.java and LiveSignUtil.java in the downloaded file.
It is strongly recommended to use the Live Java SDK for API integration. The Live Java SDK provides a unified wrapper and optimization for API call logic, exception handling, data signing, and HTTP request thread pools.
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
}
Response Example
For global error descriptions, see Global Error Codes
Success Example
{
"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
}
}
Error Example
{
"code": 400,
"status": "error",
"message": "invalid signature.",
"data": ""
}
