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)){
$awhereMap = [];
$awhereMap[] = ['position', '=', Slide::advertisement];
$awhereMap[] = ['agency_id', '=', $agency["id"]];
$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 $this->request->domain() . $value;
});
}, $orders);
if(!empty($list["list"])){
return $this->json(1,"ok",$list["list"]);
if(!empty($agency)){
$awhereMap = [];
$awhereMap[] = ['position', '=', Slide::advertisement];
$awhereMap[] = ['agency_id', '=', $agency["id"]];
$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 $this->request->domain() . $value;
});
}, $orders);
if(!empty($list["list"])){
return $this->json(1,"ok",$list["list"]);
}
}
}
}
$whereMap = [];
$whereMap[] = ['position', '=', Slide::advertisement];
$list = $repo->slideList($whereMap, ["id","title","src as image","url","url_type as type"], $page, $size, function ($q){