ソースを参照

[智价云] 导出优化2

public 8 時間 前
コミット
52a2bbdbf4

+ 2 - 4
app/Http/Controllers/Manager/Process/LowPriceGoods.php

@@ -262,7 +262,8 @@ class LowPriceGoods extends Controller
         $key_name = 'ExportLowPriceGoodsJobs_' . $low_price_goods_where['company_id'];
         $export_data_info = Cache::get($key_name);
         if ($export_data_info) return json_send(['code' => 'fail', 'msg' => '导出任务正在执行中,请稍后再试', 'data' => '']);
-
+        //创建缓存
+        Cache::put($key_name, [], 60 * 60);
         // 查询条件
         $map  = [];
         $job_page = isset($message_data['job_page']) ? $message_data['job_page'] : 1;
@@ -410,9 +411,6 @@ class LowPriceGoods extends Controller
         if ($result_count == 0) return json_send(['code' => 'fail', 'msg' => '没有查询到数据', 'data' => '']);
         if ($result_count > 150000) return json_send(['code' => 'fail', 'msg' => '导出数据超过15万条,请缩小导出范围后再试', 'data' => '']);
 
-        $key_name = 'ExportLowPriceGoodsJobs_' . $low_price_goods_where['company_id'];
-        //创建缓存
-        Cache::put($key_name, [], 60 * 60 * 24);
         // 生成唯一文件ID
         $fileId                     = make_snow_flake();
         $message_data['file_id']    = $fileId;

+ 2 - 4
app/Http/Controllers/Manager/Process/ViolationProduct.php

@@ -261,6 +261,8 @@ class ViolationProduct extends Controller
         $key_name = 'ExportViolationProductJobs_' . $violation_product_where['company_id'];
         $export_data_info = Cache::get($key_name);
         if ($export_data_info) return json_send(['code' => 'fail', 'msg' => '导出任务正在执行中,请稍后再试', 'data' => '']);
+        //创建缓存
+        Cache::put($key_name, [], 60 * 60);
 
 
         $admin_company_id = $message_data['admin_company_id'];
@@ -406,10 +408,6 @@ class ViolationProduct extends Controller
         if ($result_count == 0) return json_send(['code' => 'fail', 'msg' => '没有查询到数据', 'data' => '']);
         if ($result_count > 150000) return json_send(['code' => 'fail', 'msg' => '导出数据超过15万条,请缩小导出范围后再试', 'data' => '']);
 
-        $key_name = 'ExportViolationProductJobs_' . $violation_product_where['company_id'];
-        //创建缓存
-        Cache::put($key_name, [], 60 * 60 * 24);
-
         // 生成唯一文件ID
         $fileId                     = make_snow_flake();
         $message_data['file_id']    = $fileId;