Authored by wuxiao

Merge branch 'develop' into wuxiao

@@ -543,36 +543,45 @@ @@ -543,36 +543,45 @@
543 | url | http://api.live.yoho.cn/v1/room/getpushflow | 543 | url | http://api.live.yoho.cn/v1/room/getpushflow |
544 | method | get | 544 | method | get |
545 545
546 -###### 参数说明  
547 -参数名称| 类型| 长度| 必须| 说明  
548 -:-- | :-- | :-- | :-- | :--:  
549 -| room_id | int|不限|是|房间id|  
550 546
551 ###### 调用示例 547 ###### 调用示例
552 548
553 http://api.live.yoho.cn/v1/room/getpushflow 549 http://api.live.yoho.cn/v1/room/getpushflow
554 550
555 - GET room_id=812043076 551 + GET
556 552
557 553
558 ### **结果返回** 554 ### **结果返回**
559 555
560 ###### 正确返回 556 ###### 正确返回
561 557
562 - {  
563 - code: 200,  
564 - message: "",  
565 - data: {  
566 - url: "rtmp://2718.livepush2.myqcloud.com/live/2718_3baa8de762c411e6a2cba4dcbef5e35a?bizid=2718",  
567 - name: "这是一个开发测试",  
568 - channel_id: "16093425727657160449",  
569 - cid: "",  
570 - app: "1",  
571 - id: "812043076",  
572 - type: "0"  
573 - },  
574 - timestamp: 1471339317,  
575 - md5: "0bb29a3bc28d018c2426ff8239f9334d" 558 + {
  559 + "code": 200,
  560 + "message": "",
  561 + "data": [
  562 + {
  563 + "url": "rtmp://2718.livepush2.myqcloud.com/live/2718_3baa8de762c411e6a2cba4dcbef5e35a?bizid=2718",
  564 + "name": "这是一个开发测试",
  565 + "channel_id": "16093425727657160449",
  566 + "secret": "123",
  567 + "cid": "",
  568 + "app": "1",
  569 + "id": "1006",
  570 + "type": "1"
  571 + },
  572 + {
  573 + "url": "rtmp://2718.livepush2.myqcloud.com/live/2718_d32dc051636c11e6a2cba4dcbef5e35a?bizid=2718",
  574 + "name": "这是三个开发测试",
  575 + "channel_id": "16093425727657232769",
  576 + "secret": "321",
  577 + "cid": "",
  578 + "app": "1",
  579 + "id": "1008",
  580 + "type": "1"
  581 + }
  582 + ],
  583 + "timestamp": 1471585711,
  584 + "md5": "1857a5c615a3eed5f94fb17b0ca0da45"
576 } 585 }
577 586
578 ###### 返回说明 587 ###### 返回说明
@@ -581,10 +590,11 @@ @@ -581,10 +590,11 @@
581 | url | str|推流地址 590 | url | str|推流地址
582 | name | str|直播频道名称 591 | name | str|直播频道名称
583 | channel_id | str|直播频道id 592 | channel_id | str|直播频道id
  593 +| secret|str|房间校验码
584 | cid | str|保留 594 | cid | str|保留
585 | app | str|保留 595 | app | str|保留
586 | id | int|房间id 596 | id | int|房间id
587 -| type | int|直播状态:1|直播中,0|未直播 597 +| type | int|直播状态:1.直播中,0.未直播
588 598
589 599
590 ## **直播开始结束** 600 ## **直播开始结束**
@@ -122,7 +122,7 @@ class Video extends \yii\db\ActiveRecord @@ -122,7 +122,7 @@ class Video extends \yii\db\ActiveRecord
122 ->one(); 122 ->one();
123 //$qchannel = $this->find()->select('id,channel_id,task_id')->where(['room_id'=>$room_id])->one(); 123 //$qchannel = $this->find()->select('id,channel_id,task_id')->where(['room_id'=>$room_id])->one();
124 $time = time(); 124 $time = time();
125 - $ret = QcloudApiClient::self('vod')->CreateRecord($qchannel['channel_id'], date('Y-m-d H:i:s'), ''); 125 + $ret = QcloudApiClient::self()->CreateRecord($qchannel['channel_id'], date('Y-m-d H:i:s'), '');
126 if ($ret['code'] == 0) { 126 if ($ret['code'] == 0) {
127 $this->setAttributes([ 127 $this->setAttributes([
128 'app' => $room['app'], 128 'app' => $room['app'],
@@ -166,10 +166,10 @@ class Video extends \yii\db\ActiveRecord @@ -166,10 +166,10 @@ class Video extends \yii\db\ActiveRecord
166 ->one(); 166 ->one();
167 $video = $this->find() 167 $video = $this->find()
168 ->where(['room_id' => $room_id, 'live_end_time' => 0]) 168 ->where(['room_id' => $room_id, 'live_end_time' => 0])
169 - ->orderBy(['live_start_time' => 'desc']) 169 + ->orderBy(['live_start_time' => SORT_DESC])
170 ->one(); 170 ->one();
171 if ($video) { 171 if ($video) {
172 - $ret = QcloudApiClient::self('vod')->StopRecord($qchannel['channel_id'], $video['task_id']); 172 + $ret = QcloudApiClient::self()->StopRecord($qchannel['channel_id'], $video['task_id']);
173 if ($ret['code'] == 0) { 173 if ($ret['code'] == 0) {
174 $this->setAttributes([ 174 $this->setAttributes([
175 'live_end_time' => time(), 175 'live_end_time' => time(),
@@ -142,7 +142,7 @@ class RoomController extends BaseController @@ -142,7 +142,7 @@ class RoomController extends BaseController
142 $requests = $this->requests(); 142 $requests = $this->requests();
143 // $room_id = $requests['room_id']; 143 // $room_id = $requests['room_id'];
144 $result = (new \yii\db\Query()) 144 $result = (new \yii\db\Query())
145 - ->select('a.room_id,a.title,a.living,b.channel_id,b.upstream_address') 145 + ->select('a.room_id,a.title,a.living,a.secret,b.channel_id,b.upstream_address')
146 ->from('tbl_room a') 146 ->from('tbl_room a')
147 ->leftJoin('tbl_room_qchannel b', 'a.room_id=b.room_id') 147 ->leftJoin('tbl_room_qchannel b', 'a.room_id=b.room_id')
148 ->where(['a.living' => 1]) 148 ->where(['a.living' => 1])
@@ -153,6 +153,7 @@ class RoomController extends BaseController @@ -153,6 +153,7 @@ class RoomController extends BaseController
153 'url' => $flow['upstream_address'], 153 'url' => $flow['upstream_address'],
154 'name' => $flow['title'], 154 'name' => $flow['title'],
155 'channel_id' => $flow['channel_id'], 155 'channel_id' => $flow['channel_id'],
  156 + 'secret' => $flow['secret'],
156 'cid' => '', 157 'cid' => '',
157 'app' => '1', 158 'app' => '1',
158 'id' => $flow['room_id'], 159 'id' => $flow['room_id'],