From 0f4d91e93909887419028415576d5fb1896682e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=BB=BA=E7=82=8A?= <924182103@qq.com> Date: Fri, 8 Nov 2024 18:10:00 +0800 Subject: [PATCH 1/5] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Supplier/DailyStockRecordController.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/Supplier/DailyStockRecordController.php b/app/Http/Controllers/Supplier/DailyStockRecordController.php index d44c913..c111e9e 100644 --- a/app/Http/Controllers/Supplier/DailyStockRecordController.php +++ b/app/Http/Controllers/Supplier/DailyStockRecordController.php @@ -42,7 +42,13 @@ class DailyStockRecordController extends Controller $query->where('external_sku_id', '=', $request->external_sku_id); }); } - $dailyStockRecord = $build->orderByDesc("id")->paginate($request->get('per_page')); + $start = $request->get("start_time"); + $end = $request->get("end_time"); + $dailyStockRecord = $build->when($start, function ($query) use ($start) { + $query->where("created_at", ">=", $start); + })->when($end, function ($query) use ($end) { + $query->where("created_at", ">=", $end); + })->orderByDesc("id")->paginate($request->get('per_page')); return JsonResource::collection($dailyStockRecord); } @@ -71,7 +77,7 @@ class DailyStockRecordController extends Controller ]; return response($this->res, $this->res['httpCode']); } - $goodsSkuWithInventory = array_merge($goodsSku->toArray(),["inventory"=>$request->inventory]); + $goodsSkuWithInventory = array_merge($goodsSku->toArray(), ["inventory" => $request->inventory]); //同批量逻辑操作 $goodSkuService = new GoodSkuService(); $goodSkuService->inventory([$goodsSkuWithInventory]); @@ -94,7 +100,7 @@ class DailyStockRecordController extends Controller $this->setValidatorFailResponse($validator->getMessageBag()->getMessages()); return response($this->res, $this->res['httpCode']); } - $inventoryKeyByExternalSkuIdMap = collect($request->inventoryOrders)->pluck(null,"external_sku_id")->toArray(); + $inventoryKeyByExternalSkuIdMap = collect($request->inventoryOrders)->pluck(null, "external_sku_id")->toArray(); $goodsSkus = GoodsSku::query()->with("combinationGoods")->whereIn('external_sku_id', array_keys($inventoryKeyByExternalSkuIdMap)) ->get()->toArray(); $goodsSkus = collect($goodsSkus)->map(function ($v) use ($inventoryKeyByExternalSkuIdMap) { @@ -103,7 +109,7 @@ class DailyStockRecordController extends Controller return $v; } })->toArray(); - Log::info("goodsSkus",$goodsSkus); + Log::info("goodsSkus", $goodsSkus); $goodSkuService = new GoodSkuService(); $goodSkuService->inventory($goodsSkus); return response($this->res, $this->res['httpCode']); From 13021d439a680bc8ccbdf7aa9d6d3091427d8554 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=BB=BA=E7=82=8A?= <924182103@qq.com> Date: Fri, 8 Nov 2024 18:10:36 +0800 Subject: [PATCH 2/5] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Supplier/DailyStockRecordController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Supplier/DailyStockRecordController.php b/app/Http/Controllers/Supplier/DailyStockRecordController.php index c111e9e..3fbe7ed 100644 --- a/app/Http/Controllers/Supplier/DailyStockRecordController.php +++ b/app/Http/Controllers/Supplier/DailyStockRecordController.php @@ -47,7 +47,7 @@ class DailyStockRecordController extends Controller $dailyStockRecord = $build->when($start, function ($query) use ($start) { $query->where("created_at", ">=", $start); })->when($end, function ($query) use ($end) { - $query->where("created_at", ">=", $end); + $query->where("created_at", "<=", $end); })->orderByDesc("id")->paginate($request->get('per_page')); return JsonResource::collection($dailyStockRecord); } From fbc2eeb42c1a01d01c298ddd348c024cb4c9ba53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=BB=BA=E7=82=8A?= <924182103@qq.com> Date: Mon, 11 Nov 2024 09:35:21 +0800 Subject: [PATCH 3/5] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Events/BusinessOrdersUpdate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Events/BusinessOrdersUpdate.php b/app/Events/BusinessOrdersUpdate.php index cf2aac2..aae7f84 100644 --- a/app/Events/BusinessOrdersUpdate.php +++ b/app/Events/BusinessOrdersUpdate.php @@ -72,7 +72,7 @@ class BusinessOrdersUpdate $updateParam['status'] = GoodsSku::$STATUS_ON_SALE; } - Log::info("sku 业务订单库存更:{$this->goodsSku->id}", $updateParam); + Log::info("sku 业务订单库存更:{$this->goodsSku->id},numoldStock:{$this->num}", [$updateParam, (array)$this->goodsSku]); //乐观锁更新 return GoodsSku::query()->where('external_sku_id', $this->businessGoodSku['external_sku_id'])-> where("stock", "=", $oldStock)->update($updateParam); From efcde2d5dfc0b812299c2b84e15b0cc1a028bbd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=BB=BA=E7=82=8A?= <924182103@qq.com> Date: Mon, 11 Nov 2024 09:37:19 +0800 Subject: [PATCH 4/5] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Events/BusinessOrdersUpdate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Events/BusinessOrdersUpdate.php b/app/Events/BusinessOrdersUpdate.php index aae7f84..e6cfed1 100644 --- a/app/Events/BusinessOrdersUpdate.php +++ b/app/Events/BusinessOrdersUpdate.php @@ -72,7 +72,7 @@ class BusinessOrdersUpdate $updateParam['status'] = GoodsSku::$STATUS_ON_SALE; } - Log::info("sku 业务订单库存更:{$this->goodsSku->id},numoldStock:{$this->num}", [$updateParam, (array)$this->goodsSku]); + Log::info("sku 业务订单库存更:{$this->goodsSku->id},num:{$this->num}", [$updateParam, (array)$this->goodsSku]); //乐观锁更新 return GoodsSku::query()->where('external_sku_id', $this->businessGoodSku['external_sku_id'])-> where("stock", "=", $oldStock)->update($updateParam); From 51e8f3a9fbb23936c5142c2630e6f6dd30fcea4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=BB=BA=E7=82=8A?= <924182103@qq.com> Date: Mon, 11 Nov 2024 10:52:37 +0800 Subject: [PATCH 5/5] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Shop/ShopsController.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Http/Controllers/Shop/ShopsController.php b/app/Http/Controllers/Shop/ShopsController.php index 2df0ca0..2ae90be 100644 --- a/app/Http/Controllers/Shop/ShopsController.php +++ b/app/Http/Controllers/Shop/ShopsController.php @@ -224,6 +224,7 @@ class ShopsController extends Controller ->get() ->toArray(); $business->batchIncrQuantity($businessGoodsSkus, $stock, false); + usleep(10); } }