title = '学校信息管理'; $county_id = session('user.county_id'); $query = $this->_query($this->table)->where('county_id',$county_id)->where('is_deleted',0)->like('name')->equal('school_code,office_phone,type'); $query->order('id desc')->page(); } /** * 数据列表处理 * @param array $data * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException */ protected function _index_page_filter(&$data) { foreach ($data as &$value){ } $this->type_arr = array('1'=>'幼儿园','2'=>'小学','3'=>'初中','4'=>'高中','5'=>'特教','6'=>'工读','7'=>'中职'); $this->county_list = $this->app->db->name('county_list')->column('name','id'); } protected function _form_filter(&$data){ if($this->request->isGet()) { }elseif ($this->request->isPost()){ if (isset($data['id']) && $data['id'] > 0) { $is_set = $this->app->db->name('school2')->where('username',$data['username'])->where('id','<>',$data['id'])->find(); if($is_set){ $this->error('不能设置重复的账号'); } $data['password'] = md5($data['visible_password']); } } } /** * 编辑学校 * @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->title = '编辑'; $this->_form($this->table, 'form'); } /** * 删除学校 * @auth true * @throws \think\Exception * @throws \think\exception\PDOException */ public function remove() { $this->_save($this->table, ['is_deleted' => '1']); } /** * 禁用学校 * @auth true * @throws \think\Exception * @throws \think\exception\PDOException */ public function forbid() { $this->_save($this->table, ['status' => '0']); } /** * 启用学校 * @auth true * @throws \think\Exception * @throws \think\exception\PDOException */ public function resume() { $this->_save($this->table, ['status' => '1']); } }