Beispiel #1
0
 public function Lists()
 {
     $this->MyAction = 'Lists';
     $Model = new ModelModule();
     if ($this->_POST['searchtxt']) {
         $Searchtxt = '\'' . trim($this->_POST['searchtxt']) . '\'';
         $Data['Data'][0] = $Model->GetOneInfoByKeyID($Searchtxt, 'NO');
         if (!$Data['Data'][0]) {
             $Model = new PropertyModule();
             $Data['Data'] = $Model->GetAllModelLists('tb_model_packages', 'where PackagesNum = ' . $Searchtxt);
         }
         $this->Data = $Data;
     } elseif ($this->_GET['state']) {
         $Page = intval($this->_GET['Page']);
         $Page = $Page ? $Page : 1;
         $PageSize = 10;
         $From = ($Page - 1) * $PageSize;
         $Data['state'] = $this->_GET['state'];
         $Data['Page'] = $Page;
         $Data['Data'] = $Model->GetTaocanLists('', $From, $PageSize, 'ASC');
         $RecordCount = $Model->GetTaocanListsNum('', 'PackagesNum', 'tb_model_packages');
         $Data['RecordCount'] = $RecordCount['Num'];
         $Data['PageCount'] = ceil($RecordCount['Num'] / $PageSize);
         $Data['PageSize'] = $PageSize;
         $this->Data = $Data;
     } else {
         $Page = intval($this->_GET['Page']);
         $Page = $Page ? $Page : 1;
         $PageSize = 10;
         $From = ($Page - 1) * $PageSize;
         $Data['Page'] = $Page;
         $Data['Data'] = $Model->GetLists('', $From, $PageSize, 'ASC');
         $RecordCount = $Model->GetListsNum();
         $Data['RecordCount'] = $RecordCount['Num'];
         $Data['PageCount'] = ceil($RecordCount['Num'] / $PageSize);
         $Data['PageSize'] = $PageSize;
         $this->Data = $Data;
     }
 }
