ziwen hace 2 años
padre
commit
2ea578fc9a
Se han modificado 3 ficheros con 35 adiciones y 12 borrados
  1. 6 3
      controller/pc/pc.go
  2. 18 3
      models/response/pc/report.go
  3. 11 6
      models/tables/rddp/report/query.go

+ 6 - 3
controller/pc/pc.go

@@ -170,9 +170,12 @@ func ClassifyDetailBanner(c *gin.Context) {
 			return
 		}
 		resp := &pcModels.DetailBannerResp{
-			ReportId: reportItem.ReportId,
-			Stage:    reportItem.Stage,
-			ImgUrl:   "",
+			ReportId:           reportItem.ReportId,
+			Stage:              reportItem.Stage,
+			VipTitle:           reportItem.VipTitle,
+			Author:             reportItem.Author,
+			ImgUrl:             "",
+			ClassifyNameSecond: reportItem.ClassifyNameSecond,
 		}
 		bannerResp = resp
 	}

+ 18 - 3
models/response/pc/report.go

@@ -93,7 +93,22 @@ type RecommendResp struct {
 }
 
 type DetailBannerResp struct {
-	ReportId int
-	Stage    int
-	ImgUrl   string
+	ReportId           int
+	Stage              int
+	VipTitle           string
+	Author             string
+	ImgUrl             string
+	ClassifyNameSecond string
+}
+
+type LatestReportBanner struct {
+	ReportId           int       `orm:"column(id)" description:"报告Id" json:"reportId"`
+	ClassifyNameFirst  string    `description:"一级分类名称" json:"classify_name_first"`
+	ClassifyNameSecond string    `description:"二级分类名称" json:"classify_name_second"`
+	Title              string    `description:"标题" json:"title"`
+	State              int       `description:"1:未发布,2:已发布" json:"state"`
+	PublishTime        time.Time `description:"发布时间" json:"publish_time"`
+	Stage              int       `description:"期数" json:"stage"`
+	VipTitle           string
+	Author             string
 }

+ 11 - 6
models/tables/rddp/report/query.go

@@ -368,15 +368,20 @@ WHERE
 	return
 }
 
-func GetLatestReportByClassifyName(firstName string) (items *pc.LatestReport, err error) {
+func GetLatestReportByClassifyName(firstName string) (items *pc.LatestReportBanner, err error) {
 	sql := `SELECT
-	id as report_id,
-	stage 
+	a.id AS report_id,
+	classify_name_second,
+	author,
+	stage,
+	vip_title 
 FROM
-	report 
+	report as a
+	JOIN classify as b
 WHERE
-	state = 2 
-	AND classify_name_first = "%v" 
+	a.state = 2 
+	AND a.classify_name_first = "%v" 
+	AND a.classify_name_second = b.classify_name
 ORDER BY
 	publish_time DESC `
 	sql = fmt.Sprintf(sql, firstName)