fix: 补全 ShopProfile 和 Post 响应中缺失的后端字段

ShopProfile 补上 allowMultiShop/allowIndependentOrders/dispatchMode,Post 补上 pinned/linkedOrderId。这些字段在 RPC proto、数据库和写入逻辑中均已存在,但 API 响应类型和映射函数遗漏了它们。同时补回 community.api 中 CreateCommentReq 的 PostId 字段定义。
This commit is contained in:
zetaloop
2026-04-23 20:36:44 +08:00
parent e061c3f779
commit 198c761063
7 changed files with 82 additions and 66 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
// Code generated by goctl. DO NOT EDIT.
// goctl 1.9.2
// goctl 1.10.1
package handler
@@ -44,16 +44,18 @@ func buildUserProfile(ctx context.Context, svcCtx *svc.ServiceContext, userID in
func mapPost(ctx context.Context, svcCtx *svc.ServiceContext, p *communitypb.Posts, liked bool) types.Post {
return types.Post{
Id: p.GetId(),
Title: p.GetTitle(),
Content: p.GetContent(),
Images: append([]string(nil), p.GetImages()...),
Tags: append([]string(nil), p.GetTags()...),
LikeCount: p.GetLikeCount(),
CommentCount: p.GetCommentCount(),
Liked: liked,
Author: buildUserProfile(ctx, svcCtx, p.GetAuthorId()),
CreatedAt: time.Unix(p.GetCreatedAt(), 0).UTC().Format(time.RFC3339),
Id: p.GetId(),
Title: p.GetTitle(),
Content: p.GetContent(),
Images: append([]string(nil), p.GetImages()...),
Tags: append([]string(nil), p.GetTags()...),
LinkedOrderId: p.GetLinkedOrderId(),
Pinned: p.GetPinned(),
LikeCount: p.GetLikeCount(),
CommentCount: p.GetCommentCount(),
Liked: liked,
Author: buildUserProfile(ctx, svcCtx, p.GetAuthorId()),
CreatedAt: time.Unix(p.GetCreatedAt(), 0).UTC().Format(time.RFC3339),
}
}
+13 -11
View File
@@ -1,5 +1,5 @@
// Code generated by goctl. DO NOT EDIT.
// goctl 1.9.2
// goctl 1.10.1
package types
@@ -54,16 +54,18 @@ type PathId struct {
}
type Post struct {
Id int64 `json:"id"`
Title string `json:"title"`
Content string `json:"content"`
Images []string `json:"images"`
Tags []string `json:"tags"`
LikeCount int64 `json:"likeCount"`
CommentCount int64 `json:"commentCount"`
Liked bool `json:"liked"`
Author UserProfile `json:"author"`
CreatedAt string `json:"createdAt"`
Id int64 `json:"id"`
Title string `json:"title"`
Content string `json:"content"`
Images []string `json:"images"`
Tags []string `json:"tags"`
LinkedOrderId int64 `json:"linkedOrderId,optional"`
Pinned bool `json:"pinned"`
LikeCount int64 `json:"likeCount"`
CommentCount int64 `json:"commentCount"`
Liked bool `json:"liked"`
Author UserProfile `json:"author"`
CreatedAt string `json:"createdAt"`
}
type PostListReq struct {