添加菜單

接口URL

http://api.hemihome.com/live/v3/channel/menu/add

接口說明

1-_1288购彩是正规的吗、作用_|_金立gn105刷机包:添加一個頻道菜單
2|||尹斗俊 孙娜恩、接口支持https協議

支持格式

JSON

請求方式

POST

請求數限製

TRUE

請求參數

參數名 必選 類型 說明
appId string 從API設置中獲取|--卓易彩票怎么暂停服务,在直播係統登記的appId
timestamp string 當前時間的秒級時間戳(13位)
sign string 簽名_-_盈彩在线是哪个网址,為32位大寫的MD5值
channelId int 頻道號
name string 菜單名稱
type string 菜單類型
desc 直播介紹
chat 互動聊天
quiz 谘詢提問
text 圖文菜單
iframe推廣外鏈
content string 菜單內容-青山湖区教体信息网。
當菜單類型為直播介紹|-|亿彩彩票是不是违法的、圖文菜單時-_萧瑟流光,該值為菜單的內容---注册送30现金彩票。
當菜單類型為外鏈推廣時||_天津津工超市火车票代售点,該值為外鏈鏈接地址_-|6月新股。

操作成功響應示例

{
  "code": 200,
  "message": "",
  "data": {
    "menuId": "3b650cf438",
    "menuType": "iframe",
    "name": "推廣菜單",
    "ordered": 6,
    "content": "http://hemihome.com"
  }
}

操作失敗響應示例

簽名錯誤

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

缺少參數

{
    "code": 400,
    "status": "error"
    "message": "param should not be empty: name",
    "data": ""
}

參數長度過長

{
    "code": 400,
    "status": "error"
    "message": "param length is incorrect: name",
    "data": ""
}

菜單類型錯誤

{
    "code": 400,
    "status": "error"
    "message": "invalid menu type",
    "data": ""
}

已存在該類型的菜單(除 text||-璎珞潮牌服装批发网、iframe 類型外|--中奖身份证,其他菜單都具有唯一性___意彩会员注册,重複添加相同類型時會返回錯誤)

{
    "code": 400,
    "status": "error"
    "message": "menu already exist",
    "data": ""
}

菜單數已達到上限(“谘詢提問”之外_--诸葛智彩app,最多可以有6個菜單)

{
    "code": 400,
    "status": "error"
    "message": "menu count reached the limit",
    "data": ""
}

響應字段說明

名稱 類型 說明
code string 響應代碼_|新娘之无悔的爱全集,成功為200--赶集瓜子网,失敗為400|众赢彩票娱乐平台,簽名錯誤為401|--188彩票在线网址,異常錯誤500
status string 成功為success-|_临川晚报,失敗為error
message string 錯誤時為錯誤提示消息
menuId string 菜單ID
menuType string 菜單類型
desc 直播介紹
chat 互動聊天
quiz 谘詢提問
text 圖文菜單
iframe推廣外鏈
name string 菜單名稱
ordered string 菜單順序|||188福地彩票官网,值越小|_-掌上彩票pro官网登录,越靠前-深喉是什么意思。新添加的菜單默認位於最後|__高中排列组合。
content string 菜單內容

php請求示例

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

$params = array(
  'appId' => $appId,
  'timestamp' => $timestamp,
  'channelId' => '123456',
  'name' => '菜單名稱',
  'type' => 'text',
  'content' => '菜單內容'
);

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

$params["sign"] = $sign;
$url="http://api.hemihome.com/live/v3/channel/menu/add?".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);
?>

java請求示例

package com.live;

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;

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 com.live.util.EncryptionUtils;

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/menu/add";
        String appId = "appId";
        String key = "secretKey";
        Map<String, String> map = new HashMap<>();
        map.put("appId", appId);
        map.put("timestamp", String.valueOf(System.currentTimeMillis()));
        map.put("channelId", "123456");
        map.put("name", "菜單名稱");
        map.put("type", "text");
        map.put("content", "菜單內容");

        String sign = getSign(map, key);
        map.put("sign", sign);

        String body = "";
        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);

        System.out.println(urlStr);
        // 創建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;
    }
}

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

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

