Authored by wuxiao

Merge branch 'develop' into wuxiao

... ... @@ -543,36 +543,45 @@
| url | http://api.live.yoho.cn/v1/room/getpushflow |
| method | get |
###### 参数说明
参数名称| 类型| 长度| 必须| 说明
:-- | :-- | :-- | :-- | :--:
| room_id | int|不限|是|房间id|
###### 调用示例
http://api.live.yoho.cn/v1/room/getpushflow
GET room_id=812043076
GET
### **结果返回**
###### 正确返回
{
code: 200,
message: "",
data: {
url: "rtmp://2718.livepush2.myqcloud.com/live/2718_3baa8de762c411e6a2cba4dcbef5e35a?bizid=2718",
name: "这是一个开发测试",
channel_id: "16093425727657160449",
cid: "",
app: "1",
id: "812043076",
type: "0"
},
timestamp: 1471339317,
md5: "0bb29a3bc28d018c2426ff8239f9334d"
{
"code": 200,
"message": "",
"data": [
{
"url": "rtmp://2718.livepush2.myqcloud.com/live/2718_3baa8de762c411e6a2cba4dcbef5e35a?bizid=2718",
"name": "这是一个开发测试",
"channel_id": "16093425727657160449",
"secret": "123",
"cid": "",
"app": "1",
"id": "1006",
"type": "1"
},
{
"url": "rtmp://2718.livepush2.myqcloud.com/live/2718_d32dc051636c11e6a2cba4dcbef5e35a?bizid=2718",
"name": "这是三个开发测试",
"channel_id": "16093425727657232769",
"secret": "321",
"cid": "",
"app": "1",
"id": "1008",
"type": "1"
}
],
"timestamp": 1471585711,
"md5": "1857a5c615a3eed5f94fb17b0ca0da45"
}
###### 返回说明
... ... @@ -581,10 +590,11 @@
| url | str|推流地址
| name | str|直播频道名称
| channel_id | str|直播频道id
| secret|str|房间校验码
| cid | str|保留
| app | str|保留
| id | int|房间id
| type | int|直播状态:1|直播中,0|未直播
| type | int|直播状态:1.直播中,0.未直播
## **直播开始结束**
... ...
... ... @@ -122,7 +122,7 @@ class Video extends \yii\db\ActiveRecord
->one();
//$qchannel = $this->find()->select('id,channel_id,task_id')->where(['room_id'=>$room_id])->one();
$time = time();
$ret = QcloudApiClient::self('vod')->CreateRecord($qchannel['channel_id'], date('Y-m-d H:i:s'), '');
$ret = QcloudApiClient::self()->CreateRecord($qchannel['channel_id'], date('Y-m-d H:i:s'), '');
if ($ret['code'] == 0) {
$this->setAttributes([
'app' => $room['app'],
... ... @@ -166,10 +166,10 @@ class Video extends \yii\db\ActiveRecord
->one();
$video = $this->find()
->where(['room_id' => $room_id, 'live_end_time' => 0])
->orderBy(['live_start_time' => 'desc'])
->orderBy(['live_start_time' => SORT_DESC])
->one();
if ($video) {
$ret = QcloudApiClient::self('vod')->StopRecord($qchannel['channel_id'], $video['task_id']);
$ret = QcloudApiClient::self()->StopRecord($qchannel['channel_id'], $video['task_id']);
if ($ret['code'] == 0) {
$this->setAttributes([
'live_end_time' => time(),
... ...
... ... @@ -142,7 +142,7 @@ class RoomController extends BaseController
$requests = $this->requests();
// $room_id = $requests['room_id'];
$result = (new \yii\db\Query())
->select('a.room_id,a.title,a.living,b.channel_id,b.upstream_address')
->select('a.room_id,a.title,a.living,a.secret,b.channel_id,b.upstream_address')
->from('tbl_room a')
->leftJoin('tbl_room_qchannel b', 'a.room_id=b.room_id')
->where(['a.living' => 1])
... ... @@ -153,6 +153,7 @@ class RoomController extends BaseController
'url' => $flow['upstream_address'],
'name' => $flow['title'],
'channel_id' => $flow['channel_id'],
'secret' => $flow['secret'],
'cid' => '',
'app' => '1',
'id' => $flow['room_id'],
... ...