...
|
...
|
@@ -69,7 +69,7 @@ class LivingController extends BaseController |
|
|
'master_meta'=>'',
|
|
|
'title'=>$model->title,
|
|
|
'pic'=>CommonImages::getTemplateComplex($model->pic, 2),
|
|
|
'audience_num'=>$model->roomNums ? (int)$model->roomNums->audience_num : 0,
|
|
|
'audience_num'=>$model->roomNums ? (int)$model->roomNums->online_num : 0,//在线人数
|
|
|
];
|
|
|
if ($model->master){
|
|
|
$row = array_merge($row,[
|
...
|
...
|
@@ -91,8 +91,8 @@ class LivingController extends BaseController |
|
|
$_ret = json_decode($ret,true);
|
|
|
$models = RoomNums::find()->indexBy('room_id')->all();
|
|
|
foreach ($_ret as $k=>$row){
|
|
|
if (!empty($models[$row['room_id']]->audience_num)){
|
|
|
$row['audience_num'] = $models[$row['room_id']]->audience_num;
|
|
|
if (!empty($models[$row['room_id']]->online_num)){
|
|
|
$row['audience_num'] = $models[$row['room_id']]->online_num;//在线人数
|
|
|
}
|
|
|
$_ret[$k] = $row;
|
|
|
}
|
...
|
...
|
@@ -158,7 +158,7 @@ class LivingController extends BaseController |
|
|
'url'=>$model->url,
|
|
|
'live_title'=>$model->live_title,
|
|
|
'live_room_id'=>(int)$model->room_id,
|
|
|
'audience_num'=>$model->roomNums ? (int)$model->roomNums->audience_num+$model->roomNums->replay_num : 0,
|
|
|
'audience_num'=>$model->roomNums ? intval($model->roomNums->audience_num+$model->roomNums->replay_num) : 0,
|
|
|
];
|
|
|
$ret[$k] = $row;
|
|
|
}
|
...
|
...
|
@@ -173,8 +173,8 @@ class LivingController extends BaseController |
|
|
$_ret = json_decode($ret,true);
|
|
|
$models = RoomNums::find()->indexBy('room_id')->all();
|
|
|
foreach ($_ret as $k=>$row){
|
|
|
if (!empty($models[$row['live_room_id']]->audience_num)){
|
|
|
$row['audience_num'] = $models[$row['live_room_id']]->audience_num;
|
|
|
if (!empty($models[$row['live_room_id']])){
|
|
|
$row['audience_num'] = intval($models[$row['live_room_id']]->audience_num+$models[$row['live_room_id']]->replay_num);
|
|
|
}
|
|
|
$_ret[$k] = $row;
|
|
|
}
|
...
|
...
|
@@ -191,6 +191,10 @@ class LivingController extends BaseController |
|
|
{
|
|
|
if ($room_id = $this->requests('room_id'))
|
|
|
{//直播视频详情
|
|
|
|
|
|
//观看人数+1
|
|
|
RoomNums::updateAllCounters(['audience_num' => 1],['room_id'=>$room_id]);
|
|
|
|
|
|
$key = __CLASS__.__FUNCTION__.'room_id'.$room_id;
|
|
|
if (!$ret = $this->cache->get($key)){
|
|
|
if (!$model = Room::findOne(['room_id'=>$room_id,'app'=>$this->app])){
|
...
|
...
|
@@ -206,7 +210,7 @@ class LivingController extends BaseController |
|
|
'watermark'=>$model->watermark,
|
|
|
'living'=>$model->living,
|
|
|
'like_num'=>0,
|
|
|
'audience_num'=>0,
|
|
|
'audience_num'=>0,//在线人数
|
|
|
'live_start_time'=>0,
|
|
|
'rtmp_downstream_address'=>'',
|
|
|
'flv_downstream_address'=>'',
|
...
|
...
|
@@ -221,7 +225,7 @@ class LivingController extends BaseController |
|
|
if ($model->roomNums){
|
|
|
$ret = array_merge($ret,[
|
|
|
'like_num'=>(int)$model->roomNums->like_num,
|
|
|
'audience_num'=>(int)$model->roomNums->audience_num,
|
|
|
'audience_num'=>(int)$model->roomNums->online_num,
|
|
|
]);
|
|
|
}
|
|
|
|
...
|
...
|
@@ -264,7 +268,7 @@ class LivingController extends BaseController |
|
|
$_ret = json_decode($ret,true);
|
|
|
$ret = array_merge($_ret,[
|
|
|
'like_num'=>(int)$model->like_num,
|
|
|
'audience_num'=>(int)$model->audience_num,
|
|
|
'audience_num'=>(int)$model->online_num,
|
|
|
]);
|
|
|
}, 60);
|
|
|
}
|
...
|
...
|
|