更新店铺类型查询

This commit is contained in:
yaooo 2023-09-04 15:59:56 +08:00
parent bda042eec0
commit fa0e73c7ae
2 changed files with 5 additions and 1 deletions

View File

@ -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']}%");
});

View File

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