以上內容是否對您有幫助-|_找一个身份证号码?根本沒有幫助文檔較差文檔一般文檔不錯文檔很好
Loading...

打賞-發送打賞消息

接口URL

http://api.hemihome.com/live/v3/channel/chat/send-reward-msg

接口說明

  1. 用於發送打賞消息
  2. 請求成功後__|众乐彩票线路导航,服務器會向聊天室的用戶廣播打賞消息|-无主之地2发型不好的日子,詳見直播聊天室API接口
  3. 接口支持https

支持格式

JSON

請求方式

POST

請求參數

參數名 必選 類型 說明
channelId int 頻道ID
appId string 賬號的應用ID---撒旦缠爱,在後台的“開發設置”獲取
timestamp long 13位毫秒級時間戳
sign string 簽名__-玫琳凯督导,為32位大寫的MD5值
nickname string 打賞者昵稱
avatar string 打賞者頭像
viewerId string 打賞者ID
donateType string 打賞類型_hs小游戏,取值诺氟沙星副作用:cash 現金打賞_-莫露露人体月饼,good 道具打賞
content string 打賞內容-北京建材市场地图:禮物打賞為禮物名稱-__怎么取消gprs,現金打賞為金額
goodImage string 禮物打賞時為禮物圖片__大色老,現金打賞時為空
sessionId string 直播場次ID

響應成功JSON示例_东北鸡:

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

響應失敗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": "param is not digit: 輸入的錯誤頻道號",
  "data": ""
}

道具打賞時未提交道具圖片

{
  "code": 400,
  "status": "error",
  "message": "param should not be empty:goodImage",
  "data": ""
}

發送失敗

{
    "code": 400,
    "status": "error",
    "message": "send message failure",
    "data": ""
}

字段說明

參數名 說明
code 響應代碼||_注册送13元彩金的彩票,成功為200___yy4480捉妖记2,失敗為400_-众发娱乐怎么推广别人,簽名錯誤為403_|_十堰物流云帆t,異常錯誤500
status 成功為success-_闸北八中,失敗為error
message 錯誤時為錯誤提示消息
data 暫無作用

請求示例

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

$params = array(
  'appId' => $appId,
  'timestamp' => $timestamp,
  'channelId' => "108888",
  'nickname' => "wenen",
  'avatar' => "https://livestatic.videocc.net/uploaded/images/webapp/avatar/default-teacher.png",
  'viewerId' => "123",
  'donateType' => "good",
  'content' => "黃鑽",
  'goodImage' => "http://livestatic.videocc.net/uploaded/images/webapp/channel/donate/06-star.png"
);

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


$url="http://api.hemihome.com/live/v3/channel/chat/send-reward-msg";

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/x-www-form-urlencoded'));
   $file_contents = curl_exec($ch);
   curl_close($ch);
   return $file_contents;
}

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

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

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

以上內容是否對您有幫助|||愤世哥?根本沒有幫助文檔較差文檔一般文檔不錯文檔很好
Loading...

抽獎-提交中獎者信息

接口URL

http://api.hemihome.com/live/v3/channel/chat/add-receive-info

接口說明

1||_cts3、用於提交中獎者填寫的信息
2|-锐骐zd30、隻能成功保存一次觀眾中獎信息
3--7788电视剧百度影音、中獎信息需在7天內提交保存_-qq空间视频地址,否則會失效
4|四川工人日报电子版、接口支持https

支持格式

JSON

請求方式

POST

請求參數

參數名 必選 類型 說明
channelId string 頻道ID
appId string 賬號的應用ID_长春房地产报,在後台的“開發設置”獲取
timestamp long 13位毫秒級時間戳
sign string 簽名|-001彩票,為32位大寫的MD5值
lotteryId string 抽獎場次ID
winnerCode string 中獎碼
viewerId string 中獎者ID
name string 中獎者姓名
telephone string 中獎者手機號碼

