package message import ( logger "eta/eta_mini_ht_api/common/component/log" "eta/eta_mini_ht_api/common/contants" userService "eta/eta_mini_ht_api/domian/user" "eta/eta_mini_ht_api/task/base" "sync" ) var ( taskName base.TaskType = "NoticeTask" cron = "0/5 * * * * *" ) // Execute Task ETA取研报的数据 func (au *NoticeTask) Execute(taskDetail *base.TaskDetail) error { logger.Info(contants.TaskFormat, "监听更新通知开始") metaInfoList := userService.GetInitMetaInfos() var wg sync.WaitGroup wg.Add(len(metaInfoList)) for _, metaInfo := range metaInfoList { go func(metaInfo userService.MetaInfoDTO) { defer wg.Done() userService.CreateMessage(metaInfo) }(metaInfo) } //报告和媒体 return nil } type NoticeTask struct { } func init() { reportTask := base.NewTask(taskName, cron, new(NoticeTask), base.PROD) base.RegisterTask(&reportTask) }