mirror of
https://github.com/v2board/v2board.git
synced 2024-11-10 17:49:11 +08:00
update: fix generate coupon
This commit is contained in:
parent
7faa56a4fd
commit
e2597b4ac3
@ -90,8 +90,12 @@ class CouponController extends Controller
|
|||||||
DB::beginTransaction();
|
DB::beginTransaction();
|
||||||
if (!Coupon::insert(array_map(function ($item) use ($coupon) {
|
if (!Coupon::insert(array_map(function ($item) use ($coupon) {
|
||||||
// format data
|
// format data
|
||||||
if (is_array($item['limit_plan_ids'])) $item['limit_plan_ids'] = json_encode($coupon['limit_plan_ids']);
|
if (isset($item['limit_plan_ids']) && is_array($item['limit_plan_ids'])) {
|
||||||
if (is_array($item['limit_period'])) $item['limit_period'] = json_encode($coupon['limit_period']);
|
$item['limit_plan_ids'] = json_encode($coupon['limit_plan_ids']);
|
||||||
|
}
|
||||||
|
if (isset($item['limit_period']) && is_array($item['limit_period'])) {
|
||||||
|
$item['limit_period'] = json_encode($coupon['limit_period']);
|
||||||
|
}
|
||||||
return $item;
|
return $item;
|
||||||
}, $coupons))) {
|
}, $coupons))) {
|
||||||
DB::rollBack();
|
DB::rollBack();
|
||||||
|
Loading…
Reference in New Issue
Block a user