響應成功JSON示例_-阿訇:

{
    "code": 200,
    "status": "success",
    "message": "保存成功",
    "data": ""
}

響應失敗JSON示例|_-好看的科幻大片:

手機號碼格式錯誤

{
    "code": 400,
    "status": "fail",
    "message": "手機號碼格式錯誤",
    "data": ""
}

重複提交(已經成功提交過中獎信息後則不能再次請求)

{
    "code": 400,
    "status": "fail",
    "message": "請勿重複提交",
    "data": ""
}

中獎碼不存在

{
    "code": 400,
    "status": "fail",
    "message": "中獎碼不存在",
    "data": ""
}

抽獎場次ID錯誤

{
    "code": 400,
    "status": "fail",
    "message": "illegal lottery id: 錯誤的ID",
    "data": ""
}

有參數未提交

{
  "code": 400,
  "status": "error",
  "message": "param should not be empty:未提交的參數名",
  "data": ""
}

字段說明

參數名 說明
code 請求狀態響應碼
status 請求狀態
message 錯誤信息
data 暫無作用

請求示例

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

$params = array(
  'appId' => $appId,
  'timestamp' => $timestamp,
  'channelId' => "108888",
  'lotteryId' => "f76did5ldj",
  'viewerId' => "viewerId1231",
  'winnerCode' => "12121212123",
  'name' => "wenwenwen",
  'telephone' => "15625123456"
);

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


$url="http://api.hemihome.com/live/v3/channel/chat/add-receive-info";

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/x-www-form-urlencoded'));
   $file_contents = curl_exec($ch);
   curl_close($ch);
   return $file_contents;
}

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

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

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

以上內容是否對您有幫助|--陈奎元?根本沒有幫助文檔較差文檔一般文檔不錯文檔很好
Loading...

查詢日期區間內頻道的最大曆史並發人數

接口URL

https://api.hemihome.com/live/v3/channel/statistics/get-max-history-viewer

接口說明

1_-大庆庆聊、接口用於獲取頻道在某個日期區間的最大曆史並發人數
2-_粗口歌极品中的极品、接口支持https

支持格式

JSON

請求方式

GET

請求數限製

TRUE

請求參數

參數名 必選 類型 說明
appId string 從API設置中獲取_-_青银高速公路地图,在直播係統登記的appId
timestamp long 當前13位毫秒級時間戳_曾潇逸,3分鍾內有效
sign string 簽名--无字神曲,為32位大寫的MD5值
channelId int 頻道號
startTime long 開始日期13位毫秒級時間戳
endTime long 結束日期13位毫秒級時間戳

響應成功JSON示例-_|1博彩票官网:

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

響應失敗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": "param is not digit: dsadasd", 
  "data": ""
}

日期範圍錯誤

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

字段說明

參數名 說明
code 響應代碼||艾碧匹,成功為200|相逢是首歌原唱,失敗為400--最后情人 歌词,簽名錯誤為401||至尊时时彩登录网站,異常錯誤500
status 成功為success__-野田佳彦 西游记,失敗為error
message 錯誤時為錯誤提示消息
data 日期區間內最大的曆史並發人數

php請求示例

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

$params = array(
  'appId' => $appId,
  'timestamp' => $timestamp,
  'channelId' => 195770,
  'startTime' => 1546272000000,
  'endTime' => 1548950400000
);

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

$url = "http://api.hemihome.com/live/v3/channel/statistics/get-max-history-viewer?".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);
curl_setopt($curl, CURLOPT_POST, 0);
$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/playback/add

接口說明

1__脊柱宝、作用|持阳伞的女人:添加賬號對應的點播視頻作為直播頻道下的回放視頻--易记彩票。
2__盈盈彩口碑怎么样、接口支持https協議

支持格式

JSON

請求方式

POST

請求數限製

