查询频道打赏设置(新版后台)

旧版接口地址查询频道打赏设置(旧版)

接口描述

1、查询频道打赏设置,包括现金打赏、礼物打赏,礼物打赏又分为现金支付和积分支付
2、接口支持https协议

接口URL

http://api.polyv.net/live/v4/channel/donate/get

在线API调用

请求方式

GET

接口约束

1、接口同时支持HTTP 、HTTPS ,建议使用HTTPS 确保接口安全,接口调用有频率限制,详细请查看

请求参数描述

参数名必选类型说明

appId

true

String

账号appId【详见获取密钥

timestamp

true

Long

当前13位毫秒级时间戳,3分钟内有效

sign

true

String

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

channelId

true

String

频道号

示例

http://api.polyv.net/live/v4/channel/donate/get?appId=frlr1zazn3&sign=16DC042339E27BAD00452D004C1FA9CA&channelId=2523307&timestamp=1631064094801

响应参数描述

参数名类型说明

code

Integer

响应状态码,200为成功返回,非200为失败

status

String

响应结果,由业务决定,成功返回success,失败返回error

success

Boolean

响应结果,由业务决定,成功返回true,失败返回false

data

Object

成功响应时返回频道详细信息【详见data字段说明

error

Object

状态码非200时的错误信息【详见Error字段说明

requestId

String

请求ID,每次请求生成的唯一的 UUID,仅可用于排查、调试,不应该和业务挂上钩

Error参数描述

参数名类型说明

code

Integer

错误代码,用于确定具体的错误原因

desc

String

错误描述,与 error.code 对应

data参数描述

参数名类型说明

donateCashEnabled

String

现金红包打赏开关,Y:开启,N:关闭

cashDonate

Object

现金红包【详见TemplateCashDonateBO字段说明

donateGiftEnabled

String

礼物打赏开关,Y:开启,N:关闭

giftDonate

Object

礼物打赏(现金支付或积分支付)【详见TemplateGiftDonateBO字段说明

TemplateCashDonateBO参数描述

参数名类型说明

cashs

Array

固定打赏金额,数组长度在1-6,最小值0.01,最大值9999.99

cashMin

Float

自定义打赏金额-最低金额,最小值0.01,最大值9999.99

TemplateGiftDonateBO参数描述

参数名类型说明

payWay

String

支付方式,CASH:现金支付,POINT:积分支付

cashUnit

String

现金单位

pointUnit

String

积分单位

cashPays

Array

现金支付列表【详见GiftDonate字段说明

pointPays

Array

积分支付列表【详见GiftDonate字段说明

GiftDonate参数描述

参数名类型说明

name

String

礼物名称

img

String

礼物图片地址

price

Float

礼物价格

enabled

String

开关,Y:开启,N:关闭

Java请求示例

快速接入基础代码请下载相关依赖源码, 点击下载源代码 ,下载后加入到自己的源码工程中即可。测试用例中的HttpUtil.java 和 LiveSignUtil.java 都包含在下载文件中。

强烈建议您使用直播Java SDK完成API的功能对接,直播Java SDK 对API调用逻辑、异常处理、数据签名、HTTP请求线程池进行了统一封装和优化。

private static final Logger log = LoggerFactory.getLogger(ChannelDonateTest.class);

@Test
public void testGetDonate() throws IOException, NoSuchAlgorithmException {
    String appId = super.appId;
    String appSecret = super.appSecret;
    String timestamp = String.valueOf(System.currentTimeMillis());
    //业务参数
    String url = "http://api.polyv.net/live/v4/channel/donate/get";
    
    //http 调用逻辑
    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("appId", appId);
    requestMap.put("timestamp", timestamp);
    requestMap.put("channelId", "2523307");
    
    requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
    
    String response = HttpUtil.get(url,requestMap);
    
    log.info("测试查询频道打赏设置,返回值:{}", response);
}

响应示例

系统全局错误说明详见全局错误说明

成功示例

