正在显示
6 个修改的文件
包含
108 行增加
和
9 行删除
@@ -74,8 +74,8 @@ service Core { | @@ -74,8 +74,8 @@ service Core { | ||
74 | get /article_tag/list/all (MiniAllArticleTagRequest) returns (MiniAllArticleTagResponse) | 74 | get /article_tag/list/all (MiniAllArticleTagRequest) returns (MiniAllArticleTagResponse) |
75 | 75 | ||
76 | @doc "小程序首页数据展示" | 76 | @doc "小程序首页数据展示" |
77 | - @handler MinishowHomePage | ||
78 | - get /show/home_page (MiniAllArticleTagRequest) returns (MiniAllArticleTagResponse) | 77 | + @handler MiniShowHomePage |
78 | + get /show/home_page (MiniHomePageRequest) returns (MiniHomePageRespose) | ||
79 | 79 | ||
80 | 80 | ||
81 | } | 81 | } |
@@ -281,13 +281,13 @@ type ( | @@ -281,13 +281,13 @@ type ( | ||
281 | } | 281 | } |
282 | 282 | ||
283 | MiniArticleMarkItem { | 283 | MiniArticleMarkItem { |
284 | - Id int64 `json:"id"` | ||
285 | - CompanyId int64 `json:"companyId"` | ||
286 | - UserId int64 `json:"userId"` | ||
287 | - ArticleId int64 `json:"articleId"` | ||
288 | - Title string `json:"title"` | 284 | + Id int64 `json:"id"` |
285 | + CompanyId int64 `json:"companyId"` | ||
286 | + UserId int64 `json:"userId"` | ||
287 | + ArticleId int64 `json:"articleId"` | ||
288 | + Title string `json:"title"` | ||
289 | Author SimpleUser `json:"author"` // 发布人 | 289 | Author SimpleUser `json:"author"` // 发布人 |
290 | - UpdatedAt int64 `json:"updatedAt"` | 290 | + UpdatedAt int64 `json:"updatedAt"` |
291 | } | 291 | } |
292 | ) | 292 | ) |
293 | 293 | ||
@@ -460,4 +460,21 @@ type ( | @@ -460,4 +460,21 @@ type ( | ||
460 | 460 | ||
461 | //小程序端 首页数据展示 | 461 | //小程序端 首页数据展示 |
462 | // 统计各标签下的文章数量,和已被人员阅读的数量 | 462 | // 统计各标签下的文章数量,和已被人员阅读的数量 |
463 | -type | ||
463 | +type ( | ||
464 | + MiniHomePageRequest { | ||
465 | + CompanyId int64 `path:",optional"` | ||
466 | + UserId int64 `path:",optional"` | ||
467 | + } | ||
468 | + MiniHomePageRespose { | ||
469 | + Tags []ArticleTagCount `json:"tags"` | ||
470 | + } | ||
471 | + ArticleTagCount { | ||
472 | + TagGroup string `json:"tagGroup"` // 标签分组 | ||
473 | + TagId int64 `json:"tagId"` // 标签id | ||
474 | + TagImage string `json:"tagImage"` // 对应的图标 | ||
475 | + TagName string `json:"tagName"` // 标签名称 | ||
476 | + TagRemark string `json:"tagRemark"` // 标签备注 | ||
477 | + TotalArticle int `json:"totalArticle"` // 总的文章数量 | ||
478 | + ReadArticle int `json:"readArticle"` // 已读的标签数量 | ||
479 | + } | ||
480 | +) |
1 | +package article | ||
2 | + | ||
3 | +import ( | ||
4 | + "net/http" | ||
5 | + | ||
6 | + "github.com/zeromicro/go-zero/rest/httpx" | ||
7 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article" | ||
8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | ||
9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | ||
10 | +) | ||
11 | + | ||
12 | +func MiniShowHomePageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
13 | + return func(w http.ResponseWriter, r *http.Request) { | ||
14 | + var req types.MiniHomePageRequest | ||
15 | + if err := httpx.Parse(r, &req); err != nil { | ||
16 | + httpx.ErrorCtx(r.Context(), w, err) | ||
17 | + return | ||
18 | + } | ||
19 | + | ||
20 | + l := article.NewMiniShowHomePageLogic(r.Context(), svcCtx) | ||
21 | + resp, err := l.MiniShowHomePage(&req) | ||
22 | + if err != nil { | ||
23 | + httpx.ErrorCtx(r.Context(), w, err) | ||
24 | + } else { | ||
25 | + httpx.OkJsonCtx(r.Context(), w, resp) | ||
26 | + } | ||
27 | + } | ||
28 | +} |
@@ -364,6 +364,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | @@ -364,6 +364,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | ||
364 | Path: "/article_tag/list/all", | 364 | Path: "/article_tag/list/all", |
365 | Handler: article.MiniAllArticleTagHandler(serverCtx), | 365 | Handler: article.MiniAllArticleTagHandler(serverCtx), |
366 | }, | 366 | }, |
367 | + { | ||
368 | + Method: http.MethodGet, | ||
369 | + Path: "/show/home_page", | ||
370 | + Handler: article.MiniShowHomePageHandler(serverCtx), | ||
371 | + }, | ||
367 | }, | 372 | }, |
368 | rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret), | 373 | rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret), |
369 | rest.WithPrefix("/v1/mini"), | 374 | rest.WithPrefix("/v1/mini"), |
1 | +package article | ||
2 | + | ||
3 | +import ( | ||
4 | + "context" | ||
5 | + | ||
6 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | ||
7 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | ||
8 | + | ||
9 | + "github.com/zeromicro/go-zero/core/logx" | ||
10 | +) | ||
11 | + | ||
12 | +type MiniShowHomePageLogic struct { | ||
13 | + logx.Logger | ||
14 | + ctx context.Context | ||
15 | + svcCtx *svc.ServiceContext | ||
16 | +} | ||
17 | + | ||
18 | +func NewMiniShowHomePageLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniShowHomePageLogic { | ||
19 | + return &MiniShowHomePageLogic{ | ||
20 | + Logger: logx.WithContext(ctx), | ||
21 | + ctx: ctx, | ||
22 | + svcCtx: svcCtx, | ||
23 | + } | ||
24 | +} | ||
25 | + | ||
26 | +func (l *MiniShowHomePageLogic) MiniShowHomePage(req *types.MiniHomePageRequest) (resp *types.MiniHomePageRespose, err error) { | ||
27 | + // todo: add your logic here and delete this line | ||
28 | + | ||
29 | + return | ||
30 | +} |
@@ -993,6 +993,25 @@ type SystemArticleGetHistoryResponse struct { | @@ -993,6 +993,25 @@ type SystemArticleGetHistoryResponse struct { | ||
993 | TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] | 993 | TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] |
994 | } | 994 | } |
995 | 995 | ||
996 | +type MiniHomePageRequest struct { | ||
997 | + CompanyId int64 `path:",optional"` | ||
998 | + UserId int64 `path:",optional"` | ||
999 | +} | ||
1000 | + | ||
1001 | +type MiniHomePageRespose struct { | ||
1002 | + Tags []ArticleTagCount `json:"tags"` | ||
1003 | +} | ||
1004 | + | ||
1005 | +type ArticleTagCount struct { | ||
1006 | + TagGroup string `json:"tagGroup"` // 标签分组 | ||
1007 | + TagId int64 `json:"tagId"` // 标签id | ||
1008 | + TagImage string `json:"tagImage"` // 对应的图标 | ||
1009 | + TagName string `json:"tagName"` // 标签名称 | ||
1010 | + TagRemark string `json:"tagRemark"` // 标签备注 | ||
1011 | + TotalArticle int `json:"totalArticle"` // 总的文章数量 | ||
1012 | + ReadArticle int `json:"readArticle"` // 已读的标签数量 | ||
1013 | +} | ||
1014 | + | ||
996 | type RoleGetRequest struct { | 1015 | type RoleGetRequest struct { |
997 | Id int64 `path:"id"` | 1016 | Id int64 `path:"id"` |
998 | } | 1017 | } |
-
请 注册 或 登录 后发表评论