title='资源列表'; Model::mQuery() ->like('title')->dateBetween('create_time')->layTable(); } /** * 资源添加 * @auth true * @menu true */ public function add(){ $this->xw_vali(); Model::mForm('form'); } /** * 资源编辑 * @auth true * @menu true */ public function edit(){ $this->xw_vali(); Model::mForm('form'); } protected function xw_vali(){ if($this->request->isPost()){ $this->_vali([ 'title.max:50'=>'标题过长', ]); } } /** * 资源删除 * @auth true * @menu true */ public function remove(){ $ids=$this->request->post('id'); Model::whereIn('id',$ids)->select()->each(function ($d){$d->delete();}); $this->success('删除成功'); } /** * 资源设置 * @auth true * @menu true */ public function config(){ if($this->request->isGet()){ $this->title='资源设置'; $this->assign('vo',sysconf('config_res_center.')); $this->fetch(); }else{ $data=$this->_vali([ 'c_rule.require'=>'规则数必须', 'c_conv.require'=>'公约数必须', 'c_menu.require'=>'清单数必须', ]); sysconf('config_res_center',$data); $this->success('保存成功'); } } }