Просмотр исходного кода

[智价云] 导出查询更新

tangyuanwang 8 часов назад
Родитель
Сommit
88ed10a778

+ 9 - 9
app/Http/Controllers/Manager/Process/LowPriceGoods.php

@@ -269,7 +269,7 @@ class LowPriceGoods extends Controller
         $message_data['shipment_city_ids'] = request('shipment_city_ids', '');
         $message_data['product_brand'] = request('product_brand', '');
         $message_data['collection_time_start_time'] = request('collection_time_start_time', '');
-        $message_data['collection_time_end_time'] = request('product_brand', '');
+        $message_data['collection_time_end_time'] = request('collection_time_end_time', '');
 
         $low_price_goods_where = [];
         // 权限判断
@@ -278,12 +278,6 @@ class LowPriceGoods extends Controller
         } else {
             $low_price_goods_where['company_id']  = $message_data['admin_company_id'];
         }
-
-        $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,'1', 60 * 60 * 3);
         // 查询条件
         $map  = [];
         $job_page = isset($message_data['job_page']) ? $message_data['job_page'] : 1;
@@ -447,14 +441,20 @@ 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'];
+        $export_data_info = Cache::get($key_name);
+        if ($export_data_info) return json_send(['code' => 'fail', 'msg' => '导出任务正在执行中,请稍后再试', 'data' => '']);
+        //创建缓存
+        Cache::put($key_name,'1', 60 * 60 * 3);
+
         // 生成唯一文件ID
         $fileId                     = make_snow_flake();
         $message_data['file_id']    = $fileId;
         $fileName = '低价挂网商品数据' . $fileId . '.xlsx';
         $message_data['company_id']    = $low_price_goods_where['company_id'];
         $message_data['user_id']    = $message_data['user_id'];
-        ExportLowPriceGoodsJobs::dispatch($message_data);
-        // ExportLowPriceGoodsJobs::dispatchSync($message_data);
+        // ExportLowPriceGoodsJobs::dispatch($message_data);
+        ExportLowPriceGoodsJobs::dispatchSync($message_data);
         return json_send(['code' => 'success', 'msg' => '导出任务添加成功', 'data' => ['file_id' => $fileId, 'file_name' => $fileName]]);
     }
 

+ 6 - 6
app/Http/Controllers/Manager/Process/ViolationProduct.php

@@ -278,12 +278,6 @@ class ViolationProduct extends Controller
         } else {
             $violation_product_where['company_id']  = $message_data['admin_company_id'];
         }
-        $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,'1', 60 * 60 * 3);
-
 
         $admin_company_id = $message_data['admin_company_id'];
         $company_id = $message_data['company_id'];
@@ -443,6 +437,12 @@ 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'];
+        $export_data_info = Cache::get($key_name);
+        if ($export_data_info) return json_send(['code' => 'fail', 'msg' => '导出任务正在执行中,请稍后再试', 'data' => '']);
+        //创建缓存
+        Cache::put($key_name,'1', 60 * 60 * 3);
+
         // 生成唯一文件ID
         $fileId                     = make_snow_flake();
         $message_data['file_id']    = $fileId;