获取多频道定时抽奖状态的接口

接口URL

http://api.polyv.net/live/v3/channel/lottery/get-rooms-status

接口说明

1.获取多频道定时抽奖状态
2.接口支持https

请求方式

GET

请求参数

参数名必选类型及范围说明

sign

true

String

签名,为32位大写的MD5值,生成签名的appSecret密钥作为通信数据安全的关键信息,严禁保存在客户端直接使用,所有API都必须通过客户自己服务器中转调用POLYV服务器获取响应数据【详见签名生成规则

appId

true

string

开发者账号下的appId

timestamp

true

string

13位当前时间的时间戳

channelIds

true

string

频道号。多个用英文逗号隔开

返回错误结果JSON示例

签名错误:
{
    "code": 403,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}
时间戳错误:
{
    "code": 400,
    "status": "error",
    "message": "invalid timestamp.",
    "data": ""
}
appId错误
{
    "code": 400,
    "status": "error",
    "message": "appId is required.",
    "data": ""
}
应用找不到
{
    "code": 400,
    "status": "error",
    "message": "application not found.",
    "data": ""
}
频道号错误
{
    "code": 400,
    "status": "error",
    "message": "channelIds is required.",
    "data": ""
}

返回正确结果JSON示例

{
    "code":200,
    "status":"success",
    "message":"",
    "data":[
        {
            "roomId":"2437051",
            "status":3,
            "time":0
        },
        {
            "roomId":"2442336",
            "status":3,
            "time":0
        }
    ]
}

字段说明

字段类型及范围说明

code

int

接口请求状态码,200表示成功

status

string

接口请求状态,"success"表示成功

message

string

请求失败时返回的错误信息

data

array

data[].roomId

string

频道号

data[].status

int

抽奖状态,0倒计时,1抽奖中,2已结束,3已关闭

data[].time

int

定时剩余时间,单位毫秒

PHP请求示例

<?php

//引用config.php
include 'config.php';

$channelIds = "322120,2029098";
$params = array(
        'appId'=>$appId,
        'channelIds'=>$channelIds,
        'timestamp'=>$timestamp
    );

//生成sign
$sign = getSign($params); //详细查看config.php文件
$params['sign'] = $sign;

$url="http://api.polyv.net/live/v3/channel/bookings-and-likes?".http_build_query($params);

$ch = curl_init() or die ( curl_error() );
curl_setopt( $ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 360);
$response = curl_exec ( $ch );
curl_close ( $ch );
echo $response;
?>

Last updated