服务包订单支付成功回调,增加了发放优惠卷

This commit is contained in:
2024-04-12 19:12:00 +08:00
parent f8cabb455a
commit cb95bde20c
6 changed files with 74 additions and 5 deletions
+25
View File
@@ -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;
}
}