haozi 4 лет назад
Родитель
Сommit
9a1ebd3f40
2 измененных файлов с 2 добавлено и 24 удалено
  1. 1 12
      app/Services/StoreItemService.php
  2. 1 12
      app/Services/StoreService.php

+ 1 - 12
app/Services/StoreItemService.php

@@ -217,18 +217,7 @@ class StoreItemService
                 ];
             }
         }
-        if (count($updateParams) > 0) {
-            foreach (array_chunk($updateParams, 1000) as $item) {
-                try {
-                    $bool = $this->batchUpdate($item);
-                    if ($bool) {
-                        app('LogService')->log(__METHOD__, __FUNCTION__, "批量修改 store_item success " . count($item) . ' || ' . json_encode($item));
-                    } else app('LogService')->log(__METHOD__, __FUNCTION__, "批量修改 store_item FAILED " . ' || ' . json_encode($item));
-                } catch (\Exception $e) {
-                    app('LogService')->log(__METHOD__, __FUNCTION__, "批量修改 store_item ERROR " . ' || ' . json_encode($updateParams) . ' || ' . json_encode($e->getMessage()) . ' || ' . json_encode($e->getTraceAsString()));
-                }
-            }
-        }
+        if (count($updateParams) > 1) $this->batchUpdate($updateParams);
         if (count($delete_storeItems) > 0) $this->deleteStoreItem($delete_storeItems);
         unset($updateParams, $asnDetails, $delete_storeItems);
     }

+ 1 - 12
app/Services/StoreService.php

@@ -223,18 +223,7 @@ class StoreService
                 ];
             }
         }
-        if (count($updateParams) > 1) {
-            foreach (array_chunk($updateParams, 1000) as $item) {
-                try {
-                    $bool=$this->batchUpdate($item);
-                    if ($bool) {
-                        app('LogService')->log(__METHOD__, __FUNCTION__, "批量修改 store success " . count($item) . ' || ' . json_encode($item));
-                    } else app('LogService')->log(__METHOD__, __FUNCTION__, "批量修改 store FAILED " . ' || ' . json_encode($item));
-                } catch (\Exception $e) {
-                    app('LogService')->log(__METHOD__, __FUNCTION__, "批量修改 store ERROR " . ' || ' . json_encode($updateParams) . ' || ' . json_encode($e->getMessage()) . ' || ' . json_encode($e->getTraceAsString()));
-                }
-            }
-        }
+        if (count($updateParams) > 1) $this->batchUpdate($updateParams);
         /** @var StoreItemService $storeItemService */
         $storeItemService = app(StoreItemService::class);
         $storeItemService->storeItemUpdateByWms($asnHerders);