master
wangxinglong 2022-04-06 11:47:35 +08:00
parent 355bfa7bc8
commit 6380fffd35
1 changed files with 25 additions and 22 deletions

View File

@ -196,35 +196,38 @@ class Consumer extends Base
} }
]); ]);
}); });
if(empty($coupon)){
return $this->json(4001,"优惠券不存在");
}
if(!isset($coupon->business)||empty($coupon->business)){
return $this->json(4001,"优惠券商家不存在");
}
//如果优惠券所属商家指派了渠道商 //如果优惠券所属商家指派了渠道商
if ($coupon->business->is_assign == Business::COMMON_ON && !empty($coupon->business->agency_code)) { if(
!empty($coupon)
&&
isset($coupon->business)
&&
!empty($coupon->business)
){
if($coupon->business->is_assign
&&
!empty($coupon->business->agency_code)
){
$agency = Member::findOne([["business_code","=",$coupon->business->agency_code]]); $agency = Member::findOne([["business_code","=",$coupon->business->agency_code]]);
if(!empty($agency)){ if(!empty($agency)){
$awhereMap = []; $awhereMap = [];
$awhereMap[] = ['position', '=', Slide::advertisement]; $awhereMap[] = ['position', '=', Slide::advertisement];
$awhereMap[] = ['agency_id', '=', $agency["id"]]; $awhereMap[] = ['agency_id', '=', $agency["id"]];
$list = $repo->slideList($awhereMap, ["id","title","src as image","url","url_type as type"], $page, $size, function ($q){ $list = $repo->slideList($awhereMap, ["id","title","src as image","url","url_type as type"], $page, $size, function ($q){
return $q->withAttr("image",function ($value){ return $q->withAttr("image",function ($value){
return $this->request->domain() . $value; return $this->request->domain() . $value;
}); });
}, $orders); }, $orders);
if(!empty($list["list"])){ if(!empty($list["list"])){
return $this->json(1,"ok",$list["list"]); return $this->json(1,"ok",$list["list"]);
}
} }
} }
} }
$whereMap = []; $whereMap = [];
$whereMap[] = ['position', '=', Slide::advertisement]; $whereMap[] = ['position', '=', Slide::advertisement];
$list = $repo->slideList($whereMap, ["id","title","src as image","url","url_type as type"], $page, $size, function ($q){ $list = $repo->slideList($whereMap, ["id","title","src as image","url","url_type as type"], $page, $size, function ($q){