From e95dd996f69ae60da5c44b60b48749844535c45c Mon Sep 17 00:00:00 2001 From: yaooo <272523191@qq.com> Date: Mon, 4 Sep 2023 12:58:34 +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 | 6 ++++-- app/listener/CloudProduct.php | 4 +++- app/listener/paySuccessOrder.php | 3 ++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/controller/api/store/product/StoreSpu.php b/app/controller/api/store/product/StoreSpu.php index 1a72098b..182e9b8b 100644 --- a/app/controller/api/store/product/StoreSpu.php +++ b/app/controller/api/store/product/StoreSpu.php @@ -79,6 +79,7 @@ class StoreSpu extends BaseController public function streetLst($id) { [$page, $limit] = $this->getPage(); + $typeStoreId = Db::name('MerchantType')->where('type_code', Merchant::TypeCode['TypeStore'])->value('mer_type_id'); $where = $this->request->params([ 'keyword', 'cate_id', @@ -99,7 +100,7 @@ class StoreSpu extends BaseController $where['is_gift_bag'] = 0; $where['product_type'] = 0; $where['order'] = $where['order'] ?: 'star'; - $where['mer_ids'] = Merchant::getInstance()->where('type_id', Merchant::TypeStore)->where('street_id', $id) + $where['mer_ids'] = Merchant::getInstance()->where('type_id', $typeStoreId)->where('street_id', $id) ->where(['status' => 1, 'mer_state' => 1, 'is_del' => 0])->column('mer_id'); if ($where['is_trader'] != 1) unset($where['is_trader']); $data = $this->repository->getApiSearch($where, $page, $limit, $this->userInfo); @@ -169,6 +170,7 @@ class StoreSpu extends BaseController { [$page, $limit] = $this->getPage(); $where = $this->request->params(['common','mer_id']); + $typeStoreId = Db::name('MerchantType')->where('type_code', Merchant::TypeCode['TypeStore'])->value('mer_type_id'); $where['is_gift_bag'] = 0; //1:星级 //2:用户收藏 @@ -194,7 +196,7 @@ class StoreSpu extends BaseController } $where['product_type'] = 0; $where['is_stock'] = 1; - $where['mer_ids'] = Merchant::getInstance()->where('type_id', Merchant::TypeStore) + $where['mer_ids'] = Merchant::getInstance()->where('type_id', $typeStoreId) ->where(['status' => 1, 'mer_state' => 1, 'is_del' => 0])->column('mer_id'); $data = $this->repository->getApiSearch($where, $page, $limit, $this->userInfo); return app('json')->success($data); diff --git a/app/listener/CloudProduct.php b/app/listener/CloudProduct.php index 26064da6..b1b8d227 100644 --- a/app/listener/CloudProduct.php +++ b/app/listener/CloudProduct.php @@ -9,6 +9,7 @@ use app\common\model\store\product\Product; use app\common\model\system\merchant\Merchant; use crmeb\services\RedisCacheService; use app\common\model\store\product\CloudProduct as CloudProductModel; +use think\facade\Db; class CloudProduct { @@ -16,6 +17,7 @@ class CloudProduct public function handle($event) { $productIds = $event['product_id']; + $typeStoreId = Db::name('MerchantType')->where('type_code', Merchant::TypeCode['TypeStore'])->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); @@ -23,7 +25,7 @@ class CloudProduct $RedisCacheService = app()->make(RedisCacheService::class); $clearCache = []; foreach ($products as $product) { - $categoryId = Merchant::getDB()->where('mer_id', $product['mer_id'])->where('type_id', Merchant::TypeStore)->value('category_id'); + $categoryId = Merchant::getDB()->where('mer_id', $product['mer_id'])->where('type_id', $typeStoreId)->value('category_id'); if (!$categoryId) { continue; } diff --git a/app/listener/paySuccessOrder.php b/app/listener/paySuccessOrder.php index 702ca14c..dbc0d908 100644 --- a/app/listener/paySuccessOrder.php +++ b/app/listener/paySuccessOrder.php @@ -71,8 +71,9 @@ class paySuccessOrder //入口商户佣金 $entryMerId = $item['source_id']; + $typeStoreId = Db::name('MerchantType')->where('type_code', Merchant::TypeCode['TypeStore'])->value('mer_type_id'); $entryMerchant = app()->make(MerchantDao::class)->get($entryMerId); - if ($entryMerchant['type_id'] == Merchant::TypeStore) { + if ($entryMerchant['type_id'] == $typeStoreId) { $merchantRate = systemConfig('commission_to_merchant_rate'); $merchantAmount = bcmul($this->totalAmount, (string)($merchantRate / 100), 2); if ($merchantAmount > 0) {