Authored by xiaofeng.yao@yoho.cn

修改详情接口

... ... @@ -194,7 +194,7 @@ class LivingController extends BaseController
{//直播视频详情
//观看人数+1
RoomNums::updateAllCounters(['audience_num' => 1],['room_id'=>$room_id]);
//RoomNums::updateAllCounters(['audience_num' => 1],['room_id'=>$room_id]);
$key = __CLASS__.__FUNCTION__.'room_id'.$room_id;
if (!$ret = $this->cache->get($key)){
... ... @@ -223,12 +223,12 @@ class LivingController extends BaseController
$ret['live_last_time'] = $model->videoLast ? $model->videoLast->live_end_time-$model->videoLast->live_start_time : 0;
}
if ($model->roomNums){
/*if ($model->roomNums){
$ret = array_merge($ret,[
'like_num'=>(int)$model->roomNums->like_num,
'audience_num'=>(int)$model->roomNums->online_num,
]);
}
}*/
if ($model->master){
$ret = array_merge($ret,[
... ... @@ -238,11 +238,11 @@ class LivingController extends BaseController
]);
}
if ($model->videoRecording){
/*if ($model->videoRecording){
$ret = array_merge($ret,[
'live_start_time'=>(int)$model->videoRecording->live_start_time,
]);
}
}*/
if ($model->roomQchannel){
if (is_array($downstream_address = json_decode($model->roomQchannel->downstream_address)) && !empty($downstream_address[0])){
... ... @@ -262,7 +262,9 @@ class LivingController extends BaseController
->bindValue(':room_id', $room_id)
->getRawSql()]);
$this->cache->set($key, json_encode($ret), Yii::$app->params['defaultCacheExpire'], $dependency);
}else{
}
/*
else{
Yii::$app->db->cache(function() use ($room_id,&$ret){
if (!$model = RoomNums::findOne(['room_id'=>$room_id])){
return;
... ... @@ -273,7 +275,7 @@ class LivingController extends BaseController
'audience_num'=>(int)$model->online_num,
]);
}, 60);
}
}*/
$this->renderJson(Yii::$app->params['success_code'],'',$ret);
}elseif ($video_id = $this->requests('video_id'))
... ... @@ -334,7 +336,7 @@ class LivingController extends BaseController
if ($model){
$_ret = json_decode($ret,true);
$ret = array_merge($_ret,[
'like_num'=>(int)$model->like_num,
// 'like_num'=>(int)$model->like_num,
'audience_num'=>(int)($model->audience_num + $model->replay_num),
]);
}
... ...