|
@@ -188,6 +188,31 @@ class CouponPacketSequenceController extends Curd
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ $coupons = [];
|
|
|
|
+ if (!empty($sequence->coupon_packet_sequence_json)) {
|
|
|
|
+ $sequenceJson = json_decode($sequence->coupon_packet_sequence_json, true);
|
|
|
|
+ if (isset($sequenceJson['coupons'])) {
|
|
|
|
+ $couponIds = array_keys($sequenceJson['coupons']);
|
|
|
|
+ $couponModel = Coupon::whereIn('coupon_id', $couponIds)
|
|
|
|
+ ->select('coupon_id', 'coupon_name','coupon_classify','coupon_value','coupon_minimum_limit','coupon_category')
|
|
|
|
+ ->get()
|
|
|
|
+ ->toArray();
|
|
|
|
+ foreach ($couponModel as $coupon) {
|
|
|
|
+ foreach ($sequenceJson['coupons'] as $key => $jsonCoupon) {
|
|
|
|
+ if ($coupon['coupon_id'] == $key) {
|
|
|
|
+ $coupons[] = [
|
|
|
|
+ 'id' => $key,
|
|
|
|
+ 'name' => $coupon['coupon_name'],
|
|
|
|
+ 'nbr' => $jsonCoupon['num'],
|
|
|
|
+ 'classify'=>$coupon['coupon_classify'],
|
|
|
|
+ 'info'=>CouponService::couponClassifyInfo($coupon['coupon_classify'],$coupon['coupon_category'],$coupon['coupon_value'],$coupon['coupon_minimum_limit'])
|
|
|
|
+ ];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ $sequence->coupons = $coupons;
|
|
|
|
|
|
return json_success('', $sequence);
|
|
return json_success('', $sequence);
|
|
}
|
|
}
|