setter
parent
2549b509b4
commit
0f196e30d7
|
@ -93,7 +93,13 @@ 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","business"])
|
return $q->with([
|
||||||
|
"couponMain",
|
||||||
|
"scoreModel",
|
||||||
|
"business" => function ($q) {
|
||||||
|
$q->field("code,id,business_name,business_subtitle");
|
||||||
|
}
|
||||||
|
])
|
||||||
->where(function ($q){
|
->where(function ($q){
|
||||||
$notUsedWhereMap = [];//未过期 未使用
|
$notUsedWhereMap = [];//未过期 未使用
|
||||||
$notUsedWhereMap[] = ['is_verificated', '=', self::BOOL_FALSE];
|
$notUsedWhereMap[] = ['is_verificated', '=', self::BOOL_FALSE];
|
||||||
|
@ -231,20 +237,16 @@ class Coupon extends Base
|
||||||
},
|
},
|
||||||
"scoreModel",
|
"scoreModel",
|
||||||
"business" => function ($q) {
|
"business" => function ($q) {
|
||||||
$q->field("id,code,business_name");
|
$q->field("id,code,business_name,business_subtitle");
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
}, $sortOrder);
|
}, $sortOrder);
|
||||||
|
|
||||||
$res['list'] ->each(function ($item) use($time){
|
$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));
|
$item->endTimeText = date("Y-m-d",strtotime($item->endTime));
|
||||||
|
|
||||||
|
|
||||||
$status = CouponModel::status_success;//默认未使用
|
$status = CouponModel::status_success;//默认未使用
|
||||||
$endTime = strtotime($item->endTime);
|
$endTime = strtotime($item->endTime);
|
||||||
$ExpirationTime = abs(($endTime - $time) / 86400);
|
$ExpirationTime = abs(($endTime - $time) / 86400);
|
||||||
|
|
|
@ -20,7 +20,7 @@ class Coupon extends Base
|
||||||
|
|
||||||
const status_success = 0;//未过期未使用
|
const status_success = 0;//未过期未使用
|
||||||
const status_used = 1;//已使用
|
const status_used = 1;//已使用
|
||||||
const status_be_overdue = 3;//已过期
|
const status_be_overdue = 2;//已过期
|
||||||
|
|
||||||
|
|
||||||
public function couponBill()
|
public function couponBill()
|
||||||
|
|
Loading…
Reference in New Issue