作者 tangxvhui

处理文章标签

@@ -8,13 +8,40 @@ info( @@ -8,13 +8,40 @@ info(
8 version: "v1" 8 version: "v1"
9 ) 9 )
10 10
  11 +@server(
  12 + prefix: v1/system
  13 + group: tags
  14 + jwt: SystemAuth
  15 +)
  16 +service Core {
  17 + @doc "后台创建文章标签"
  18 + @handler CreateTag
  19 + post /article_tag (TagCreateRequest) returns (TagCreateResponse)
  20 +
  21 + @doc "后台编辑文章标签"
  22 + @handler EditTag
  23 + put /article_tag (TagEditRequest) returns (TagEditResponse)
  24 +
  25 + @doc "后台获取文章标签"
  26 + @handler GetTag
  27 + get /article_tag/:id (TagGetRequest) returns (TagGetResponse)
  28 +
  29 + @doc "后台删除文章标签"
  30 + @handler DeleteTag
  31 + delete /article_tag/:id (TagDeleteRequest) returns (TagDeleteResponse)
  32 +
  33 + @doc "后台搜索标签"
  34 + @handler SearchTag
  35 + post/article_tag/search (TagListRequest) returns (TagListResponse)
  36 +}
  37 +
11 // 创建标签 38 // 创建标签
12 type ( 39 type (
13 TagCreateRequest { 40 TagCreateRequest {
14 - CompanyId int64 `json:"companyId"` 41 + CompanyId int64 `json:",optional"`
15 Image string `json:"image"` 42 Image string `json:"image"`
16 Name string `json:"name"` // 标签名称 43 Name string `json:"name"` // 标签名称
17 - Group string `json:"group"` // 标签分类 44 + Category string `json:"category"` // 标签分类
18 Remark string `json:"remark,optional"` // 备注 45 Remark string `json:"remark,optional"` // 备注
19 } 46 }
20 47
@@ -27,10 +54,10 @@ type ( @@ -27,10 +54,10 @@ type (
27 type ( 54 type (
28 TagEditRequest { 55 TagEditRequest {
29 Id int64 `json:"id"` 56 Id int64 `json:"id"`
30 - CompanyId int64 `json:"-"` 57 + CompanyId int64 `json:",optional"`
31 Image string `json:"image"` 58 Image string `json:"image"`
32 Name string `json:"name"` // 标签名称 59 Name string `json:"name"` // 标签名称
33 - Group string `json:"group"` // 标签分类 60 + Category string `json:"category"` // 标签分类
34 Remark string `json:"remark,optional"` // 备注 61 Remark string `json:"remark,optional"` // 备注
35 } 62 }
36 63
@@ -43,13 +70,13 @@ type ( @@ -43,13 +70,13 @@ type (
43 type ( 70 type (
44 TagGetRequest { 71 TagGetRequest {
45 Id int64 `path:"id"` 72 Id int64 `path:"id"`
46 - CompanyId int64 `path:"-"` 73 + CompanyId int64 `path:",optional"`
47 } 74 }
48 TagGetResponse { 75 TagGetResponse {
49 Id int64 `json:"id"` 76 Id int64 `json:"id"`
50 Image string `json:"image"` 77 Image string `json:"image"`
51 Name string `json:"name"` // 标签名称 78 Name string `json:"name"` // 标签名称
52 - Group string `json:"group"` // 标签分类 79 + Category string `json:"category"` // 标签分类
53 Remark string `json:"remark"` // 备注 80 Remark string `json:"remark"` // 备注
54 } 81 }
55 ) 82 )
@@ -59,9 +86,9 @@ type ( @@ -59,9 +86,9 @@ type (
59 TagListRequest { 86 TagListRequest {
60 Page int `json:"page"` 87 Page int `json:"page"`
61 Size int `json:"size"` 88 Size int `json:"size"`
62 - CompanyId int64 `json:"-"` 89 + CompanyId int64 `json:",optional"`
63 TagName string `json:"tagName,optional"` 90 TagName string `json:"tagName,optional"`
64 - Group string `json:"group,optional"` 91 + Category string `json:"category,optional"`
65 Remark string `json:"remark,optional"` 92 Remark string `json:"remark,optional"`
66 } 93 }
67 TagListResponse { 94 TagListResponse {
@@ -72,7 +99,7 @@ type ( @@ -72,7 +99,7 @@ type (
72 Id int64 `json:"id"` 99 Id int64 `json:"id"`
73 Image string `json:"image"` 100 Image string `json:"image"`
74 Name string `json:"name"` // 标签名称 101 Name string `json:"name"` // 标签名称
75 - Group string `json:"group"` // 标签分类 102 + Category string `json:"category"` // 标签分类
76 Remark string `json:"remark"` // 备注 103 Remark string `json:"remark"` // 备注
77 CreatedAt int64 `json:"createdAt"` 104 CreatedAt int64 `json:"createdAt"`
78 } 105 }
@@ -82,36 +109,9 @@ type ( @@ -82,36 +109,9 @@ type (
82 type ( 109 type (
83 TagDeleteRequest { 110 TagDeleteRequest {
84 Id int64 `path:"id"` 111 Id int64 `path:"id"`
85 - CompanyId int64 `path:"-"` 112 + CompanyId int64 `path:",optional"`
86 } 113 }
87 TagDeleteResponse { 114 TagDeleteResponse {
88 Id int64 `json:"id"` 115 Id int64 `json:"id"`
89 } 116 }
90 ) 117 )
91 -  
92 -@server(  
93 - prefix: v1/system  
94 - group: tags  
95 - jwt: MiniAuth  
96 -)  
97 -service Core {  
98 - @doc "后台创建文章标签"  
99 - @handler CreateTag  
100 - post /article_tag (TagCreateRequest) returns (TagCreateResponse)  
101 -  
102 - @doc "后台编辑文章标签"  
103 - @handler EditTag  
104 - put /article_tag (TagEditRequest) returns (TagEditResponse)  
105 -  
106 - @doc "后台获取文章标签"  
107 - @handler GetTag  
108 - get /article_tag/:id (TagGetRequest) returns (TagGetResponse)  
109 -  
110 - @doc "后台删除文章标签"  
111 - @handler DeleteTag  
112 - delete /article_tag/:id (TagDeleteRequest) returns (TagDeleteResponse)  
113 -  
114 - @doc "后台搜索标签"  
115 - @handler SearchTag  
116 - post/article_tag/search (TagListRequest) returns (TagListResponse)  
117 -}  
@@ -120,7 +120,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { @@ -120,7 +120,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
120 Handler: tags.SearchTagHandler(serverCtx), 120 Handler: tags.SearchTagHandler(serverCtx),
121 }, 121 },
122 }, 122 },
123 - rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret), 123 + rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret),
124 rest.WithPrefix("/v1/system"), 124 rest.WithPrefix("/v1/system"),
125 ) 125 )
126 126
@@ -7,6 +7,8 @@ import ( @@ -7,6 +7,8 @@ import (
7 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/tags" 7 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/tags"
8 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" 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" 9 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
10 ) 12 )
11 13
12 func CreateTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { 14 func CreateTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
@@ -18,11 +20,9 @@ func CreateTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { @@ -18,11 +20,9 @@ func CreateTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
18 } 20 }
19 21
20 l := tags.NewCreateTagLogic(r.Context(), svcCtx) 22 l := tags.NewCreateTagLogic(r.Context(), svcCtx)
  23 + token := contextdata.GetUserTokenFromCtx(r.Context())
  24 + req.CompanyId = token.CompanyId
21 resp, err := l.CreateTag(&req) 25 resp, err := l.CreateTag(&req)
22 - if err != nil {  
23 - httpx.ErrorCtx(r.Context(), w, err)  
24 - } else {  
25 - httpx.OkJsonCtx(r.Context(), w, resp)  
26 - } 26 + result.HttpResult(r, w, resp, err)
27 } 27 }
28 } 28 }
@@ -7,6 +7,8 @@ import ( @@ -7,6 +7,8 @@ import (
7 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/tags" 7 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/tags"
8 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" 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" 9 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
10 ) 12 )
11 13
12 func DeleteTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { 14 func DeleteTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
@@ -18,11 +20,9 @@ func DeleteTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { @@ -18,11 +20,9 @@ func DeleteTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
18 } 20 }
19 21
20 l := tags.NewDeleteTagLogic(r.Context(), svcCtx) 22 l := tags.NewDeleteTagLogic(r.Context(), svcCtx)
  23 + token := contextdata.GetUserTokenFromCtx(r.Context())
  24 + req.CompanyId = token.CompanyId
21 resp, err := l.DeleteTag(&req) 25 resp, err := l.DeleteTag(&req)
22 - if err != nil {  
23 - httpx.ErrorCtx(r.Context(), w, err)  
24 - } else {  
25 - httpx.OkJsonCtx(r.Context(), w, resp)  
26 - } 26 + result.HttpResult(r, w, resp, err)
27 } 27 }
28 } 28 }
@@ -7,6 +7,8 @@ import ( @@ -7,6 +7,8 @@ import (
7 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/tags" 7 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/tags"
8 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" 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" 9 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
10 ) 12 )
11 13
12 func EditTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { 14 func EditTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
@@ -18,11 +20,9 @@ func EditTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { @@ -18,11 +20,9 @@ func EditTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
18 } 20 }
19 21
20 l := tags.NewEditTagLogic(r.Context(), svcCtx) 22 l := tags.NewEditTagLogic(r.Context(), svcCtx)
  23 + token := contextdata.GetUserTokenFromCtx(r.Context())
  24 + req.CompanyId = token.CompanyId
