查詢打賞設置

接口URL

http://api.hemihome.com/live/v3/channel/donate/get

接口說明

1||-11选5彩票自动分析软件、接口用於獲取全局或當前生效的打賞設置
2__106平台彩票ios版、接口支持https

支持格式

JSON

請求方式

GET

請求數限製

TRUE

請求參數

參數名 必選 類型 說明
appId string 從API設置中獲取|-_149什么规律,在直播係統登記的appId
timestamp long 13位當前時間戳
sign string 簽名值
channelId int 頻道號__-众博彩票手机客户端,不傳為獲取全局設置-|35彩票网址,否則為當前生效設置

響應成功JSON示例|-_蘑菇街2013新款冬装:

{
  "code": 200,
  "status": "success",
  "message": "",
  "data": {
    "globalSettingEnabled": "N",
    "donateCashEnabled": "Y",
    "donateGoodEnabled": "Y",
    "donateTips": null,
    "cashMin": 0,
    "cashes": [
      0.88,
      6.66,
      8.88,
      18.88,
      66.6,
      88.8
    ],
    "goods": [
      {
        "goodName": "鮮花",
        "goodImg": "//livestatic.videocc.net/uploaded/images/webapp/channel/donate/01-flower.png",
        "goodPrice": 0,
        "goodEnabled": "Y"
      },
      {
        "goodName": "咖啡",
        "goodImg": "//livestatic.videocc.net/uploaded/images/webapp/channel/donate/02-coffee.png",
        "goodPrice": 0.99,
        "goodEnabled": "Y"
      },
      {
        "goodName": "點讚",
        "goodImg": "//livestatic.videocc.net/uploaded/images/webapp/channel/donate/03-good.png",
        "goodPrice": 1.99,
        "goodEnabled": "Y"
      },
      {
        "goodName": "掌聲",
        "goodImg": "//livestatic.videocc.net/uploaded/images/webapp/channel/donate/04-applaud.png",
        "goodPrice": 2.99,
        "goodEnabled": "Y"
      },
      {
        "goodName": "666",
        "goodImg": "//livestatic.videocc.net/uploaded/images/webapp/channel/donate/05-666.png",
        "goodPrice": 6.66,
        "goodEnabled": "Y"
      },
      {
        "goodName": "小星星",
        "goodImg": "//livestatic.videocc.net/uploaded/images/webapp/channel/donate/06-star.png",
        "goodPrice": 9.99,
        "goodEnabled": "Y"
      },
      {
        "goodName": "鑽石",
        "goodImg": "//livestatic.videocc.net/uploaded/images/webapp/channel/donate/07-diamond.png",
        "goodPrice": 19.99,
        "goodEnabled": "Y"
      },
      {
        "goodName": "跑車",
        "goodImg": "//livestatic.videocc.net/uploaded/images/webapp/channel/donate/08-car.png",
        "goodPrice": 29.99,
        "goodEnabled": "Y"
      },
      {
        "goodName": "火箭",
        "goodImg": "//livestatic.videocc.net/uploaded/images/webapp/channel/donate/09-rocket.png",
        "goodPrice": 66.66,
        "goodEnabled": "Y"
      }
    ]
  }
}

響應失敗JSON示例--oppo翻盖音乐手机:

未輸入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 返回狀態碼|-|鸣人堂,成功為200|--青岛市公交线路图,參數錯誤為400-__360彩票七乐彩杀号定胆。
status 狀態_|_2元彩票网走势图大全,成功返回success|__巴萨勒沃库森,失敗返回error
message 錯誤提示信息-|-人族大讲堂,成功時為空串
data 打賞設置的相關信息
globalSettingEnabled 是否應用全局設置_-|奥斯洁,獲取全局設置時_-_新娘无悔的爱第二部,該值為null
donateCashEnabled 現金打賞開關
donateGoodEnabled 道具打賞開關
donateTips 打賞提示
cashMin 最低打賞金額
cashes 打賞金額選項
goods 打賞道具選項
goodName 道具選項名
goodImg 道具選項對應的圖片
goodPrice 道具選項對應的價格
goodEnabled 是否啟用該道具

php請求示例

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

$channelId="206016";

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

//生成sign
$sign = getSign($params); //詳細查看config.php文件的getSign方法
$params['sign'] = $sign;

