From fa0e73c7ae4532d8cc4bc7e44d44dc83c8f342e5 Mon Sep 17 00:00:00 2001 From: yaooo <272523191@qq.com> Date: Mon, 4 Sep 2023 15:59:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=BA=97=E9=93=BA=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/dao/system/merchant/MerchantDao.php | 4 ++++ app/controller/api/store/merchant/Merchant.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/common/dao/system/merchant/MerchantDao.php b/app/common/dao/system/merchant/MerchantDao.php index c3e34e04..dba99cb6 100644 --- a/app/common/dao/system/merchant/MerchantDao.php +++ b/app/common/dao/system/merchant/MerchantDao.php @@ -79,6 +79,10 @@ class MerchantDao extends BaseDao ->when(isset($where['type_id']) && $where['type_id'] !== '', function ($query) use ($where) { $query->whereIn('type_id', is_array($where['type_id']) ? $where['type_id'] : explode(',', $where['type_id'])); }) + ->when(isset($where['type_code']) && $where['type_code'] !== '', function ($query) use ($where) { + $typeId = Db::name('MerchantType')->where('type_code', $where['type_code'])->value('mer_type_id'); + $query->where('type_id', $typeId); + }) ->when(isset($where['delivery_way']) && $where['delivery_way'] !== '', function ($query) use ($where) { $query->whereLike('delivery_way', "%{$where['delivery_way']}%"); }); diff --git a/app/controller/api/store/merchant/Merchant.php b/app/controller/api/store/merchant/Merchant.php index 302e6e86..0be883de 100644 --- a/app/controller/api/store/merchant/Merchant.php +++ b/app/controller/api/store/merchant/Merchant.php @@ -55,7 +55,7 @@ class Merchant extends BaseController public function lst() { [$page, $limit] = $this->getPage(); - $where = $this->request->params(['keyword', 'order', 'is_best', 'location', 'category_id', 'type_id','is_trader', 'street_id', 'credit_buy']); + $where = $this->request->params(['keyword', 'order', 'is_best', 'location', 'category_id', 'type_id', 'type_code', 'is_trader', 'street_id', 'credit_buy']); if (empty($where['type_id'])) { //$where['type_id'] = [MerchantModel::TypeCloudWarehouse, MerchantModel::TypeStore, MerchantModel::TypeSupplyChain, MerchantModel::TypePlatform]; $where['type_id'] = Db::name('MerchantType')->where('is_allow_apply', 1)->where('type_code', '<>', MerchantModel::TypeCode['TypeSupplyChain'])->column('mer_type_id');