TRUE

請求參數

參數名 必選 類型 說明
appId string 從API設置中獲取flypaper刘玉玲,在直播係統登記的appId
timestamp string 當前13位毫秒級時間戳_|天目通移动维修论坛,3分鍾內有效
channelId int 頻道號
vid string 要添加為回放的的點播視頻
sign string 簽名--雅高布草,32位大寫MD5值
setAsDefault string 添加到回放列表中的位置-||诺森德草药有哪些,Y (回放列表中置頂)__雳剑电视剧 全集36,N 回放列表中置底-|_苏州文庙,不傳默認為 N
listType string playback-回放列表-_118彩票ios,vod-點播列表; 默認普通直播場景為vod-|圣洁化身索拉卡多少钱,三分屏為playback

響應成功JSON示例_11068彩票:

{
    "code": 200,
    "status": "success",
    "message": "",
    "data": {
        "videoId": "bd75a9c155",
        "videoPoolId": "8205ac89d3981cc8070eef326039527f",
        "userId": "8205ac89d3",
        "channelId": 108888,
        "title": "123",
        "firstImage": "8205ac89d3/f/8205ac89d3981cc8070eef326039527f_0.jpg",
        "duration": "00:00:30",
        "myBr": "3",
        "qid": null,
        "seed": 1,
        "ordertime": 0,
        "createdTime": 1548409750793,
        "lastModified": 1548409750793,
        "rank": 1,
        "asDefault": "N",
        "url": "http://hls.videocc.net/source/8205ac89d3/f/8205ac89d3981cc8070eef326039527f_3.mp4",
        "channelSessionId": null,
        "mergeInfo": null,
        "status": "Y",
        "fileUrl": null,
        "fileId": null,
        "startTime": "",
        "liveType": null
    }
}

字段說明

參數名 說明
status 響應狀態
data 響應結果
message 異常錯誤信息 |
videoId 直播係統生成的id
videoPoolId 點播視頻vid
userId 點播後台用戶id
channelId 回放視頻對應的直播頻道id
title 視頻標題
firstImage 視頻首圖
duration 視頻長度
myBr 默認視頻的播放清晰度___芜湖市地税局网上申报,1為流暢_陈氏太极拳教程,2為高清_麟游吧,3為超清
qid 訪客信息收集id
seed 視頻加密狀態-__兰州方言兔八哥,1表示為加密狀態__|透蜜光学祛斑仪,0為非加密
createdTime 添加為回放視頻的日期
lastModified 視頻最後修改日期
asDefault 是否為默認播放視頻__艾爵护理液,值為Y/N(已棄用)
url 視頻播放地址_||沈阳国美网上商城,注-|掌上永辉下载:如果視頻為加密視頻-_云顶彩票娱乐网站,則此地址無法訪問
channelSessionId 用於PPT請求數據|-中央1台,與PPT直播的回放相關_|重生附送大礼包,普通直播回放值為null
mergeInfo 視頻合並信息
startTime 直播開始時間
liveType 回放視頻的場景類型

php請求示例

<?php

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

//接口需要的參數(非sign)賦值
$appId = "xxxx";
$channelId = "xxx";
$vid = "xxxxxxxx";
$setAsDefault = "Y";

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

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

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

$url = "http://api.hemihome.com/live/v3/channel/playback/add?".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);
curl_setopt($curl, CURLOPT_POST, 0);
$res = curl_exec($curl);
curl_close($curl);

echo $res;
?>

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

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

以上內容是否對您有幫助|耐美金?根本沒有幫助文檔較差文檔一般文檔不錯文檔很好
Loading...

問卷設置

接口URL

https://api.hemihome.com/live/v3/channel/questionnaire/add-edit-questionnaire

接口說明

1-1分钟开大发快三规律、接口用於編輯或添加問卷信息__洛阳电视台二套,為全量增加或修改
2|_众发彩票可靠吗?、接口支持https

支持格式

JSON

請求方式

POST

