|
@@ -2,14 +2,37 @@ package report
|
|
|
|
|
|
import (
|
|
|
"encoding/json"
|
|
|
+<<<<<<< Updated upstream
|
|
|
"eta_mini_ht_api/common/component/es"
|
|
|
logger "eta_mini_ht_api/common/component/log"
|
|
|
"eta_mini_ht_api/common/utils/page"
|
|
|
+=======
|
|
|
+<<<<<<< Updated upstream
|
|
|
+ "eta/eta_mini_ht_api/common/component/es"
|
|
|
+ logger "eta/eta_mini_ht_api/common/component/log"
|
|
|
+ "eta/eta_mini_ht_api/common/utils/page"
|
|
|
+ "eta/eta_mini_ht_api/models"
|
|
|
+ "eta/eta_mini_ht_api/models/eta"
|
|
|
+ etaDao "eta/eta_mini_ht_api/models/eta"
|
|
|
+ reportDao "eta/eta_mini_ht_api/models/report"
|
|
|
+=======
|
|
|
+ "eta_mini_ht_api/common/component/es"
|
|
|
+ logger "eta_mini_ht_api/common/component/log"
|
|
|
+ "eta_mini_ht_api/common/utils/page"
|
|
|
+ stringUtils "eta_mini_ht_api/common/utils/string"
|
|
|
+ userService "eta_mini_ht_api/domian/user"
|
|
|
+>>>>>>> Stashed changes
|
|
|
"eta_mini_ht_api/models"
|
|
|
"eta_mini_ht_api/models/eta"
|
|
|
etaDao "eta_mini_ht_api/models/eta"
|
|
|
reportDao "eta_mini_ht_api/models/report"
|
|
|
+<<<<<<< Updated upstream
|
|
|
+=======
|
|
|
+ "github.com/google/uuid"
|
|
|
+>>>>>>> Stashed changes
|
|
|
+>>>>>>> Stashed changes
|
|
|
"strconv"
|
|
|
+ "strings"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
@@ -257,25 +280,45 @@ func SyncETAReportList(list []eta.ETAReport) (err error) {
|
|
|
return
|
|
|
}
|
|
|
//生产meta信息
|
|
|
- //for _, report := range reports {
|
|
|
- //userIds := userService.GetPostUser(report.Author, report.PublishedTime)
|
|
|
- //usersStr := stringUtils.IntToStringSlice(userIds)
|
|
|
- //Meta :=
|
|
|
- //toStr := strings.Join(usersStr, ",")
|
|
|
- ////user.SyncMeta(etaReportList[i])
|
|
|
- //userService.MetaInfoDTO{
|
|
|
- // From: "ETA",
|
|
|
- // Meta: string(list),
|
|
|
- // MetaType: "USER_NOTICE",
|
|
|
- // SourceType: "REPORT",
|
|
|
- // To: toStr,
|
|
|
- // Uid: userIds[0],
|
|
|
- //}
|
|
|
- //}
|
|
|
+ logger.Info("生成推送META信息")
|
|
|
+ for _, report := range reports {
|
|
|
+ userIds := userService.GetPostUser(report.Author, report.PublishedTime)
|
|
|
+ if len(userIds) > 0 {
|
|
|
+ usersStr := stringUtils.IntToStringSlice(userIds)
|
|
|
+ Meta := reportMeta{
|
|
|
+ AuthorName: report.Author,
|
|
|
+ PublishedTime: report.PublishedTime,
|
|
|
+ ReportId: report.ID,
|
|
|
+ Title: report.Title,
|
|
|
+ }
|
|
|
+ metaStr, _ := json.Marshal(Meta)
|
|
|
+ toStr := strings.Join(usersStr, ",")
|
|
|
+ UUID := uuid.New()
|
|
|
+ uuidStr := UUID.String()
|
|
|
+ metaContent := userService.MetaInfoDTO{
|
|
|
+ From: "ETA",
|
|
|
+ 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
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
return
|
|
|
}
|
|
|
|
|
|
type reportMeta struct {
|
|
|
+ ReportId int `json:"reportId"`
|
|
|
+ AuthorName string `json:"authorName"`
|
|
|
+ Title string `json:"title"`
|
|
|
+ PublishedTime string `json:"publishedTime"`
|
|
|
}
|
|
|
|
|
|
func GetListOrderByConditionWeekly(week bool, column string, limit int, order models.Order) (dtoList []ReportDTO, err error) {
|