static function Delete($userID)
 {
     $errorCode = MispErrorCode::SUCCESS;
     FuegoLog::getLog()->LogInfo("delete user...");
     $systemUserDao = MispDaoContext::SystemUser();
     $condition['user_id'] = $userID;
     try {
         $result = MispCommonService::Delete($systemUserDao, $condition);
     } catch (FuegoException $e) {
         $errorCode = $e->getCode();
     }
     return $errorCode;
 }
 public function GetLatestVersion()
 {
     $this->LogInfo("Get latest client version.");
     $req = $this->GetReqObj();
     $condition['client_type'] = $req->clientType;
     $condition['company_id'] = $req->app_id;
     $condition['version_status'] = VersionStatusEnum::LATEST_VERSION;
     $ClientVersionDao = $this->GetModel();
     try {
         $object = MispCommonService::GetUniRecord($ClientVersionDao, $condition);
     } catch (FuegoException $e) {
         $this->errorCode = $e->getCode();
         $this->ReturnJson();
         return;
     }
     $this->LogInfo("Latest client version info " . json_encode($object));
     $data['obj'] = $object;
     $this->ReturnJson($data);
 }
 public function Delete()
 {
     $Req = $this->GetReqObj();
     $this->LogInfo("customer delete, customer_id is " . $Req->obj);
     //删除会员信息
     $customerDao = $this->GetModel();
     $customerCondition[$customerDao->getPk()] = $Req->obj;
     try {
         $result = MispCommonService::Delete($customerDao, $customerCondition);
     } catch (FuegoException $e) {
         $this->errorCode = $e->getCode();
         $this->ReturnJson();
         return;
     }
     //删除用户信息
     $this->errorCode = MispCommonUserService::Delete($Req->obj);
     $this->ReturnJson();
 }
Пример #4
0
 public function CreateAdmin($admin)
 {
     $errorCode = MispErrorCode::SUCCESS;
     FuegoLog::getLog()->LogInfo("Create admin");
     $adminDao = LaundryDaoContext::administrators();
     try {
         $result = MispCommonService::Create($adminDao, $admin);
     } catch (FuegoException $e) {
         $errorCode = $e->getCode();
     }
     return $errorCode;
 }
Пример #5
0
 public function Delete()
 {
     $Req = $this->GetReqObj();
     $this->LogInfo("delete order, order id is " . $Req->obj);
     $condition['order_id'] = $Req->obj;
     $orderDetailDao = LaundryDaoContext::OrderDetail();
     try {
         $result = MispCommonService::Delete($orderDetailDao, $condition);
     } catch (FuegoException $e) {
         $this->errorCode = $e->getCode();
         $this->ReturnJson();
         return;
     }
     parent::Delete();
 }
Пример #6
0
 public function Delete()
 {
     $Req = $this->GetReqObj();
     $this->LogInfo("admin delete, user_id is " . $Req->obj);
     if ($Req->obj == $_SESSION['user']['user_id']) {
         $this->LogWarn("Delete admin failed, can not delete yourself.");
         $this->errorCode = MispErrorCode::CANT_DELETE_YOURSELF;
         $this->ReturnJson();
         return;
     }
     //删除管理员信息
     $adminDao = $this->GetModel();
     $adminCondition[$adminDao->getPk()] = $Req->obj;
     try {
         $result = MispCommonService::Delete($adminDao, $adminCondition);
     } catch (FuegoException $e) {
         $this->errorCode = $e->getCode();
         $this->ReturnJson();
         return;
     }
     //删除用户信息
     $this->errorCode = MispCommonUserService::Delete($Req->obj);
     $this->ReturnJson();
 }
 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();
 }
Пример #8
0
 public function DeleteModel($model)
 {
     $this->LogInfo("delete");
     $condition[$model->getPk()] = $this->GetObj();
     try {
         $result = MispCommonService::Delete($model, $condition);
     } catch (FuegoException $e) {
         $this->errorCode = $e->getCode();
     }
     $this->ReturnJson();
 }
 public function UpdateStatus($status)
 {
     $companyIDList = $this->GetCommonData();
     $this->LogInfo("Update company status, company id list is " . $companyIDList);
     if ("freeze" == $status) {
         $this->LogInfo("Company freeze..");
         $company_status = CompanyEnum::STATUS_FREEZE;
     }
     if ("unfreeze" == $status) {
         $this->LogInfo("Company unfreeze..");
         $company_status = CompanyEnum::STATUS_NORMAL;
     }
     $companyDao = $this->GetModel();
     try {
         $result = MispCommonService::ModifyField($companyDao, $companyIDList, 'company_status', $company_status);
     } catch (FuegoException $e) {
         $this->errorCode = $e->getCode();
     }
     $this->ReturnJson();
 }
Пример #10
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();
 }