预警17
This commit is contained in:
parent
9cab8c7aa4
commit
4107f7f1ba
|
|
@ -115,14 +115,24 @@ func (this *VoucherBiz) WarningBudget(ctx context.Context, product *bo.ProductBo
|
||||||
return fmt.Errorf("no warning budget")
|
return fmt.Errorf("no warning budget")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if product.WarningBudget == 0 {
|
||||||
|
return fmt.Errorf("no warning budget")
|
||||||
|
}
|
||||||
|
|
||||||
|
now := time.Now()
|
||||||
|
if now.Before(*product.StartTime) {
|
||||||
|
return fmt.Errorf("not start")
|
||||||
|
}
|
||||||
|
if now.After(*product.EndTime) {
|
||||||
|
return fmt.Errorf("expired")
|
||||||
|
}
|
||||||
|
|
||||||
wxResp, err := this.WechatCpnRepo.QueryProduct(ctx, product.MchId, product.BatchNo)
|
wxResp, err := this.WechatCpnRepo.QueryProduct(ctx, product.MchId, product.BatchNo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err = this.Calculate(ctx, product, wxResp); err != nil {
|
|
||||||
return err
|
return this.Calculate(ctx, product, wxResp)
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *VoucherBiz) Calculate(ctx context.Context, product *bo.ProductBo, wxResp *cashcoupons.Stock) error {
|
func (this *VoucherBiz) Calculate(ctx context.Context, product *bo.ProductBo, wxResp *cashcoupons.Stock) error {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue