This commit is contained in:
李子铭 2025-03-19 20:17:07 +08:00
parent 17afd86f85
commit 508a838f2f
4 changed files with 10 additions and 3 deletions

View File

@ -83,7 +83,7 @@ cron:
commandMap:
orderNotice:
isOpen: false #是否启动 true/false
command: "0 1 * * *" # 每天凌晨1点执行一次0 2 * * * "0 */10 * * *" #cron表达式,每10分钟执行一次
command: "0 0 1 * * ?" # 每天凌晨1点执行一次
#配置日志
logs:

View File

@ -80,7 +80,7 @@ cron:
commandMap:
orderNotice:
isOpen: true #是否启动 true/false
command: "0 1 * * *" # 每天凌晨1点执行一次0 2 * * * "0 */10 * * *" #cron表达式,每10分钟执行一次
command: "0 0 1 * * ?" # 每天凌晨1点执行一次
#配置日志
logs:

View File

@ -29,7 +29,7 @@ func (j *VoucherService) GetNotifyRetryConfig() *mq.ConsumerConfig {
func (j *VoucherService) NotifyRetryConsumer(ctx context.Context, msg *mq.ConsumerMessage) error {
shardingKey := msg.GetShardingKey()
if shardingKey == "" {
if len(shardingKey) == 0 {
log.Error("notify retry 消费异常,获取 shardingKey 失败")
return errors.New("orderNotify 消费异常,获取 orderNo 失败")
}

View File

@ -25,6 +25,13 @@ func (s *VoucherService) CronOrderNotice(ctx context.Context) error {
return nil
}
// 每五秒: */5 * * * * ?
// 每隔1分钟执行一次"0 */1 * * * ?"
// 每天23点执行一次"0 0 23 * * ?"
// 每天凌晨1点执行一次"0 0 1 * * ?"
// 每月1号凌晨1点执行一次"0 0 1 1 * ?"
// 在26分、29分、33分执行一次"0 26,29,33 * * * ?"
// 每天的0点、13点、18点、21点都执行一次"0 0 0,13,18,21 * * ?"
return s.cron.AddFunc(c.Command, func() {
s.OrderNotice(ctx)