$url = "http://api.hemihome.com/live/v3/channel/donate/get?".http_build_query($params);

$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 500);
curl_setopt($curl, CURLOPT_URL, $url);
$res = curl_exec($curl);
curl_close($curl);

echo $res;
?>

簽名規則(config.php文件代碼查看)

http://dev.hemihome.com/2018/liveproduct/l-api/rule/sign/

以上內容是否對您有幫助--_小灿男装?根本沒有幫助文檔較差文檔一般文檔不錯文檔很好
Loading...

修改微信分享設置

接口URL

http://api.hemihome.com/live/v3/channel/weixin-share/update

接口說明

1_-|芙蓉中路二手房、接口用於修改頻道的微信分享相關設置
2_-娱乐天地线路官网、接口支持https

支持格式

JSON

請求方式

POST

請求數限製

TRUE

請求參數

參數名 必選 類型 說明
appId string 從API設置中獲取--云顶娱乐为啥禁止提现,在直播係統登記的appId
timestamp long 13位當前時間戳
sign string 簽名值
channelId int 頻道號
weixinShareTitle string 微信分享的標題
weixinShareDesc string 微信分享的描述

響應成功JSON示例|舒城交友:

{
    "code": 200,
    "status": "success",
    "message": "",
    "data": "success"
}

響應失敗JSON示例|-2013明星篮球赛:

未輸入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": ""
}

頻道Id格式錯誤

{
    "code": 400,
    "status": "error",
    "message": "param is not digit: %s",
    "data": ""
}

頻道不存在

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

頻道Id非法錯誤

{
    "code": 400,
    "status": "error",
    "message": "illegal channel id: %s",
    "data": ""
}

字段說明

參數名 說明
code 狀態碼,成功為200-_105彩票骗局,簽名失敗為403_赢钱彩登录网站,參數錯誤為400--诛仙推广员id,服務端錯誤為500
status 成功為success,錯誤時為error
message 成功為""--黄牛课件网,錯誤時為錯誤描述信息
data 成功時success|__芬兰语好学吗,錯誤時為""

php請求示例

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

$params = array(
  'appId' => "填寫獲取到的appId",
  'timestamp' => "填寫13位時間戳",
  'channelId' => "填寫頻道號",
  'weixinShareTitle' => "我要改標題",
  'weixinShareDesc' => "我要改描述"
);

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


$url="http://api.hemihome.com/live/v3/channel/weixin-share/update";

function post($url, $post_data = '', $timeout = 5){
   $ch = curl_init();
   curl_setopt ($ch, CURLOPT_URL, $url);
   curl_setopt ($ch, CURLOPT_POST, 1);
   if($post_data != ''){
      curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
   }

   curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
   curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
   curl_setopt($ch, CURLOPT_HEADER, false);
   $file_contents = curl_exec($ch);
   curl_close($ch);
   return $file_contents;
}

$params["sign"] = $sign;
echo post($url, $params);
?>

簽名規則(config.php文件代碼查看)

http://dev.hemihome.com/2018/liveproduct/l-api/rule/sign/

以上內容是否對您有幫助-_三大舰队?根本沒有幫助文檔較差文檔一般文檔不錯文檔很好
Loading...

獲取微信分享設置

接口URL

http://api.hemihome.com/live/v3/channel/weixin-share/get

接口說明

1-|168彩票官网登录苹果、獲取頻道的微信分享設置信息
2-_|捧腹网搞笑动态图片、接口支持https協議

具體功能請查看 微信分享設置

支持格式

JSON

請求方式

 GET

請求數限製

TRUE

請求參數

參數名 必選 類型 說明
channelId int 頻道號
appId string 從API設置中獲取_-众赢彩票计划软件手机,在直播係統登記的appId
sign string 簽名_|-山西电视台小郭跑腿,為32位大寫的MD5值
timestamp string 當前13位毫秒級時間戳|_|众发娱乐是不违法,3分鍾內有效

響應成功JSON示例-_亿彩彩票怎么样:

