1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <?php
- /**
- * Created by PhpStorm.
- * User: Administrator
- * Date: 2020-09-12
- * Time: 17:01
- */
-
- namespace app\back\controller;
-
-
- use app\back\model\AgencyRankModel;
- use cmf\controller\AdminBaseController;
- /**
- * Class AgencyRankController
- * @package app\back\controller
- * @adminMenuRoot(
- * 'name' =>'代理管理',
- * 'action' =>'agency',
- * 'parent' =>'',
- * 'display'=> true,
- * 'order' => 10000,
- * 'icon' =>'address-book-o',
- * 'remark' =>'代理管理'
- * )
- */
- class AgencyRankController extends AdminBaseController
- {
-
- /**
- * 添加页
- * @adminMenu(
- * 'name' => '添加页',
- * 'parent' => 'agency',
- * 'display'=> true,
- * 'hasView'=> true,
- * 'order' => 10000,
- * 'icon' => '',
- * 'remark' => '级别添加页',
- * 'param' => ''
- * )
- */
- public function index()
- {
- $list = AgencyRankModel::order('id','asc')->select();
- $this->assign('list',$list);
- return $this->fetch();
- }
-
- /**
- * 添加页
- * @adminMenu(
- * 'name' => '添加页',
- * 'parent' => 'index',
- * 'display'=> false,
- * 'hasView'=> true,
- * 'order' => 10000,
- * 'icon' => '',
- * 'remark' => '级别添加页',
- * 'param' => ''
- * )
- */
- public function add()
- {
- return $this->fetch();
- }
-
- public function addPost()
- {
- $data = $this->request->param();
- $agencyRankModel = new AgencyRankModel();
- $agencyRankModel->allowField(true)->isUpdate(false)->save($data);
- $this->success('添加成功');
- }
- public function edit()
- {
- $id = $this->request->param('id');
- $info = AgencyRankModel::get($id);
- $this->assign('info',$info);
- return $this->fetch();
- }
- public function editPost()
- {
- $data = $this->request->param();
- $agencyRankModel = new AgencyRankModel();
- $agencyRankModel->allowField(true)->isUpdate(true)->save($data);
- $this->success('修改成功');
- }
- }
|