{
    "code": 200,
    "status": "success",
    "requestId": "5d413aa5dc6b4cc1b79d4374aa5ac974.67.16310640996487509",
    "data": {
        "donateCashEnabled": "N",
        "donateGiftEnabled": "N",
        "cashDonate": {
            "cashs": [
                0.88,
                6.66,
                8.88,
                18.88,
                66.6,
                88.8
            ],
            "cashMin": 0.01
        },
        "giftDonate": {
            "payWay": null,
            "cashUnit": "元",
            "pointUnit": "点",
            "cashPays": [
                {
                    "name": "666",
                    "img": "//s1.videocc.net/default-img/donate/666.png",
                    "price": 6.66,
                    "sequence": 0,
                    "enabled": "Y"
                },
                {
                    "name": "掌声",
                    "img": "//s1.videocc.net/default-img/donate/handclap.png",
                    "price": 88.99,
                    "sequence": 0,
                    "enabled": "Y"
                },
                {
                    "name": "点赞",
                    "img": "//s1.videocc.net/default-img/donate/like.png",
                    "price": 1.99,
                    "sequence": 0,
                    "enabled": "Y"
                },
                {
                    "name": "小星星",
                    "img": "//s1.videocc.net/default-img/donate/star.png",
                    "price": 9.99,
                    "sequence": 0,
                    "enabled": "N"
                },
                {
                    "name": "钻石",
                    "img": "//s1.videocc.net/default-img/donate/diamond.png",
                    "price": 19.99,
                    "sequence": 0,
                    "enabled": "N"
                },
                {
                    "name": "跑车",
                    "img": "//s1.videocc.net/default-img/donate/car.png",
                    "price": 29.99,
                    "sequence": 0,
                    "enabled": "N"
                },
                {
                    "name": "火箭",
                    "img": "//s1.videocc.net/default-img/donate/rocket.png",
                    "price": 66.66,
                    "sequence": 0,
                    "enabled": "N"
                }
            ],
            "pointPays": [
                {
                    "name": "咖啡",
                    "img": "//s1.videocc.net/default-img/donate/coffee.png",
                    "price": 5,
                    "sequence": 1,
                    "enabled": "Y"
                },
                {
                    "name": "鲜花",
                    "img": "//s1.videocc.net/default-img/donate/flower.png",
                    "price": 0,
                    "sequence": 2,
                    "enabled": "Y"
                },
                {
                    "name": "点赞",
                    "img": "//s1.videocc.net/default-img/donate/like.png",
                    "price": 10,
                    "sequence": 3,
                    "enabled": "Y"
                },
                {
                    "name": "掌声",
                    "img": "//s1.videocc.net/default-img/donate/handclap.png",
                    "price": 15,
                    "sequence": 4,
                    "enabled": "Y"
                },
                {
                    "name": "666",
                    "img": "//s1.videocc.net/default-img/donate/666.png",
                    "price": 20,
                    "sequence": 5,
                    "enabled": "Y"
                },
                {
                    "name": "小星星",
                    "img": "//s1.videocc.net/default-img/donate/star.png",
                    "price": 25,
                    "sequence": 6,
                    "enabled": "Y"
                },
                {
                    "name": "钻石",
                    "img": "//s1.videocc.net/default-img/donate/diamond.png",
                    "price": 30,
                    "sequence": 7,
                    "enabled": "Y"
                },
                {
                    "name": "烟火",
                    "img": "//s1.videocc.net/default-img/donate/fireworks.png",
                    "price": 35,
                    "sequence": 8,
                    "enabled": "Y"
                },
                {
                    "name": "金蛋",
                    "img": "//s1.videocc.net/default-img/donate/golden-egg.png",
                    "price": 40,
                    "sequence": 9,
                    "enabled": "Y"
                },
                {
                    "name": "奖杯",
                    "img": "//s1.videocc.net/default-img/donate/cup.png",
                    "price": 45,
                    "sequence": 10,
                    "enabled": "Y"
                },
                {
                    "name": "跑车",
                    "img": "//s1.videocc.net/default-img/donate/car.png",
                    "price": 50,
                    "sequence": 11,
                    "enabled": "Y"
                },
                {
                    "name": "皇冠",
                    "img": "//s1.videocc.net/default-img/donate/crown.png",
                    "price": 60,
                    "sequence": 12,
                    "enabled": "Y"
                },
                {
                    "name": "别墅",
                    "img": "//s1.videocc.net/default-img/donate/house.png",
                    "price": 65,
                    "sequence": 13,
                    "enabled": "Y"
                },
                {
                    "name": "游艇",
                    "img": "//s1.videocc.net/default-img/donate/yacht.png",
                    "price": 70,
                    "sequence": 14,
                    "enabled": "Y"
                },
                {
                    "name": "飞机",
                    "img": "//s1.videocc.net/default-img/donate/plane.png",
                    "price": 88,
                    "sequence": 15,
                    "enabled": "Y"
                },
                {
                    "name": "火箭",
                    "img": "//s1.videocc.net/default-img/donate/rocket.png",
                    "price": 100,
                    "sequence": 16,
                    "enabled": "Y"
                }
            ]
        }
    },
    "success": true
}

异常示例

{
    "code": 400,
    "status": "error",
    "requestId": "4081dbac03e6441e8bdd301d8feee5a2.124.16360828110501391",
    "error": {
        "code": 20001,
        "desc": "application not found."
    },
    "success": false
}

Last updated