by Robin at 20240411

This commit is contained in:
Leufolium 2024-04-11 19:37:04 +08:00
parent c89082aea9
commit 6c47d7fa33
2 changed files with 12 additions and 0 deletions

View File

@ -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

View File

@ -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"
}