作者 庄敏学
@@ -16,10 +16,6 @@ info( @@ -16,10 +16,6 @@ info(
16 ) 16 )
17 service Core { 17 service Core {
18 18
19 - @doc "小程序获取回复@人可选列表"  
20 - @handler MiniArticleCommentAtUser  
21 - post /article_comment/at_user/select (MiniArticleCommentAtUserRequest) returns (MiniArticleCommentAtUserResponse)  
22 -  
23 @doc "小程序填写文章的评论" 19 @doc "小程序填写文章的评论"
24 @handler MiniCreateArticleComment 20 @handler MiniCreateArticleComment
25 post /article_comment (MiniCreateArticleCommentRequest) returns (MiniCreateArticleCommentResponse) 21 post /article_comment (MiniCreateArticleCommentRequest) returns (MiniCreateArticleCommentResponse)
@@ -58,17 +54,6 @@ service Core { @@ -58,17 +54,6 @@ service Core {
58 post /article_comment/search/me (SystemArticleCommentSearchMeRequest) returns (SystemArticleCommentSearchMeResponse) 54 post /article_comment/search/me (SystemArticleCommentSearchMeRequest) returns (SystemArticleCommentSearchMeResponse)
59 } 55 }
60 56
61 -//  
62 -// 小程序获取回复@人可选列表  
63 -type (  
64 - MiniArticleCommentAtUserRequest {  
65 - ArtitceId int64 `json:"articleId"`  
66 - }  
67 -  
68 - MiniArticleCommentAtUserResponse {  
69 - }  
70 -)  
71 -  
72 //评论的填写人 57 //评论的填写人
73 type CommentAuthor { 58 type CommentAuthor {
74 Id int64 `json:"id"` // 人员id 59 Id int64 `json:"id"` // 人员id
@@ -152,7 +137,7 @@ type ( @@ -152,7 +137,7 @@ type (
152 AtWho []CommentAtWho `json:"atWho"` // 填写评论时@的人 137 AtWho []CommentAtWho `json:"atWho"` // 填写评论时@的人
153 CreatedAt int64 `json:"createdAt"` // 138 CreatedAt int64 `json:"createdAt"` //
154 MeLoveFlag int `json:"meLoveFlag"` //当前人员对评论的点赞标识 (0 没有点赞 1有点赞) 139 MeLoveFlag int `json:"meLoveFlag"` //当前人员对评论的点赞标识 (0 没有点赞 1有点赞)
155 - Content string `json:"content"` // 评论的内容 140 + Content string `json:"content"` // 评论的内容
156 } 141 }
157 ) 142 )
158 143
@@ -206,16 +191,16 @@ type ( @@ -206,16 +191,16 @@ type (
206 } 191 }
207 ) 192 )
208 193
209 -type(  
210 - SystemArticleCommentSearchMeRequest{ 194 +type (
  195 + SystemArticleCommentSearchMeRequest {
211 Page int `json:"page"` 196 Page int `json:"page"`
212 Size int `json:"size"` 197 Size int `json:"size"`
213 - AuthorId int64 `json:"authorId"` // 用户 198 + AuthorId int64 `json:"authorId"` // 用户
214 BeginTime int64 `json:"beginTime,optional"` // 开始时间 199 BeginTime int64 `json:"beginTime,optional"` // 开始时间
215 - EndTime int64 `json:"endTime,optional"` // 结束时间 200 + EndTime int64 `json:"endTime,optional"` // 结束时间
216 } 201 }
217 - SystemArticleCommentSearchMeResponse{ 202 + SystemArticleCommentSearchMeResponse {
218 List []ArticleCommentItem `json:"list"` 203 List []ArticleCommentItem `json:"list"`
219 - Total int64 `json:"total"` 204 + Total int64 `json:"total"`
220 } 205 }
221 ) 206 )
@@ -7,6 +7,8 @@ import ( @@ -7,6 +7,8 @@ import (
7 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article" 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" 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 MiniArticleSetTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { 14 func MiniArticleSetTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
@@ -18,11 +20,10 @@ func MiniArticleSetTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { @@ -18,11 +20,10 @@ func MiniArticleSetTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
18 } 20 }
19 21
20 l := article.NewMiniArticleSetTagLogic(r.Context(), svcCtx) 22 l := article.NewMiniArticleSetTagLogic(r.Context(), svcCtx)
  23 + token := contextdata.GetUserTokenFromCtx(r.Context())
  24 + req.UserId = token.UserId
  25 + req.CompanyId = token.CompanyId
21 resp, err := l.MiniArticleSetTag(&req) 26 resp, err := l.MiniArticleSetTag(&req)
22 - if err != nil {  
23 - httpx.ErrorCtx(r.Context(), w, err)  
24 - } else {  
25 - httpx.OkJsonCtx(r.Context(), w, resp)  
26 - } 27 + result.HttpResult(r, w, resp, err)
27 } 28 }
28 } 29 }
1 -package comment  
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/comment"  
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 MiniArticleCommentAtUserHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {  
13 - return func(w http.ResponseWriter, r *http.Request) {  
14 - var req types.MiniArticleCommentAtUserRequest  
15 - if err := httpx.Parse(r, &req); err != nil {  
16 - httpx.ErrorCtx(r.Context(), w, err)  
17 - return  
18 - }  
19 -  
20 - l := comment.NewMiniArticleCommentAtUserLogic(r.Context(), svcCtx)  
21 - resp, err := l.MiniArticleCommentAtUser(&req)  
22 - if err != nil {  
23 - httpx.ErrorCtx(r.Context(), w, err)  
24 - } else {  
25 - httpx.OkJsonCtx(r.Context(), w, resp)  
26 - }  
27 - }  
28 -}  
@@ -22,11 +22,6 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { @@ -22,11 +22,6 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
22 []rest.Route{ 22 []rest.Route{
23 { 23 {
24 Method: http.MethodPost, 24 Method: http.MethodPost,
25 - Path: "/article_comment/at_user/select",  
26 - Handler: comment.MiniArticleCommentAtUserHandler(serverCtx),  
27 - },  
28 - {  
29 - Method: http.MethodPost,  
30 Path: "/article_comment", 25 Path: "/article_comment",
31 Handler: comment.MiniCreateArticleCommentHandler(serverCtx), 26 Handler: comment.MiniCreateArticleCommentHandler(serverCtx),
32 }, 27 },
@@ -23,8 +23,9 @@ func NewMiniArticleSetTagLogic(ctx context.Context, svcCtx *svc.ServiceContext) @@ -23,8 +23,9 @@ func NewMiniArticleSetTagLogic(ctx context.Context, svcCtx *svc.ServiceContext)
23 } 23 }
24 } 24 }
25 25
  26 +// 设置文章的定性标签