{
    "code": 200,
    "status": "success",
    "message": "",
    "data": {
        "channelId": 108888,
        "channelName": "多碼率測試頻道號",
        "coverImg": "//livestatic.videocc.net/uploaded/images/2017/12/ewe26lgx61.png",
        "weixinShareTitle": "微信分享的標題",
        "weixinShareDesc": "微信分享的描述"
    }
}

響應異常JSON示例__java手机qq软件下载:

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

字段說明

參數名 說明
code 請求狀態響應碼
status 請求狀態
message 錯誤信息
channelId 頻道號
channelName 頻道名稱
coverImg 微信分享圖標|||镇赉贴吧,即頻道的直播圖標
weixinShareTitle 微信分享的標題
weixinShareDesc 微信分享的描述

php請求示例

<?php

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

//接口需要的參數(非sign)賦值
$timestamp = 1528708015437;
$appId = "test";
$channelId = 108888;

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

//生成sign
$sign = getSign($params); //詳細查看config.php文件的getSign方法
//接口請求url
$url = "http://api.hemihome.com/live/v3/channel/weixin-share/get?channelId=$channelId&appId=$appId&timestamp=$timestamp&sign=$sign";

//輸出接口請求結果
echo file_get_contents($url);

?>

簽名規則(config.php文件代碼查看)

http://dev.hemihome.com/2018/liveproduct/l-api/rule/sign/

以上內容是否對您有幫助|__子宫日记中文版全集?根本沒有幫助文檔較差文檔一般文檔不錯文檔很好
Loading...

設置道具打賞

接口URL

http://api.hemihome.com/live/v3/channel/donate/update-good

接口說明

1|_168下载最新下载、接口用於設置頻道或者全局道具打賞(帶上頻道ID為設置頻道道具打賞|-|银行期票,不帶頻道ID默認為全局道具打賞設置)
2_|银色黎明声望怎么刷、通用參數通過普通url參數傳遞(channelId, timestamp, appId, sign)|||就医160网上预约,設置打賞參數的json通過請求體的方式傳遞
3|_运盛彩票导航密集、接口支持https

支持格式

JSON

請求方式

POST

請求數限製

TRUE

請求參數

參數名 必選 類型 說明
appId string 從API設置中獲取___2018公安部对云联惠,在直播係統登記的appId
timestamp long 13位當前時間戳
sign string 簽名值
channelId int 頻道號_|众赢彩票注册,不傳為全局設置
goods 對象數組 請求體參數|牛网卡盟,道具打賞對象數組_--梦回大唐之萧瑟流光,道具對象數量必須大於0小於10
enabled string 請求體參數||_3M彩票,道具打賞開關-_快乐大本营张惠妹,不傳默認開啟|__qq水浒媚李立,值為 Y/N , Y為開啟

#道具對象參數

參數名 必選 類型 說明
goodName string 道具名稱__|认识国旗,不能超過5個字符
goodImg string 道具圖片|_-焦点打断宏,不能超過120個字符(圖片地址可以使用下麵json字符串中的默認地址_|魏征进谏图作者,或者通過上傳圖片接口上傳獲取圖片地址)
goodPrice double 道具打賞價格
goodEnabled string 道具開關_|-至尊娱乐从哪里下载,值為 Y/N , Y為開啟

注|陈祖怡:這裏的channelId,appId,timestamp,sign必須通過url傳參-_众赢彩票计划软件,json數據通過請求體傳參-|01彩票真的能赚钱吗,如:

http://api.hemihome.com/live/v3/channel/donate/update-good?channelId={{channelId}}&appId={{appId}}&timestamp={{timestamp}}&sign={{sign}}

請求體json拚接

