Authored by xiaofeng.yao@yoho.cn

Merge branch 'release'

... ... @@ -4,6 +4,7 @@ namespace backend\controllers;
use Yii;
use common\components\cachekey\Parser;
use common\config\Params;
use common\models\Video;
/**
* Ajax controller
*/
... ... @@ -26,11 +27,21 @@ class AjaxController extends BaseController
{
$room_id = Yii::$app->request->get('room_id');
//更新房间主表直播状态
/*//更新房间主表直播状态
$living_status = Params::LIVE_END;
$result = Yii::$app->db->createCommand()
->update('{{%room}}', ['living' => $living_status,'update_time'=>time()], ['room_id' => $room_id])
->execute();
$this->renderJson(Yii::$app->params['success_code'],'',$room_id);
->execute();*/
try {
$model = new Video();
$result = $model->setVideoStop($room_id);
if($result){
$this->renderJson(Yii::$app->params['success_code'],'结束成功',$room_id);
}else{
$this->renderJson(Yii::$app->params['failed_code'],'结束失败');
}
} catch (\Exception $e){
$this->renderJson(Yii::$app->params['failed_code'],$e->getMessage(),'');
}
}
}
... ...
... ... @@ -388,6 +388,8 @@ class LiveController extends BaseController
case 'enable'://启用直播间
$r = $model->status(1);
break;
case 'start'://开始直播
$r = (new \common\models\Video)->setVideoStart($model->room_id);
default:
break;
}
... ...
... ... @@ -110,6 +110,8 @@ $this->registerJs($this->blocks['javascript'],View::POS_END)
<span>
<?php if ($model->living == 1)://直播中?>
<button type="button" onclick="stopLiving(<?=$model->room_id?>)" class="btn btn-danger btn-metro">结束直播</button>
<?php else:?>
<a onclick="return confirm('将房间设为直播中状态,确定?')" href="/live/roomoperate/<?=$model->id?>?type=start" class="btn btn-success btn-metro">开始直播</a>
<?php endif;?>
</span>
... ...
... ... @@ -167,7 +167,7 @@ class Video extends \yii\db\ActiveRecord
//清在线观看数
Yii::$app->redisIm->del(sprintf($cache_prefix . "audience_nums_room_%s", $room_id));
//清点赞数
//Yii::$app->redisIm->del(sprintf($cache_prefix . "like_numbers_room_%s", $room_id));
Yii::$app->redisIm->del(sprintf($cache_prefix . "like_numbers_room_%s", $room_id));
//清直播状态
Yii::$app->redisIm->del(sprintf($cache_prefix . "play_stat_room_%s", $room_id));
/*------------清除弹幕相关redis--------------*/
... ...