|
@@ -458,30 +458,35 @@ func syncESAndSendMessage(reports []reportDao.Report) (err error) {
|
|
|
logger.Error("获取研报作者失败:%v", err)
|
|
|
continue
|
|
|
}
|
|
|
- if len(userIds) > 0 {
|
|
|
- usersStr := stringUtils.IntToStringSlice(userIds)
|
|
|
- Meta := userService.MetaData{
|
|
|
- AuthorName: report.Author,
|
|
|
- AuthorId: author.Id,
|
|
|
- SourceId: report.ID,
|
|
|
- PublishedTime: report.PublishedTime,
|
|
|
- }
|
|
|
- metaStr, _ := json.Marshal(Meta)
|
|
|
- toStr := strings.Join(usersStr, ",")
|
|
|
- UUID := uuid.New()
|
|
|
- uuidStr := UUID.String()
|
|
|
- metaContent := userService.MetaInfoDTO{
|
|
|
- From: "HT",
|
|
|
- Uid: "report:" + uuidStr,
|
|
|
- Meta: string(metaStr),
|
|
|
- MetaType: "USER_NOTICE",
|
|
|
- SourceType: "REPORT",
|
|
|
- To: toStr,
|
|
|
- }
|
|
|
- err = userService.CreateMetaInfo(metaContent)
|
|
|
- if err != nil {
|
|
|
- logger.Error("创建Meta信息失败:%v", err)
|
|
|
- return err
|
|
|
+ authors := strings.Split(report.Author, ",")
|
|
|
+ authors = stringUtils.RemoveEmptyStrings(authors)
|
|
|
+ if len(authors) > 0 && len(userIds) > 0 {
|
|
|
+ logger.Info("推送META信息,用户ID:%v", userIds)
|
|
|
+ for _, authorName := range authors {
|
|
|
+ usersStr := stringUtils.IntToStringSlice(userIds)
|
|
|
+ Meta := userService.MetaData{
|
|
|
+ AuthorName: authorName,
|
|
|
+ AuthorId: author.Id,
|
|
|
+ SourceId: report.ID,
|
|
|
+ PublishedTime: report.PublishedTime,
|
|
|
+ }
|
|
|
+ metaStr, _ := json.Marshal(Meta)
|
|
|
+ toStr := strings.Join(usersStr, ",")
|
|
|
+ UUID := uuid.New()
|
|
|
+ uuidStr := UUID.String()
|
|
|
+ metaContent := userService.MetaInfoDTO{
|
|
|
+ From: "HT",
|
|
|
+ Uid: "report:" + uuidStr,
|
|
|
+ Meta: string(metaStr),
|
|
|
+ MetaType: "USER_NOTICE",
|
|
|
+ SourceType: "REPORT",
|
|
|
+ To: toStr,
|
|
|
+ }
|
|
|
+ err = userService.CreateMetaInfo(metaContent)
|
|
|
+ if err != nil {
|
|
|
+ logger.Error("创建Meta信息失败:%v", err)
|
|
|
+ return err
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|