作者 何书鹏

开通会员赠送优惠券

... ... @@ -208,12 +208,27 @@ class Coupons extends Model
break;
}
foreach ($couponsList as $v){
if(!empty($v->user_coupons_id)){
$user_coupons = UserCoupons::get($v->user_coupons_id);
if($user_coupons && $user_coupons['package_coupons_time'] > 0){
$v->usetime = [
'start' => date('Y.m.d',$user_coupons['createtime']),
'end' => date('Y.m.d',$user_coupons['package_coupons_time']),
];
}
}
}
return $couponsList;
}
public function getUsetimeAttr($value, $data)
{
if(is_array($value)){
return $value;
}
$usetimeArray = explode(' - ', $value);
$usetime['start'] = date('Y.m.d',strtotime($usetimeArray[0]));
$usetime['end'] = date('Y.m.d',strtotime($usetimeArray[1]));
... ...