Commit ea46fb75d281a7e723f35c6de9390efdc921bfac

Authored by 翁力
2 parents 2c94fefa 01cec276

Merge remote-tracking branch 'origin/master'

0. 公共组件/1.1 SHA1签名.md
@@ -14,23 +14,35 @@ SHA1 加密 @@ -14,23 +14,35 @@ SHA1 加密
14 3. 对传入参数中所有键值对的 value 进行 urlencode 转码后重新拼接成字符串 string2。 14 3. 对传入参数中所有键值对的 value 进行 urlencode 转码后重新拼接成字符串 string2。
15 4. 将 sign=signValue拼接到string2后面得到最终的 参数 字符串。 15 4. 将 sign=signValue拼接到string2后面得到最终的 参数 字符串。
16 16
17 -#### 代码示例 17 +#### Java代码示例
18 18
19 -```java 19 +```java
20 20
  21 + //生成get 方式 带签名的请求URL
21 public static void main(String[] args) { 22 public static void main(String[] args) {
22 - String sp_key = "672db30805f848f59ec3728f8347a4a0"; //找相关开发者获取 23 + String sp_key = "xxxxxxxxxxx"; //开发者帐号对应的key. 请开发者谨慎保管此值。
23 Map<String, String> map = new HashMap<String,String>(); 24 Map<String, String> map = new HashMap<String,String>();
24 - map.put("sp_id","iqhpk8pl19"); //找相关开发者获取  
25 - map.put("mobile", "13520335460");  
26 - map.put("content", "你好,test");  
27 25
28 - //生成get 方式 请求  
29 - String getUrl = buildURL("http://localhost:9091/openapi/api/CnliveMobile/sendMsg",map, sp_key);  
30 - System.out.println(getUrl);  
31 - //生成 post 方式签名  
32 - //String sign = sign(map, sp_key); 26 + map.put("sp_id","iqhpk8pl19"); //开发者帐号对应的10位ID ,所有接口参数都必须有此参数。
  27 + map.put("param1_keyname", "Parm1_vaule"); //接口需要的参数1
  28 + map.put("param2_keyname", "Parm2_vaule"); //接口需要的参数2 。。。 等等
  29 +
  30 + String getUrl = buildURL("http://api.cnlive.com/open/api/xxxxxxx",map, sp_key);
  31 + System.out.println(getUrl);
33 } 32 }
  33 +
  34 + //生成post方式的请求参数签名
  35 + public static void main(String[] args) {
  36 + String sp_key = "xxxxxxxxxxx"; //开发者帐号对应的key. 请开发者谨慎保管此值。
  37 + Map<String, String> map = new HashMap<String,String>();
  38 +
  39 + map.put("sp_id","iqhpk8pl19"); //开发者帐号对应的10位ID ,所有接口参数都必须有此参数。
  40 + map.put("param1_keyname", "Parm1_vaule"); //接口需要的参数1
  41 + map.put("param2_keyname", "Parm2_vaule"); //接口需要的参数2 。。。 等等
  42 +
  43 + String post_param_signed = sign(map, sp_key);
  44 + System.out.println(post_param_signed);
  45 + }
34 46
35 /** 47 /**
36 * 生成URL 48 * 生成URL
8.直播云/1.1 获取直播活动信息接口.md
@@ -21,7 +21,7 @@ HTTP GET @@ -21,7 +21,7 @@ HTTP GET
21 21
22 ``` json 22 ``` json
23 { 23 {
24 - "ret":"0", 24 + "errorCode":"0",
25 "mp4_url_rate2":"http://api.cnlive.com/open/api3/play/IPS/liveplay?cid=xinyingshi&sp_id=iqhpk8pl19", 25 "mp4_url_rate2":"http://api.cnlive.com/open/api3/play/IPS/liveplay?cid=xinyingshi&sp_id=iqhpk8pl19",
26 "mp4_url_rate1":"http://api.cnlive.com/open/api3/play/IPS/liveplay?cid=xinyingshi&sp_id=iqhpk8pl19", 26 "mp4_url_rate1":"http://api.cnlive.com/open/api3/play/IPS/liveplay?cid=xinyingshi&sp_id=iqhpk8pl19",
27 "mp4_url_rate4":"", 27 "mp4_url_rate4":"",
@@ -37,6 +37,27 @@ HTTP GET @@ -37,6 +37,27 @@ HTTP GET
37 "bigImg":"大图图片URL" 37 "bigImg":"大图图片URL"
38 } 38 }
39 ``` 39 ```
  40 +#### 多路流
  41 +``` json
  42 +{
  43 + "errorCode":"0",
  44 + "status":"1",
  45 + "msg":"请求成功",
  46 + "title":"测试活动",
  47 + "smallImg":"小图图片URL",
  48 + "bigImg":"大图图片URL",
  49 + "views" :[
  50 + "mp4_url_rate2":"http://api.cnlive.com/open/api3/play/IPS/liveplay?cid=xinyingshi&sp_id=iqhpk8pl19",
  51 + "mp4_url_rate1":"http://api.cnlive.com/open/api3/play/IPS/liveplay?cid=xinyingshi&sp_id=iqhpk8pl19",
  52 + "mp4_url_rate4":"",
  53 + "mp4_url_rate3":"",
  54 + "hls_url_rate2":"http://api.cnlive.com/open/api3/play/IPS/liveplay?cid=xinyingshi&sp_id=iqhpk8pl19",
  55 + "hls_url_rate1":"http://api.cnlive.com/open/api3/play/IPS/liveplay?cid=xinyingshi&sp_id=iqhpk8pl19",
  56 + "hls_url_rate4":"",
  57 + "hls_url_rate3":"",
  58 + ]
  59 +}
  60 +```
40 61
41 JSON属性说明: 四路播放地址至少一个有效 62 JSON属性说明: 四路播放地址至少一个有效
42 63