update: fix coupon multi generate

This commit is contained in:
tokumeikoi 2022-03-13 03:41:46 +08:00
parent 82730acdac
commit d76c2b3bca

View File

@ -90,8 +90,8 @@ 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
$item['limit_plan_ids'] = json_encode($coupon['limit_plan_ids']); if (is_array($item['limit_plan_ids'])) $item['limit_plan_ids'] = json_encode($coupon['limit_plan_ids']);
$item['limit_period'] = json_encode($coupon['limit_period']); if (is_array($item['limit_period'])) $item['limit_period'] = json_encode($coupon['limit_period']);
return $item; return $item;
}, $coupons))) { }, $coupons))) {
DB::rollBack(); DB::rollBack();