21 resp, err := l.EditTag(&req) 25 resp, err := l.EditTag(&req)
22 - if err != nil {  
23 - httpx.ErrorCtx(r.Context(), w, err)  
24 - } else {  
25 - httpx.OkJsonCtx(r.Context(), w, resp)  
26 - } 26 + result.HttpResult(r, w, resp, err)
27 } 27 }
28 } 28 }
@@ -7,6 +7,8 @@ import ( @@ -7,6 +7,8 @@ import (
7 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/tags" 7 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/tags"
8 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" 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" 9 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
10 ) 12 )
11 13
12 func GetTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { 14 func GetTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
@@ -16,13 +18,10 @@ func GetTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { @@ -16,13 +18,10 @@ func GetTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
16 httpx.ErrorCtx(r.Context(), w, err) 18 httpx.ErrorCtx(r.Context(), w, err)
17 return 19 return
18 } 20 }
19 - 21 + token := contextdata.GetUserTokenFromCtx(r.Context())
  22 + req.CompanyId = token.CompanyId
20 l := tags.NewGetTagLogic(r.Context(), svcCtx) 23 l := tags.NewGetTagLogic(r.Context(), svcCtx)
21 resp, err := l.GetTag(&req) 24 resp, err := l.GetTag(&req)
22 - if err != nil {  
23 - httpx.ErrorCtx(r.Context(), w, err)  
24 - } else {  
25 - httpx.OkJsonCtx(r.Context(), w, resp)  
26 - } 25 + result.HttpResult(r, w, resp, err)
27 } 26 }
28 } 27 }
@@ -7,6 +7,8 @@ import ( @@ -7,6 +7,8 @@ import (
7 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/tags" 7 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/tags"
8 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" 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" 9 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
10 ) 12 )
11 13
12 func SearchTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { 14 func SearchTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
@@ -18,11 +20,9 @@ func SearchTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { @@ -18,11 +20,9 @@ func SearchTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
18 } 20 }
19 21
20 l := tags.NewSearchTagLogic(r.Context(), svcCtx) 22 l := tags.NewSearchTagLogic(r.Context(), svcCtx)
  23 + token := contextdata.GetUserTokenFromCtx(r.Context())
  24 + req.CompanyId = token.CompanyId
