diff --git a/internal/biz/cmb.go b/internal/biz/cmb.go index acd2635..8cc21ba 100644 --- a/internal/biz/cmb.go +++ b/internal/biz/cmb.go @@ -125,9 +125,6 @@ func (v *VoucherBiz) CmbProductQuery(ctx context.Context, productNo string) (rep EndTime: *wechatResp.AvailableEndTime, AvailableStock: "", Detail: *wechatResp.Description, - - SaleStartTime: *wechatResp.StartTime, - SaleEndTime: *wechatResp.StopTime, } reps.Amount = fmt.Sprintf("%d", *wechatResp.StockUseRule.FixedNormalCoupon.CouponAmount) @@ -136,6 +133,13 @@ func (v *VoucherBiz) CmbProductQuery(ctx context.Context, productNo string) (rep availableStock := *wechatResp.StockUseRule.MaxCoupons - *wechatResp.DistributedCoupons reps.AvailableStock = fmt.Sprintf("%d", availableStock) + if wechatResp.StartTime != nil { + reps.SaleStartTime = *wechatResp.StartTime + } + if wechatResp.StopTime != nil { + reps.SaleEndTime = *wechatResp.StopTime + } + reps.AvailableType = vo.CmbAvailableTypeFixed.GetValue() return nil