...
|
...
|
@@ -39,7 +39,7 @@ class LiveController extends BaseController |
|
|
$list = $model
|
|
|
->with(['master','roomNums'])
|
|
|
->offset($pagination->offset)->limit($pagination->limit)
|
|
|
->orderBy(['create_time'=>SORT_DESC,'update_time'=>SORT_DESC])
|
|
|
->orderBy( $this->_roomOrderBy(isset($condition['living']) ? $condition['living']:-1) ) //根据直播状态返回不同排序
|
|
|
->all();
|
|
|
//var_dump($list);
|
|
|
|
...
|
...
|
@@ -489,4 +489,26 @@ class LiveController extends BaseController |
|
|
$replace = "<br/>";
|
|
|
return str_replace($search,$replace,trim($text));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取房间列表排序
|
|
|
* @param int $living_stat 直播状态
|
|
|
* @return array
|
|
|
*/
|
|
|
private function _roomOrderBy($living_stat)
|
|
|
{
|
|
|
$order = [];
|
|
|
switch ($living_stat) {
|
|
|
case Params::LIVE_NOT_START :
|
|
|
$order = ['unstart_sort'=>SORT_DESC,'starting_time'=>SORT_ASC];
|
|
|
break;
|
|
|
case Params::LIVING :
|
|
|
$order = ['living_sort'=>SORT_DESC,'room_id'=>SORT_DESC];
|
|
|
break;
|
|
|
default :
|
|
|
$order = ['create_time'=>SORT_DESC,'update_time'=>SORT_DESC];
|
|
|
break;
|
|
|
}
|
|
|
return $order;
|
|
|
}
|
|
|
} |
...
|
...
|
|