Example #1
0
 /**
  * 保存
  */
 public function save()
 {
     $this->checkPermission($this->rankId . '02');
     //检测权限
     $id = $this->input->get_post('id');
     $data = $this->input->get_post('data');
     $status = $this->bindModel->setAttrs($data)->setPkValue($id)->save($id == 0);
     if ($id == 0) {
         $msg = "添加成功";
         $errorMsg = "添加失败";
     } else {
         $msg = "编辑成功";
         $errorMsg = "编辑失败";
     }
     if ($status) {
         $this->echoAjax(0, $msg, array('url' => '/admin/' . $this->controllerId));
     } else {
         $this->echoAjax(100, $errorMsg);
     }
 }