Authored by xiaofeng.yao@yoho.cn

修复禁言用户列表翻页报错问题

... ... @@ -5,6 +5,8 @@ use Yii;
use backend\components\Pagination;
use app\models\Forbidden;
use app\models\Room;
use yii\helpers\ArrayHelper;
/**
* Live controller
*/
... ... @@ -19,6 +21,7 @@ class ForbiddenController extends BaseController
{
$model = Forbidden::find();
$filter = Yii::$app->request->get();
$filter = ArrayHelper::filter($filter,['room_id','name','uid']);
$room_id = $filter['room_id'];
if($room_id){
//获取房间数据
... ... @@ -27,7 +30,6 @@ class ForbiddenController extends BaseController
die('房间不存在');
}
if ($filter) {
// var_dump($filter);
foreach ($filter as $field => $value) {
if ($field == 'name') {
if (!empty($value)) {
... ... @@ -40,12 +42,8 @@ class ForbiddenController extends BaseController
}
}
}
//获取房间数据
$room = Room::findOne(['room_id'=>$room_id]);
$count = clone $model;
$pagination = new Pagination(['totalCount' => $count->count()]);
$list = $model->offset($pagination->offset)->limit($pagination->limit)->orderBy(['create_time' => SORT_DESC])->all();
return $this->render('index', [
'filter' => $filter ?: [],
... ...