回调通知
This commit is contained in:
parent
194b508f55
commit
bd83a242c0
|
|
@ -0,0 +1,22 @@
|
||||||
|
package service
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"github.com/go-kratos/kratos/v2/log"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (s *VoucherService) CronNotice(ctx context.Context) error {
|
||||||
|
|
||||||
|
start := time.Now()
|
||||||
|
|
||||||
|
if err := s.VoucherBiz.Notice(ctx); err != nil {
|
||||||
|
log.Error("订单定时通知,执行失败,err: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
end := time.Now()
|
||||||
|
elapsed := end.Sub(start)
|
||||||
|
log.Warnf("订单定时通知,开始执行时间%s,执行结束时间%s,代码块执行耗时: %s", start.Format(time.DateTime), end.Format(time.DateTime), elapsed)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -1,9 +1,6 @@
|
||||||
package service
|
package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"github.com/go-kratos/kratos/v2/log"
|
|
||||||
"time"
|
|
||||||
"voucher/internal/biz"
|
"voucher/internal/biz"
|
||||||
"voucher/internal/biz/mixrepos"
|
"voucher/internal/biz/mixrepos"
|
||||||
"voucher/internal/biz/wechatrepo"
|
"voucher/internal/biz/wechatrepo"
|
||||||
|
|
@ -30,18 +27,3 @@ func NewVoucherService(
|
||||||
WechatCpnRepo: WechatCpnRepo,
|
WechatCpnRepo: WechatCpnRepo,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *VoucherService) CronNotice(ctx context.Context) error {
|
|
||||||
|
|
||||||
start := time.Now()
|
|
||||||
|
|
||||||
if err := s.VoucherBiz.Notice(ctx); err != nil {
|
|
||||||
log.Error("订单定时通知,执行失败,err: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
end := time.Now()
|
|
||||||
elapsed := end.Sub(start)
|
|
||||||
log.Warnf("订单定时通知,开始执行时间%s,执行结束时间%s,代码块执行耗时: %s", start.Format(time.DateTime), end.Format(time.DateTime), elapsed)
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue