| xqd
@@ -23,13 +23,12 @@ class CouponBatchGrant extends BatchAction
|
|
|
$user_num = count($user_arr);
|
|
|
$coupon = Coupon::where('id',$coupon_id)->first();
|
|
|
$all_num = $coupon_num*$user_num;
|
|
|
-// dd($all_num);
|
|
|
//判断优惠券是否充足 优惠券数量*用户数量
|
|
|
if ($coupon->num < $all_num)
|
|
|
{
|
|
|
return $this->response()->error('优惠券'.Coupon::where('id',$coupon_id)->value('name').'数量不足')->refresh();
|
|
|
}
|
|
|
- for ($i = 0;$i<$all_num;$i++)
|
|
|
+ for ($i = 0;$i<$coupon_num;$i++)
|
|
|
{
|
|
|
//获取过期类型是指定几天过期
|
|
|
if ($coupon->expire_type == 1){
|
| xqd
@@ -53,7 +52,6 @@ class CouponBatchGrant extends BatchAction
|
|
|
'expire_type' => $coupon->expire_type,
|
|
|
'effective_days' => $coupon->effective_days,
|
|
|
'expire_time' => $expire_time_num,
|
|
|
-// 'coupons_num'=>0
|
|
|
];
|
|
|
}else if ($coupon->expire_type == 2){
|
|
|
$arr = [
|
| xqd
@@ -73,7 +71,6 @@ class CouponBatchGrant extends BatchAction
|
|
|
'expire_type' => $coupon->expire_type,
|
|
|
'start_time' => $coupon->start_time,
|
|
|
'end_time' => $coupon->end_time,
|
|
|
-// 'coupons_num'=>0
|
|
|
];
|
|
|
}
|
|
|
if ($coupon->usable_type == 2)
|
| xqd
@@ -110,6 +107,6 @@ class CouponBatchGrant extends BatchAction
|
|
|
{
|
|
|
$name = Coupon::where('position_type',2)->pluck('name','id');
|
|
|
$this->select('id', '优惠券名称')->options($name);
|
|
|
- $this->text('num', '优惠券数量');
|
|
|
+ $this->text('num', '优惠券数量')->help('点击提交后请耐心等待,请勿再次点击提交按钮,以免造成多次发放');
|
|
|
}
|
|
|
}
|