Procházet zdrojové kódy

其他分类首页展示

xingzai před 3 roky
rodič
revize
14f7c142b0
3 změnil soubory, kde provedl 24 přidání a 12 odebrání
  1. 5 0
      controllers/article.go
  2. 18 12
      controllers/home.go
  3. 1 0
      models/article.go

+ 5 - 0
controllers/article.go

@@ -2,6 +2,7 @@ package controllers
 
 import (
 	"encoding/json"
+	"fmt"
 	"hongze/hongze_cygx/models"
 	"hongze/hongze_cygx/services"
 	"hongze/hongze_cygx/utils"
@@ -201,11 +202,15 @@ func (this *ArticleController) Detail() {
 			detail.SellerName = sellerItem.RealName
 		}
 		sellerList, err := models.GetSellerList(articleId)
+		fmt.Println(sellerList)
 		if err != nil {
 			br.Msg = "获取信息失败"
 			br.ErrMsg = "获取销售数据失败,Err:" + err.Error() + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
 			return
 		}
+		if detail.ArticleId > 1000000 {
+			fmt.Println(detail.SellerAndMobile)
+		}
 		detail.SellerList = sellerList
 	} else { //潜在客户
 		if applyCount > 0 {

+ 18 - 12
controllers/home.go

@@ -1,6 +1,7 @@
 package controllers
 
 import (
+	"fmt"
 	"hongze/hongze_cygx/models"
 	"hongze/hongze_cygx/services"
 	"hongze/hongze_cygx/utils"
@@ -57,22 +58,27 @@ func (this *HomeController) ListHome() {
 			return
 		}
 		page = paging.GetPaging(currentIndex, pageSize, total)
-		if categoryId == "" {
-			list := make([]*models.HomeArticle, 0)
-			resp.List = list
-			resp.Paging = page
-			br.Ret = 200
-			br.Success = true
-			br.Msg = "获取成功"
-			br.Data = resp
-			return
+		//if categoryId == "" {
+		//	list := make([]*models.HomeArticle, 0)
+		//	resp.List = list
+		//	resp.Paging = page
+		//	br.Ret = 200
+		//	br.Success = true
+		//	br.Msg = "获取成功"
+		//	br.Data = resp
+		//	return
+		//}
+		if categoryId != "" {
+			condition = ` AND category_id IN(` + categoryId + `)`
+			condition += ` OR ( category_name = '` + categoryinfo.PermissionName + `' AND publish_status = 1 )`
+		} else {
+			condition += ` AND  category_name = '` + categoryinfo.PermissionName + `'`
 		}
-		condition = ` AND category_id IN(` + categoryId + `)`
-		condition += ` OR ( category_name = '` + categoryinfo.PermissionName + `' AND publish_status = 1 )`
+
 	}
 	condition += ` AND is_summary = 1  `
 	//condition = ` AND a.category_id NOT IN (85,71) `
-
+	fmt.Println(condition)
 	total, err := models.GetHomeCount(condition, pars)
 	if err != nil {
 		br.Msg = "获取信息失败"

+ 1 - 0
models/article.go

@@ -78,6 +78,7 @@ type ArticleDetail struct {
 	IsClass              int    `description:"是否归类,1是,0否"`
 	CategoryId           int    `description:"分类ID"`
 	FileLink             string `description:"下载预览链接"`
+	SellerAndMobile      string `description:"销售和手机号"`
 	SellerList           []*SellerRep
 }