ShuanghongS 1 mēnesi atpakaļ
vecāks
revīzija
cf431888ec
1 mainītis faili ar 18 papildinājumiem un 48 dzēšanām
  1. 18 48
      service/ocean_order.class.php

+ 18 - 48
service/ocean_order.class.php

@@ -92,52 +92,20 @@ class ocean_order {
         * download  batch document 
         */
         if ($operate == "batch_download") {
-            $url_param = $_POST['url_param'];
-            $url = $_POST['url'];
-            $h_bol = $_POST['h_bol'];
-            $label = $_POST['label'];
-            $standard = $_POST['standard'];
-            $is_topocean = $_POST['is_topocean'];
-
+            $data = $_POST['data'];
             $fileMap = array();
-            foreach($url_param as $key => $_url_param){
+            foreach($data as $key => $_data){
+                $url_param = $_data['url_param'];
+                $url = $_data['url'];
+                $h_bol = $_data['h_bol'];
+                $label = $_data['label'];
+                $standard = $_data['standard'];
+                $is_topocean = $_data['is_topocean'];
                 if($is_topocean[$key] == 't'){
+                    //这个不会进来,现在文件全是从online 这边查询的
                     continue;
-                    //远程获取文件,并保存到服务器
-                    // $opts = array(
-                    //     'http'=>array(
-                    //         'method'=>"GET",
-                    //         'timeout'=>300,
-                    //     )
-                    // );
-                    // $context = stream_context_create($opts);
-                    // $jd = file_get_contents($url, false, $context);
-                    // //测试数据
-                    // $jd = json_decode(trim($jd,"\xEF\xBB\xBF"),true);
-                    // $data = base64_decode($jd['data']);
-                    
-                    // $old_filename = $jd['filename'];
-                   
-                    // $file_path = FILE_UPLOAD_PAHT . date("Ymd") . DS. date('His') . DS;
-                    // if (!is_dir($file_path)) {
-                    //     common::mkdirs($file_path);
-                    // }
-                    // if (file_exists($file_path . $old_filename)) {
-                    //     $old_filename = common::uuid() . $old_filename;
-                    // }
-                    // $path = $file_path . $old_filename;
-                    // $myfile = fopen($path, "w") or die("Unable to open file!");
-                    // fwrite($myfile, $data);
-                    // fclose($myfile);
-
-                    // $fileMap[] = [
-                    //         'file_path' => $path,
-                    //         'h_bol' => $h_bol[$key],
-                    //         'format_name' => $label[$key],
-                    //         'standard' => $standard[$key]
-                    //     ];
                 }else{
-                    $filename = common::deCode($_url_param, 'D');
+                    $filename = common::deCode($url_param, 'D');
                     $filename = str_replace("/", DIRECTORY_SEPARATOR, $filename);
                     $filename = str_replace("\\", DIRECTORY_SEPARATOR, $filename);
                     if (!file_exists($filename))
@@ -145,9 +113,9 @@ class ocean_order {
 
                     $fileMap[] = [
                             'file_path' => $filename,
-                            'h_bol' => $h_bol[$key],
-                            'format_name' => $label[$key],
-                            'standard' => $standard[$key]
+                            'h_bol' => $h_bol,
+                            'format_name' => $label,
+                            'standard' => $standard
                         ];
                 }
             }
@@ -326,7 +294,8 @@ class ocean_order {
                                     '" . common::check_input($from_station) . "', '" . $serial_no . "',
                                     '" . common::check_input($file_type) . "','" . common::check_input($format_serialno) . "','" . common::check_input($filename) . "');";        
                         } else {
-                            error_log("Upload Filed Failed: move_uploaded_file error");
+                            error_log("Upload Filed Failed: move_uploaded_file error,".$save_path . $filename);
+                            error_log("Upload Filed Info:".json_encode($_FILES));
                             $errorMsg = "Upload Filed Failed.";
                             continue;
                         }
@@ -2070,7 +2039,7 @@ class ocean_order {
                 $file_serial_nos = utils::implode(';',$file_serial_nos);
 
                 $filefilter = " ('TELEX') ";
-                $fileSql = "SELECT ff.format_name,ff.standard
+                $fileSql = "SELECT ff.format_name,ff.standard,
                             file_path, file_name, upload_by, to_char(upload_date, 'MM/DD/YYYY') as upload_date
                         from $_schemas.air_doc_upload 
                             left join $_schemas.air_file_format ff on ff.serial_no = air_doc_upload.format_serailno
@@ -2472,7 +2441,7 @@ class ocean_order {
             if(!empty($ocean_milestone_status_code['IFFDEL']['act_date'])){
                 $children[] = array("label" =>"Cargo handover/Delivered","date" =>$ocean_milestone_status_code['IFFDEL']['act_date']);
             }
-        }                 
+        }
         $simplexData[] = $place_of_Delivery_status;
         $data['shipmentData'] = $simplexData;
 
@@ -2738,6 +2707,7 @@ class ocean_order {
                 'url'        => $file['url'],
                 'url_param'  => $file['url_param'],
                 'detail'     => $file['detail'],
+                "file_name"  => $file['file_name'],
                 'h_bol'      => $h_bol,
                 'label'      => $formatName,
                 'is_topocean'=> $file['is_topocean']