Authored by xiaofeng.yao@yoho.cn

新增接口(直播结束通知本次直播的相关参数)

... ... @@ -204,4 +204,18 @@ class Video extends \yii\db\ActiveRecord
return false;
}
}
/**
* 获取当前正在直播的视频
* @param $room_id
* @return array|null|\yii\db\ActiveRecord
*/
public function getCurrentLivingVideo($room_id)
{
$video = $this->find()
->where(['room_id' => $room_id, 'live_end_time' => 0])
->orderBy(['live_start_time' => SORT_DESC])
->one();
return $video;
}
}
... ...
... ... @@ -61,6 +61,46 @@ class RoomController extends BaseController
}
/**
* 弹幕服务器上传房间一些数目参数
* @return mixed
*/
public function actionSetvideoargs()
{
$gets = $this->requests();
$room_id = $gets['room'];
if ($room_id) {
$model = new Video();
$video = $model->getCurrentLivingVideo($room_id);
if (isset($gets['likeNums'])) {
$video->like_num = $gets['likeNums'];
}
if (isset($gets['audienceNums'])) {
$video->audience_num = $gets['audienceNums'];
}
if ($video->save()) {
$retArr = [
'code' => Yii::$app->params['success_code'],
'messsage' => '保存成功'
];
} else {
$retArr = [
'code' => Yii::$app->params['failed_code'],
'messsage' => '保存失败'
];
}
} else {
$retArr = [
'code' => Yii::$app->params['failed_code'],
'messsage' => '更新失败,缺少房间号'
];
}
$this->renderJson($retArr['code'], $retArr['messsage']);
}
/**
* 弹幕服务器上报弹幕消息
* @author yaoxiaofeng
*/
... ... @@ -241,16 +281,6 @@ class RoomController extends BaseController
}
/**
* 获取评论表名称
* @param $room_id
* @return string
*/
private function getTableName($room_id)
{
return 'tbl_live_comment' . str_pad((int)($room_id % 10), 2, '0', STR_PAD_LEFT);
}
/**
* 直播中的所有房间
*/
public function actionListing()
... ... @@ -275,11 +305,21 @@ class RoomController extends BaseController
}
public function actionTest(){
$re = \common\lib\QcloudApi\Client::self()->CreateRecord("16093425727657864680", date('Y-m-d H:i:s',time()+120), '');
// $re = \common\lib\QcloudApi\Client::self()->DescribeRecordList("16093425727657864680",1,10);
// $re = \common\lib\QcloudApi\Client::self()->CreateRecord("16093425727657864680", date('Y-m-d H:i:s',time()+120), '');
$re = \common\lib\QcloudApi\Client::self()->DescribeRecordList("16093425727657864680",1,10);
// $re = \common\lib\QcloudApi\Client::self()->StopRecord("16093425727657524184", "131525");
var_dump($re);
//http://200013340.vod.myqcloud.com/200013340_6e79da1e65d140d887cdbb7f3ebadf79.f20.mp4
}
/**
* 获取评论表名称
* @param $room_id
* @return string
*/
private function getTableName($room_id)
{
return 'tbl_live_comment' . str_pad((int)($room_id % 10), 2, '0', STR_PAD_LEFT);
}
}
... ...