{
  "enabled": "Y",
  "goods": [
    {
      "goodName": "鮮花333",
      "goodImg": "//livestatic.videocc.net/uploaded/images/webapp/channel/donate/01-flower.png",
      "goodPrice": 0,
      "goodEnabled": "Y"
    },
    {
      "goodName": "咖啡",
      "goodImg": "//livestatic.videocc.net/uploaded/images/webapp/channel/donate/02-coffee.png",
      "goodPrice": 0.99,
      "goodEnabled": "Y"
    },
    {
      "goodName": "點讚",
      "goodImg": "//livestatic.videocc.net/uploaded/images/webapp/channel/donate/03-good.png",
      "goodPrice": 1.99,
      "goodEnabled": "Y"
    },
    {
      "goodName": "掌聲",
      "goodImg": "//livestatic.videocc.net/uploaded/images/webapp/channel/donate/04-applaud.png",
      "goodPrice": 2.99,
      "goodEnabled": "Y"
    },
    {
      "goodName": "666",
      "goodImg": "//livestatic.videocc.net/uploaded/images/webapp/channel/donate/05-666.png",
      "goodPrice": 6.66,
      "goodEnabled": "Y"
    },
    {
      "goodName": "小星星",
      "goodImg": "//livestatic.videocc.net/uploaded/images/webapp/channel/donate/06-star.png",
      "goodPrice": 9.99,
      "goodEnabled": "Y"
    },
    {
      "goodName": "鑽石",
      "goodImg": "//livestatic.videocc.net/uploaded/images/webapp/channel/donate/07-diamond.png",
      "goodPrice": 19.99,
      "goodEnabled": "Y"
    },
    {
      "goodName": "跑車",
      "goodImg": "//livestatic.videocc.net/uploaded/images/webapp/channel/donate/08-car.png",
      "goodPrice": 29.99,
      "goodEnabled": "Y"
    },
    {
      "goodName": "火箭233",
      "goodImg": "//livestatic.videocc.net/uploaded/images/webapp/channel/donate/09-rocket.png",
      "goodPrice": 66.66,
      "goodEnabled": "Y"
    }
  ]
}

響應成功JSON示例||-山海情缘东方神韵:

{
    "code": 200,
    "status": "success",
    "message": "",
    "data": true
}

響應失敗JSON示例||_29彩票注册:

#參數錯誤

{
    "code": 400,
    "status": "error",
    "message": "param validate error",
    "data": 400
}

#未輸入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": ""
}

#channelId非法錯誤

{
    "code": 403,
    "status": "error",
    "message": "illegal channel id: 10001",
    "data": ""
}

#json為空或者json解析錯誤

{
    "code": 400,
    "status": "error",
    "message": "param validate error",
    "data": ""
}

#json中的goods數量限製

{
    "code": 400,
    "status": "error",
    "message": "goods over limit",
    "data": ""
}

#json中的goods的名稱字符限製

{
    "code": 400,
    "status": "error",
    "message": "goods name over limit",
    "data": ""
}

#json中的goods的圖片地址字符限製

{
    "code": 400,
    "status": "error",
    "message": "goods image length over limit",
    "data": ""
}

#json中的goods的價格數據類型錯誤

{
    "code": 400,
    "status": "error",
    "message": "number range error",
    "data": ""
}

字段說明

參數名 說明
code 狀態碼,成功為200_-芜湖拉手网,簽名失敗為403|凯源吧,參數錯誤為400龙的对联,服務端錯誤為500
status 成功為success,錯誤時為error
message 成功為""|-寂寞先生 刘悦,錯誤時為錯誤描述信息
data 成功時為true__-优乐彩彩票开奖官方网,錯誤時為""

java請求示例

import com.live.util.EncryptionUtils;
import org.apache.http.HttpEntity;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;

