static function Modify($user)
 {
     $errorCode = MispErrorCode::SUCCESS;
     FuegoLog::getLog()->LogInfo("modify user...");
     $systemUserDao = MispDaoContext::SystemUser();
     try {
         $result = MispCommonService::Modify($systemUserDao, $user);
     } catch (FuegoException $e) {
         $errorCode = $e->getCode();
     }
     return $errorCode;
 }
 public function Modify()
 {
     $this->LogInfo("Modify customer ...");
     $customer = $this->objectToArray($this->GetCommonData());
     if ("" == $customer['role_id']) {
         $this->errorCode = MispErrorCode::ERROR_ROLE_IS_EMPTY;
         $this->ReturnJson();
         return;
     }
     //修改用户角色
     $user['user_id'] = $customer['user_id'];
     $user['role_id'] = $customer['role_id'];
     $this->errorCode = MispCommonUserService::Modify($user);
     if (MispErrorCode::SUCCESS != $this->errorCode) {
         $this->ReturnJson();
         return;
     }
     //修改会员信息
     unset($customer['role_id']);
     //删除$customer中的role_id字段
     try {
         $result = MispCommonService::Modify($this->GetModel(), $customer);
     } catch (FuegoException $e) {
         $this->errorCode = $e->getCode();
     }
     $this->ReturnJson();
 }
예제 #3
0
 public function ModifyPassword($condition, $req)
 {
     FuegoLog::getLog()->LogInfo("Modify password...");
     $errorCode = MispErrorCode::SUCCESS;
     $userDao = MispDaoContext::SystemUser();
     $orginalUser = $userDao->where($condition)->find();
     $orginalPwd = $orginalUser['password'];
     if ($orginalPwd != $req->pwdOld) {
         FuegoLog::getLog()->LogWarn("Modify password failed,pwdOld is wrong.");
         $errorCode = MispErrorCode::ERROR_OLD_PASSWORD_WORD;
         return $errorCode;
     }
     $orginalUser['password'] = $req->pwdNew;
     try {
         $result = MispCommonService::Modify($userDao, $orginalUser);
         FuegoLog::getLog()->LogInfo("Modify password success.");
     } catch (FuegoException $e) {
         $errorCode = $e->getCode();
     }
     return $errorCode;
 }
 public function Modify()
 {
     $this->LogInfo("Modify product...");
     //导入图片上传类
     import("ORG.Net.UploadFile");
     //实例化上传类
     $upload = new UploadFile();
     $upload->maxSize = 20976;
     //设置文件上传类型
     $upload->allowExts = array('jpg', 'gif', 'png', 'jpeg');
     //设置文件上传位置
     $upload->savePath = "./Public/Fuego/Uploads/";
     //根目录下的Public文件夹
     //设置文件上传名(按照时间)
     //$upload->saveRule = "time";
     if (!$upload->upload()) {
         if (MispErrorCode::UPLOAD_IMG_FAILED == $upload->getErrorMsg()) {
             //图片未更新
             $this->LogInfo("No image update.");
         } else {
             //上传图片错误
             $this->LogWarn("Image update failed." . $upload->getErrorMsg());
             $this->LogWarn("Modify product failed.");
             $this->errorCode = MispErrorCode::UPLOAD_IMG_FAILED;
             $data['PrivateErrorMsg'] = $upload->getErrorMsg();
             $this->ReturnJson($data);
             return;
         }
     } else {
         $this->LogInfo("Image update success.");
         //上传成功,获取上传信息
         $info = $upload->getUploadFileInfo();
     }
     $productDao = $this->GetModel();
     $data['product_id'] = $_POST['product_id'];
     $data['product_name'] = $_POST['product_name'];
     $data['price_type'] = $_POST['price_type'];
     $data['price'] = $_POST['price'];
     $data['describe'] = $_POST['describe'];
     $data['type_id'] = $_POST['type_id'];
     if ($info[0]['savename'] != "") {
         $data['img'] = $info[0]['savename'];
     }
     $this->LogInfo("Modify product info " . json_encode($data));
     try {
         $result = MispCommonService::Modify($productDao, $data);
         $this->LogInfo("Modify product success.");
     } catch (FuegoException $e) {
         $this->errorCode = $e->getCode();
     }
     return $this->ReturnJson();
 }
예제 #5
0
 public function ModifyModel($model)
 {
     $this->LogInfo("modify");
     $obj = $this->GetObj();
     $result = $this->Validator($obj);
     if (SUCCESS != $result) {
         $this->errorCode = $result;
         $this->LogErr("validator failed when create " . $model->tableName);
         $this->LogErr("the error is " . $result);
         $this->ReturnJson();
         return;
     }
     $object = $this->objectToArray($obj);
     try {
         $result = MispCommonService::Modify($model, $object);
     } catch (FuegoException $e) {
         $this->errorCode = $e->getCode();
     }
     $this->ReturnJson();
 }
예제 #6
0
 public function ResetPassword()
 {
     $Req = $this->GetReqObj();
     $systemUserDao = MispDaoContext::SystemUser();
     $condition['user_name'] = $Req->user_name;
     $condition['company_id'] = $Req->app_id;
     $this->LogInfo("Customer reset password , customer info is " . json_encode($condition));
     $userID = $systemUserDao->where($condition)->getField('user_id');
     if ($userID == '') {
         $this->LogWarn("Finding password failed, user_name is not exist." . $Req->user_name);
         $this->errorCode = MispErrorCode::ERROR_USER_NOT_EXISTED;
         $this->ReturnJson();
         return;
     }
     $user['user_id'] = $userID;
     $user['password'] = $Req->password;
     try {
         $result = MispCommonService::Modify($systemUserDao, $user);
     } catch (FuegoException $e) {
         $this->errorCode = $e->getCode();
     }
     $this->ReturnJson();
 }