title = '管理'; $sel_type = input('sel_type'); $module = input('module',1); $this->module = input('module',1); $query = $this->_query($this->table) ->alias('f') ->field('f.*,u.name,u.headimg') ->leftJoin('store_member u','u.id = f.user_id') ->order('sort asc,id desc') ->where('is_deleted',0) ->where('module',$module) ->when($sel_type,function ($query)use ($sel_type){ if($sel_type) $query->where('type',$sel_type); })->page(false); } /** * 数据列表处理 * @auth true * @menu true * @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 $k=>&$v){ } } /** * 删除 * @auth true * @menu true * @param array $data * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException */ public function remove() { $this->_delete($this->table); } /** * 添加 * @auth true * @menu true * @param array $data * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException */ public function add(){ $this->title = '添加'; $this->_form($this->table, 'form'); } /** * * 编辑 * @auth true * @menu true * @param array $data * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException */ public function edit() { $this->title = '编辑'; $this->_form($this->table, 'form'); } /** * * 数据处理 * @auth true * @menu true * @param array $data * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException */ protected function _form_filter(&$data) { if($this->request->isGet()) { $this->all_user = User::where('is_deleted',0)->column('name','id'); } if($this->request->isPost() && $this->request->action() == 'edit')unset($data['module']); } }