title = '项目分类管理'; $query = $this->_query($this->table)->like('name'); $query->order('sort asc,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) { $this->mlist = Db::name('LcUserMember')->select(); foreach ($data as &$vo) { list($vo['member']) = [[]]; foreach ($this->mlist as $member) if ($member['id'] == $vo['member_id']) $vo['member'] = $member; } } /** * 添加项目分类 * @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->title = '添加项目分类'; $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->title = '编辑项目分类'; $this->_form($this->table, 'form'); } /** * 删除项目分类 * @auth true * @throws \think\Exception * @throws \think\exception\PDOException */ public function remove() { $this->_delete($this->table); } /** * 表单数据处理 * @param array $vo * @throws \ReflectionException */ protected function _form_filter(&$vo){ if ($this->request->isGet()) { if (empty($vo['member_id']) && $this->request->get('member_id', '0')) $vo['member_id'] = $this->request->get('member_id', '0'); $this->member = Db::name("LcUserMember")->order('id desc')->select(); } if (empty($vo['add_time'])) $vo['add_time'] = date("Y-m-d H:i:s"); } }