1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <?php
- namespace app\user\controller;
- use app\base\controller\Base;
- class Rule extends Base{
-
- private $ruleModel;
-
- public function _initialize(){
- parent::_initialize();
-
- $this->ruleModel = new \app\user\model\Rule();
- }
-
- public function index(){
- $info = $this->ruleModel->getInfo();
-
- $this->assign("info", $info);
- return $this->fetch();
- }
-
- public function edit(){
- $id = $this->request->post('id');
- $info = $this->ruleModel->getRuleById($id);
- return json($info);
- }
-
- public function save(){
- $res = $this->ruleModel->addAndSave();
-
- if($res){
- $this->success('保存成功!', 'index');
- }else{
- $this->error('保存失败!');
- }
- }
-
- public function delete(){
- $res = $this->ruleModel->remove();
-
- if($res){
- $this->success('删除成功!', 'index');
- }else{
- $this->error('删除失败!');
- }
- }
-
-
- }
|