26 func (l *MiniArticleSetTagLogic) MiniArticleSetTag(req *types.MiniArticleSetTagRequest) (resp *types.MiniArticleSetTagResponse, err error) { 27 func (l *MiniArticleSetTagLogic) MiniArticleSetTag(req *types.MiniArticleSetTagRequest) (resp *types.MiniArticleSetTagResponse, err error) {
27 - // todo: add your logic here and delete this line  
28 28
  29 + //
29 return 30 return
30 } 31 }
1 -package comment  
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 MiniArticleCommentAtUserLogic struct {  
13 - logx.Logger  
14 - ctx context.Context  
15 - svcCtx *svc.ServiceContext  
16 -}  
17 -  
18 -func NewMiniArticleCommentAtUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniArticleCommentAtUserLogic {  
19 - return &MiniArticleCommentAtUserLogic{  
20 - Logger: logx.WithContext(ctx),  
21 - ctx: ctx,  
22 - svcCtx: svcCtx,  
23 - }  
24 -}  
25 -  
26 -func (l *MiniArticleCommentAtUserLogic) MiniArticleCommentAtUser(req *types.MiniArticleCommentAtUserRequest) (resp *types.MiniArticleCommentAtUserResponse, err error) {  
27 - // todo: add your logic here and delete this line  
28 -  
29 - return  
30 -}  
1 // Code generated by goctl. DO NOT EDIT. 1 // Code generated by goctl. DO NOT EDIT.
2 package types 2 package types
3 3
4 -type MiniArticleCommentAtUserRequest struct {  
5 - ArtitceId int64 `json:"articleId"`  
6 -}  
7 -  
8 -type MiniArticleCommentAtUserResponse struct {  
9 -}  
10 -  
11 type CommentAuthor struct { 4 type CommentAuthor struct {
12 Id int64 `json:"id"` // 人员id 5 Id int64 `json:"id"` // 人员id
13 Name string `json:"name"` // 人员的名字 6 Name string `json:"name"` // 人员的名字