package service import ( "context" "github.com/go-kratos/kratos/v2/log" "time" "voucher/internal/biz" "voucher/internal/biz/mixrepos" "voucher/internal/biz/wechatrepo" "voucher/internal/conf" ) type VoucherService struct { bc *conf.Bootstrap VoucherBiz *biz.VoucherBiz CmbMixRepo mixrepos.CmbMixRepo WechatCpnRepo wechatrepo.WechatCpnRepo } func NewVoucherService( bc *conf.Bootstrap, VoucherBiz *biz.VoucherBiz, CmbMixRepo mixrepos.CmbMixRepo, WechatCpnRepo wechatrepo.WechatCpnRepo, ) *VoucherService { return &VoucherService{ bc: bc, VoucherBiz: VoucherBiz, CmbMixRepo: CmbMixRepo, WechatCpnRepo: WechatCpnRepo, } } func (s *VoucherService) OrderNotice(ctx context.Context) error { start := time.Now() err := s.VoucherBiz.OrderNotice(ctx) end := time.Now() elapsed := end.Sub(start) log.Warnf("订单定时通知,开始执行时间%s,执行结束时间%s,代码块执行耗时: %s", start.Format(time.DateTime), end.Format(time.DateTime), elapsed) return err }