From a3147b010256f6502af2b5f912364f099860df6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E9=B9=8F?= Date: Mon, 20 Jan 2020 12:00:24 +0800 Subject: [PATCH] fix --- .../updatetrain/controllers/updatestation.php | 47 ++++++++++--------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/application/third_party/updatetrain/controllers/updatestation.php b/application/third_party/updatetrain/controllers/updatestation.php index 262168bf..952c6634 100644 --- a/application/third_party/updatetrain/controllers/updatestation.php +++ b/application/third_party/updatetrain/controllers/updatestation.php @@ -10,7 +10,7 @@ defined('BASEPATH') or exit('No direct script access allowed'); -ini_set('memory_limit','256M'); +ini_set('memory_limit', '256M'); class updatestation extends CI_Controller { @@ -30,13 +30,14 @@ class updatestation extends CI_Controller $this->load->view('bootstrap3/footer'); } - public function test(){ - $results=""; - for($i=1; $i<=2000000; $i++){ - $results.='"'.$i.'"'; + public function test() + { + $results = ""; + for ($i = 1; $i <= 2000000; $i++) { + $results .= '"' . $i . '"'; } $len = strlen($results); - header("Content-Length: ".$len); + header("Content-Length: " . $len); header("Content-Encoding:UTF-8"); echo $results; } @@ -54,7 +55,7 @@ class updatestation extends CI_Controller $arr_Station = explode("@", str_replace("';", "", str_replace("var station_names ='", "", $StationData))); //print_r($arr_Station); $NewStation = ""; - $UpdateStaion=""; + $UpdateStaion = ""; for ($i = 0; $i < count($arr_Station); $i++) { if ($arr_Station[$i] != null) { $arr_StationDetail = explode("|", $arr_Station[$i]); @@ -69,7 +70,7 @@ class updatestation extends CI_Controller $strStation = "@-1|" . $TRS_Code . "|" . $TRS_Station . "|" . $TRS_StationCN . "|2|"; $UpdateStaion .= $strStation; //表操作 - // $this->station_model->UpdateStation($TRS_Code, $TRS_StationCN); + // $this->station_model->UpdateStation($TRS_Code, $TRS_StationCN); } else if ($isNew == 2) { //新增 $strStation = "@9999|" . $TRS_Code . "|" . $TRS_Station . "|" . $TRS_StationCN . "|2|"; @@ -82,21 +83,24 @@ class updatestation extends CI_Controller } } } - $NewStationList = $UpdateStaion.$NewStation; - //发送邮件 - $this->station_model->SendMail( - "UpdateStationSystem", - "noreplay@email.com", - 'zhaopeng', - 'zhaopeng@hainatravel.com', - 'New Station(by12306):' . date("Y-m-d"), - $NewStationList - ); + $NewStationList = $UpdateStaion . $NewStation; - $len = strlen($NewStationList);//count( explode("@",$NewStationList))-1; - header("Content-Length: ".$len); + $len = strlen($NewStationList); //count( explode("@",$NewStationList))-1; + header("Content-Length: " . $len); header("Content-Encoding:UTF-8"); echo $NewStationList; + + if ($len > 0) { + //发送邮件 + $this->station_model->SendMail( + "UpdateStationSystem", + "noreplay@email.com", + 'zhaopeng', + 'zhaopeng@hainatravel.com', + 'New Station(by12306):' . date("Y-m-d"), + $NewStationList + ); + } } /** @@ -123,10 +127,9 @@ class updatestation extends CI_Controller $arr_StationFileDetail = explode("|", $arr_StationFile[$j]); //对比目前的站点文件,如果是新的就保存 if ($arr_StationDetail[2] == $arr_StationFileDetail[1] && $arr_StationDetail[1] == $arr_StationFileDetail[3]) { - + $isNew = false; break; - } } }