Merge pull request 'cron add clear moment create times' (#106) from feat-20240117-001-Robin into test

Reviewed-on: #106
This commit is contained in:
chenhao 2024-02-05 21:40:39 +08:00
commit 2a45bd9339
2 changed files with 12 additions and 0 deletions

View File

@ -46,6 +46,7 @@ func (s *CronService) Init(c any) (err error) {
//设置日志查看handler //设置日志查看handler
exec.RegTask("reload_recomm_list", s.ReloadRecommList) exec.RegTask("reload_recomm_list", s.ReloadRecommList)
exec.RegTask("clear_veri_code_send_times", s.ClearVeriCodeSendTimes) 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("create_daily_statement", s.CreateDailyStatement)
exec.RegTask("image_audit_batch", s.ImageAuditBatch) exec.RegTask("image_audit_batch", s.ImageAuditBatch)
exec.RegTask("image_audit_batch_his", s.ImageAuditBatchHis) exec.RegTask("image_audit_batch_his", s.ImageAuditBatchHis)

View File

@ -57,6 +57,17 @@ func (s *CronService) ClearVeriCodeSendTimes(ctx context.Context, param *xxl.Run
return "vericode_send_times collection has been cleared" 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) { 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)) logger.Info("task %v param: %v log_id: %v", param.ExecutorHandler, param.ExecutorParams, xxl.Int64ToStr(param.LogID))