소스 검색

[智价云] 数据导出数量过多增加限制

tangyuanwang 4 주 전
부모
커밋
513df89ae9
2개의 변경된 파일16개의 추가작업 그리고 0개의 파일을 삭제
  1. 8 0
      app/Http/Controllers/Manager/Process/LowPriceGoods.php
  2. 8 0
      app/Http/Controllers/Manager/Process/ViolationProduct.php

+ 8 - 0
app/Http/Controllers/Manager/Process/LowPriceGoods.php

@@ -277,6 +277,14 @@ class LowPriceGoods extends Controller
                 $query1->select('lowprice_product_logid')->fromSub($subQuery, 'sub1');
             });
         }
+        $result_totle = $LowPriceGoodsModel
+            ->where($map)
+            ->orderByDesc('id')
+            ->count();
+        // 数量过多时,限制导出
+        if ($result_totle > 10000) {
+            return json_send(['code' => 'error', 'msg' => '导出数据过多,请缩小查询条件']);
+        }
         $result = $LowPriceGoodsModel
             ->where($map)
             ->orderByDesc('id')

+ 8 - 0
app/Http/Controllers/Manager/Process/ViolationProduct.php

@@ -277,6 +277,14 @@ class ViolationProduct extends Controller
                 $query1->select('violation_product_logid')->fromSub($subQuery, 'sub1');
             });
         }
+        $result_totle = $ViolationProductModel
+            ->where($map)
+            ->orderByDesc('id')
+            ->count();
+        // 数量过多时,限制导出
+        if ($result_totle > 10000) {
+            return json_send(['code' => 'error', 'msg' => '导出数据过多,请缩小查询条件']);
+        }
         $result = $ViolationProductModel
             ->where($map)
             ->orderByDesc('id')