ShuanghongS 3 minggu lalu
induk
melakukan
eec133c811
1 mengubah file dengan 14 tambahan dan 0 penghapusan
  1. 14 0
      service/report.class.php

+ 14 - 0
service/report.class.php

@@ -614,6 +614,11 @@ class report {
          * export excel
         */
         if ($operate == "excel") {
+            $max_ec = ini_get('max_execution_time'); //set max_excution_time
+            ini_set('max_execution_time', '0');
+            $memory_limit = ini_get("memory_limit");
+            ini_set("memory_limit", '2048M');
+            try {
             $sql = common::deCode($_POST['tmp_search'], 'D');
             $tmp_mapping = common::deCode($_POST['tmp_mapping'], 'D');
             $mappingConfig = json_decode($tmp_mapping,true);
@@ -651,6 +656,15 @@ class report {
                 $convertedRs[] = $newRow;
             }
             common::echo_json_encode(200,array("msg"=>"success","Data" => $convertedRs));
+            } catch (Exception $exc) {
+                error_log("report datail download:".$exc->getTraceAsString());
+                //处理异常,标记归位
+                ini_set('max_execution_time', $max_ec); //recover old value
+                ini_set("memory_limit", $memory_limit);
+            }
+            
+            ini_set('max_execution_time', $max_ec); //recover old value
+            ini_set("memory_limit", $memory_limit);
             exit;
         }