diff --git a/app/mix/service/cronservice.go b/app/mix/service/cronservice.go index 01bbd362..8af0b457 100644 --- a/app/mix/service/cronservice.go +++ b/app/mix/service/cronservice.go @@ -57,6 +57,7 @@ func (s *CronService) Init(c any) (err error) { exec.RegTask("send_contact_customer_services_of_last_minute", s.SendContactCustomerServicesOfLastMinute) exec.RegTask("cancel_account_at_due_time", s.CancelAccountsAtDueTime) exec.RegTask("reload_moment_recomm_list", s.ReloadMomentRecommList) + exec.RegTask("clear_zone_moment_create_times", s.ClearZoneMomentCreateTimes) exec.LogHandler(customLogHandle) //注册任务handler diff --git a/app/mix/service/xxljob_tasks.go b/app/mix/service/xxljob_tasks.go index 846570ae..fdee6ded 100644 --- a/app/mix/service/xxljob_tasks.go +++ b/app/mix/service/xxljob_tasks.go @@ -423,3 +423,14 @@ func (s *CronService) ReloadMomentRecommList(ctx context.Context, param *xxl.Run logger.Info("Refresh moment recommendation list cached in redis accomplished...") return "Refresh moment recommendation list cached in redis accomplished" } + +func (s *CronService) ClearZoneMomentCreateTimes(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 zone_moment_create_times collection...") + if err := _DefaultZoneMomentCreateTimes.OpClear(&gin.Context{}); err != nil { + logger.Error("Clear zone_moment_create_times collection fail: %v", err) + return fmt.Sprintf("Clear zone_moment_create_times collection fail: %v", err) + } + logger.Info("zone_moment_create_times collection has been cleared") + return "zone_moment_create_times collection has been cleared" +}