request->get('id'); $this->uid=$id; $where['uid'] = $id; $this->title = '服务订单'; $query = $this->_query($this->table)->where($where); $query->dateBetween('login_at,create_at')->where($where)->order('id desc')->page(); } /** * 数据列表处理 */ protected function _index_page_filter(&$data) { foreach ($data as &$v) { $v['images'] = explode('|',$v['image']); } } /** * 添加系统用户 * @auth true * @throws \think\Exception * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException * @throws \think\exception\PDOException */ public function add() { $this->applyCsrfToken(); $this->_form($this->table, 'form'); } /** * 编辑系统用户 * @auth true * @throws \think\Exception * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException * @throws \think\exception\PDOException */ public function edit() { $this->applyCsrfToken(); $this->_form($this->table, 'form'); } /** * 表单数据处理 * @param array $data * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException */ public function _form_filter(&$data) { $uid = $this->request->get('uid'); if (isset($uid)) $data['uid'] = $uid; if ($this->request->isPost()) { if (empty($data['create_time'])) $data['create_time'] = date('Y-m-d H:i:s',time()); // // 用户权限处理 // $data['authorize'] = (isset($data['authorize']) && is_array($data['authorize'])) ? join(',', $data['authorize']) : ''; // // 用户账号重复检查 // if (isset($data['id'])) unset($data['username']); // elseif (Db::name($this->table)->where(['username' => $data['username'], 'is_deleted' => '0'])->count() > 0) { // $this->error("账号{$data['username']}已经存在,请使用其它账号!"); // } } else { $data['authorize'] = explode(',', isset($data['authorize']) ? $data['authorize'] : ''); $this->authorizes = Db::name('SystemAuth')->where(['status' => '1'])->order('sort desc,id desc')->select(); } } /** * 禁用系统用户 * @auth true * @throws \think\Exception * @throws \think\exception\PDOException */ public function forbid() { if (in_array('10000', explode(',', $this->request->post('id')))) { $this->error('系统超级账号禁止操作!'); } $this->applyCsrfToken(); $this->_save($this->table, ['status' => '0']); } /** * 启用系统用户 * @auth true * @throws \think\Exception * @throws \think\exception\PDOException */ public function resume() { $this->applyCsrfToken(); $this->_save($this->table, ['status' => '1']); } /** * 删除系统用户 * @auth true * @throws \think\Exception * @throws \think\exception\PDOException */ public function remove() { if (in_array('10000', explode(',', $this->request->post('id')))) { $this->error('系统超级账号禁止删除!'); } $this->applyCsrfToken(); $this->_delete($this->table); } }