mirror of
https://github.com/v2board/v2board.git
synced 2024-11-13 02:59:10 +08:00
update: fix coupon multi generate
This commit is contained in:
parent
d184225b2b
commit
82730acdac
@ -88,7 +88,12 @@ class CouponController extends Controller
|
|||||||
array_push($coupons, $coupon);
|
array_push($coupons, $coupon);
|
||||||
}
|
}
|
||||||
DB::beginTransaction();
|
DB::beginTransaction();
|
||||||
if (!Coupon::insert($coupons)) {
|
if (!Coupon::insert(array_map(function ($item) use ($coupon) {
|
||||||
|
// format data
|
||||||
|
$item['limit_plan_ids'] = json_encode($coupon['limit_plan_ids']);
|
||||||
|
$item['limit_period'] = json_encode($coupon['limit_period']);
|
||||||
|
return $item;
|
||||||
|
}, $coupons))) {
|
||||||
DB::rollBack();
|
DB::rollBack();
|
||||||
abort(500, '生成失败');
|
abort(500, '生成失败');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user