优化会员列表显示

优化个人资料列表显示
优化基类模型
pull/238/head
Karson 2020-09-18 17:17:13 +08:00
parent 82fc4f971c
commit e550b327dd
3 changed files with 13 additions and 10 deletions

View File

@ -24,10 +24,10 @@ class Profile extends Backend
//设置过滤方法 //设置过滤方法
$this->request->filter(['strip_tags', 'trim']); $this->request->filter(['strip_tags', 'trim']);
if ($this->request->isAjax()) { if ($this->request->isAjax()) {
$model = model('AdminLog'); $this->model = model('AdminLog');
list($where, $sort, $order, $offset, $limit) = $this->buildparams(); list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$list = $model $list = $this->model
->where($where) ->where($where)
->where('admin_id', $this->auth->id) ->where('admin_id', $this->auth->id)
->order($sort, $order) ->order($sort, $order)

View File

@ -15,9 +15,9 @@
</ul> </ul>
</div> </div>
</div> </div>
<table id="table" class="table table-striped table-bordered table-hover" <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
data-operate-edit="{:$auth->check('user/user/edit')}" data-operate-edit="{:$auth->check('user/user/edit')}"
data-operate-del="{:$auth->check('user/user/del')}" data-operate-del="{:$auth->check('user/user/del')}"
width="100%"> width="100%">
</table> </table>
</div> </div>

View File

@ -388,7 +388,7 @@ class Backend extends Controller
$arr = $arr[0]; $arr = $arr[0];
} }
$tableArr = explode('.', $k); $tableArr = explode('.', $k);
if (count($tableArr) > 1 && $tableArr[0] != $name && !in_array($tableArr[0], $alias)) { if (count($tableArr) > 1 && $tableArr[0] != $name && !in_array($tableArr[0], $alias) && !empty($this->model)) {
//修复关联模型下时间无法搜索的BUG //修复关联模型下时间无法搜索的BUG
$relation = Loader::parseName($tableArr[0], 1, false); $relation = Loader::parseName($tableArr[0], 1, false);
$alias[$this->model->$relation()->getTable()] = $tableArr[0]; $alias[$this->model->$relation()->getTable()] = $tableArr[0];
@ -406,12 +406,15 @@ class Backend extends Controller
} }
$index++; $index++;
} }
if (!empty($this->model)) {
$this->model->alias($alias); $this->model->alias($alias);
}
$model = $this->model; $model = $this->model;
$where = function ($query) use ($where, $alias, $bind, &$model) { $where = function ($query) use ($where, $alias, $bind, &$model) {
$model->alias($alias); if (!empty($model)) {
$model->bind($bind); $model->alias($alias);
$model->bind($bind);
}
foreach ($where as $k => $v) { foreach ($where as $k => $v) {
if (is_array($v)) { if (is_array($v)) {
call_user_func_array([$query, 'where'], $v); call_user_func_array([$query, 'where'], $v);