21 resp, err := l.SearchTag(&req) 25 resp, err := l.SearchTag(&req)
22 - if err != nil {  
23 - httpx.ErrorCtx(r.Context(), w, err)  
24 - } else {  
25 - httpx.OkJsonCtx(r.Context(), w, resp)  
26 - } 26 + result.HttpResult(r, w, resp, err)
27 } 27 }
28 } 28 }
@@ -36,20 +36,20 @@ func (l *MiniAllArticleTagLogic) MiniAllArticleTag(req *types.MiniAllArticleTagR @@ -36,20 +36,20 @@ func (l *MiniAllArticleTagLogic) MiniAllArticleTag(req *types.MiniAllArticleTagR
36 var group []string 36 var group []string
37 tagMap := map[string][]types.ArticleTagItem{} 37 tagMap := map[string][]types.ArticleTagItem{}
38 for _, val := range tagList { 38 for _, val := range tagList {
39 - if m, ok := tagMap[val.Group]; ok { 39 + if m, ok := tagMap[val.Category]; ok {
40 m = append(m, types.ArticleTagItem{ 40 m = append(m, types.ArticleTagItem{
41 Id: val.Id, 41 Id: val.Id,
42 - Group: val.Group, 42 + Group: val.Category,
43 Name: val.Name, 43 Name: val.Name,
44 Image: val.Image.Url, 44 Image: val.Image.Url,
45 }) 45 })
46 - tagMap[val.Group] = m 46 + tagMap[val.Category] = m
47 } else { 47 } else {
48 - group = append(group, val.Group)  
49 - tagMap[val.Group] = []types.ArticleTagItem{ 48 + group = append(group, val.Category)
  49 + tagMap[val.Category] = []types.ArticleTagItem{
50 { 50 {
51 Id: val.Id, 51 Id: val.Id,
52 - Group: val.Group, 52 + Group: val.Category,
53 Name: val.Name, 53 Name: val.Name,
54 Image: val.Image.Url, 54 Image: val.Image.Url,
55 }, 55 },
@@ -32,14 +32,14 @@ func (l *CreateTagLogic) CreateTag(req *types.TagCreateRequest) (resp *types.Tag @@ -32,14 +32,14 @@ func (l *CreateTagLogic) CreateTag(req *types.TagCreateRequest) (resp *types.Tag
32 //检查重复 32 //检查重复
33 cnt, _, err := l.svcCtx.ArticleTagRepository.Find(l.ctx, conn, req.CompanyId, map[string]interface{}{ 33 cnt, _, err := l.svcCtx.ArticleTagRepository.Find(l.ctx, conn, req.CompanyId, map[string]interface{}{
34 "name": req.Name, 34 "name": req.Name,
35 - "group": req.Group, 35 + "category": req.Category,
36 "countOnly": true, 36 "countOnly": true,
37 }) 37 })
38 if err != nil { 38 if err != nil {
39 return nil, xerr.NewErrMsgErr("添加标签失败", err) 39 return nil, xerr.NewErrMsgErr("添加标签失败", err)
40 } 40 }
41 if cnt > 0 { 41 if cnt > 0 {
42 - return nil, xerr.NewErrMsg(fmt.Sprintf("已存在标签 分类[%s]名称[%s]", req.Group, req.Name)) 42 + return nil, xerr.NewErrMsg(fmt.Sprintf("已存在标签 分类[%s]名称[%s]", req.Category, req.Name))
43 } 43 }
44 //TODO 获取图片的尺寸大小 44 //TODO 获取图片的尺寸大小
45 45
@@ -56,7 +56,7 @@ func (l *CreateTagLogic) CreateTag(req *types.TagCreateRequest) (resp *types.Tag @@ -56,7 +56,7 @@ func (l *CreateTagLogic) CreateTag(req *types.TagCreateRequest) (resp *types.Tag
56 Height: 0, 56 Height: 0,
57 }, 57 },
58 Name: req.Name, 58 Name: req.Name,
59 - Group: req.Group, 59 + Category: req.Category,
60 Remark: req.Remark, 60 Remark: req.Remark,
61 } 61 }
62 62
@@ -33,7 +33,7 @@ func (l *EditTagLogic) EditTag(req *types.TagEditRequest) (resp *types.TagEditRe @@ -33,7 +33,7 @@ func (l *EditTagLogic) EditTag(req *types.TagEditRequest) (resp *types.TagEditRe
33 queryOptions := domain.NewQueryOptions(). 33 queryOptions := domain.NewQueryOptions().
34 WithFindOnly(). 34 WithFindOnly().
35 MustWithKV("name", req.Name). 35 MustWithKV("name", req.Name).
36 - MustWithKV("group", req.Group). 36 + MustWithKV("category", req.Category).
37 WithOffsetLimit(1, 1) 37 WithOffsetLimit(1, 1)
38 38
39 _, tagList, err := l.svcCtx.ArticleTagRepository.Find(l.ctx, conn, req.CompanyId, queryOptions) 39 _, tagList, err := l.svcCtx.ArticleTagRepository.Find(l.ctx, conn, req.CompanyId, queryOptions)
@@ -42,7 +42,7 @@ func (l *EditTagLogic) EditTag(req *types.TagEditRequest) (resp *types.TagEditRe @@ -42,7 +42,7 @@ func (l *EditTagLogic) EditTag(req *types.TagEditRequest) (resp *types.TagEditRe
42 } 42 }
43 if len(tagList) > 0 { 43 if len(tagList) > 0 {
44 if tagList[0].Id != req.Id { 44 if tagList[0].Id != req.Id {
45 - return nil, xerr.NewErrMsg(fmt.Sprintf("已存在标签 分类[%s]名称[%s]", req.Group, req.Name)) 45 + return nil, xerr.NewErrMsg(fmt.Sprintf("已存在标签 分类[%s]名称[%s]", req.Category, req.Name))
46 } 46 }
47 } 47 }
48 oldTag, err := l.svcCtx.ArticleTagRepository.FindOne(l.ctx, conn, req.Id) 48 oldTag, err := l.svcCtx.ArticleTagRepository.FindOne(l.ctx, conn, req.Id)
@@ -55,7 +55,7 @@ func (l *EditTagLogic) EditTag(req *types.TagEditRequest) (resp *types.TagEditRe @@ -55,7 +55,7 @@ func (l *EditTagLogic) EditTag(req *types.TagEditRequest) (resp *types.TagEditRe
55 55
56 //TODO 获取图片的尺寸大小 56 //TODO 获取图片的尺寸大小
57 57
58 - oldTag.Group = req.Group 58 + oldTag.Category = req.Category
59 oldTag.Image.Url = req.Image 59 oldTag.Image.Url = req.Image
60 oldTag.Name = req.Name 60 oldTag.Name = req.Name
61 oldTag.Remark = req.Remark 61 oldTag.Remark = req.Remark
@@ -38,7 +38,7 @@ func (l *GetTagLogic) GetTag(req *types.TagGetRequest) (resp *types.TagGetRespon @@ -38,7 +38,7 @@ func (l *GetTagLogic) GetTag(req *types.TagGetRequest) (resp *types.TagGetRespon
38 Id: oldTag.Id, 38 Id: oldTag.Id,
39 Image: oldTag.Image.Url, 39 Image: oldTag.Image.Url,
40 Name: oldTag.Name, 40 Name: oldTag.Name,
41 - Group: oldTag.Group, 41 + Category: oldTag.Category,
42 Remark: oldTag.Remark, 42 Remark: oldTag.Remark,
43 } 43 }
44 return 44 return
@@ -27,8 +27,8 @@ func (l *SearchTagLogic) SearchTag(req *types.TagListRequest) (resp *types.TagLi @@ -27,8 +27,8 @@ func (l *SearchTagLogic) SearchTag(req *types.TagListRequest) (resp *types.TagLi
27 var conn = l.svcCtx.DefaultDBConn() 27 var conn = l.svcCtx.DefaultDBConn()
28 queryOptions := domain.NewQueryOptions().WithOffsetLimit(req.Page, req.Size) 28 queryOptions := domain.NewQueryOptions().WithOffsetLimit(req.Page, req.Size)
29 29
30 - if len(req.Group) > 0 {  
31 - queryOptions = queryOptions.MustWithKV("group", req.Group) 30 + if len(req.Category) > 0 {
  31 + queryOptions = queryOptions.MustWithKV("group", req.Category)
32 } 32 }
33 if len(req.TagName) > 0 { 33 if len(req.TagName) > 0 {
34 queryOptions = queryOptions.MustWithKV("name", req.TagName) 34 queryOptions = queryOptions.MustWithKV("name", req.TagName)
@@ -50,7 +50,7 @@ func (l *SearchTagLogic) SearchTag(req *types.TagListRequest) (resp *types.TagLi @@ -50,7 +50,7 @@ func (l *SearchTagLogic) SearchTag(req *types.TagListRequest) (resp *types.TagLi
50 Id: tagList[i].Id, 50 Id: tagList[i].Id,
51 Image: tagList[i].Image.Url, 51 Image: tagList[i].Image.Url,
52 Name: tagList[i].Name, 52 Name: tagList[i].Name,
53 - Group: tagList[i].Group, 53 + Category: tagList[i].Category,
54 Remark: tagList[i].Remark, 54 Remark: tagList[i].Remark,
55 CreatedAt: tagList[i].CreatedAt, 55 CreatedAt: tagList[i].CreatedAt,
56 } 56 }
@@ -209,10 +209,10 @@ type SimpleArticle struct { @@ -209,10 +209,10 @@ type SimpleArticle struct {
209 } 209 }
210 210
211 type TagCreateRequest struct { 211 type TagCreateRequest struct {
212 - CompanyId int64 `json:"companyId"` 212 + CompanyId int64 `json:",optional"`
213 Image string `json:"image"` 213 Image string `json:"image"`
214 Name string `json:"name"` // 标签名称 214 Name string `json:"name"` // 标签名称
215 - Group string `json:"group"` // 标签分类 215 + Category string `json:"category"` // 标签分类
216 Remark string `json:"remark,optional"` // 备注 216 Remark string `json:"remark,optional"` // 备注
217 } 217 }
218 218
@@ -222,10 +222,10 @@ type TagCreateResponse struct { @@ -222,10 +222,10 @@ type TagCreateResponse struct {
222 222
223 type TagEditRequest struct { 223 type TagEditRequest struct {
224 Id int64 `json:"id"` 224 Id int64 `json:"id"`
225 - CompanyId int64 `json:"-"` 225 + CompanyId int64 `json:",optional"`
226 Image string `json:"image"` 226 Image string `json:"image"`
227 Name string `json:"name"` // 标签名称 227 Name string `json:"name"` // 标签名称
228 - Group string `json:"group"` // 标签分类 228 + Category string `json:"category"` // 标签分类
229 Remark string `json:"remark,optional"` // 备注 229 Remark string `json:"remark,optional"` // 备注
230 } 230 }
231 231
@@ -235,23 +235,23 @@ type TagEditResponse struct { @@ -235,23 +235,23 @@ type TagEditResponse struct {
235 235
236 type TagGetRequest struct { 236 type TagGetRequest struct {
237 Id int64 `path:"id"` 237 Id int64 `path:"id"`
238 - CompanyId int64 `path:"-"` 238 + CompanyId int64 `path:",optional"`
239 } 239 }
240 240
241 type TagGetResponse struct { 241 type TagGetResponse struct {
242 Id int64 `json:"id"` 242 Id int64 `json:"id"`
243 Image string `json:"image"` 243 Image string `json:"image"`
244 Name string `json:"name"` // 标签名称 244 Name string `json:"name"` // 标签名称
245 - Group string `json:"group"` // 标签分类 245 + Category string `json:"category"` // 标签分类
246 Remark string `json:"remark"` // 备注 246 Remark string `json:"remark"` // 备注
247 } 247 }
248 248
249 type TagListRequest struct { 249 type TagListRequest struct {
250 Page int `json:"page"` 250 Page int `json:"page"`
251 Size int `json:"size"` 251 Size int `json:"size"`
252 - CompanyId int64 `json:"-"` 252 + CompanyId int64 `json:",optional"`
253 TagName string `json:"tagName,optional"` 253 TagName string `json:"tagName,optional"`
254 - Group string `json:"group,optional"` 254 + Category string `json:"category,optional"`
255 Remark string `json:"remark,optional"` 255 Remark string `json:"remark,optional"`
256 } 256 }
257 257
@@ -264,14 +264,14 @@ type TagItem struct { @@ -264,14 +264,14 @@ type TagItem struct {
264 Id int64 `json:"id"` 264 Id int64 `json:"id"`
265 Image string `json:"image"` 265 Image string `json:"image"`
266 Name string `json:"name"` // 标签名称 266 Name string `json:"name"` // 标签名称
267 - Group string `json:"group"` // 标签分类 267 + Category string `json:"category"` // 标签分类
268 Remark string `json:"remark"` // 备注 268 Remark string `json:"remark"` // 备注
269 CreatedAt int64 `json:"createdAt"` 269 CreatedAt int64 `json:"createdAt"`
270 } 270 }
271 271
272 type TagDeleteRequest struct { 272 type TagDeleteRequest struct {
273 Id int64 `path:"id"` 273 Id int64 `path:"id"`
274 - CompanyId int64 `path:"-"` 274 + CompanyId int64 `path:",optional"`
275 } 275 }
276 276
277 type TagDeleteResponse struct { 277 type TagDeleteResponse struct {
@@ -20,9 +20,8 @@ type ArticleTag struct { @@ -20,9 +20,8 @@ type ArticleTag struct {
20 Version int 20 Version int
21 Image domain.Image `gorm:"type:jsonb;serializer:json"` // 图片 21 Image domain.Image `gorm:"type:jsonb;serializer:json"` // 图片
22 Name string // 标签名称 22 Name string // 标签名称
23 - Group string // 标签分类  
24 Remark string // 备注 23 Remark string // 备注
25 - Other string // 其他内容 24 + Category string // 标签分类
26 SortBy int64 // 顺序 25 SortBy int64 // 顺序
27 } 26 }
28 27
@@ -127,8 +127,8 @@ func (repository *ArticleTagRepository) Find(ctx context.Context, conn transacti @@ -127,8 +127,8 @@ func (repository *ArticleTagRepository) Find(ctx context.Context, conn transacti
127 if v, ok := queryOptions["name"]; ok { 127 if v, ok := queryOptions["name"]; ok {
128 tx = tx.Where("name like ?", v) 128 tx = tx.Where("name like ?", v)
129 } 129 }
130 - if v, ok := queryOptions["group"]; ok {  
131 - tx = tx.Where("group like ?", v) 130 + if v, ok := queryOptions["category"]; ok {
  131 + tx = tx.Where("category like ?", v)
132 } 132 }
133 133
134 if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil { 134 if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil {
@@ -17,7 +17,7 @@ type ArticleTag struct { @@ -17,7 +17,7 @@ type ArticleTag struct {
17 Version int `json:"version,omitempty"` 17 Version int `json:"version,omitempty"`
18 Image Image `json:"image"` // 图片 18 Image Image `json:"image"` // 图片
19 Name string `json:"name"` // 标签名称 19 Name string `json:"name"` // 标签名称
20 - Group string `json:"group"` // 标签分类 20 + Category string `json:"category"` // 标签分类 [紧急重要]、[机会风险]
21 Remark string `json:"remark"` // 备注 21 Remark string `json:"remark"` // 备注
22 SortBy int64 `json:"sortBy"` // 顺序 22 SortBy int64 `json:"sortBy"` // 顺序
23 Other string `json:"other"` // 23 Other string `json:"other"` //