Browse Source

客户评价

ziwen 2 years ago
parent
commit
961bd1f14d

+ 14 - 2
controller/pc/pc.go

@@ -3,7 +3,8 @@ package pc
 import (
 	"github.com/gin-gonic/gin"
 	"hongze/hongze_yb/controller/response"
-	models "hongze/hongze_yb/models/response/pc"
+	pcModels "hongze/hongze_yb/models/response/pc"
+	"hongze/hongze_yb/models/tables/customer_comment"
 	"hongze/hongze_yb/models/tables/rddp/banner"
 	"hongze/hongze_yb/models/tables/rddp/classify"
 	"hongze/hongze_yb/models/tables/rddp/report"
@@ -151,7 +152,7 @@ func Recommend(c *gin.Context)  {
 	} else {
 		reportType = 2
 	}
-	recommendList, err := models.GetRecommendList(reportId, reportType)
+	recommendList, err := pcModels.GetRecommendList(reportId, reportType)
 	if err != nil {
 		response.Fail("获取报告详情失败"+err.Error(), c)
 		return
@@ -172,4 +173,15 @@ func ClassifyFirstList(c *gin.Context)  {
 	}
 	response.OkData("查询成功", classList, c )
 	return
+}
+
+// CustomerComment 客户评价
+func CustomerComment(c *gin.Context)  {
+	lists,err := customer_comment.GetCustomerComment()
+	if err != nil {
+		response.Fail(err.Error(), c)
+		return
+	}
+	response.OkData("查询成功", lists, c )
+	return
 }

+ 14 - 0
models/tables/customer_comment/customer_comment.go

@@ -0,0 +1,14 @@
+package customer_comment
+
+type CustomerComment struct {
+	Id           int `orm:"customer_comment(id)" `
+	HeadImgUrl   string
+	CustomerName string
+	CompanyName  string
+	Comment      string
+}
+
+func (d *CustomerComment) TableName() string  {
+	return "customer_comment"
+}
+

+ 9 - 0
models/tables/customer_comment/query.go

@@ -0,0 +1,9 @@
+package customer_comment
+
+import "hongze/hongze_yb/global"
+
+func GetCustomerComment() (items []*CustomerComment, err error) {
+	sql := ` SELECT * FROM customer_comment `
+	err = global.MYSQL["rddp"].Raw(sql).Scan(&items).Error
+	return
+}

+ 1 - 0
routers/pc.go

@@ -15,4 +15,5 @@ func InitPc(r *gin.Engine)  {
 	rGroup.GET("/detail_banner", pc.ClassifyDetailBanner)
 	rGroup.GET("/recommend", pc.Recommend)
 	rGroup.GET("/classify", pc.ClassifyFirstList)
+	rGroup.GET("/comment", pc.CustomerComment)
 }