123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- <?php
- namespace app\admin\controller;
- use app\data\model\DataResCenter as Model;
- use app\data\model\DataXwAd;
- use app\data\model\DataXwCategory;
- use think\admin\Controller;
- /**
- * 资源中心
- * Class Xw
- * @package app\admin\controller\Xw
- */
- class ResCenter extends Controller
- {
- /**
- * 资源列表
- * @auth true
- * @menu true
- */
- public function index(){
- $this->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('保存成功');
- }
- }
- }
|