예제 #1
0
 public function Add()
 {
     if ($this->_GET['SeverID']) {
         $FuwuqiModel = new FuwuqiModule();
         $Data = $FuwuqiModel->GetOneInfoByKeyID($this->_GET['SeverID']);
         $this->Data = $Data;
     } elseif ($this->_POST['SeverID']) {
         $Data['FuwuqiName'] = trim($this->_POST['FuwuqiName']);
         $Data['IP'] = trim($this->_POST['IP']);
         $Data['CName'] = trim($this->_POST['CName']);
         $Data['FwAdress'] = trim($this->_POST['FwAdress']);
         $Data['FTP'] = trim($this->_POST['FTP']);
         $Data['FTPName'] = trim($this->_POST['FTPName']);
         $Data['FTPPassword'] = trim($this->_POST['FTPPassword']);
         $Data['FTPDuankou'] = trim($this->_POST['FTPDuankou']);
         $Data['FTPMulu'] = trim($this->_POST['FTPMulu']);
         if ($this->_POST['State']) {
             $Data['State'] = 1;
         } else {
             $Data['State'] = 0;
         }
         if ($Data['FuwuqiName'] == '') {
             $this->__Message('服务器名称不能为空!');
         }
         $FuwuqiModel = new FuwuqiModule();
         if ($FuwuqiModel->UpdateArrayByKeyID($Data, $this->_POST['SeverID'])) {
             $this->__Message('修改服务器成功!', UrlRewriteSimple('Fuwuqi', 'Manage', true), '继续操作');
         } else {
             $this->__Message('修改服务器失败,请再一次尝试!');
         }
     } else {
         if ($this->_POST) {
             $Data['FuwuqiName'] = trim($this->_POST['FuwuqiName']);
             $Data['IP'] = trim($this->_POST['IP']);
             $Data['CName'] = trim($this->_POST['CName']);
             $Data['FwAdress'] = trim($this->_POST['FwAdress']);
             $Data['FTP'] = trim($this->_POST['FTP']);
             $Data['FTPName'] = trim($this->_POST['FTPName']);
             $Data['FTPPassword'] = trim($this->_POST['FTPPassword']);
             $Data['FTPDuankou'] = trim($this->_POST['FTPDuankou']);
             $Data['FTPMulu'] = trim($this->_POST['FTPMulu']);
             if ($this->_POST['State']) {
                 $Data['State'] = 1;
             } else {
                 $Data['State'] = 0;
             }
             if ($Data['FuwuqiName'] == '') {
                 $this->__Message('服务器名称不能为空!');
             }
             $FuwuqiModel = new FuwuqiModule();
             if ($FuwuqiModel->InsertArray($Data)) {
                 $this->__Message('添加服务器成功!', UrlRewriteSimple('Fuwuqi', 'Manage', true), '继续操作');
             } else {
                 $this->__Message('添加服务器失败,请再一次尝试!');
             }
         }
     }
 }
