$generalListCertificateSheetDetailCertificateWifi7Title = array("Ssid", "Security", "Channel", "Test origin"); break; case 'pt_BR': $generalListCertificateModalTable2Title = array("Localização CPE", "Nac Carr.", "Nac Desc.", "Int Carr.", "Int Desc."); $generalListCertificateModalTable4Title = array("Localização", "Nac Carr.", "Nac Desc.", "Int Carr.", "Int Desc.", "Sinal"); $generalListCertificateModalTable5Title = array("Tipo", "Modelo", "Mac", "Localização", "Aceitar proposta localização", "Estado"); $generalListCertificateSheetDetailCertificateWifi1Title = array("Nac Carr.", "Nac Desc.", "Int Carr.", "Int Desc."); $generalListCertificateSheetDetailCertificateWifi2Table1Title = array("Spe", "Avg", "Tim", "Siz", "Tlo", "Tco", "Tpr", "Tst", "URL"); $generalListCertificateSheetDetailCertificateWifi3Title = array("Enviados", "Recebidos", "Perdidos", "Média", "Mínimo", "Máximo", "Jitter", "URL"); $generalListCertificateSheetDetailCertificateWifi4Title = array("N°", "Dispositivo"); $generalListCertificateSheetDetailCertificateWifi5Title = array("Int Desc.", "Int Carr.", "Nac Desc.", "Nac Carr."); $generalListCertificateSheetDetailCertificateWifi6Title = array("N°", "Ssid"); $generalListCertificateSheetDetailCertificateWifi7Title = array("Ssid", "Segurança", "Canal", "Origem dispositivo"); break; } loadExcel(); // Create new PHPExcel object $objPHPExcel = new PHPExcel(); setDocumentProperties($objPHPExcel); populateTableHead($objPHPExcel, 0, "A2:B2", "A2", $generalListCertificateTitles[0]); populateTableHead($objPHPExcel, 0, "D2:D2", "D2", $generalListCertificateTitles[2]); $objPHPExcel->getActiveSheet()->getColumnDimension('D')->setAutoSize(true); populateTableHead($objPHPExcel, 0, "F2:K2", "F2", $generalListCertificateTitles[3]); //populateTableHead($objPHPExcel,"F12:J12","F12",$generalListCertificateTitles[5]); $i = populateTableCells($objPHPExcel, $generalListCertificateModalTable1Title, $generalListCertificateModalTable1Content, 0, "A", "B"); populateTableHead($objPHPExcel, 0, "A" . ($i + 1) . ":B" . ($i + 1), "A" . ($i + 1), $generalListCertificateTitles[1]); //$i=populateTableCells($objPHPExcel,$generalListCertificateModalTable2Title,$generalListCertificateModalTable2Content); //populateTableHead($objPHPExcel,"A".($i+1).":B".($i+1),"A".($i+1),$generalListCertificateTitles[2]); $objPHPExcel->getActiveSheet()->getStyle("A3:A22")->applyFromArray(getPropertiesLateralLeftText()); $objPHPExcel->getActiveSheet()->getStyle("A25:A29")->applyFromArray(getPropertiesLateralLeftText()); $objPHPExcel->getActiveSheet()->getColumnDimension('A')->setAutoSize(true);
/** * @desc 读取excel文件 * @return array $productMessage 包含excel信息的多维数组 */ function readExcel() { $productMessage = array(); //存储所有的excel数据 $excelFile = $_FILES['excelFile']; if (!empty($excelFile)) { $excelFilePath = loadExcel($excelFile); //上传文件,得到excel文件路径 } else { echo "请选择excel文件"; } $isuploadOk = isuploadOk($excelFile, $excelFilePath); //判断是否上传成功 //如果excel上传成功 if ($isuploadOk) { // Error reporting error_reporting(E_ALL); ini_set('display_errors', TRUE); ini_set('display_startup_errors', TRUE); define('EOL', PHP_SAPI == 'cli' ? PHP_EOL : "\n"); require_once 'Classes/PHPExcel.php'; //引入类库 $PHPReader = new PHPExcel_Reader_Excel2007(); //如果没有选择excel文件 if (!$PHPReader->canRead($excelFilePath)) { $PHPReader = new PHPExcel_Reader_Excel5(); if (!$PHPReader->canRead($excelFilePath)) { echo 'no Excel'; return; } } $PHPExcel = $PHPReader->load($excelFilePath); //传入excel路径,载入该excel //sheet 0 $currentSheet = $PHPExcel->getSheet(0); //column Count $allColumn = $currentSheet->getHighestColumn(); //列 //Row Count $allRow = $currentSheet->getHighestRow(); //行 /**excel 中需要读的参数**/ $arrRPProTitle = array(); //产品标题 $arrRPVideoUrl = array(); //视频链接 $arrRPProDesc = array(); //产品描述 $arrRPProPic = array(); //产品图片 $arrRPBanner = array(); //海报图 $arrRPResultShowPicSrc = array(); //场景图 $arrRPProPackage = array(); //产品包裹 $arrRPProBrightSpot = array(); //产品亮点 $arrRPShoppingDetails = array(); //购物细节 $arrRPAAdProBEFORE = array(); //A类推广产品:连接DB处理前 $arrRPAAdProBEFORE = array(); //B类推广产品:连接DB处理前 $arrRPBCdProBEFORE = array(); //C类推广产品:连接DB处理前 $arrRPDAdProBEFORE = array(); //D类推广产品:连接DB处理前 $arrRPOters = array(); //其它 $arrRPCertificate = array(); //证书 $arrRPSamePara = array(); //共同参数 $arrRPDiffPara = array(); //不同参数 $arrDiffPataTableNum = array(); //不同参数参数表 $arrTabTitleA = array(); $arrTabHeadA = array(); $arrTabContA = array(); $arrTabTitleB = array(); $arrTabHeadB = array(); $arrTabContB = array(); $colBIndex = "B"; //B列 $colCIndex = "C"; //C列 $colDIndex = "D"; //D列 $colEIndex = "E"; //E列 $colFIndex = "F"; //E列 $tableNum = 0; //产品一级分类类型数(excel中有多少个参数规格表就是几) //开始循环读取每个单元格的内容 for ($rowIndex = 1; $rowIndex <= $allRow; $rowIndex++) { //从第一行开始循环 for ($colIndex = 'A'; $colIndex <= $allColumn; $colIndex++) { //从A列开始循环 $addr = $colIndex . $rowIndex; //单元格地址:列名.行名 $cell = trim($currentSheet->getCell($addr)->getValue()); //得到单元格内容,并去掉单元格开头和结尾处的空格 if ($cell instanceof PHPExcel_RichText) { //处理富文本 $cell = $cell->__toString(); } //产品标题 if ($cell === "产品标题") { $addrBCol = $colBIndex . $rowIndex; $cellBCol = trim($currentSheet->getCell($addrBCol)->getValue()); $arrRPProTitle[] = $cellBCol; } //end 产品标题 //视频链接 if ($cell === "视频链接") { $addrBCol = $colBIndex . $rowIndex; $cellBCol = trim($currentSheet->getCell($addrBCol)->getValue()); $arrRPVideoUrl[] = $cellBCol; } //end 视频链接 //=============================================== //产品描述 if ($cell === "产品描述") { //产品描述内容 $addrBCol = $colBIndex . $rowIndex; $cellBCol = trim($currentSheet->getCell($addrBCol)->getValue()); $arrRPProDesc[] = $cellBCol; } //end 产品描述 //=============================================== //产品图片 if ($cell === "产品图片") { //产品图片URL $addrBCol = $colBIndex . $rowIndex; $cellBCol = trim($currentSheet->getCell($addrBCol)->getValue()); //产品图片title $addrCCol = $colCIndex . $rowIndex; $cellCCol = trim($currentSheet->getCell($addrCCol)->getValue()); $arrRPProPic[] = array($cellBCol, $cellCCol); } //end 产品图片 //=============================================== //海报图 if ($cell === "海报图") { //海报图图片URL $addrBCol = $colBIndex . $rowIndex; $cellBCol = trim($currentSheet->getCell($addrBCol)->getValue()); //海报图跳转Href $addrCCol = $colCIndex . $rowIndex; $cellCCol = trim($currentSheet->getCell($addrCCol)->getValue()); $arrRPBanner[] = array($cellBCol, $cellCCol); } //end 海报图 //=============================================== //场景图 if ($cell === "场景图") { //场景图片URL $addrBCol = $colBIndex . $rowIndex; $cellBCol = trim($currentSheet->getCell($addrBCol)->getValue()); $arrRPResultShowPicSrc[] = $cellBCol; } //end 场景图 //=============================================== //产品包裹 if ($cell === "产品包裹") { $addrBCol = $colBIndex . $rowIndex; $cellBCol = trim($currentSheet->getCell($addrBCol)->getValue()); $arrRPProPackage[] = $cellBCol; } //end 产品包裹 //=============================================== //产品亮点 if ($cell === "产品亮点") { //产品亮点title $addrBCol = $colBIndex . $rowIndex; $cellBCol = trim($currentSheet->getCell($addrBCol)->getValue()); //产品亮点图片 $addrCCol = $colCIndex . $rowIndex; $cellCCol = trim($currentSheet->getCell($addrCCol)->getValue()); //产品亮点文本 $addrDCol = $colDIndex . $rowIndex; $cellDCol = trim($currentSheet->getCell($addrDCol)->getValue()); $arrRPProBrightSpot[] = array($cellBCol, $cellCCol, $cellDCol); } //end 产品亮点 //=============================================== //购物细节 if ($cell === "购物细节") { //购物细节Title $addrBCol = $colBIndex . $rowIndex; $cellBCol = trim($currentSheet->getCell($addrBCol)->getValue()); //购物细节Cont $addrCCol = $colCIndex . $rowIndex; $cellCCol = trim($currentSheet->getCell($addrCCol)->getValue()); //购物细节Pic $addrDCol = $colDIndex . $rowIndex; $cellDCol = trim($currentSheet->getCell($addrDCol)->getValue()); $arrRPShoppingDetails[] = array($cellBCol, $cellCCol, $cellDCol); //title,cont,pic } //end 购物细节 //=============================================== //A类推广产品 if ($cell === "A类推广产品") { //标题 $addrBCol = $colBIndex . $rowIndex; $cellBCol = trim($currentSheet->getCell($addrBCol)->getValue()); //推广产品Account $addrCCol = $colCIndex . $rowIndex; $cellCCol = trim($currentSheet->getCell($addrCCol)->getValue()); //推广产品ItemNumber $addrDCol = $colDIndex . $rowIndex; $cellDCol = trim($currentSheet->getCell($addrDCol)->getValue()); //推广产品运费 $addrECol = $colEIndex . $rowIndex; $cellECol = trim($currentSheet->getCell($addrECol)->getValue()); $arrRPAAdProBEFORE[] = array($cellBCol, $cellCCol, $cellDCol, $cellECol); } //end A类推广产品 //=============================================== //B类推广产品 if ($cell === "B类推广产品") { //标题 $addrBCol = $colBIndex . $rowIndex; $cellBCol = trim($currentSheet->getCell($addrBCol)->getValue()); //推广产品Account $addrCCol = $colCIndex . $rowIndex; $cellCCol = trim($currentSheet->getCell($addrCCol)->getValue()); //推广产品ItemNumber $addrDCol = $colDIndex . $rowIndex; $cellDCol = trim($currentSheet->getCell($addrDCol)->getValue()); //推广产品运费 $addrECol = $colEIndex . $rowIndex; $cellECol = trim($currentSheet->getCell($addrECol)->getValue()); $arrRPBAdProBEFORE[] = array($cellBCol, $cellCCol, $cellDCol, $cellECol); } //end B类推广产品 //=============================================== //C类推广产品 if ($cell === "C类推广产品") { //标题 $addrBCol = $colBIndex . $rowIndex; $cellBCol = trim($currentSheet->getCell($addrBCol)->getValue()); //推广产品Account $addrCCol = $colCIndex . $rowIndex; $cellCCol = trim($currentSheet->getCell($addrCCol)->getValue()); //推广产品ItemNumber $addrDCol = $colDIndex . $rowIndex; $cellDCol = trim($currentSheet->getCell($addrDCol)->getValue()); //推广产品运费 $addrECol = $colEIndex . $rowIndex; $cellECol = trim($currentSheet->getCell($addrECol)->getValue()); $arrRPCAdProBEFORE[] = array($cellBCol, $cellCCol, $cellDCol, $cellECol); } //end C类推广产品 //=============================================== //D类推广产品 if ($cell === "D类推广产品") { //标题 $addrBCol = $colBIndex . $rowIndex; $cellBCol = trim($currentSheet->getCell($addrBCol)->getValue()); //推广产品Account $addrCCol = $colCIndex . $rowIndex; $cellCCol = trim($currentSheet->getCell($addrCCol)->getValue()); //推广产品ItemNumber $addrDCol = $colDIndex . $rowIndex; $cellDCol = trim($currentSheet->getCell($addrDCol)->getValue()); //推广产品运费 $addrECol = $colEIndex . $rowIndex; $cellECol = trim($currentSheet->getCell($addrECol)->getValue()); $arrRPDAdProBEFORE[] = array($cellBCol, $cellCCol, $cellDCol, $cellECol); } //end D类推广产品 //=============================================== //其它 if ($cell === "其它") { //Title $addrBCol = $colBIndex . $rowIndex; $cellBCol = trim($currentSheet->getCell($addrBCol)->getValue()); //其它图片 $addrCCol = $colCIndex . $rowIndex; $cellCCol = trim($currentSheet->getCell($addrCCol)->getValue()); //其它文本 $addrDCol = $colDIndex . $rowIndex; $cellDCol = trim($currentSheet->getCell($addrDCol)->getValue()); $arrRPOters[] = array($cellBCol, $cellCCol, $cellDCol); } //end 其它 //=============================================== //证书 if ($cell === "证书") { //证书Title $addrBCol = $colBIndex . $rowIndex; $cellBCol = trim($currentSheet->getCell($addrBCol)->getValue()); //证书Cont $addrCCol = $colCIndex . $rowIndex; $cellCCol = trim($currentSheet->getCell($addrCCol)->getValue()); $arrRPCertificate[] = array($cellBCol, $cellCCol); } //end 证书 //=============================================== //共同参数 if ($cell === "共同参数") { //共同参数参数名name $addrBCol = $colBIndex . $rowIndex; $cellBCol = trim($currentSheet->getCell($addrBCol)->getValue()); //共同参数参数内容cont $addrCCol = $colCIndex . $rowIndex; $cellCCol = trim($currentSheet->getCell($addrCCol)->getValue()); $arrRPSamePara[] = array($cellBCol, $cellCCol); } //end 共同参数 //=============================================== //自定义表格 --表标题 if ($cell === "表标题A") { //表标题 $addrBCol = $colBIndex . $rowIndex; $cellBCol = trim($currentSheet->getCell($addrBCol)->getValue()); $arrTabTitleA[] = $cellBCol; } //end 自定义表格 --表标题 //=============================================== //自定义表格 --表头 if ($cell === "表头A") { //表头 $addrBCol = $colBIndex . $rowIndex; $cellBCol = trim($currentSheet->getCell($addrBCol)->getValue()); //将字符串数值的表头值转为数组 $arrTabHeadA = explode(',', $cellBCol); //取出每个表头值的两头的空格 foreach ($arrTabHeadA as &$v) { $v = trim($v); } } //end 自定义表格--表头 //=============================================== //自定义表格 --表内容 if ($cell === "表内容A") { //表内容 $addrBCol = $colBIndex . $rowIndex; $cellBCol = trim($currentSheet->getCell($addrBCol)->getValue()); //将字符串数值的表头值转为数组 $arrTabContA = explode('\\n', $cellBCol); foreach ($arrTabContA as &$v) { $v = explode(',', $v); foreach ($v as &$vv) { $vv = trim($vv); } } } //end 自定义表格--表内容 //=============================================== //自定义表格 --表标题 if ($cell === "表标题B") { //表标题 $addrBCol = $colBIndex . $rowIndex; $cellBCol = trim($currentSheet->getCell($addrBCol)->getValue()); $arrTabTitleB[] = $cellBCol; } //end 自定义表格 --表标题 //=============================================== //自定义表格 --表头 if ($cell === "表头B") { //表头 $addrBCol = $colBIndex . $rowIndex; $cellBCol = trim($currentSheet->getCell($addrBCol)->getValue()); //将字符串数值的表头值转为数组 $arrTabHeadB = explode(',', $cellBCol); //取出每个表头值的两头的空格 foreach ($arrTabHeadB as &$v) { $v = trim($v); } } //end 自定义表格--表头 //=============================================== //自定义表格 --表内容 if ($cell === "表内容B") { //表内容 $addrBCol = $colBIndex . $rowIndex; $cellBCol = trim($currentSheet->getCell($addrBCol)->getValue()); //将字符串数值的表头值转为数组 $arrTabContB = explode('\\n', $cellBCol); foreach ($arrTabContB as &$v) { $v = explode(',', $v); foreach ($v as &$vv) { $vv = trim($vv); } } } //end 自定义表格--表内容 //=============================================== // 产品分类和小图 if ($cell === "产品分类") { $rowIndexNext = $rowIndex + 1; //产品分类 $addrNextRow = $colIndex . $rowIndexNext; //下一行 $cellNextRow = trim($currentSheet->getCell($addrNextRow)->getValue()); //classify0 //小图 $addrNextRowDcol = $colDIndex . $rowIndexNext; //下一行 $cellNextRowDcol = trim($currentSheet->getCell($addrNextRowDcol)->getValue()); //samllpicSrc $arrRPDiffPara[] = array("0" => $cellNextRow, "2" => $cellNextRowDcol); } //end 产品分类和小图 //=============================================== //不同参数表 if ($cell === "产品规格") { $rowIndexNext = $rowIndex; do { $rowIndexNext++; $addrNextRow = $colIndex . $rowIndexNext; //下一行 $cellNextRow = trim($currentSheet->getCell($addrNextRow)->getValue()); //3w//5w $addrCCol = $colCIndex . $rowIndexNext; //C列 $cellCCol = trim($currentSheet->getCell($addrCCol)->getValue()); //33//55 //判断读取多少行二级分类产品规格 if (!($cellNextRow === "产品规格" || empty($cellNextRow))) { //0 //1 $arrProDiffParaNum[] = array($cellNextRow, $cellCCol); //array(array('3w','33'),array('5w','55'),); } } while (!($cellNextRow === "产品规格" || empty($cellNextRow))); //把二级产品分类数组赋给二级产品分类总数组,并清空二级产品分类数组,准备下次的分类存储 $arrDiffPataTableNum[$tableNum] = $arrProDiffParaNum; $arrProDiffParaNum = array(); $tableNum++; } //end -产品规格 //=============================================== } //end-col(结束列循环) } //end-row(结束行循环) /**整合处理不同参数分类名 小图和不同参数表*/ $diffParaTableCount = count($arrDiffPataTableNum); //产品分类数量//3 for ($i = 0; $i < $diffParaTableCount; $i++) { $arrRPDiffPara[$i][1] = $arrDiffPataTableNum[$i]; } /**查询数据库返回处理后 的推广类产品的数组**/ $arrRPAAdProAFTER = array(); $arrRPBAdProAFTER = array(); $arrRPCAdProAFTER = array(); $arrRPDAdProAFTER = array(); if (!empty($arrRPAAdProBEFORE)) { $arrRPAAdProAFTER = ADRPProDB($arrRPAAdProBEFORE); } if (!empty($arrRPBAdProBEFORE)) { $arrRPBAdProAFTER = ADRPProDB($arrRPBAdProBEFORE); } if (!empty($arrRPCAdProBEFORE)) { $arrRPCAdProAFTER = ADRPProDB($arrRPCAdProBEFORE); } if (!empty($arrRPDAdProBEFORE)) { $arrRPDAdProAFTER = ADRPProDB($arrRPDAdProBEFORE); } /**将所有数组整合成一个数组以便返回**/ $productMessage["产品标题"] = $arrRPProTitle; $productMessage["视频链接"] = $arrRPVideoUrl; $productMessage["产品描述"] = $arrRPProDesc; $productMessage["产品图片"] = $arrRPProPic; $productMessage["海报图"] = $arrRPBanner; $productMessage["场景图"] = $arrRPResultShowPicSrc; $productMessage["产品包裹"] = $arrRPProPackage; $productMessage["产品亮点"] = $arrRPProBrightSpot; $productMessage["购物细节"] = $arrRPShoppingDetails; $productMessage["A类推广产品"] = $arrRPAAdProAFTER; $productMessage["B类推广产品"] = $arrRPBAdProAFTER; $productMessage["C类推广产品"] = $arrRPCAdProAFTER; $productMessage["D类推广产品"] = $arrRPDAdProAFTER; $productMessage["其它"] = $arrRPOters; $productMessage["证书"] = $arrRPCertificate; $productMessage["共同参数"] = $arrRPSamePara; $productMessage['不同参数'] = $arrRPDiffPara; $productMessage['表标题A'] = $arrTabTitleA; $productMessage['表头A'] = $arrTabHeadA; $productMessage['表内容A'] = $arrTabContA; $productMessage['表标题B'] = $arrTabTitleB; $productMessage['表头B'] = $arrTabHeadB; $productMessage['表内容B'] = $arrTabContB; } //end-IF($isuploadO) //存储数据到数组后,便可删除excel表 if (file_exists($excelFilePath)) { unlink($excelFilePath); } //var_dump($productMessage);die; return $productMessage; }
function downloadError() { $file = $this->session_token_model->getData($this->session_token, 'error_upload_number_file'); if (!$file) { output_error('没有日志可供下载'); } $pars_default = array('sheetIndex' => 0, 'headerKey' => TRUE, 'readColumn' => array('运单号码', '商家代码', '快递公司')); $data = loadExcel($file, $pars_default); if (!$data) { //output_error('数据有问题,列都不匹配'); $msg = array('数据有问题,列都不匹配'); $header = array('msg' => '消息'); outputCSV($msg, $header); } $msg = $this->customer_number_model->validateData($data); $header = array('msg' => '消息'); outputCSV($msg, $header); }
public function validate_import() { $this->task = $this->task_model->getNewTask(); if (empty($this->task)) { echo 'no task' . PHP_EOL; exit; } $file_id = $this->task['file_id']; $file = $this->file_upload_model->getFile($file_id); $file_dir = './upload/excel/' . date('Ym', strtotime($file['created_at'])) . '/'; $file_path = FCPATH . $file_dir . $file['file_save_name']; if (!file_exists($file_path)) { echo 'file not exists' . PHP_EOL; exit; } $tempName = explode('.', $file['file_save_name']); $err_file = FCPATH . $file_dir . $tempName[0] . '_error.csv'; write_log("开始验证 " . $file['file_name'] . " - " . $file['file_save_name']); //状态改为进行中 $this->task_model->update($this->task['task_id'], 2); $pars_default = array('sheetIndex' => 0, 'headerKey' => TRUE, 'readColumn' => array('运单号', '重量', '计费目的网点名称', '计费目的网点代码', '揽收时间', '快递公司')); $data = loadExcel($file_path, $pars_default); if (!$data) { echo 'wrong excel, no data' . PHP_EOL; exit; } //更新总数 $upd_data = array('item_total' => count($data), 'status' => 2); $this->file_upload_model->update($file_id, $upd_data); //更新总数完毕 $repeat_number = $this->tracking_number_model->checkExcelField($data, '运单号'); if ($repeat_number) { //改为未通过 $upd_data = array('status' => 3); $this->file_upload_model->update($file_id, $upd_data); $msg = array(); foreach ($repeat_number as $number) { $msg[] = array('msg' => 'Excel内部重复的运单号:' . $number); } $header = array('msg' => '消息'); saveCSV($msg, $header, $err_file); output_error('Excel内部运单号重复,验证未通过'); } write_log("Excel内部验证完毕,开始数据库验证 \r\n - - - - - - - - - - - - - -- - - -"); $msg = $this->tracking_number_model->validateData($data, $file_id); write_log("验证 " . $file['file_name'] . " - " . $file['file_save_name'] . " 完毕\r\n- - - - - - - - - - - - - - - - - - - - - - -"); if ($msg) { //改为未通过 $upd_data = array('status' => 3); $this->file_upload_model->update($file_id, $upd_data); $header = array('msg' => '消息'); saveCSV($msg, $header, $err_file); //任务状态改为完成 $this->task_model->update($this->task['task_id'], 1); echo 'error in file' . PHP_EOL; exit; } //改为验证通过 $upd_data = array('item_total' => count($data), 'status' => 4); $this->file_upload_model->update($file_id, $upd_data); write_log("部验证完毕,开始导入数据"); $num = $this->tracking_number_model->importData($data, $file_id); write_log("导入 " . $file['file_name'] . " 完成,共 {$num} 条记录\r\n- - - - - - - - - - - - - - - - - - - - - - -"); //状态改为导入成功 $upd_data = array('status' => 1, 'import_time' => date('Y-m-d H:i:s')); $this->file_upload_model->update($file_id, $upd_data); //任务状态改为完成 $this->task_model->update($this->task['task_id'], 1); //如果有错误日志文件,就删除 if (file_exists($err_file)) { unlink($err_file); } echo 'import over' . PHP_EOL; exit; }