|
@@ -89,7 +89,7 @@ class LivingController extends BaseController |
|
@@ -89,7 +89,7 @@ class LivingController extends BaseController |
89
|
}else{
|
89
|
}else{
|
90
|
Yii::$app->db->cache(function() use (&$ret){
|
90
|
Yii::$app->db->cache(function() use (&$ret){
|
91
|
$_ret = json_decode($ret,true);
|
91
|
$_ret = json_decode($ret,true);
|
92
|
- $models = RoomNums::find()->where(['app'=>$this->app])->indexBy('room_id')->all();
|
92
|
+ $models = RoomNums::find()->indexBy('room_id')->all();
|
93
|
foreach ($_ret as $k=>$row){
|
93
|
foreach ($_ret as $k=>$row){
|
94
|
if (!empty($models[$row['room_id']]->online_num)){
|
94
|
if (!empty($models[$row['room_id']]->online_num)){
|
95
|
$row['audience_num'] = (int)$models[$row['room_id']]->online_num;//在线人数
|
95
|
$row['audience_num'] = (int)$models[$row['room_id']]->online_num;//在线人数
|
|
@@ -216,11 +216,16 @@ class LivingController extends BaseController |
|
@@ -216,11 +216,16 @@ class LivingController extends BaseController |
216
|
'rtmp_downstream_address'=>'',
|
216
|
'rtmp_downstream_address'=>'',
|
217
|
'flv_downstream_address'=>'',
|
217
|
'flv_downstream_address'=>'',
|
218
|
'hls_downstream_address'=>'',
|
218
|
'hls_downstream_address'=>'',
|
|
|
219
|
+ 'live_last_time'=>0,
|
219
|
];
|
220
|
];
|
220
|
|
221
|
|
221
|
//直播时长(秒)
|
222
|
//直播时长(秒)
|
222
|
if ($model->living == 2){
|
223
|
if ($model->living == 2){
|
223
|
- $ret['live_last_time'] = $model->videoLast ? $model->videoLast->live_end_time-$model->videoLast->live_start_time : 0;
|
224
|
+ if ($model->videoLast){
|
|
|
225
|
+ $ret['live_last_time'] = max($model->videoLast->live_end_time-$model->videoLast->live_start_time,0);
|
|
|
226
|
+ $ret['like_num'] = $model->videoLast->like_num;
|
|
|
227
|
+ $ret['audience_num'] = $model->videoLast->audience_num;
|
|
|
228
|
+ }
|
224
|
}
|
229
|
}
|
225
|
|
230
|
|
226
|
/*if ($model->roomNums){
|
231
|
/*if ($model->roomNums){
|