예제 #2
0
 function EditCustomerGbaopenInfo()
 {
     $filters = array();
     $filters2 = array();
     $Page = $this->_GET['Page'];
     $CustomersModule = new CustomersModule();
     $CustProModule = new CustProModule();
     $Fuwuqi = new FuwuqiModule();
     $FuwuqiInfo = $Fuwuqi->GetAll();
     $Fuwuqimessage = array();
     $Model = new ModelModule();
     foreach ($FuwuqiInfo as $value) {
         $Fuwuqimessage[$value['FuwuqiName']] = array('ID' => $value['ID'], 'FTP' => $value['FTP'], 'FTPName' => $value['FTPName'], 'FTPPassword' => $value['FTPPassword'], 'FwAdress' => $value['FwAdress'], 'FTPDuankou' => $value['FTPDuankou'], 'FTPMulu' => $value['FTPMulu']);
     }
     if (isset($this->_POST)) {
         $CustomersID = intval($this->_POST['CustomersID']);
         //获取G宝盆项目id
         $ProjectId = intval(GBAOPEN_ID);
         $sql = "Where CustomersID={$CustomersID} and ProjectID={$ProjectId} and AgentID={$_SESSION['AgentID']}";
         $filters2['CustomersID'] = $CustomersID;
         $filters2['AgentID'] = intval($_SESSION['AgentID']);
         $filters2['ProjectID'] = $ProjectId;
         $IsFengxingCustom = $CustProModule->GetInfoByWhere($sql);
         $LogsFunction = new LogsFunction();
         if (!empty($IsFengxingCustom)) {
             $DB = new DB();
             $Data['Remark'] = $this->_POST['Remark'];
             $DataCustoms['AgentID'] = $_SESSION['AgentID'];
             $Data['CustomersID'] = $CustomersID;
             $Data['UpdateTime'] = date('Y-m-d H:i:s', time());
             $Data['G_name'] = $this->_POST['GUserName'];
             $Data['CPhone'] = $this->_POST['CPhone'];
             $Data['FTP'] = $this->_POST['ftp'];
             if ($this->_POST['ftp'] or $this->_POST['xftp']) {
                 $Data['FuwuqiName'] = $this->_POST['fuwuqiName'];
                 $Data['G_Ftp_Address'] = $Fuwuqimessage[$Data['FuwuqiName']]['FTP'];
                 $Data['G_Ftp_User'] = $Fuwuqimessage[$Data['FuwuqiName']]['FTPName'];
                 $Data['G_Ftp_Pwd'] = $Fuwuqimessage[$Data['FuwuqiName']]['FTPPassword'];
                 $Data['G_Ftp_FwAdress'] = $Fuwuqimessage[$Data['FuwuqiName']]['FwAdress'];
                 $Data['G_Ftp_Duankou'] = $Fuwuqimessage[$Data['FuwuqiName']]['FTPDuankou'];
                 $Data['G_Ftp_Mulu'] = $Fuwuqimessage[$Data['FuwuqiName']]['FTPMulu'];
             } else {
                 $Data['G_Ftp_Address'] = $this->_POST['G_Ftp_Address'];
                 $Data['G_Ftp_User'] = $this->_POST['G_Ftp_User'];
                 $Data['G_Ftp_Pwd'] = $this->_POST['G_Ftp_Pwd'];
                 $Data['G_Ftp_FwAdress'] = $this->_POST['G_Ftp_FwAdress'];
                 $Data['G_Ftp_Duankou'] = $this->_POST['G_Ftp_Duankou'];
                 $Data['G_Ftp_Mulu'] = $this->_POST['G_Ftp_Mulu'];
             }
             if (preg_match("/[\\x{4e00}-\\x{9fa5}]/u", $Data['G_name'])) {
                 JsMessage('G宝盆账号不能是中文!');
             }
             $Data['GongNeng'] = $this->GetGbaopenPropertyID('基础版');
             $FengXinUserNameNum = $CustProModule->GetListsNum("where G_name='{$Data['G_name']}' and CustomersID!={$CustomersID}");
             if ($FengXinUserNameNum['Num'] > 0) {
                 $LogsFunction->logsinfile('114', 2, $CustomersID);
                 JsMessage('该G宝盆账号已经被使用!');
             }
             if ($DB->UpdateArray($CustProModule->TableName, $Data, $filters2)) {
                 $IsOk = $this->ToGbaoPenEditInfo($IsFengxingCustom['CustomersProjectID']);
                 if (!$IsOk) {
                     JsMessage('修改客户G宝盆资料失败,请再一次尝试!');
                 }
                 $LogsFunction->logsinfile('114', 1, $CustomersID);
                 JsMessage('修改客户G宝盆资料成功!', UrlRewriteSimple($this->MyModule, 'Customer', true) . '&Page=' . $Page, '继续操作');
             } else {
                 $LogsFunction->logsinfile('114', 0, $CustomersID);
                 JsMessage('修改客户G宝盆资料失败,请再一次尝试!');
             }
         } else {
             if (isset($this->_POST['create']) && isset($this->_POST['new'])) {
                 $Custom['CompanyName'] = $this->_POST['CompanyName'];
                 $Custom['CustomersName'] = $this->_POST['CustomersName'];
                 $Custom['Tel'] = $this->_POST['Tel'];
                 $Custom['Email'] = $this->_POST['Email'];
                 $Custom['Address'] = $this->_POST['Address'];
                 $Custom['Fax'] = $this->_POST['Fax'];
                 $Custom['AddTime'] = date('Y-m-d H:i:s', time());
                 $Custom['UpdateTime'] = $Custom['AddTime'];
                 $Custom['Address'] = $this->_POST['Address'];
                 $Custom['Remark'] = $this->_POST['Remark'];
                 $Custom['AgentID'] = $_SESSION['AgentID'];
                 if ($Custom['CompanyName'] == '' || $Custom['AgentID'] == '') {
                     JsMessage('信息填写错误!');
                 }
                 $CustomersModule->InsertArray($Custom);
                 $CustomersID = mysql_insert_id();
             }
             $Data['GongNeng'] = $this->GetGbaopenPropertyID('基础版');
             //模板域名处理
             $Data['CPhone'] = $this->_POST['PChone'];
             if ($Data['CPhone'] == 1) {
                 $Data['isPackage'] = 0;
                 $Data['PK_model'] = 0;
                 $id = $this->_POST['choosemodel'];
                 $PC_Model = $Model->GetListsAll('tb_model', 'where Type = \'PC\' and ID = ' . $id);
                 if ($PC_Model) {
                     $Data['PC_model'] = $PC_Model[0]['NO'];
                     if ($this->_POST['pc_domain']) {
                         $Data['PC_domain'] = $this->_POST['pc_domain'];
                     } else {
                         JsMessage('请填写PC域名!');
                     }
                     $Data['Mobile_model'] = 0;
                     if (isset($this->_POST['outmobile_add'])) {
                         $Data['Mobile_domain'] = $this->_POST['outmobile_domain'];
                     }
                 } else {
                     JsMessage('不存在此模板!');
                 }
             } elseif ($Data['CPhone'] == 2) {
                 $Data['isPackage'] = 0;
                 $Data['PK_model'] = 0;
                 $id = $this->_POST['choosemodel'];
                 $Mobile_model = $Model->GetListsAll('tb_model', 'where Type = \'手机\' and ID = ' . $id);
                 if ($Mobile_model) {
                     $Data['PC_model'] = 0;
                     if (isset($this->_POST['outpc_add'])) {
                         $Data['PC_domain'] = $this->_POST['outpc_domain'];
                     }
                     $Data['Mobile_model'] = $Mobile_model[0]['NO'];
                     if ($this->_POST['mobile_domain']) {
                         $Data['Mobile_domain'] = $this->_POST['mobile_domain'];
                     } else {
                         JsMessage('请填写手机域名!');
                     }
                 } else {
                     JsMessage('不存在此模板!');
                 }
             } else {
                 if ($this->_POST['ispackage']) {
                     $Data['isPackage'] = 1;
                     $id = $this->_POST['choosemodel'];
                     $Package_Model = $Model->GetListsAll('tb_model_packages', 'where ID = ' . $id);
                     if ($Package_Model) {
                         $Data['PC_model'] = $Package_Model[0]['PCNum'];
                         $Data['Mobile_model'] = $Package_Model[0]['PhoneNum'];
                         $Data['PK_model'] = $Package_Model[0]['PackagesNum'];
                     } else {
                         JsMessage('不存在此套餐!');
                     }
                 } else {
                     $Data['isPackage'] = 0;
                     $Data['PK_model'] = 0;
                     $id = $this->_POST['pc_choose'];
                     $PC_Model = $Model->GetListsAll('tb_model', 'where Type = \'PC\' and ID = ' . $id);
                     if ($PC_Model) {
                         $Data['PC_model'] = $PC_Model[0]['NO'];
                     } else {
                         JsMessage('不存在此模板!');
                     }
                     $id = $this->_POST['mobile_choose'];
                     $Mobile_model = $Model->GetListsAll('tb_model', 'where Type = \'手机\' and ID = ' . $id);
                     if ($Mobile_model) {
                         $Data['Mobile_model'] = $Mobile_model[0]['NO'];
                     } else {
                         JsMessage('不存在此模板!');
                     }
                 }
                 if ($this->_POST['pc_domain']) {
                     $Data['PC_domain'] = $this->_POST['pc_domain'];
                 } else {
                     JsMessage('请填写PC域名!');
                 }
                 if ($this->_POST['mobile_domain']) {
                     $Data['Mobile_domain'] = $this->_POST['mobile_domain'];
                 } else {
                     JsMessage('请填写手机域名!');
                 }
             }
             //ftp处理
             $Data['FTP'] = $this->_POST['xftp'];
             if ($this->_POST['xftp'] or $this->_POST['ftp']) {
                 if ($this->_POST['xfuwuqiName']) {
                     $Data['FuwuqiName'] = $this->_POST['xfuwuqiName'];
                 } else {
                     $Data['FuwuqiName'] = $this->_POST['fuwuqiName'];
                 }
                 $Data['G_Ftp_Address'] = $Fuwuqimessage[$Data['FuwuqiName']]['FTP'];
                 $Data['G_Ftp_User'] = $Fuwuqimessage[$Data['FuwuqiName']]['FTPName'];
                 $Data['G_Ftp_Pwd'] = $Fuwuqimessage[$Data['FuwuqiName']]['FTPPassword'];
                 $Data['G_Ftp_FwAdress'] = $Fuwuqimessage[$Data['FuwuqiName']]['FwAdress'];
                 $Data['G_Ftp_Duankou'] = $Fuwuqimessage[$Data['FuwuqiName']]['FTPDuankou'];
                 $Data['G_Ftp_Mulu'] = $Fuwuqimessage[$Data['FuwuqiName']]['FTPMulu'];
             } else {
                 $Data['G_Ftp_Address'] = $this->_POST['G_Ftp_Address'];
                 $Data['G_Ftp_User'] = $this->_POST['G_Ftp_User'];
                 $Data['G_Ftp_Pwd'] = $this->_POST['G_Ftp_Pwd'];
                 $Data['G_Ftp_FwAdress'] = $this->_POST['G_Ftp_FwAdress'];
                 $Data['G_Ftp_Duankou'] = $this->_POST['G_Ftp_Duankou'];
                 $Data['G_Ftp_Mulu'] = $this->_POST['G_Ftp_Mulu'];
             }
             if (isset($this->_POST['create'])) {
                 $Coupons = $this->_POST['xCoupons'];
                 if ($Coupons) {
                     $CouponsPrice = file_get_contents(DAILI_DOMAIN . '?module=ApiModel&action=GetCoupons&code=' . $Coupons . '&use=1');
                     if ($CouponsPrice > 0) {
                         $Data['Coupons'] = $Coupons;
                         $Data['CouponsPrice'] = $CouponsPrice;
                     }
                 }
             } else {
                 $Coupons = $this->_POST['Coupons'];
                 if ($Coupons) {
                     $CouponsPrice = file_get_contents(DAILI_DOMAIN . '?module=ApiModel&action=GetCoupons&code=' . $Coupons . '&use=1');
                     if ($CouponsPrice > 0) {
                         $Data['Coupons'] = $Coupons;
                         $Data['CouponsPrice'] = $CouponsPrice;
                     }
                 }
             }
             $Data['ProjectID'] = $ProjectId;
             $Data['AgentID'] = $_SESSION['AgentID'];
             $Data['Remark'] = $this->_POST['Remark'];
             $Data['CustomersID'] = $CustomersID;
             $Data['AddTime'] = date('Y-m-d H:i:s', time());
             $Data['UpdateTime'] = $Data['AddTime'];
             $Data['StartTime'] = $Data['AddTime'];
             $Data['EndTime'] = date('Y-m-d H:i:s', strtotime("{$Data['AddTime']}"));
             $Data['G_name'] = $this->_POST['GUserName'];
             if (preg_match("/[\\x{4e00}-\\x{9fa5}]/u", $Data['G_name'])) {
                 JsMessage('G宝盆账号不能是中文!');
             }
             $Data['AddTime'] = $Data['UpdateTime'];
             if ($Data['CustomersID'] == '') {
                 JsMessage('信息填写错误!');
             }
             //$Data['G_beian'] = $this->_POST['beian'];
             $GnameNum = $CustProModule->GetListsNum("where G_name='" . $Data['G_name'] . "' and CustomersID!={$CustomersID}");
             if ($GnameNum['Num'] > 0) {
                 $LogsFunction->logsinfile('113', 2, $CustomersID);
                 JsMessage('该G宝盆账户已经被使用!');
             }
             $GetCustProjectID = $CustProModule->InsertArray($Data, true);
             if ($GetCustProjectID) {
                 $CustomersProjectID = $GetCustProjectID;
                 $IsOk = $this->ToGbaoPenEditInfo($CustomersProjectID);
                 if (!$IsOk) {
                     $CustomersModule->DeleteInfoByKeyID($CustomersID);
                     $CustProModule->DeleteInfoByKeyID($CustomersProjectID);
                     JsMessage('添加客户为新的G宝盆客户失败,已删除客户信息');
                 }
                 $LogsFunction->logsinfile('113', 1, $CustomersID);
                 JsMessage('添加客户为新的G宝盆客户成功!', UrlRewriteSimple($this->MyModule, 'Customer', true) . '&Page=' . $Page, '继续操作');
             } else {
                 $CustomersModule->DeleteInfoByKeyID($CustomersID);
                 $LogsFunction->logsinfile('113', 0, $CustomersID);
                 JsMessage('修改G宝盆客户失败,请再一次尝试!');
             }
         }
     }
 }