Ver Fonte

增加标识

kobe6258 há 5 meses atrás
pai
commit
cafeb06d3a

+ 1 - 0
domian/media/media_service.go

@@ -41,6 +41,7 @@ func elastic() *es.ESClient {
 }
 
 type MediaDTO struct {
+	Type                  string   `json:"type"`
 	MediaId               int      `json:"mediaId"`
 	AuthorId              int      `json:"authorId"`
 	AuthorName            string   `json:"authorName,omitempty"`

+ 29 - 27
domian/report/report_service.go

@@ -59,33 +59,35 @@ type ESReport struct {
 }
 
 type ReportDTO struct {
-	ReportID         int             `json:"reportId"`
-	OrgId            int             `json:"orgId"`
-	Title            string          `json:"title"`
-	Author           string          `json:"author"`
-	AuthorInfo       []Anthor        `json:"authorInfo"`
-	Source           string          `json:"source"`
-	Abstract         string          `json:"abstract"`
-	PublishedTime    string          `json:"publishedTime"`
-	RiskLevel        string          `json:"riskLevel"`
-	PlateName        string          `json:"-"`
-	ClassifyId       int             `json:"-"`
-	SecondPermission map[int]string  `json:"-"`
-	Permissions      map[int]string  `json:"-"`
-	PermissionNames  interface{}     `json:"permissionNames"`
-	Highlight        []string        `json:"highlight"`
-	Detail           json.RawMessage `json:"detail"`
-	PdfUrl           string          `json:"pdfUrl"`
-	CoverSrc         int             `json:"coverSrc"`
-	CoverUrl         string          `json:"coverUrl"`
-	Login            bool            `json:"login"`
-	RiskLevelStatus  string          `json:"riskLevelStatus"`
-	IsFree           bool            `json:"isFree"`
-	IsSubscribe      bool            `json:"isSubscribe"`
-	Price            string          `json:"price"`
-	ProductId        int             `json:"productId"`
-	IsPackage        bool            `json:"isPackage"`
-	Score            float64         `json:"score"`
+	Type             string         `json:"type"`
+	ReportID         int            `json:"reportId"`
+	OrgId            int            `json:"orgId"`
+	Title            string         `json:"title"`
+	Author           string         `json:"author"`
+	AuthorInfo       []Anthor       `json:"authorInfo"`
+	Source           string         `json:"source"`
+	Abstract         string         `json:"abstract"`
+	PublishedTime    string         `json:"publishedTime"`
+	RiskLevel        string         `json:"riskLevel"`
+	PlateName        string         `json:"-"`
+	ClassifyId       int            `json:"-"`
+	SecondPermission map[int]string `json:"-"`
+	Permissions      map[int]string `json:"-"`
+	PermissionNames  interface {
+	} `json:"permissionNames"`
+	Highlight       []string        `json:"highlight"`
+	Detail          json.RawMessage `json:"detail"`
+	PdfUrl          string          `json:"pdfUrl"`
+	CoverSrc        int             `json:"coverSrc"`
+	CoverUrl        string          `json:"coverUrl"`
+	Login           bool            `json:"login"`
+	RiskLevelStatus string          `json:"riskLevelStatus"`
+	IsFree          bool            `json:"isFree"`
+	IsSubscribe     bool            `json:"isSubscribe"`
+	Price           string          `json:"price"`
+	ProductId       int             `json:"productId"`
+	IsPackage       bool            `json:"isPackage"`
+	Score           float64         `json:"score"`
 }
 
 type Detail struct {

+ 2 - 0
service/home/home_service.go

@@ -109,6 +109,7 @@ func transMedia(hit es.Hit, content map[string][]string) (media *mediaDomian.Med
 	media.Highlight = content[MediaColumn]
 	media.PublishedTime = media.PublishedTime[:10]
 	media.MediaTitle = media.Highlight[0]
+	media.Type = "media"
 	return
 }
 
@@ -121,6 +122,7 @@ func transReport(hit es.Hit, content map[string][]string) (report *reportDomain.
 	report.Highlight = content[ReportColumn]
 	report.Title = report.Highlight[0]
 	report.PublishedTime = report.PublishedTime[:10]
+	report.Type = "report"
 	return
 }
 func homeSearch(key string, from int, to int, sorts []string, publishedTime string) (request *es.ESQueryRequest) {