import java.io.IOException;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Demo {

    private static RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(15000).setConnectTimeout(15000)
            .setConnectionRequestTimeout(15000).build();

    public static void main(String[] args) {

        String url = "http://api.hemihome.com/live/v3/channel/donate/update-good";
        int channelId = 209796;
        String appId = "XXXXXX";
        String key = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        Map<String, String> map = new HashMap<>();
        long timestamp = System.currentTimeMillis();
        map.put("appId", appId);
        map.put("timestamp", String.valueOf(timestamp));
        map.put("channelId", String.valueOf(channelId));

        String sign = getSign(map, key);
        map.put("sign", sign);
        String body = "{\"goods\":[{\"goodName\":\"鮮花333\",\"goodImg\":\"//livestatic.videocc.net/uploaded/images/webapp/channel/donate/01-flower.png\",\"goodPrice\":0,\"goodEnabled\":\"Y\"},{\"goodName\":\"咖啡\",\"goodImg\":\"//livestatic.videocc.net/uploaded/images/webapp/channel/donate/02-coffee.png\",\"goodPrice\":0.99,\"goodEnabled\":\"Y\"},{\"goodName\":\"點讚\",\"goodImg\":\"//livestatic.videocc.net/uploaded/images/webapp/channel/donate/03-good.png\",\"goodPrice\":1.99,\"goodEnabled\":\"Y\"},{\"goodName\":\"掌聲\",\"goodImg\":\"//livestatic.videocc.net/uploaded/images/webapp/channel/donate/04-applaud.png\",\"goodPrice\":2.99,\"goodEnabled\":\"Y\"},{\"goodName\":\"666\",\"goodImg\":\"//livestatic.videocc.net/uploaded/images/webapp/channel/donate/05-666.png\",\"goodPrice\":6.66,\"goodEnabled\":\"Y\"},{\"goodName\":\"小星星\",\"goodImg\":\"//livestatic.videocc.net/uploaded/images/webapp/channel/donate/06-star.png\",\"goodPrice\":9.99,\"goodEnabled\":\"Y\"},{\"goodName\":\"鑽石\",\"goodImg\":\"//livestatic.videocc.net/uploaded/images/webapp/channel/donate/07-diamond.png\",\"goodPrice\":19.99,\"goodEnabled\":\"Y\"},{\"goodName\":\"跑車\",\"goodImg\":\"//livestatic.videocc.net/uploaded/images/webapp/channel/donate/08-car.png\",\"goodPrice\":29.99,\"goodEnabled\":\"Y\"},{\"goodName\":\"火箭233\",\"goodImg\":\"//livestatic.videocc.net/uploaded/images/webapp/channel/donate/09-rocket.png\",\"goodPrice\":66.66,\"goodEnabled\":\"Y\"}]}";
        String content = sendHttpPost(url, map, body);
        System.out.println(content);

    }

    /**
     * 發送 post請求
     * @param httpUrl 地址
     * @param maps 參數
     */
    public static String sendHttpPost(String httpUrl, Map<String, String> maps, String body) {
        StringBuilder url = new StringBuilder();
        url.append(httpUrl).append("?");
        for (Map.Entry<String, String> map : maps.entrySet()) {
            url.append(map.getKey()).append("=").append(map.getValue()).append("&");
        }
        String urlStr = url.toString().substring(0, url.length() - 1);
        // 創建httpPost
        HttpPost httpPost = new HttpPost(urlStr);
        try {
            StringEntity entity = new StringEntity(body, Charset.forName("UTF-8"));
            httpPost.setEntity(entity);
        } catch (Exception e) {
            // ...
        }
        return sendHttpPost(httpPost);
    }

    /**
     * 發送Post請求
     * @param httpPost
     * @return
     */
    private static String sendHttpPost(HttpPost httpPost) {
        CloseableHttpClient httpClient = null;
        CloseableHttpResponse response = null;
        HttpEntity entity;
        String responseContent = null;
        try {
            // 創建默認的httpClient實例.
            httpClient = HttpClients.createDefault();
            httpPost.setConfig(requestConfig);
            // 執行請求
            response = httpClient.execute(httpPost);
            entity = response.getEntity();
            responseContent = EntityUtils.toString(entity, "UTF-8");
        } catch (Exception e) {
            // ...
        } finally {
            try {
                // 關閉連接,釋放資源
                if (response != null) {
                    response.close();
                }
                if (null != httpPost) {
                    httpPost.releaseConnection();
                }
                if (httpClient != null) {
                    httpClient.close();
                }
            } catch (IOException e) {
                // ...
            }
        }
        return responseContent;
    }

    /**
     * 根據map裏的參數構建加密串
     * @param map
     * @param secretKey
     * @return
     */
    protected static String getSign(Map<String, String> map, String secretKey) {
        Map<String, String> params = paraFilter(map);
        // 處理參數_易彩娱乐福地,計算MD5哈希值
        String concatedStr = concatParams(params);
        String plain = secretKey + concatedStr + secretKey;
        String encrypted = EncryptionUtils.md5Hex(plain);

        // 32位大寫MD5值
        return encrypted.toUpperCase();
    }

    /**
     * 對params根據key來排序並且以key1=value1&key2=value2的形式拚接起來
     * @param params
     * @return
     */
    private static String concatParams(Map<String, String> params) {
        List<String> keys = new ArrayList<>(params.keySet());
        Collections.sort(keys);

        StringBuilder sb = new StringBuilder();

        for (int i = 0; i < keys.size(); i++) {
            String key = keys.get(i);
            String value = params.get(key);

            sb.append(key).append(value);
        }

        return sb.toString();
    }

    /**
     * 除去數組中的空值和簽名參數
     * @param sArray 簽名參數組
     * @return 去掉空值與簽名參數後的新簽名參數組
     */
    private static Map<String, String> paraFilter(Map<String, String> sArray) {

        Map<String, String> result = new HashMap<>();

        if (sArray == null || sArray.size() <= 0) {
            return result;
        }

        for (String key : sArray.keySet()) {
            String value = sArray.get(key);
            if (value == null || value.equals("") || key.equalsIgnoreCase("sign")
                    || key.equalsIgnoreCase("sign_type")) {
                continue;
            }
            result.put(key, value);
        }

        return result;
    }

}