Beispiel #2
0
 public function Uploadfile()
 {
     if ($this->_POST['submit2']) {
         if (!empty($this->_FILES["file"]["tmp_name"][0]) or !empty($this->_FILES["file"]["tmp_name"][1])) {
             $ModelClass = new ModelClassModule();
             $ModelClassLists = $ModelClass->GetListsAll();
             $ModelModule = new ModelModule();
             $ret = $ModelModule->GetOneListForAll();
             $ModelList = array();
             foreach ($ret as $val) {
                 $ModelList[] = $val['NO'];
             }
             //判断批量报价是否上传
             if (!empty($_FILES["file"]["tmp_name"][1])) {
                 if ($_FILES["file"]["error"][1] > 0) {
                     $this->__Message('csv文件上传失败,请再一次尝试!,(~>__<~)');
                 } else {
                     $filename = $_FILES["file"]["name"][1];
                     $filetype = pathinfo($filename, PATHINFO_EXTENSION);
                     if ($filetype == 'csv') {
                         if (!is_dir('./uploads')) {
                             $k = @mkdir('./uploads', 0777, true);
                             if (!$k) {
                                 $this->__Message('上传路径出错,不存在临时存放路径,请联系程序猿! /(ㄒoㄒ)/~~');
                             }
                         }
                         move_uploaded_file($_FILES["file"]["tmp_name"][1], "uploads/baojia.csv");
                     } else {
                         $this->__Message('请上传csv格式的文件,(^人^) 拜托啦^^~');
                     }
                 }
             }
             //判断是否有压缩包上传
             if (!empty($this->_FILES["file"]["tmp_name"][0])) {
                 if ($_FILES["file"]["error"][0] > 0) {
                     $this->__Message('压缩文件上传失败,请再一次尝试!,(~>__<~)');
                 } else {
                     //将压缩包存放在临时的文件夹
                     $filename = $_FILES["file"]["name"][0];
                     $filetype = pathinfo($filename, PATHINFO_EXTENSION);
                     if ($filetype == 'zip') {
                         if (!is_dir('./linshi')) {
                             $k = @mkdir('./linshi', 0777, true);
                             if (!$k) {
                                 $this->__Message('上传路径出错,不存在临时存放路径,请联系程序猿! /(ㄒoㄒ)/~~');
                             }
                         }
                         if (file_exists('./linshi/model/linshi/config.ini')) {
                             $this->__Message('其他人员正在进行文件上传操作,请稍后重试!若此情况存在时间过长,酌情联系程序猿!(~>__<~)');
                         }
                         $filename = 'linshi.zip';
                         $filepath = "./linshi/" . $filename;
                         move_uploaded_file($_FILES["file"]["tmp_name"][0], $filepath);
                     } else {
                         $this->__Message('请上传zip格式的压缩包,(^人^) 拜托啦^^~');
                     }
                 }
                 //解压zip文件获取需要的文件信息
                 $zip = new ZipArchive();
                 if ($zip->open($filepath) === TRUE) {
                     if (!is_dir('./linshi/model')) {
                         $k = @mkdir('./linshi/model', 0777, true);
                         if (!$k) {
                             deldir('./linshi');
                             $this->__Message('解压路径出错,不存在临时解压路径,请联系程序猿! /(ㄒoㄒ)/~~');
                         }
                     }
                     $zip->extractTo('./linshi/model/linshi');
                     //提取全部文件
                     if (file_exists('./linshi/model/linshi/config.ini')) {
                         $config_exchange = file_get_contents('./linshi/model/linshi/config.ini');
                         if (preg_match('/LogoSize=([\\w]+\\*[\\w]+)\\|(\\w+)/', $config_exchange)) {
                             $config_exchange = preg_replace('/LogoSize=([\\w]+\\*[\\w]+)\\|(\\w+)/', 'LogoSize=$1\'|\'\'$2\'', $config_exchange);
                             file_put_contents('./linshi/model/linshi/config.ini', $config_exchange);
                             if (!$zip->addFile('linshi/model/linshi/config.ini', 'config.ini')) {
                                 $zip->close();
                                 deldir('./linshi');
                                 $this->__Message('对压缩包操作config.ini文件失败,请重新上传! /(ㄒoㄒ)/~~');
                             }
                         }
                     } else {
                         $zip->close();
                         deldir('./linshi');
                         $this->__Message('压缩包不存在config.ini文件,请重新审核! /(ㄒoㄒ)/~~');
                     }
                     $zip->close();
                     $get = new getmodelmessage('./linshi/model/', './uploads/img_url');
                     $model = $get->getmessage();
                     $Data = array();
                     $Data['Pic'] = $model[0]['img_url'];
                     $Data['Name'] = $model[0]['config']['Template']['Name'] ? $model[0]['config']['Template']['Name'] : '';
                     $Data['Descript'] = $model[0]['config']['Template']['Description'] ? $model[0]['config']['Template']['Description'] : '';
                     $Data['Url'] = $model[0]['config']['Template']['URL'] ? $model[0]['config']['Template']['URL'] : '';
                     $Data['Version'] = $model[0]['config']['Template']['Version'] ? $model[0]['config']['Template']['Version'] : '';
                     $Data['Type'] = $model[0]['config']['Config']['Type'] ? $model[0]['config']['Config']['Type'] : '';
                     $Data['Keyword'] = $model[0]['config']['Config']['Tags'] ? $model[0]['config']['Config']['Tags'] : '';
                     $Data['Color'] = $model[0]['config']['Config']['StyleColors'] ? str_replace(' ', '', $model[0]['config']['Config']['StyleColors']) : '';
                     $Data['DeveloperSN'] = $model[0]['config']['Developer']['SN'] ? $model[0]['config']['Developer']['SN'] : '';
                     $Data['DeveloperName'] = $model[0]['config']['Developer']['Name'] ? $model[0]['config']['Developer']['Name'] : '';
                     $Data['DeveloperHi'] = $model[0]['config']['Developer']['Hi'] ? $model[0]['config']['Developer']['Hi'] : '';
                     $Data['DeveloperEmail'] = $model[0]['config']['Developer']['Email'] ? $model[0]['config']['Developer']['Email'] : '';
                     $Data['DeveloperQQ'] = $model[0]['config']['Developer']['QQ'] ? $model[0]['config']['Developer']['QQ'] : '';
                     $Data['DeveloperURL'] = $model[0]['config']['Developer']['URL'] ? $model[0]['config']['Developer']['URL'] : '';
                     $Data['DesignerSN'] = $model[0]['config']['Designer']['SN'] ? $model[0]['config']['Designer']['SN'] : '';
                     $Data['DesignerName'] = $model[0]['config']['Designer']['Name'] ? $model[0]['config']['Designer']['Name'] : '';
                     $Data['DesignerHi'] = $model[0]['config']['Designer']['Hi'] ? $model[0]['config']['Designer']['Hi'] : '';
                     $Data['DesignerEmail'] = $model[0]['config']['Designer']['Email'] ? $model[0]['config']['Designer']['Email'] : '';
                     $Data['DesignerQQ'] = $model[0]['config']['Designer']['QQ'] ? $model[0]['config']['Designer']['QQ'] : '';
                     $Data['DesignerURL'] = $model[0]['config']['Designer']['URL'] ? $model[0]['config']['Designer']['URL'] : '';
                     $Data['TesterName'] = $model[0]['config']['Tester']['Name'] ? $model[0]['config']['Tester']['Name'] : '';
                     $Data['TesterHi'] = $model[0]['config']['Tester']['Hi'] ? $model[0]['config']['Tester']['Hi'] : '';
                     $Data['TesterEmail'] = $model[0]['config']['Tester']['Email'] ? $model[0]['config']['Tester']['Email'] : '';
                     $Data['TesterQQ'] = $model[0]['config']['Tester']['QQ'] ? $model[0]['config']['Tester']['QQ'] : '';
                     $Data['TesterURL'] = $model[0]['config']['Tester']['URL'] ? $model[0]['config']['Tester']['URL'] : '';
                     if ($this->_POST['ModelType']) {
                         $Data['ModelClassID'] = $this->_POST['ModelType'];
                         $Data['ModelClassID'] = implode(',', $Data['ModelClassID']);
                         $Data['ModelClassID'] = ',' . $Data['ModelClassID'] . ',';
                     } else {
                         $Data['ModelClassID'] = $model[0]['config']['Config']['Category'] ? $model[0]['config']['Config']['Category'] : '';
                         if ($Data['ModelClassID']) {
                             preg_match_all('/[\\x{4e00}-\\x{9fa5}]+/u', $Data['ModelClassID'], $ModelClassID);
                             if ($ModelClassID[0]) {
                                 $Data['ModelClassID'] = ',';
                                 foreach ($ModelClassID[0] as $key) {
                                     foreach ($ModelClassLists as $val) {
                                         if (strstr($val[CName], $key)) {
                                             if (!strstr($Data['ModelClassID'], ',' . $val[ID] . ',')) {
                                                 $Data['ModelClassID'] .= $val[ID] . ',';
                                             }
                                         }
                                     }
                                 }
                                 if (!$Data['ModelClassID']) {
                                     $Data['ModelClassID'] = ',24' . ',';
                                 }
                             } else {
                                 $Data['ModelClassID'] = ',24' . ',';
                             }
                         } else {
                             $Data['ModelClassID'] = ',24' . ',';
                         }
                     }
                     if ($Data['Color']) {
                         preg_match_all('/\\b\\w[a-z]*\\b/', $Data['Color'], $have);
                         foreach ($have[0] as $val) {
                             $Color .= $val . ',';
                         }
                         $Data['Color'] = $Color;
                     }
                     if ($Data['Type']) {
                         if (preg_match('/[A-Za-z]/', str_replace(' ', '', $Data['Type']))) {
                             $Data['Type'] = 'PC';
                         } else {
                             $Data['Type'] = '手机';
                         }
                     } else {
                         deldir('./linshi');
                         unlink('uploads/img_url/linshi_screenshot.jpg');
                         $this->__Message('模板文件中config.ini里配置出错,请填写Type类型! /(ㄒoㄒ)/~~');
                     }
                     if ($this->_POST['ModelStar']) {
                         $Data['BaiDuXingPing'] = $this->_POST['ModelStar'];
                     } else {
                         $Data['BaiDuXingPing'] = 3;
                     }
                     if ($Data['Color']) {
                         preg_match('/\\b\\w[a-z]*\\b/', $Data['Color'], $have);
                         $Data['ZhuSeDiao'] = $have[0];
                     } else {
                         $Data['ZhuSeDiao'] = '';
                     }
                     if ($this->_POST['Price']) {
                         $Data['Price'] = $this->_POST['Price'];
                     }
                     if ($this->_POST['Youhui']) {
                         $Data['Youhui'] = $this->_POST['Youhui'];
                     }
                     if ($this->_POST['ModelTese']) {
                         $Data['ModelTese'] = $this->_POST['ModelTese'];
                     }
                     if ($this->_POST['ModelStar'] === 0) {
                         $Data['TuiJian'] = '1';
                     } else {
                         $Data['TuiJian'] = '0';
                     }
                     $Data['Language'] = 'PHP';
                     $Data['AddTime'] = date('Y-n-j H:i:s', time());
                     $Data['Content'] = $this->_POST['ModelContent'];
                     $Data['TuiJian'] = $this->_POST['TuiJian'];
                 } else {
                     deldir('./linshi');
                     unlink('uploads/img_url/linshi_screenshot.jpg');
                     $this->__Message('解压出错,请重新上传! /(ㄒoㄒ)/~~');
                 }
                 if (!empty($this->_POST['Modelname'])) {
                     $Modelname = trim($this->_POST['Modelname']);
                     if (preg_match('/GM\\d{4}/', $Modelname) or preg_match('/GP\\d{4}/', $Modelname)) {
                         if (preg_match('/GM\\d{5}/', $Modelname) or preg_match('/GP\\d{5}/', $Modelname)) {
                             deldir('./linshi');
                             unlink('uploads/img_url/linshi_screenshot.jpg');
                             $this->__Message('错误的模板名,请重新上传! /(ㄒoㄒ)/~~');
                         }
                     } else {
                         deldir('./linshi');
                         unlink('uploads/img_url/linshi_screenshot.jpg');
                         $this->__Message('错误的模板名,请重新上传! /(ㄒoㄒ)/~~');
                     }
                 } else {
                     $Modelname = '';
                 }
                 if (empty($Modelname)) {
                     if ($Data['Type'] == 'PC') {
                         $NewName = $ModelModule->GetOneForNew('\'PC\'');
                         $NewName = (int) $NewName['Num'] + 1;
                         $Data['Num'] = $NewName;
                         $geshu = strlen((string) $NewName);
                         $geshu = 4 - $geshu;
                         $Modelname = 'GP';
                         for ($i = 0; $i < $geshu; $i++) {
                             $Modelname .= '0';
                         }
                         $Modelname .= $Data['Num'];
                         $Data['NO'] = $Modelname;
                         rename($filepath, './linshi/' . $Modelname . '.zip');
                         $filename = $Modelname . '.zip';
                     } else {
                         $NewName = $ModelModule->GetOneForNew('\'手机\'');
                         $NewName = (int) $NewName['Num'] + 1;
                         $Data['Num'] = $NewName;
                         $geshu = strlen((string) $NewName);
                         $geshu = 4 - $geshu;
                         $Modelname = 'GM';
                         for ($i = 0; $i < $geshu; $i++) {
                             $Modelname .= '0';
                         }
                         $Modelname .= $Data['Num'];
                         $Data['NO'] = $Modelname;
                         rename($filepath, './linshi/' . $Modelname . '.zip');
                         $filename = $Modelname . '.zip';
                     }
                 } else {
                     $Data['NO'] = $Modelname;
                     $filename = $Modelname . '.zip';
                     preg_match('/[1-9]+/', $Modelname, $have);
                     $Data['Num'] = $have[0];
                     if (!$Data['Num']) {
                         deldir('./linshi');
                         unlink('uploads/img_url/linshi_screenshot.jpg');
                         $this->__Message('错误的模板编号!请核对后填写 /(ㄒoㄒ)/~~');
                     }
                     rename($filepath, './linshi/' . $Modelname . '.zip');
                 }
                 rename('uploads/img_url/linshi_screenshot.jpg', 'uploads/img_url/' . $Modelname . '_screenshot.jpg');
                 $Data['Pic'] = $Modelname . '_screenshot.jpg';
                 $Data['TJArray'] = str_replace(',', ',', $this->_POST['Model_Array']);
                 //生成二维码图片
                 if (empty($Data['Url'])) {
                     if ($Data['Type'] == 'PC') {
                         $Data['Url'] = 'http://' . $Data['NO'] . '.n01.5067.org';
                     } else {
                         $Data['Url'] = 'http://' . $Data['NO'] . '.n01.5067.org';
                     }
                 }
                 //判断文件是否是插入或者更新
                 $InsertOrUp = 0;
                 if (in_array($Modelname, $ModelList)) {
                     $InsertOrUp = 1;
                 }
                 //执行更新或插入数据操作
                 if ($InsertOrUp) {
                     $Modelever = $ModelModule->GetOneInfoByKeyID('\'' . $Modelname . '\'', 'NO');
                     if (!$ModelModule->UpdateArrayByNO($Data, $Modelname)) {
                         deldir('./linshi');
                         $this->__Message('数据入库失败,请重试 /(ㄒoㄒ)/~~');
                     }
                     $GetChangeID = $Modelname;
                 } else {
                     $GetChangeID = $ModelModule->InsertArray($Data, true);
                 }
                 if ($GetChangeID) {
                     //向统一平台发送文件
                     $ToUrl = GBAOPEN_DOMAIN . 'upload_template';
                     $ReturnString = sendStreamFile($ToUrl, $filename);
                     $ret = json_decode($ReturnString, true);
                     if ($ret['err'] != 1000) {
                         //统一发送失败,还原数据库
                         if ($InsertOrUp) {
                             $ModelModule->UpdateArrayByNO($Modelever, $Modelname);
                         } else {
                             $ModelModule->DeleteInfoByKeyID($GetChangeID);
                         }
                         deldir('./linshi');
                         $this->__Message('向统一平台发送文件失败,请再一次尝试!,(~>__<~) ');
                     }
                     deldir('./linshi');
                     $this->__Message('上传成功!! (*^‧^*) ', UrlRewriteSimple('Property', 'Lists', true) . '&ProjectID=1', '继续操作');
                 } else {
                     deldir('./linshi');
                     $this->__Message('上传失败,请再一次尝试!,(~>__<~) ');
                 }
             }
             //批量报价文件是否存在,存在则获取相应的模板信息。
             if (file_exists('./uploads/baojia.csv')) {
                 //报价信息格式验证
                 $ModulePriceToken = array(0 => '模板编号', 1 => '美观度得分', 2 => '交互体验得分', 3 => '功能得分', 4 => '设计经理评分', 5 => '产品经理评分', 6 => '总评分', 7 => '市场价', 8 => '优惠价', 9 => 'BUG扣分', 10 => '设计师积分累计', 11 => '开发者积分累计', 12 => '测试积分累计', 13 => '模板特色');
                 $i = 1;
                 $file = fopen('./uploads/baojia.csv', 'r');
                 while ($data = fgetcsv($file)) {
                     if ($i) {
                         $jieguo = $data;
                         unset($i);
                     }
                     if (preg_match("/^[0-9a-zA-Z]{3,}\$/", $data['0'])) {
                         $bj_list[$data[0]] = $data;
                         $bj_model[] = $data[0];
                     } else {
                         continue;
                     }
                 }
                 foreach ($bj_list as &$arr) {
                     foreach ($arr as &$v) {
                         $v = trim(str_replace('?', '', $v));
                         $v = trim(str_replace(',', '', $v));
                     }
                 }
                 fclose($file);
                 //判断模板文件格式是否正确
                 $i = 0;
                 foreach ($jieguo as $k => &$val) {
                     $encode = mb_detect_encoding($val, array('ASCII', 'GB2312', 'GBK', 'UTF-8'));
                     if ($encode != 'UTF-8') {
                         $val = iconv($encode, "UTF-8", $val);
                     }
                     if ($ModulePriceToken[$k] != $val) {
                         $i = 1;
                     }
                 }
                 if ($i) {
                     unlink('./uploads/baojia.csv');
                     $this->__Message('csv文件格式错误,请检查!  (~>__<~)');
                 }
                 //取得要更新报价的模板名
                 $Updata_model = array_intersect($bj_model, $ModelList);
                 $Data = array();
                 $err = array();
                 $success = 0;
                 for ($i = 0; $i < count($Updata_model); $i++) {
                     $Data['Aesthetics'] = $bj_list[$Updata_model[$i]][1] ? $bj_list[$Updata_model[$i]][1] : '';
                     $Data['Interaction'] = $bj_list[$Updata_model[$i]][2] ? $bj_list[$Updata_model[$i]][2] : '';
                     $Data['Features'] = $bj_list[$Updata_model[$i]][3] ? $bj_list[$Updata_model[$i]][3] : '';
                     if ($bj_list[$Updata_model[$i]][7]) {
                         $Data['Price'] = $bj_list[$Updata_model[$i]][7];
                     }
                     if ($bj_list[$Updata_model[$i]][8]) {
                         $Data['Youhui'] = $bj_list[$Updata_model[$i]][8];
                     }
                     $Data['DesignerScore'] = $bj_list[$Updata_model[$i]][10] ? $bj_list[$Updata_model[$i]][10] : '';
                     $Data['DeveloperScore'] = $bj_list[$Updata_model[$i]][11] ? $bj_list[$Updata_model[$i]][11] : '';
                     $Data['TesterScore'] = $bj_list[$Updata_model[$i]][12] ? $bj_list[$Updata_model[$i]][12] : '';
                     if ($bj_list[$Updata_model[$i]][13]) {
                         $Data['ModelTese'] = $bj_list[$Updata_model[$i]][13];
                     }
                     if ($ModelModule->UpdateArray($Data, array('NO' => $Updata_model[$i]))) {
                         $success++;
                     } else {
                         $err[] = $Updata_model[$i];
                     }
                 }
                 unlink('./uploads/baojia.csv');
                 if (count($err)) {
                     $this->__Message('成功修改' . $success . '个,失败' . count($err) . '个! 失败的报价模板分别为:' . implode(',', $err) . '。请对这些模板的报价重新上传或手动修改  (⊙﹏⊙)b');
                 } else {
                     $this->__Message('批量报价成功!!共' . $success . '个 (*^‧^*) ', UrlRewriteSimple('Property', 'Lists', true) . '&ProjectID=1', '继续操作');
                 }
             }
         } else {
             $this->__Message('没有选择上传文件,请再一次尝试!  (⊙﹏⊙)b');
         }
     }
     if ($this->_POST['submit3']) {
         $ModelModule = new ModelModule();
         $ret = $ModelModule->GetOneListForAll();
         $AllModel = array();
         $AllPackagesName = array();
         foreach ($ret as $val) {
             $AllModel[] = $val['NO'];
         }
         $ret = $ModelModule->GetOneListForAll('PackagesNum', 'tb_model_packages');
         foreach ($ret as $val) {
             $AllPackagesName[] = $val['PackagesNum'];
         }
         $Data['PackagesName'] = trim($this->_POST['PackagesName']);
         $Data['PackagesNum'] = trim($this->_POST['PackagesNum']);
         $Data['PCNum'] = trim($this->_POST['PCNum']);
         $Data['PhoneNum'] = trim($this->_POST['PhoneNum']);
         $Data['Price'] = trim($this->_POST['MarketPrice']);
         $Data['Youhui'] = trim($this->_POST['YouhuiPrice']);
         $Data['ModelTese'] = trim($this->_POST['ModelTese']);
         if ($this->_POST['PCURL']) {
             $Data['PCUrl'] = $this->_POST['PCURL'];
         } else {
             $Data['PCUrl'] = 'http://' . $Data['PackagesNum'] . 'n01.5067.org';
         }
         if ($this->_POST['PhoneURL']) {
             $Data['PhoneUrl'] = $this->_POST['PhoneURL'];
         } else {
             $Data['PhoneUrl'] = 'http://m.' . $Data['PackagesNum'] . 'n01.5067.org';
         }
         $Data['Content'] = $this->_POST['ModelContent'];
         $Data['TuiJian'] = $this->_POST['TuiJian'];
         if (in_array($Data['PackagesNum'], $AllPackagesName)) {
             $this->__Message('此套餐已存在,换一个名字咯!  (⊙﹏⊙)b');
         }
         if (!in_array($Data['PCNum'], $AllModel) && !in_array($Data['PhoneNum'], $AllModel)) {
             $this->__Message('没有相应的手机或PC模板!  (⊙﹏⊙)b');
         }
         if (!empty($Data['PhoneNum'])) {
             $Modelname = trim($this->_POST['PhoneNum']);
             if (preg_match('/GM\\d{4}/', $Modelname) or preg_match('/GP\\d{4}/', $Modelname)) {
                 if (preg_match('/GM\\d{5}/', $Modelname) or preg_match('/GP\\d{5}/', $Modelname)) {
                     $this->__Message('错误的模板名,请重新上传! /(ㄒoㄒ)/~~');
                 }
             } else {
                 $this->__Message('错误的模板名,请重新上传! /(ㄒoㄒ)/~~');
             }
         } else {
             $this->__Message('属性名称不能为空!  (⊙﹏⊙)b');
         }
         if (!empty($this->_POST['PackagesNum'])) {
             $Modelname = trim($this->_POST['PackagesNum']);
             if (preg_match('/GT\\d{4}/', $Modelname)) {
                 if (preg_match('/GT\\d{5}/', $Modelname)) {
                     deldir('./linshi');
                     $this->__Message('错误的模板名,请重新上传! /(ㄒoㄒ)/~~');
                 }
             } else {
                 deldir('./linshi');
                 $this->__Message('错误的模板名,请重新上传! /(ㄒoㄒ)/~~');
             }
         }
         if (!empty($this->_POST['PCNum'])) {
             $Modelname = trim($this->_POST['PCNum']);
             if (preg_match('/GM\\d{4}/', $Modelname) or preg_match('/GP\\d{4}/', $Modelname)) {
                 if (preg_match('/GM\\d{5}/', $Modelname) or preg_match('/GP\\d{5}/', $Modelname)) {
                     deldir('./linshi');
                     $this->__Message('错误的模板名,请重新上传! /(ㄒoㄒ)/~~');
                 }
             } else {
                 deldir('./linshi');
                 $this->__Message('错误的模板名,请重新上传! /(ㄒoㄒ)/~~');
             }
         }
         $PCModel = $ModelModule->GetOneInfoByKeyID('\'' . $Data['PCNum'] . '\'', 'NO');
         $PhoneModel = $ModelModule->GetOneInfoByKeyID('\'' . $Data['PhoneNum'] . '\'', 'NO');
         $Data['Color'] = $PCModel['Color'] . ',' . $PhoneModel['Color'];
         $Data['Keyword'] = $PCModel['Keyword'];
         $Data['ZhuSeDiao'] = $PCModel['Color'];
         $Data['DesignerScore'] = ceil(($PCModel['DesignerScore'] + $PhoneModel['DesignerScore']) / 2);
         $Data['DeveloperScore'] = ceil(($PCModel['DeveloperScore'] + $PhoneModel['DeveloperScore']) / 2);
         $Data['TesterScore'] = ceil(($PCModel['TesterScore'] + $PhoneModel['TesterScore']) / 2);
         $Data['Language'] = 'PHP';
         $Data['ModelClassID'] = 0;
         $Data['AddTime'] = date("Y-m-d H:i:s", time());
         if ($ModelModule->InsertArrayPackages($Data, true)) {
             $this->__Message('添加套餐成功!!  (*^‧^*) ');
         } else {
             $this->__Message('添加失败,请再一次尝试!,(~>__<~) ');
         }
     }
 }
