瀏覽代碼

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

tangyuanwang 4 周之前
父節點
當前提交
513df89ae9

+ 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');
                 $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
         $result = $LowPriceGoodsModel
             ->where($map)
             ->where($map)
             ->orderByDesc('id')
             ->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');
                 $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
         $result = $ViolationProductModel
             ->where($map)
             ->where($map)
             ->orderByDesc('id')
             ->orderByDesc('id')