|
@@ -67,6 +67,8 @@ class Admin extends Backend
|
|
|
*/
|
|
*/
|
|
|
public function index()
|
|
public function index()
|
|
|
{
|
|
{
|
|
|
|
|
+ //设置过滤方法
|
|
|
|
|
+ $this->request->filter(['strip_tags', 'trim']);
|
|
|
if ($this->request->isAjax()) {
|
|
if ($this->request->isAjax()) {
|
|
|
//如果发送的来源是Selectpage,则转发到Selectpage
|
|
//如果发送的来源是Selectpage,则转发到Selectpage
|
|
|
if ($this->request->request('keyField')) {
|
|
if ($this->request->request('keyField')) {
|
|
@@ -90,26 +92,21 @@ class Admin extends Backend
|
|
|
$adminGroupName[$this->auth->id][$n['id']] = $n['name'];
|
|
$adminGroupName[$this->auth->id][$n['id']] = $n['name'];
|
|
|
}
|
|
}
|
|
|
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
|
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
|
|
- $total = $this->model
|
|
|
|
|
- ->where($where)
|
|
|
|
|
- ->where('id', 'in', $this->childrenAdminIds)
|
|
|
|
|
- ->order($sort, $order)
|
|
|
|
|
- ->count();
|
|
|
|
|
|
|
|
|
|
$list = $this->model
|
|
$list = $this->model
|
|
|
->where($where)
|
|
->where($where)
|
|
|
->where('id', 'in', $this->childrenAdminIds)
|
|
->where('id', 'in', $this->childrenAdminIds)
|
|
|
->field(['password', 'salt', 'token'], true)
|
|
->field(['password', 'salt', 'token'], true)
|
|
|
->order($sort, $order)
|
|
->order($sort, $order)
|
|
|
- ->limit($offset, $limit)
|
|
|
|
|
- ->select();
|
|
|
|
|
|
|
+ ->paginate($limit);
|
|
|
|
|
+
|
|
|
foreach ($list as $k => &$v) {
|
|
foreach ($list as $k => &$v) {
|
|
|
$groups = isset($adminGroupName[$v['id']]) ? $adminGroupName[$v['id']] : [];
|
|
$groups = isset($adminGroupName[$v['id']]) ? $adminGroupName[$v['id']] : [];
|
|
|
$v['groups'] = implode(',', array_keys($groups));
|
|
$v['groups'] = implode(',', array_keys($groups));
|
|
|
$v['groups_text'] = implode(',', array_values($groups));
|
|
$v['groups_text'] = implode(',', array_values($groups));
|
|
|
}
|
|
}
|
|
|
unset($v);
|
|
unset($v);
|
|
|
- $result = array("total" => $total, "rows" => $list);
|
|
|
|
|
|
|
+ $result = array("total" => $list->total(), "rows" => $list->items());
|
|
|
|
|
|
|
|
return json($result);
|
|
return json($result);
|
|
|
}
|
|
}
|