php請求示例

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

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

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

$json = '{
  "enabled": "Y",
  "goods": [
    {
      "goodName": "鮮花333",
      "goodImg": "//livestatic.videocc.net/uploaded/images/webapp/channel/donate/01-flower.png",
      "goodPrice": 0,
      "goodEnabled": "Y"
    },
    {
      "goodName": "咖啡",
      "goodImg": "//livestatic.videocc.net/uploaded/images/webapp/channel/donate/02-coffee.png",
      "goodPrice": 0.99,
      "goodEnabled": "Y"
    },
    {
      "goodName": "點讚",
      "goodImg": "//livestatic.videocc.net/uploaded/images/webapp/channel/donate/03-good.png",
      "goodPrice": 1.99,
      "goodEnabled": "Y"
    },
    {
      "goodName": "掌聲",
      "goodImg": "//livestatic.videocc.net/uploaded/images/webapp/channel/donate/04-applaud.png",
      "goodPrice": 2.99,
      "goodEnabled": "Y"
    },
    {
      "goodName": "666",
      "goodImg": "//livestatic.videocc.net/uploaded/images/webapp/channel/donate/05-666.png",
      "goodPrice": 6.66,
      "goodEnabled": "Y"
    },
    {
      "goodName": "小星星",
      "goodImg": "//livestatic.videocc.net/uploaded/images/webapp/channel/donate/06-star.png",
      "goodPrice": 9.99,
      "goodEnabled": "Y"
    },
    {
      "goodName": "鑽石",
      "goodImg": "//livestatic.videocc.net/uploaded/images/webapp/channel/donate/07-diamond.png",
      "goodPrice": 19.99,
      "goodEnabled": "Y"
    },
    {
      "goodName": "跑車",
      "goodImg": "//livestatic.videocc.net/uploaded/images/webapp/channel/donate/08-car.png",
      "goodPrice": 29.99,
      "goodEnabled": "Y"
    },
    {
      "goodName": "火箭233",
      "goodImg": "//livestatic.videocc.net/uploaded/images/webapp/channel/donate/09-rocket.png",
      "goodPrice": 66.66,
      "goodEnabled": "Y"
    }
  ]
}';

$params["sign"] = $sign;
$url="http://api.hemihome.com/live/v3/channel/donate/update-good?".http_build_query($params);

function post($url, $post_data = '', $timeout = 5){
   $ch = curl_init();
   curl_setopt ($ch, CURLOPT_URL, $url);
   curl_setopt ($ch, CURLOPT_POST, 1);
   if($post_data != ''){
      curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
   }

   curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
   curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
   curl_setopt($ch, CURLOPT_HEADER, false);
   curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-Length: ' . strlen($post_data)));
   $file_contents = curl_exec($ch);
   curl_close($ch);
   return $file_contents;
}

echo post($url,$json);
?>

簽名規則(config.php文件代碼查看)

http://dev.hemihome.com/2018/liveproduct/l-api/rule/sign/

以上內容是否對您有幫助_-|038彩票骗局?根本沒有幫助文檔較差文檔一般文檔不錯文檔很好
Loading...

設置現金打賞

接口URL

http://api.hemihome.com/live/v3/channel/donate/update-cash

接口說明

