|
@@ -59,8 +59,8 @@ class Admin extends Apic
|
|
|
$groupdata = $result;
|
|
|
}
|
|
|
|
|
|
- $this->view->assign('groupdata', $groupdata);
|
|
|
- $this->assignconfig("admin", ['id' => $this->auth->id]);
|
|
|
+ /*$this->view->assign('groupdata', $groupdata);
|
|
|
+ $this->assignconfig("admin", ['id' => $this->auth->id]);*/
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -68,13 +68,7 @@ class Admin extends Apic
|
|
|
*/
|
|
|
public function index()
|
|
|
{
|
|
|
- //设置过滤方法
|
|
|
- $this->request->filter(['strip_tags', 'trim']);
|
|
|
- if ($this->request->isAjax()) {
|
|
|
- //如果发送的来源是Selectpage,则转发到Selectpage
|
|
|
- if ($this->request->request('keyField')) {
|
|
|
- return $this->selectpage();
|
|
|
- }
|
|
|
+
|
|
|
$childrenGroupIds = $this->childrenGroupIds;
|
|
|
$groupName = AuthGroup::where('id', 'in', $childrenGroupIds)
|
|
|
->column('id,name');
|
|
@@ -92,26 +86,25 @@ class Admin extends Apic
|
|
|
foreach ($groups as $m => $n) {
|
|
|
$adminGroupName[$this->auth->id][$n['id']] = $n['name'];
|
|
|
}
|
|
|
- list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
|
|
|
|
|
- $list = $this->model
|
|
|
- ->where($where)
|
|
|
+ $list = Db::name('pc_admin')
|
|
|
+ ->where('company_id',$this->auth->company_id)
|
|
|
->where('id', 'in', $this->childrenAdminIds)
|
|
|
->field(['password', 'salt', 'token'], true)
|
|
|
- ->order($sort, $order)
|
|
|
- ->paginate($limit);
|
|
|
+ ->order('id', 'asc')
|
|
|
+ ->autopage()
|
|
|
+ ->select();
|
|
|
|
|
|
foreach ($list as $k => &$v) {
|
|
|
+ $v['avatar'] = localpath_to_netpath($v['avatar']);
|
|
|
$groups = isset($adminGroupName[$v['id']]) ? $adminGroupName[$v['id']] : [];
|
|
|
$v['groups'] = implode(',', array_keys($groups));
|
|
|
$v['groups_text'] = implode(',', array_values($groups));
|
|
|
}
|
|
|
unset($v);
|
|
|
- $result = array("total" => $list->total(), "rows" => $list->items());
|
|
|
|
|
|
- return json($result);
|
|
|
- }
|
|
|
- return $this->view->fetch();
|
|
|
+ $this->success(1,$list);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -119,7 +112,7 @@ class Admin extends Apic
|
|
|
*/
|
|
|
public function add()
|
|
|
{
|
|
|
- if ($this->request->isPost()) {
|
|
|
+
|
|
|
$this->token();
|
|
|
$params = $this->request->post("row/a");
|
|
|
if ($params) {
|
|
@@ -156,8 +149,7 @@ class Admin extends Apic
|
|
|
$this->success();
|
|
|
}
|
|
|
$this->error(__('Parameter %s can not be empty', ''));
|
|
|
- }
|
|
|
- return $this->view->fetch();
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|