Browse Source

搜索结果

kphcdr 1 year ago
parent
commit
9edb00be07
1 changed files with 4 additions and 2 deletions
  1. 4 2
      app/Console/Commands/TestCommand.php

+ 4 - 2
app/Console/Commands/TestCommand.php

@@ -51,8 +51,10 @@ class TestCommand extends Command
 
 
     public function search()
     public function search()
     {
     {
-        Goods::get()->map(function (Goods $g) {
-            app(GoodsService::class)->createIndex($g);
+        Goods::chunk(100, function ($goods) {
+            $goods->each(function (Goods $g) {
+                app(GoodsService::class)->createIndex($g);
+            });
         });
         });
     }
     }
 }
 }