請求數限製

TRUE

請求參數

參數名 必選 類型 說明
appId string 從API設置中獲取|-衡水电大成绩查询,在直播係統登記的appId
timestamp long 當前13位毫秒級時間戳-|1234成人网站,3分鍾內有效
sign string 簽名|-赢咖娱乐登录,為32位大寫的MD5值
channelId string 頻道號
questionnaireId string 問卷id,修改問卷時需要
questionnaireTitle string 問卷標題
questions array 題目數組
questions[].questionId string 題目id-22彩票是不是合法的,修改問卷時需要傳
questions[].name string 題目
questions[].type string 題目類型,R為單選--105彩票苹果版怎么没了,C為多選||-酷派w706软件下载,Q為問答
questions[].scoreEnabled string 題目是否需要評分--|黎巴嫩邮编,Y為需要-__金铃子种植,N為不需要
questions[].answer string 需要評分的選擇題才有答案__劳动法合同法全文,填入對應選項序號|-耽美小说h肉文,如-_快穿之宛儿的任务H:A或AB
questions[].required string 題目是否為必答|-福州华伦中学网站,Y為必答-||日暮苍山兰舟小 李白,N為非必答
questions[].options array 題目為單選題或多選題為必填_35彩票官方网站,選項數組下標0-9對應答案A-J
questions[].options[] string 選項描述

注|||KINGXCON:這裏的channelId,appId,timestamp,sign必須通過url傳參-|_亿发彩票吧,json數據通過請求體傳參---qq2011版,如:

https://api.hemihome.com/live/v3/channel/questionnaire/add-edit-questionnaire?channelId={{channelId}}&appId={{appId}}&timestamp={{timestamp}}&sign={{sign}}

請求體json拚接

{
  "questionnaireId": "f8v53d83qe",
  "questionnaireTitle": "問卷標題", 
  "questions": [
    {
      "questionId": "feqfr13ftz", 
      "name": "題目名稱", 
      "type": "R", 
      "answer": "A", 
      "scoreEnabled": "Y", 
      "score": 10, 
      "required": "Y", 
      "options": [
        "選項1", 
        "選項2", 
        "選項3"
      ]
    }
  ]
}

響應成功JSON示例-|采花心:

{
  "code": 200, 
  "status": "success", 
  "message": "", 
  "data": {
    "questionnaireId": "f8v3visks0", 
    "questionIds": [
      "3ff650e4d4"
    ]
  }
}

響應失敗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": "param is not digit: dsadasd", 
  "data": ""
}

字段說明

參數名 說明
code 響應代碼___歌手半决赛排名,成功為200_-|敖广恩,失敗為400-赢彩彩票因为有你,簽名錯誤為401|-|辽宁电视台都市频道,異常錯誤500
status 成功為success|--143期双色球开奖啦,失敗為error
message 錯誤時為錯誤提示消息
data 成功響應時為問卷和題目id
data.questionnaireId 問卷id
data.questionIds[] 題目的id數組

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 = "https://api.hemihome.com/live/v3/channel/questionnaire/add-edit-questionnaire";
        int channelId = 206204;
        String appId = "f018j7iirt";
        String key = "96651acd43e04cc8a94a1cfa60cec909";
        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 = "{\"questionnaireTitle\":\"問卷標題\",\"questions\":[{\"questionId\":null,\"name\":\"題目名稱\"," +
                "\"type\":\"R\",\"answer\":\"A\",\"scoreEnabled\":\"Y\",\"score\":10,\"required\":\"Y\"," +
                "\"options\":[\"選項1\",\"選項2\",\"選項3\"]}],\"questionnaireId\":null}";
        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' => 206204
);

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

$url = "https://api.hemihome.com/live/v3/channel/questionnaire/add-edit-questionnaire?".http_build_query($params);
$json = '{
  "questionnaireTitle": "問卷標題", 
  "questions": [
    {
      "questionId": null, 
      "name": "題目名稱", 
      "type": "R", 
      "answer": "A", 
      "scoreEnabled": "Y", 
      "score": 10, 
      "required": "Y", 
      "options": [
        "選項1", 
        "選項2", 
        "選項3"
      ]
    }
  ], 
  "questionnaireId": null
}';

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/

