This commit is contained in:
李子铭 2025-03-20 16:37:40 +08:00
parent e511aae2d4
commit 17e6902994
3 changed files with 19 additions and 0 deletions

View File

@ -143,6 +143,16 @@ func (v *VoucherBiz) CmbProductQuery(ctx context.Context, productNo string) (rep
reps.SaleEndTime = reps.EndTime
}
if wechatResp.StartTime != nil {
s, _ := time.Parse(inputFormat, *wechatResp.StartTime)
reps.SaleStartTime = s.Format(time.DateTime)
}
if wechatResp.StopTime != nil {
e, _ := time.Parse(inputFormat, *wechatResp.StopTime)
reps.SaleEndTime = e.Format(time.DateTime)
}
reps.Amount = fmt.Sprintf("%d", *wechatResp.StockUseRule.FixedNormalCoupon.CouponAmount)
reps.MinAmount = fmt.Sprintf("%d", *wechatResp.StockUseRule.FixedNormalCoupon.TransactionMinimum)

View File

@ -139,6 +139,11 @@ func (v *VoucherBiz) notice(ctx context.Context, order *bo.OrderBo) error {
func (v *VoucherBiz) cmbNotice(ctx context.Context, order *bo.OrderBo, orderNotify *bo.OrderNotifyBo) error {
if !orderNotify.Event.CanNotify() {
log.Warnf("notice 券状态:%s忽略不通知,orderNo:%s", orderNotify.Event.GetText(), order.OrderNo)
return nil
}
request, err := v.Cmb.NotifyRequest(ctx, order, orderNotify)
if err != nil {
return err

View File

@ -35,6 +35,10 @@ func (s OrderNotifyEvent) IsUsed() bool {
return s == OrderNotifyEventUsed
}
func (s OrderNotifyEvent) CanNotify() bool {
return s.IsSendDEd() || s.IsUsed()
}
func (s OrderNotifyEvent) IsExpired() bool {
return s == OrderNotifyEventExpired
}