setter
parent
df11ed6edc
commit
504c48c71c
|
@ -57,7 +57,9 @@ class Coupon extends Base
|
||||||
'type_name',
|
'type_name',
|
||||||
'money',
|
'money',
|
||||||
'name as couponName',
|
'name as couponName',
|
||||||
|
'business_code',
|
||||||
'business_code as businessCode',
|
'business_code as businessCode',
|
||||||
|
'coupon_id',
|
||||||
'end_time as endTime',
|
'end_time as endTime',
|
||||||
'consumer_name as consumerName',
|
'consumer_name as consumerName',
|
||||||
'verificate_time as verificateTime',
|
'verificate_time as verificateTime',
|
||||||
|
@ -87,13 +89,16 @@ class Coupon extends Base
|
||||||
}
|
}
|
||||||
|
|
||||||
$res = CouponRepository::getInstance()->findList($whereMap, $fields, $page, $size,function ($q){
|
$res = CouponRepository::getInstance()->findList($whereMap, $fields, $page, $size,function ($q){
|
||||||
return $q->with(["couponMain","scoreModel"]);
|
return $q->with(["couponMain","scoreModel","business"]);
|
||||||
}, $sortOrder);
|
}, $sortOrder);
|
||||||
$time = time();
|
$time = time();
|
||||||
$res['list'] ->each(function ($item) use($time){
|
$res['list'] ->each(function ($item) use($time){
|
||||||
//重置优惠券名称
|
//重置优惠券名称
|
||||||
if(isset($item->couponMain) && $item->couponMain){
|
if(isset($item->couponMain) && $item->couponMain){
|
||||||
$item->couponName = $item->couponMain->name;
|
$item->couponName = $item->couponMain->name;
|
||||||
|
$item->image_url = $item->couponMain->image_url;
|
||||||
|
}else{
|
||||||
|
$item->image_url = '';
|
||||||
}
|
}
|
||||||
//是否已经打分过了
|
//是否已经打分过了
|
||||||
if(isset($item->scoreModel) && $item->scoreModel){
|
if(isset($item->scoreModel) && $item->scoreModel){
|
||||||
|
@ -105,9 +110,8 @@ class Coupon extends Base
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//到期状态 到期前7天!!!!!!!!没做完
|
//到期状态
|
||||||
$expirationStr = '';
|
$expirationStr = '';
|
||||||
|
|
||||||
$endTime = strtotime($item->endTime);
|
$endTime = strtotime($item->endTime);
|
||||||
$ExpirationTime = abs(($endTime - $time) / 86400);
|
$ExpirationTime = abs(($endTime - $time) / 86400);
|
||||||
if (($endTime > $time) ) {
|
if (($endTime > $time) ) {
|
||||||
|
@ -115,9 +119,23 @@ class Coupon extends Base
|
||||||
} else {
|
} else {
|
||||||
$expirationStr = "到期" . ceil($ExpirationTime) . "天";
|
$expirationStr = "到期" . ceil($ExpirationTime) . "天";
|
||||||
}
|
}
|
||||||
|
|
||||||
$item->expirationStr =$expirationStr;
|
$item->expirationStr =$expirationStr;
|
||||||
|
|
||||||
|
|
||||||
|
//商家简称
|
||||||
|
if(!empty($item->business)){
|
||||||
|
$item->business_subtitle = $item->business->business_subtitle;
|
||||||
|
}else{
|
||||||
|
$item->business_subtitle = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
//图片
|
||||||
|
if(!empty($item->business)){
|
||||||
|
$item->business_subtitle = $item->business->business_subtitle;
|
||||||
|
}else{
|
||||||
|
$item->business_subtitle = '';
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$res['list'] = multiTwoArrayKeysExcludeFilter($res['list']->toArray(), ['sort_weight']);
|
$res['list'] = multiTwoArrayKeysExcludeFilter($res['list']->toArray(), ['sort_weight']);
|
||||||
|
|
Loading…
Reference in New Issue