以上內容是否對您有幫助|||光明农场攻略?根本沒有幫助文檔較差文檔一般文檔不錯文檔很好
Loading...

查詢頻道的回放開關狀態

接口URL

https://api.hemihome.com/live/v3/channel/playback/get-enabled

接口說明

1|_单位性质、接口用於獲取頻道的回放開關
2|_158开奖计划网、接口支持https

支持格式

JSON

請求方式

GET

請求數限製

TRUE

請求參數

參數名 必選 類型 說明
appId string 從API設置中獲取_||亿彩彩票安卓,在直播係統登記的appId
timestamp long 13位當前時間戳
sign string 簽名值
channelId int 頻道號-|-宫易康静电理疗贴,不傳該參數為獲取全局設置

響應成功JSON示例_--无锡排骨是什么地方的菜:

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

響應失敗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": "param is not digit: dsadasd", 
  "data": ""
}

字段說明

參數名 說明
code 響應代碼-_|珠蕾初开全文阅读,成功為200||autocad2004破解版下载,失敗為400-_进口哈雷摩托车报价,簽名錯誤為401-|_南华苑路55号,異常錯誤500
status 成功為success|_汤姆斯杯决赛时间,失敗為error
message 錯誤時為錯誤提示消息
data 成功響應時為回放開關_|湖南省基础教育资源网,Y(開啟)_-河南省2017年度学生参加校外培训、N(關閉)

php請求示例

<?php
//引用config.php
include '/srv/http/config.php';
$channelId = '要查詢的頻道號';
$params = array(
  'appId' => $appId,
  'channelId' => $channelId,
  'timestamp' => $timestamp
);

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

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

$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 500);
curl_setopt($curl, CURLOPT_POST, 1);
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...

問卷結果查詢API

接口URL

https://api.hemihome.com/live/v3/channel/questionnaire/answer-records

接口說明

1|-_陈嘉男、接口用於查詢直播問卷的答題結果及統計
2_|国家医考网登录入口、接口支持https

支持格式

JSON

請求方式

GET

請求數限製

TRUE

請求參數

參數名 必選 類型 說明
appId string 從API設置中獲取__济南一中升学率,在直播係統登記的appId
timestamp long 當前13位毫秒級時間戳-|_爱划算,3分鍾內有效
sign string 簽名|--秦岚女儿,為32位大寫的MD5值
channelId int 頻道號
startDate string 開始時間_|南宁君怡酒店,格式__优乐彩彩票官网:2018-12-10
endDate string 結束時間--赢彩网可靠吗,格式_||爱唯侦察论坛地址:2018-12-10

響應成功JSON示例__|320彩票:

{
"code": 200,
"status": "success",
"message": "",
"data": [
{
"questionnaireId": "f7g2gtgtsd",
"questionnaireTitle": "ttt",
"questionStats": {
"questions": [
{
"questionId": "f7g2gtgtt9",
"score": 10,
"totalScore": 10,
"total": 2,
"correctCount": 1,
"d": 0,
"e": 0,
"f": 0,
"h": 0,
"i": 0,
"j": 0,
"c": 0,
"a": 1,
"b": 1,
"g": 0
},
{
"questionId": "f7g2gtgtyg",
"score": 10,
"totalScore": 10,
"total": 2,
"correctCount": 1,
"d": 0,
"e": 0,
"f": 0,
"h": 0,
"i": 0,
"j": 0,
"c": 0,
"a": 1,
"b": 1,
"g": 0
}
],
"total": 2
},
"users": [
{
"viewerId": "1544406042082",
"nickname": "廣州觀眾/98347",
"totalScore": 20,
"answers": [
{
"questionId": "f7g2gtgtt9",
"questionName": "a",
"answer": "A",
"score": 10,
"type": "R"
},
{
"questionId": "f7g2gtgtyg",
"questionName": "b",
"answer": "A",
"score": 10,
"type": "R"
}
]
},
{
"viewerId": "oL0En04rCbHNSNdey_rFMAkLT-Ps",
"nickname": "ilyq69",
"totalScore": 0,
"answers": [
{
"questionId": "f7g2gtgtt9",
"questionName": "a",
"answer": "B",
"score": 0,
"type": "R"
},
{
"questionId": "f7g2gtgtyg",
"questionName": "b",
"answer": "B",
"score": 0,
"type": "R"
}
]
}
]
}
]
}

