diff --git a/app/common/dao/system/merchant/MerchantDao.php b/app/common/dao/system/merchant/MerchantDao.php index c94a238..4b0db25 100644 --- a/app/common/dao/system/merchant/MerchantDao.php +++ b/app/common/dao/system/merchant/MerchantDao.php @@ -37,7 +37,11 @@ class MerchantDao extends BaseDao */ public function search(array $where, $is_del = 0) { + $merchantType = $where['merchant_type'] ?? 0; + $merchantType = in_array((int)$merchantType,[1,2,3]) ? $merchantType : 0;// 类型非法,使用默认类型 + $query = Merchant::getDB() + ->where('merchant_type', $merchantType) ->when($is_del !== null, function ($query) use ($is_del) { $query->where('is_del', $is_del); }) diff --git a/app/controller/admin/system/merchant/Merchant.php b/app/controller/admin/system/merchant/Merchant.php index 3c1aefe..69db61a 100644 --- a/app/controller/admin/system/merchant/Merchant.php +++ b/app/controller/admin/system/merchant/Merchant.php @@ -50,7 +50,7 @@ class Merchant extends BaseController public function count() { - $where = $this->request->params(['keyword', 'date', 'status', 'statusTag', 'is_trader', 'category_id', 'type_id']); + $where = $this->request->params(['keyword','date','status','statusTag','is_trader','category_id','type_id','merchant_type']); return app('json')->success($this->repository->count($where)); } @@ -65,7 +65,20 @@ class Merchant extends BaseController public function lst() { [$page, $limit] = $this->getPage(); - $where = $this->request->params(['mer_id_list','keyword','mer_id', 'date', 'status', 'statusTag', 'is_trader', 'category_id', 'type_id',['order','create_time'],'is_best']); + $where = $this->request->params([ + 'mer_id_list', + 'keyword', + 'mer_id', + 'date', + 'status', + 'statusTag', + 'is_trader', + 'category_id', + 'type_id', + ['order','create_time'], + 'is_best', + 'merchant_type' + ]); return app('json')->success($this->repository->lst($where, $page, $limit)); } @@ -208,6 +221,7 @@ class Merchant extends BaseController ['mer_exchange_quota_multiple',0], ['avg_consumption',0], 'mer_label', + ['merchant_type',0], ]); $data['mer_label'] = str_replace(',',',',$data['mer_label']); if (!$isUpdate) {