获取打赏设置

接口URL

http://api.polyv.net/live/v2/channelSetting/{channelId}/getDonate

接口说明

1、作用:获取直播后台的打赏信息
2、接口支持https协议
3、接口URL中的{channelId}为 频道ID

支持格式

JSON

请求方式

GET,POST

请求数限制

TRUE

请求参数

参数名 必选 类型 说明
appId string 从API设置中获取,在直播系统登记的appId
timestamp string 当前13位毫秒级时间戳,3分钟内有效
sign string 签名,32位大写MD5值

响应成功JSON示例:

道具打赏

{
    "code": 200,
    "status": "success",
    "message": "",
    "data": {
        "donateEnabled": "Y",
        "type": "good",
        "goodName1": "测试道具1",
        "goodPrice1": "0.01",
        "goodImg1": "//static.live.polyv.net/uploaded/images/2016/05/ef5b2exweu.png",
        "goodName2": "测试道具3",
        "goodPrice2": "0.01",
        "goodImg2": "//static.live.polyv.net/uploaded/images/2016/09/eik3tygryl.bmp",
        "goodName3": "测试道具测",
        "goodPrice3": "0.02",
        "goodImg3": "//static.live.polyv.net/uploaded/images/2016/09/eik3up1o42.png"
    }
}

现金打赏

{
    "code": 200,
    "status": "success",
    "message": "",
    "data": {
        "donateEnabled": "Y",
        "type": "cash",
        "cashMin": "0.00"
    }
}

响应失败JSON示例:

未输入appId

{
    "code": 400,
    "status": "error",
    "message": "appId is required.",
    "data": ""
}

appId不正确

{
    "code": 400,
    "status": "error",
    "message": "application not found.",
    "data": ""
}

时间戳错误

{
    "code": 400,
    "status": "error",
    "message": "invalid timestamp.",
    "data": ""
}

签名错误

{
    "code": 403,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}

频道号错误

{
    "code": 400,
    "status": "error",
    "message": "channel not found.",
    "data": ""
}

频道配置错误

{
    "code": 400,
    "status": "error",
    "message": "channelSetting not found.",
    "data": ""
}

字段说明

参数名 说明
code 请求状态响应码
status 请求状态
message 错误信息
donateEnabled 打赏开关
type 打赏类型:good 道具打赏,cash 现金打赏
cashMin 现金打赏最低下限
goodName1 打赏道具1名称
goodPrice1 打赏道具1价格
goodImg1 打赏道具1图片

php请求示例

<?php

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

//接口需要的参数(非sign)赋值
$channelId = "127075";

$params = array(
    'appId'=>$appId,
    'timestamp'=>$timestamp
  );

//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法

//接口请求url
$url = "http://api.live.polyv.net/v2/channelSetting/$channelId/getDonate?appId=$appId&timestamp=$timestamp&sign=$sign";

//输出接口请求结果
echo file_get_contents($url);

?>

签名规则(config.php文件代码查看)

http://dev.polyv.net/2018/liveproduct/l-api/rule/sign/

以上内容是否对您有帮助?根本没有帮助文档较差文档一般文档不错文档很好
Loading...