響應失敗JSON示例_|注册送彩的彩票APP大全:

未輸入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": "param is not digit: dsadasd", 
  "data": ""
}

字段說明

參數名 說明
code 響應代碼___01彩票正规吗,成功為200|-雪花飞舞图片,失敗為400||-陈水扁发烧就医,簽名錯誤為401_-苏州红星美凯龙,異常錯誤500(http狀態碼也跟code相同)
status 成功為success|-沙河市登山协会,失敗為error
message 錯誤時為錯誤提示消息
data 成功時||ems怎么取货,返回用戶答題結果及各個題目的統計信息-|-历任北京市委书记,是個數組
questionnaireId 問卷ID--河马家老总,string
questionnaireTitle 問卷名稱||laichien,string
questionStats 問卷下各個問題的答題統計
questionStats.total 題目的答題人數|168彩票官方,int
questionStats.questions 題目的答題統計信息-__闸北八中,數組[]
questionStats.questions[].questionId 題目ID,string
questionStats.questions[].questionName 題目名稱,string
questionStats.questions[].score 題目分數,int
questionStats.questions[].totalScore 題目的總得分,int
questionStats.questions[].correctCount 題目的答對人數,int
questionStats.questions[].a-g 選擇項a到g分別的答題人數,int
users 觀看端提交答題的信息
users[].viewerId 提交問卷的用戶ID|_|刘教授甩葱歌,string
users[].nickname 提交問卷的用戶昵稱_-兔瓣,string
users[].totalScore 提交問卷的用戶的總得分_-nonono歌词,int
users[].answers[] 用戶每道題目的答題情況||222彩票安卓,數組 []
users[].answers[].questionId 題目ID_|-中兴彩票官网,string
users[].answers[].questionName 題目名稱___易商通,string
users[].answers[].answer 提交的題目答案---1995返水05彩票网,string
users[].answers[].score 用戶答題的得分-|_七彩尾房超市,string
users[].answers[].type 題目的類型|_如来陈涛,string||_亿发彩票安全么,R 單選題 ,C 多項題 ,Q 問答題

php請求示例

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

$params = array(
  'appId' => $appId,
  'timestamp' => $timestamp,
  'channelId' => 195770,
  'startDate' => '2018-12-08',
  'endDate' => '2018-12-10'  
);

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

$url = "http://api.hemihome.com/live/v3/channel/questionnaire/answer-record?".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);
curl_setopt($curl, CURLOPT_POST, 1);
$res = curl_exec($curl);
curl_close($curl);

echo $res;
?>

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

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

以上內容是否對您有幫助-|深度ghost xp?根本沒有幫助文檔較差文檔一般文檔不錯文檔很好
Loading...

修改菜單排序

接口URL

http://api.hemihome.com/live/v3/channel/menu/update-rank

接口說明

1__众发彩票怎么提现、作用_--对子莲:修改直播頻道的菜單的順序
2-地下城宝珠大全、接口支持https協議

支持格式

JSON

請求方式

POST

請求數限製

TRUE

請求參數

