From d0942f48d17c57287e52244e9c66982432c1f2c5 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Thu, 28 Nov 2024 19:58:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E7=AB=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/md/md_article.go | 1 + app/svc/article/svc_list.go | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/app/md/md_article.go b/app/md/md_article.go index a77a6ac..fcac0ce 100644 --- a/app/md/md_article.go +++ b/app/md/md_article.go @@ -34,6 +34,7 @@ type ArticleListReq struct { type ArticleListResp struct { Total int64 `json:"total"` SelectData []map[string]interface{} `json:"select_data"` + CateData []map[string]interface{} `json:"cate_data"` List []ArticleList `json:"list"` } type ArticleList struct { diff --git a/app/svc/article/svc_list.go b/app/svc/article/svc_list.go index eaffad5..e2e87cf 100644 --- a/app/svc/article/svc_list.go +++ b/app/svc/article/svc_list.go @@ -40,10 +40,22 @@ func List(c *gin.Context) { } list = append(list, tmp1) } + tmp["list"] = list } resp.SelectData = append(resp.SelectData, tmp) } } + resp.CateData = make([]map[string]interface{}, 0) + cate, _, _ := NewArticleCateDb.FindArticleCateAndTotalPid("1", "100") + if cate != nil { + for _, v := range *cate { + list := make([]map[string]string, 0) + tmp := map[string]interface{}{ + "name": v.Name, "value": utils.IntToStr(v.Id), "list": list, + } + resp.CateData = append(resp.CateData, tmp) + } + } if notice != nil { for _, v := range *notice { tmp := md.ArticleList{