diff --git a/app/mix/service/cronservice.go b/app/mix/service/cronservice.go index f7d95bc3..18c79e56 100644 --- a/app/mix/service/cronservice.go +++ b/app/mix/service/cronservice.go @@ -46,6 +46,7 @@ func (s *CronService) Init(c any) (err error) { //设置日志查看handler exec.RegTask("reload_recomm_list", s.ReloadRecommList) exec.RegTask("clear_veri_code_send_times", s.ClearVeriCodeSendTimes) + exec.RegTask("clear_moment_create_times", s.ClearMomentCreateTimes) exec.RegTask("create_daily_statement", s.CreateDailyStatement) exec.RegTask("image_audit_batch", s.ImageAuditBatch) exec.RegTask("image_audit_batch_his", s.ImageAuditBatchHis) diff --git a/app/mix/service/xxljob_tasks.go b/app/mix/service/xxljob_tasks.go index c0c4a2c6..94cef458 100644 --- a/app/mix/service/xxljob_tasks.go +++ b/app/mix/service/xxljob_tasks.go @@ -57,6 +57,17 @@ func (s *CronService) ClearVeriCodeSendTimes(ctx context.Context, param *xxl.Run return "vericode_send_times collection has been cleared" } +func (s *CronService) ClearMomentCreateTimes(ctx context.Context, param *xxl.RunReq) (msg string) { + logger.Info("task %v param: %v log_id: %v", param.ExecutorHandler, param.ExecutorParams, xxl.Int64ToStr(param.LogID)) + logger.Info("Clearing moment_create_times collection...") + if err := _DefaultMomentCreateTimes.OpClear(&gin.Context{}); err != nil { + logger.Error("Clear moment_create_times collection fail: %v", err) + return fmt.Sprintf("Clear moment_create_times collection fail: %v", err) + } + logger.Info("moment_create_times collection has been cleared") + return "moment_create_times collection has been cleared" +} + // 统计每日报表 func (s *CronService) CreateDailyStatement(ctx context.Context, param *xxl.RunReq) (msg string) { logger.Info("task %v param: %v log_id: %v", param.ExecutorHandler, param.ExecutorParams, xxl.Int64ToStr(param.LogID))