From 355bfa7bc881fe8765862d032fcafada6edae613 Mon Sep 17 00:00:00 2001 From: wangxinglong <2371974647@qq.com> Date: Wed, 6 Apr 2022 11:36:29 +0800 Subject: [PATCH] setter --- app/controller/api/Consumer.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/controller/api/Consumer.php b/app/controller/api/Consumer.php index f25d273..8529e08 100644 --- a/app/controller/api/Consumer.php +++ b/app/controller/api/Consumer.php @@ -181,6 +181,7 @@ class Consumer extends Base * */ public function advertisement() { + $repo = OperationRepository::getInstance(); $orders = ['sort'=>'asc']; @@ -202,10 +203,13 @@ class Consumer extends Base return $this->json(4001,"优惠券商家不存在"); } + //如果优惠券所属商家指派了渠道商 if ($coupon->business->is_assign == Business::COMMON_ON && !empty($coupon->business->agency_code)) { + $agency = Member::findOne([["business_code","=",$coupon->business->agency_code]]); - if(empty($agency)){ + + if(!empty($agency)){ $awhereMap = []; $awhereMap[] = ['position', '=', Slide::advertisement]; $awhereMap[] = ['agency_id', '=', $agency["id"]]; @@ -214,8 +218,9 @@ class Consumer extends Base return $this->request->domain() . $value; }); }, $orders); - - return $this->json(1,"ok",$list["list"]); + if(!empty($list["list"])){ + return $this->json(1,"ok",$list["list"]); + } } }