參數名 必選 類型 說明
appId string 從API設置中獲取-|铺铺儿,在直播係統登記的appId
timestamp string 當前時間的秒級時間戳(13位)
sign string 簽名-_-重装机兵2重制版金手指,為32位大寫的MD5值
channelId int 頻道號
menuIds string 頻道菜單ID列表_|_可口可乐瓶盖兑奖,必須是完整的列表(不能多也不能少)|-云顶娱乐客服电话多少,表示按該順序排列菜單

操作成功響應示例

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

操作失敗響應示例

簽名錯誤

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

缺少參數 menuIds

{
    "code": 400,
    "status": "error"
    "message": "param should not be empty: menuIds",
    "data": ""
}

菜單ID列表錯誤(缺少菜單ID|云顶娱乐平台怎么样,或者有多餘的||_功夫小帅、錯誤的菜單ID)

{
    "code": 400,
    "status": "error"
    "message": "illegal menu id: menuIds",
    "data": ""
}

響應字段說明

名稱 類型 說明
code string 響應代碼_|钳子先生的魔法龙虾盒,成功為200|_-至尊彩快3软件下载,失敗為400||银彩平台,簽名錯誤為401-|_易富彩票平台,異常錯誤500
status string 成功為success_91160,失敗為error
message string 錯誤時為錯誤提示消息

php請求示例

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

$params = array(
  'appId' => $appId,
  'timestamp' => $timestamp,
  'channelId' => '123456',
  'menuIds' => '123,456'
);

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

$params["sign"] = $sign;
$url="http://api.hemihome.com/live/v3/channel/menu/update-rank?".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);
?>

java請求示例

package com.live;

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;

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 com.live.util.EncryptionUtils;

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/menu/update-rank";
        String appId = "appId";
        String key = "secretKey";
        Map<String, String> map = new HashMap<>();
        map.put("appId", appId);
        map.put("timestamp", String.valueOf(System.currentTimeMillis()));
        map.put("channelId", "123456");
        map.put("menuIds", "123,456");

        String sign = getSign(map, key);
        map.put("sign", sign);

        String body = "";
        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);

        System.out.println(urlStr);
        // 創建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);
        // 處理參數_|229彩票,計算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;
    }
}

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

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

以上內容是否對您有幫助|__班主任工作论文?根本沒有幫助文檔較差文檔一般文檔不錯文檔很好
Loading...

刪除指定菜單

接口URL

http://api.hemihome.com/live/v3/channel/menu/delete

接口說明

1_||甜妞追逃夫、接口用於刪除指定的頻道菜單||_csol防沉迷,支持批量
2__至尊时时彩票平台4567、接口支持https

支持格式

JSON

請求方式

POST

請求數限製

TRUE

請求參數

參數名 必選 類型 說明
appId string 從API設置中獲取|_杨幂被灌醉扒衣视频,在直播係統登記的appId
timestamp long 13位當前時間戳
sign string 簽名值
menuIds string 菜單id--2011qq官方下载,指定多個以英文逗號,分隔

響應成功JSON示例||_镇赉吧:

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

響應失敗JSON示例|-autocad2004中文版:

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

menuId分割後為空

{
  "code": 400, 
  "status": "error", 
  "message": "param length is incorrect: menuIds", 
  "data": ""
}

菜單不存在

{
  "code": 400, 
  "status": "error", 
  "message": "illegal menu id: test", 
  "data": ""
}

菜單類型不能刪除

{
  "code": 400, 
  "status": "error", 
  "message": "can't delete special menu type", 
  "data": ""
}

字段說明

參數名 說明
code 響應代碼__|脉搏士,成功為200__苏铁惜,失敗為400---雷区里的工具,簽名錯誤為401_酒包装设计,異常錯誤500
status 成功為success_-_重庆公交图吧,失敗為error
message 錯誤時為錯誤提示消息
data 成功響應時為本次成功刪除的個數

php請求示例

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

$params = array(
  'appId' => $appId,
  'timestamp' => $timestamp,
  'menuIds' => "9991391d9d,ea4375fcfb"
);

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

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

$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 500);
curl_setopt($curl, CURLOPT_POST, 1);
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...