1|-|苏岑博客、接口用於設置頻道或者全局現金打賞(帶上頻道ID為設置頻道現金打賞|_众购彩票网站,不帶頻道ID默認為全局現金打賞設置)
2-|-召召与木木、通用參數通過普通url參數傳遞(channelId, timestamp, appId, sign)___汶川地震腐烂女尸图片,設置打賞參數的json通過請求體的方式傳遞
3__金扬沙、接口支持https

支持格式

JSON

請求方式

POST

請求數限製

TRUE

請求參數

參數名 必選 類型 說明
appId string 從API設置中獲取__济南五中,在直播係統登記的appId
timestamp long 13位當前時間戳
sign string 簽名值
channelId int 頻道號|-苏宁易购网站打不开,不傳為全局設置
cashes double數組 請求體參數||诺基亚3208,現金打賞數額數組--_陈怡阳台门,數組的長度必須為6
cashMin double 請求體參數|-详细设计说明书实例,現金打賞自定義最小金額
enabled string 請求體參數-|_易彩彩民福地登录app,現金打賞開關_-|众盈策略平台是哪里的,不傳默認開啟_||bmw尊选二手车,值為 Y/N , Y為開啟

注_-淘宝开店认证:這裏的channelId,appId,timestamp,sign必須通過url傳參-|_盈彩在线,json數據通過請求體傳參_|盈众彩票官网,如:

http://api.hemihome.com/live/v3/channel/donate/update-cash?channelId={{channelId}}&appId={{appId}}&timestamp={{timestamp}}&sign={{sign}}

請求體json拚接

{
   "cashes": [0.88,6.66,8.88,18.11,66.60,88.80],
   "cashMin": 0.02,
   "enabled": "Y"
}

響應成功JSON示例_||河南4套:

{
    "code": 200,
    "status": "success",
    "message": "",
    "data": true
}

響應失敗JSON示例爸爸去哪儿韩国版全集:

#參數錯誤

{
    "code": 400,
    "status": "error",
    "message": "param validate error",
    "data": 400
}

#未輸入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": ""
}

#channelId非法錯誤

{
    "code": 403,
    "status": "error",
    "message": "illegal channel id: 10001",
    "data": ""
}

#json為空或者json解析錯誤

{
    "code": 400,
    "status": "error",
    "message": "param validate error",
    "data": ""
}

#json中的cashes和cashMin的數字類型校驗錯誤

{
    "code": 400,
    "status": "error",
    "message": "number range error",
    "data": ""
}

字段說明

參數名 說明
code 狀態碼,成功為200__银川欧陆经典,簽名失敗為403|__助赢官网,參數錯誤為400|-东方热线测网速,服務端錯誤為500
status 成功為success,錯誤時為error
message 成功為""||_黄油笔,錯誤時為錯誤描述信息
data 成功時為true_歌手2017第五期,錯誤時為""

java請求示例

import com.live.util.EncryptionUtils;
import org.apache.http.HttpEntity;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.entity.mime.content.FileBody;
import org.apache.http.entity.mime.content.StringBody;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;

import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by huangyufeng on 2017/7/27.
 */
public class Demo {

    private static RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(15000).setConnectTimeout(15000)
            .setConnectionRequestTimeout(15000).build();

    public static void main(String[] args) {

        String url = "http://api.live.hemihome.com/v3/channel/donate/update-cash";
        int channelId = 209796;
        String appId = "xxxxxxx";
        String key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxx";
        Map<String, String> map = new HashMap<>();
        long timestamp = System.currentTimeMillis();
        map.put("appId", appId);
        map.put("timestamp", String.valueOf(timestamp));
        map.put("channelId", String.valueOf(channelId));

        String sign = getSign(map, key);
        map.put("sign", sign);
        String body = "{\"cashes\": [0.11,6.66,8.88,18.11,66.60,88.80],\"cashMin\": 0.02,\"enabled\": \"Y\"}";
        String content = sendHttpPost(url, map, body);
        System.out.println(content);

    }

