setter
parent
2549b509b4
commit
0f196e30d7
|
@ -93,7 +93,13 @@ class Coupon extends Base
|
|||
|
||||
|
||||
$res = CouponRepository::getInstance()->findList($whereMap, $fields, $page, $size,function ($q){
|
||||
return $q->with(["couponMain","scoreModel","business"])
|
||||
return $q->with([
|
||||
"couponMain",
|
||||
"scoreModel",
|
||||
"business" => function ($q) {
|
||||
$q->field("code,id,business_name,business_subtitle");
|
||||
}
|
||||
])
|
||||
->where(function ($q){
|
||||
$notUsedWhereMap = [];//未过期 未使用
|
||||
$notUsedWhereMap[] = ['is_verificated', '=', self::BOOL_FALSE];
|
||||
|
@ -231,20 +237,16 @@ class Coupon extends Base
|
|||
},
|
||||
"scoreModel",
|
||||
"business" => function ($q) {
|
||||
$q->field("id,code,business_name");
|
||||
$q->field("id,code,business_name,business_subtitle");
|
||||
}
|
||||
]);
|
||||
}, $sortOrder);
|
||||
|
||||
$res['list'] ->each(function ($item) use($time){
|
||||
//重置优惠券名称
|
||||
if(isset($item->couponMain) && $item->couponMain){
|
||||
$item->couponName = $item->couponMain->name;
|
||||
}
|
||||
|
||||
//重置过期时间
|
||||
$item->endTimeText = date("Y-m-d",strtotime($item->endTime));
|
||||
|
||||
|
||||
$status = CouponModel::status_success;//默认未使用
|
||||
$endTime = strtotime($item->endTime);
|
||||
$ExpirationTime = abs(($endTime - $time) / 86400);
|
||||
|
|
|
@ -20,7 +20,7 @@ class Coupon extends Base
|
|||
|
||||
const status_success = 0;//未过期未使用
|
||||
const status_used = 1;//已使用
|
||||
const status_be_overdue = 3;//已过期
|
||||
const status_be_overdue = 2;//已过期
|
||||
|
||||
|
||||
public function couponBill()
|
||||
|
|
Loading…
Reference in New Issue