From ccbd53a895bb788d5e33bf3354954f6f3ac7c0ea Mon Sep 17 00:00:00 2001 From: yaooo <272523191@qq.com> Date: Mon, 4 Sep 2023 13:08:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=8A=B6=E6=80=81=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/api/store/product/StoreSpu.php | 3 ++- app/listener/CloudProduct.php | 3 ++- app/listener/ProductCreate.php | 3 ++- app/listener/paySuccessOrder.php | 4 ++-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/controller/api/store/product/StoreSpu.php b/app/controller/api/store/product/StoreSpu.php index 182e9b8b..39f4ab72 100644 --- a/app/controller/api/store/product/StoreSpu.php +++ b/app/controller/api/store/product/StoreSpu.php @@ -143,12 +143,13 @@ class StoreSpu extends BaseController ]); if ($where['action']) unset($where['product_type']); $currentMerchant = Db::name('merchant')->where('mer_id',$id)->field('category_id,street_id')->find(); + $typeCloudWarehouseId = Db::name('MerchantType')->where('type_code', Merchant::TypeCode['TypeCloudWarehouse'])->value('mer_type_id'); $mer_id = Db::name('merchant') ->where('street_id',$currentMerchant['street_id']) ->where('mer_state',1) ->where('status',1) ->where('category_id',$currentMerchant['category_id']) - ->where('type_id',Merchant::TypeCloudWarehouse) + ->where('type_id', $typeCloudWarehouseId) ->value('mer_id'); if (!$mer_id) { return app('json')->success(['count'=>0,'list'=>[]]); diff --git a/app/listener/CloudProduct.php b/app/listener/CloudProduct.php index b1b8d227..9c66566e 100644 --- a/app/listener/CloudProduct.php +++ b/app/listener/CloudProduct.php @@ -18,6 +18,7 @@ class CloudProduct { $productIds = $event['product_id']; $typeStoreId = Db::name('MerchantType')->where('type_code', Merchant::TypeCode['TypeStore'])->value('mer_type_id'); + $typeCloudWarehouseId = Db::name('MerchantType')->where('type_code', Merchant::TypeCode['TypeCloudWarehouse'])->value('mer_type_id'); $products = Product::withTrashed()->whereIn('product_id', $productIds)->field('product_id,mer_id,status,is_del,is_show,mer_status,is_used')->select(); /** @var CloudProductDao $repo */ $repo = app()->make(CloudProductDao::class); @@ -29,7 +30,7 @@ class CloudProduct if (!$categoryId) { continue; } - $cloudMerchant = Merchant::getDB()->where(['type_id' => Merchant::TypeCloudWarehouse, 'category_id' => $categoryId, 'status' => 1, 'mer_state' => 1])->value('mer_id'); + $cloudMerchant = Merchant::getDB()->where(['type_id' => $typeCloudWarehouseId, 'category_id' => $categoryId, 'status' => 1, 'mer_state' => 1])->value('mer_id'); if (empty($cloudMerchant)) { continue; } diff --git a/app/listener/ProductCreate.php b/app/listener/ProductCreate.php index f5c5e833..c22b0731 100644 --- a/app/listener/ProductCreate.php +++ b/app/listener/ProductCreate.php @@ -19,7 +19,8 @@ class ProductCreate if (empty($merchant)) { return false; } - if ($merchant['type_id'] == Merchant::TypePlatform || $merchant['type_id'] == Merchant::TypeCloudWarehouse) { + $typeCloudWarehouseId = Db::name('MerchantType')->where('type_code', Merchant::TypeCode['TypeCloudWarehouse'])->value('mer_type_id'); + if ($merchant['type_id'] == Merchant::TypePlatform || $merchant['type_id'] == $typeCloudWarehouseId) { return false; } diff --git a/app/listener/paySuccessOrder.php b/app/listener/paySuccessOrder.php index dbc0d908..180f07f7 100644 --- a/app/listener/paySuccessOrder.php +++ b/app/listener/paySuccessOrder.php @@ -104,9 +104,9 @@ class paySuccessOrder } } } - + $typeCloudWarehouseId = Db::name('MerchantType')->where('type_code', Merchant::TypeCode['TypeCloudWarehouse'])->value('mer_type_id'); //云仓佣金 - $this->calculate(Merchant::TypeCloudWarehouse, 'commission_to_cloud_rate'); + $this->calculate($TypeCloudWarehouse, 'commission_to_cloud_rate'); } if ($this->remain > 0) {