服务包订单支付成功回调,增加了发放优惠卷
This commit is contained in:
@@ -198,4 +198,29 @@ class CouponService extends BaseService
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发放购买服务包的关联优惠卷
|
||||
* @param string $user_id 用户id
|
||||
* @return bool
|
||||
*/
|
||||
public function GrantBuyOrderServicePackageCoupon(string $user_id): bool
|
||||
{
|
||||
// 获取购买服务包的用户可领取的优惠卷列表
|
||||
$coupon = Coupon::getOrderServicePackageCouponList();
|
||||
if (empty($coupon)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
foreach ($coupon as $value){
|
||||
// 发放优惠卷
|
||||
$res = $this->GrantUserCoupon($value['coupon_id'],$user_id);
|
||||
if (!$res){
|
||||
// 发放失败
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user