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