Ejemplo n.º 1
0
 /**
  *  保存
  */
 public function saveSettingAction()
 {
     if (!$this->getRequest()->isPost()) {
         $this->responseJson(401, '请求方式不正确');
     }
     $password = $_POST['password'];
     if (empty($password)) {
         $this->responseJson(401, '密码不能为空');
     }
     $admin = new AdminModel();
     $ret = $admin->saveSetting($this->adminid, $password);
     if ($ret[0]) {
         $this->responseJson(200, $ret[1]);
     } else {
         $this->responseJson(401, $ret[1]);
     }
     return false;
 }
Ejemplo n.º 2
0
 /**
  * 保存设置
  * http://demo.mpress_api.com/admin/saveSetting
  */
 public function saveSettingAction()
 {
     $data = $this->getRequest()->getRequest();
     if (!isset($data['_id'])) {
         $this->responseJson(401, '_id is empty');
     } else {
         if (empty($data['_id'])) {
             $this->responseJson(401, '_id is empty');
         }
     }
     if (!isset($data['username'])) {
         $this->responseJson(401, 'username is empty');
     } else {
         if (empty($data['username'])) {
             $this->responseJson(401, 'username is empty');
         }
     }
     if (!isset($data['password'])) {
         $this->responseJson(401, 'password is empty');
     } else {
         if (empty($data['password'])) {
             $this->responseJson(401, 'password is empty');
         }
     }
     if (!isset($data['repassword'])) {
         $this->responseJson(401, 'repassword is empty');
     } else {
         if (empty($data['repassword'])) {
             $this->responseJson(401, 'repassword is empty');
         }
     }
     if ($data['password'] != $data['repassword']) {
         $this->responseJson(401, '密码与重复密码必须相等');
     }
     $Admin = new AdminModel();
     $ret = $Admin->saveSetting($data['_id'], $data['username'], $data['password']);
     if ($ret[0]) {
         $this->responseJson(200, '登录成功');
     } else {
         $this->responseJson(402, '登录失败');
     }
     return false;
 }