From 9616494680af15a8fba527839a2e5a58ccc39b28 Mon Sep 17 00:00:00 2001 From: shengchanzhe <179998674@qq.com> Date: Fri, 15 Dec 2023 10:29:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../merchant/MerchantCategoryRepository.php | 16 +++++++++++++++- .../api/store/merchant/MerchantIntention.php | 4 ++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/app/common/repositories/system/merchant/MerchantCategoryRepository.php b/app/common/repositories/system/merchant/MerchantCategoryRepository.php index 53a87746..6ce8f934 100644 --- a/app/common/repositories/system/merchant/MerchantCategoryRepository.php +++ b/app/common/repositories/system/merchant/MerchantCategoryRepository.php @@ -22,6 +22,7 @@ use FormBuilder\Form; use think\db\exception\DataNotFoundException; use think\db\exception\DbException; use think\db\exception\ModelNotFoundException; +use think\facade\Db; use think\facade\Route; /** @@ -115,7 +116,7 @@ class MerchantCategoryRepository extends BaseRepository * @Date: 2020/9/15 * @return array */ - public function getSelect($v2=0) + public function getSelect($v2=0,$type=0) { $query = $this->search([])->field('merchant_category_id,category_name,background'); $list = $query->select()->toArray(); @@ -126,6 +127,19 @@ class MerchantCategoryRepository extends BaseRepository } } } + if($type==1){ + $lists=[]; + foreach($list as $k=>$v) { + if($type==1){ + $find=Db::name('merchant')->where('category_id',$v['merchant_category_id']) + ->where('status',1)->where('is_del',0)->cache(300)->find(); + if($find){ + $lists[]=$v; + } + } + } + $list=$lists; + } return $list; } } diff --git a/app/controller/api/store/merchant/MerchantIntention.php b/app/controller/api/store/merchant/MerchantIntention.php index 93b93e51..8dbe29ac 100644 --- a/app/controller/api/store/merchant/MerchantIntention.php +++ b/app/controller/api/store/merchant/MerchantIntention.php @@ -389,9 +389,9 @@ class MerchantIntention extends BaseController * @Date: 2020/9/15 * @return mixed */ - public function cateLst() + public function cateLst($type=0) { - $lst = app()->make(MerchantCategoryRepository::class)->getSelect(); + $lst = app()->make(MerchantCategoryRepository::class)->getSelect(0,$type); return app('json')->success($lst); }