校验优惠码 checkAvailable (User $user, $orderAmount = null) 方法内是否存在小 bug?
if ($this->not_before && $this->not_before->gt(Carbon::now())) {
throw new CouponCodeUnavailableException('该优惠券现在还不能使用');
}
这段代码中如果后台没有给not_before
赋值,也就是优惠卷开始时间是空的话,在购物车检查优惠卷和下单时不会报‘该优惠卷现在还不能使用’提醒,这个项目中对优惠卷是否有在不设定优惠卷开始时间的情况下依然可以使用优惠卷需求?如果不是的话应该要改动下if的判断条件吧。
if (!$this->not_before || $this->not_before->gt(Carbon::now())) {
throw new CouponCodeUnavailableException('该优惠卷现在还不能使用');
}
推荐文章: