From e0fce64e1846cc35d2a89b1bf7d1c6e240ec4978 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=BB=BA=E7=82=8A?= <924182103@qq.com> Date: Thu, 8 Aug 2024 17:06:50 +0800 Subject: [PATCH] =?UTF-8?q?=E9=B2=9C=E8=8A=B12.0-=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=B5=8B=E8=AF=95bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Supplier/PurchaseRecordController.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/Supplier/PurchaseRecordController.php b/app/Http/Controllers/Supplier/PurchaseRecordController.php index 8041a44..bb9f962 100644 --- a/app/Http/Controllers/Supplier/PurchaseRecordController.php +++ b/app/Http/Controllers/Supplier/PurchaseRecordController.php @@ -69,10 +69,15 @@ class PurchaseRecordController extends Controller if (!empty($goodsSku)) { $expireDay = DeveloperConfigService::getDefaultExpireDay(); $today = DateTimeUtils::getToday(); - $buyerUserId = User::query()->where("name", $allParams['buyer_name'] ?? '') - ->pluck("id")->first(); - $supplierId = Suppliers::query()->where("name", $allParams['supplier_name'] ?? '') - ->pluck("id")->first(); + if (empty($allParams['buyer_user_id'])) { + $buyerUserId = User::query()->where("name", $allParams['buyer_name'] ?? '') + ->pluck("id")->first(); + } + if (empty($allParams['supplier_id'])) { + $supplierId = Suppliers::query()->where("supplier_name", $allParams['supplier_name'] ?? '') + ->pluck("id")->first(); + } + //保存記錄 $purchaseRecords = new PurchaseRecords(); $purchaseRecords->external_sku_id = $allParams['external_sku_id'];