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');