Beispiel #3
0
    public function GetDoubleStModelRead()
    {
        if ($this->_GET) {
            $Number = _intval($this->_GET['Number']);
            //每页显示数量
            if ($Number == 0) {
                $Number = 1;
            }
            $Where = ' where TuiJian>1';
            $Model = new ModelModule();
            //$Offset = ($Page - 1) * $Number;
            $ModelList = $Model->GetPackagesLists($Where, 0, $Number);
            $ModelListNun = $Model->GetPackagesListsNum($Where);
            $String = '';
            foreach ($ModelList as $Value) {
                $ModelPC = $Model->GetOneInfoByKeyID('\'' . $Value['PCNum'] . '\'', 'NO');
                $ModelPhone = $Model->GetOneInfoByKeyID('\'' . $Value['PhoneNum'] . '\'', 'NO');
                $ModelPC['Pic'] = DAILI_DOMAIN . 'uploads/img_url/' . $ModelPC['Pic'];
                $ModelPhone['Pic'] = DAILI_DOMAIN . 'uploads/img_url/' . $ModelPhone['Pic'];
                if (!$Value['Url_status']) {
                    $Value['PCUrl'] = '';
                    $Value['EWM'] = '';
                } else {
                    $Value['EWM'] = 'http://s.jiathis.com/qrcode.php?url=' . $Value['PhoneUrl'];
                }
                $String .= '  <model>
			    <id>' . $Value['ID'] . '</id>
			    <title>' . $Value['PackagesName'] . '</title>
			    <price>' . $Value['Price'] . '</price>
    			<youhui>' . $Value['Youhui'] . '</youhui>
			    <website>' . $Value['PCUrl'] . '</website>
			    <pcpicture>' . $ModelPC['Pic'] . '</pcpicture>
				<mobilepicture>' . $ModelPhone['Pic'] . '</mobilepicture>
				<ewm>' . $Value['EWM'] . '</ewm>
   				<time>' . $Value['AddTime'] . '</time>
			  </model>
			';
            }
            $String = '<?xml version="1.0" encoding="utf-8"?>
			<models>
			' . $String . '  <page>
				<total>' . $ModelListNun['Num'] . '</total>
			  </page>
			</models>';
            echo $String;
            exit;
        } else {
            echo '参数错误';
            exit;
        }
    }
Beispiel #4
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宝盆客户失败,请再一次尝试!');
             }
         }
     }
 }