From 7e33d707a4a341847729e754b895f539448f9496 Mon Sep 17 00:00:00 2001 From: chenbo <709206448@qq.com> Date: Tue, 19 Dec 2023 14:35:50 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E5=95=86=E6=88=B7=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/api/dataview/Merchant.php | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/app/controller/api/dataview/Merchant.php b/app/controller/api/dataview/Merchant.php index 4e6b353f..65b8cae7 100644 --- a/app/controller/api/dataview/Merchant.php +++ b/app/controller/api/dataview/Merchant.php @@ -2,6 +2,7 @@ namespace app\controller\api\dataview; +use app\common\dao\system\merchant\MerchantDao; use app\common\model\store\order\StoreOrderProduct; use app\common\model\store\product\Product as model; use app\common\model\user\UserVisit; @@ -45,7 +46,28 @@ class Merchant extends BaseController { [$page, $limit] = $this->getPage(); $where = $this->request->params([ 'status', 'statusTag', 'is_trader', 'category_id', 'type_id', 'area_id', 'street_id']); - return app('json')->success($this->repository->lst($where, $page, $limit)); + $dao = new MerchantDao(); + $query = $dao->search($where); + $count = $query->count($dao->getPk()); + $list = $query->page($page, $limit)->setOption('field', []) + ->where(function ($query) { + if ($this->streetCode != '') { + $query->where('street_id', $this->streetCode); + } else { + $query->where('area_id', $this->areaCode); + } + }) + ->with([ + 'admin' => function ($query) { + $query->field('mer_id,account'); + }, + 'merchantCategory', + 'merchantType' + ]) + ->order('mer_id','desc') + ->field('sort, mer_id, mer_name, real_name, mer_phone, mer_address, mark, status, create_time,is_best,is_trader,type_id,category_id,copy_product_num,export_dump_num,is_margin,margin,mer_avatar')->select(); + + return app('json')->success(compact('count', 'list')); } // 商户统计