接口URL
http://api.polyv.net/live/v2/channelSetting/{channelId}/setDonate
接口说明
1、接口支持https协议
2、频道的打赏设置
3、可设置cash(现金打赏)、good(道具打赏),不能同时设置,道具最多设置3个。
4、注:如果只设置现金打赏不上传图片,表单也需要设置以下属性enctype="multipart/form-data"
5、接口URL中的{channelId}为 频道ID
支持格式
JSON
请求方式
POST
请求数限制
TRUE
请求参数(设置现金打赏)
参数名 | 必选 | 类型 | 说明 |
---|---|---|---|
appId | 是 | string | 从API设置中获取,在直播系统登记的appId |
timestamp | 是 | string | 当前13位毫秒级时间戳,3分钟内有效 |
donateEnabled | 是 | Y/N | 打赏开关 |
type | 是 | 固定为cash | 打赏类型 |
casnMin | 否 | 数字 | 打赏的最低下限,范围是0-9999之间,不设置则默认为0 |
sign | 是 | string | 签名,32位大写MD5值 |
请求参数(设置道具打赏)
参数名 | 必选 | 类型 | 说明 |
---|---|---|---|
appId | 是 | string | 从API设置中获取,在直播系统登记的appId |
timestamp | 是 | string | 当前13位毫秒级时间戳,3分钟内有效 |
donateEnabled | 是 | Y/N | 打赏开关 |
type | 是 | 固定为good | 打赏类型 |
goodName | 是 | string | 道具名称,多个名称请用英文逗号隔开 |
goodPrice | 是 | string | 道具价格,多个价格请用英文逗号隔开 |
goodImg | 是 | MultipartFile | 图片大小不能超过100K,仅支持jpg、jpeg、png图片 |
sign | 是 | string | 签名,32位大写MD5值 |
响应成功JSON示例:
{
"code": 200,
"status": "success",
"message": "",
"data": "success"
}
响应失败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": ""
}
打赏开关输入错误(取值为Y或N)
{
"code": 400,
"status": "error",
"message": "donateEnabled is wrong.",
"data": ""
}
打赏类型输入错误(取值为cash或good)
{
"code": 400,
"status": "error",
"message": "type is wrong.",
"data": ""
}
现金打赏最低下限输入错误(数字)
{
"code": 400,
"status": "error",
"message": "cashMin is wrong.",
"data": ""
}
设置的道具超过三个
{
"code": 400,
"status": "error",
"message": "道具不能超过3个.",
"data": ""
}
道具名称相同
{
"code": 400,
"status": "error",
"message": "道具名称不能相同.",
"data": ""
}
道具的信息输入不完整(例如输入三个道具名,而道具价格只设置两个)
{
"code": 400,
"status": "error",
"message": "打赏道具的信息不能为空.",
"data": ""
}
道具图片超过100kb
{
"code": 400,
"status": "error",
"message": "image oversize error.",
"data": ""
}
道具图片格式不正确
{
"code": 400,
"status": "error",
"message": "image format error.",
"data": ""
}
其他错误
{
"code": 400,
"status": "error",
"message": "设置失败,请重试.",
"data": ""
}
字段说明
参数名 | 说明 |
---|---|
code | 请求状态响应码 |
status | 请求状态 |
message | 错误信息 |
donateEnabled | 打赏开关 |
type | 打赏类型:good 道具打赏,cash 现金打赏 |
cashMin | 现金打赏最低下限 |
goodName1 | 打赏道具1名称 |
goodPrice1 | 打赏道具1价格 |
goodImg1 | 打赏道具1图片 |
php请求示例
http://demo.polyv.net/wfy/demo/setDonate.html
可右键直接查看源代码进行复制