    /**
     * 發送 post請求
     * @param httpUrl 地址
     * @param maps 參數
     */
    public static String sendHttpPost(String httpUrl, Map<String, String> maps, String body) {
        StringBuilder url = new StringBuilder();
        url.append(httpUrl).append("?");
        for (Map.Entry<String, String> map : maps.entrySet()) {
            url.append(map.getKey()).append("=").append(map.getValue()).append("&");
        }
        String urlStr = url.toString().substring(0, url.length() - 1);
        // 創建httpPost
        HttpPost httpPost = new HttpPost(urlStr);
        try {
            StringEntity entity = new StringEntity(body, Charset.forName("UTF-8"));
            httpPost.setEntity(entity);
        } catch (Exception e) {
            // ...
        }
        return sendHttpPost(httpPost);
    }

    /**
     * 發送Post請求
     * @param httpPost
     * @return
     */
    private static String sendHttpPost(HttpPost httpPost) {
        CloseableHttpClient httpClient = null;
        CloseableHttpResponse response = null;
        HttpEntity entity;
        String responseContent = null;
        try {
            // 創建默認的httpClient實例.
            httpClient = HttpClients.createDefault();
            httpPost.setConfig(requestConfig);
            // 執行請求
            response = httpClient.execute(httpPost);
            entity = response.getEntity();
            responseContent = EntityUtils.toString(entity, "UTF-8");
        } catch (Exception e) {
            // ...
        } finally {
            try {
                // 關閉連接,釋放資源
                if (response != null) {
                    response.close();
                }
                if (null != httpPost) {
                    httpPost.releaseConnection();
                }
                if (httpClient != null) {
                    httpClient.close();
                }
            } catch (IOException e) {
                // ...
            }
        }
        return responseContent;
    }

    /**
     * 根據map裏的參數構建加密串
     * @param map
     * @param secretKey
     * @return
     */
    protected static String getSign(Map<String, String> map, String secretKey) {
        Map<String, String> params = paraFilter(map);
        // 處理參數--09被骗20w,計算MD5哈希值
        String concatedStr = concatParams(params);
        String plain = secretKey + concatedStr + secretKey;
        String encrypted = EncryptionUtils.md5Hex(plain);

        // 32位大寫MD5值
        return encrypted.toUpperCase();
    }

    /**
     * 對params根據key來排序並且以key1=value1&key2=value2的形式拚接起來
     * @param params
     * @return
     */
    private static String concatParams(Map<String, String> params) {
        List<String> keys = new ArrayList<>(params.keySet());
        Collections.sort(keys);

        StringBuilder sb = new StringBuilder();

        for (int i = 0; i < keys.size(); i++) {
            String key = keys.get(i);
            String value = params.get(key);

            sb.append(key).append(value);
        }

        return sb.toString();
    }

    /**
     * 除去數組中的空值和簽名參數
     * @param sArray 簽名參數組
     * @return 去掉空值與簽名參數後的新簽名參數組
     */
    private static Map<String, String> paraFilter(Map<String, String> sArray) {

        Map<String, String> result = new HashMap<>();

        if (sArray == null || sArray.size() <= 0) {
            return result;
        }

        for (String key : sArray.keySet()) {
            String value = sArray.get(key);
            if (value == null || value.equals("") || key.equalsIgnoreCase("sign")
                    || key.equalsIgnoreCase("sign_type")) {
                continue;
            }
            result.put(key, value);
        }

        return result;
    }

}

php請求示例

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

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

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

$json = '{
    "cashes": [0.88,6.66,8.88,18.11,66.60,88.80],
    "cashMin": 0.02,
    "enabled": "Y"
}';

$params["sign"] = $sign;
$url="http://api.hemihome.com/live/v3/channel/donate/update-cash?".http_build_query($params);

function post($url, $post_data = '', $timeout = 5){
   $ch = curl_init();
   curl_setopt ($ch, CURLOPT_URL, $url);
   curl_setopt ($ch, CURLOPT_POST, 1);
   if($post_data != ''){
      curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
   }

   curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
   curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
   curl_setopt($ch, CURLOPT_HEADER, false);
   curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-Length: ' . strlen($post_data)));
   $file_contents = curl_exec($ch);
   curl_close($ch);
   return $file_contents;
}

echo post($url,$json);
?>

簽名規則(config.php文件代碼查看)

http://dev.hemihome.com/2018/liveproduct/l-api/rule/sign/

以上內容是否對您有幫助__-038彩票app下载苹果?根本沒有幫助文檔較差文檔一般文檔不錯文檔很好
Loading...