예제 #1
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('添加失败,请再一次尝试!,(~>__<~) ');
         }
     }
 }
예제 #2
0
파일: send.php 프로젝트: liujb/hello-php
<?php

/** php 发送流文件
 * @param  String  $url  接收的路径
 * @param  String  $file 要发送的文件
 * @return boolean
 */
function sendStreamFile($url, $file)
{
    if (!file_exists($file)) {
        exit("No this files");
    }
    $opts = array('http' => array('method' => 'POST', 'header' => 'content-type:application/x-www-form-urlencoded', 'content' => file_get_contents($file), "src" => "haiou"));
    $context = stream_context_create($opts);
    $response = file_get_contents($url, false, $context);
    exit($response);
}
sendStreamFile('http://xx.xx/fist/partner/dataUpload?src=haiou&sign=09cda323df3b29699d5891fd4e2b770d&timestamp=1446807214&type=1', 'I_1449487802.txt');
// sendStreamFile('http://xxxx:xxx/fist/partner/dataUpload?src=haiou&sign=09cda323df3b29699d5891fd4e2b770d&timestamp=1446807214&type=1', 'I_1449487802.txt');