Merge branch 'dev' of http://gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss into dev
正在显示
42 个修改的文件
包含
1433 行增加
和
302 行删除
1 | syntax = "v1" | 1 | syntax = "v1" |
2 | 2 | ||
3 | -import "core/article_type.api" | ||
4 | import "core/comment.api" | 3 | import "core/comment.api" |
5 | import "core/message.api" | 4 | import "core/message.api" |
6 | import "core/article_tag.api" | 5 | import "core/article_tag.api" |
7 | import "core/user.api" | 6 | import "core/user.api" |
8 | import "core/company.api" | 7 | import "core/company.api" |
8 | +import "core/article_type.api" | ||
9 | import "core/article.api" | 9 | import "core/article.api" |
10 | import "core/role.api" | 10 | import "core/role.api" |
11 | +import "core/department.api" |
@@ -32,18 +32,37 @@ service Core { | @@ -32,18 +32,37 @@ service Core { | ||
32 | @handler MiniArticleMarkUserRead | 32 | @handler MiniArticleMarkUserRead |
33 | post /article/mark/user_read (MiniArticleMarkUserReadRequest) returns (MiniArticleMarkUserReadResponse) | 33 | post /article/mark/user_read (MiniArticleMarkUserReadRequest) returns (MiniArticleMarkUserReadResponse) |
34 | 34 | ||
35 | + @doc "小程序获取文章浏览记录" | ||
36 | + @handler MiniArticleMarkList | ||
37 | + post /article/mark/list (MiniArticleMarkListRequest) returns (MiniArticleMarkListResponse) | ||
38 | + | ||
35 | @doc "小程序获取我发布的文章" | 39 | @doc "小程序获取我发布的文章" |
36 | @handler MiniArticleSearchMe | 40 | @handler MiniArticleSearchMe |
37 | post /article/search/me (MiniArticleSearchMeRequest) returns (MiniArticleSearchMeResponse) | 41 | post /article/search/me (MiniArticleSearchMeRequest) returns (MiniArticleSearchMeResponse) |
38 | 42 | ||
39 | @doc "小程序创建文章进草稿箱" | 43 | @doc "小程序创建文章进草稿箱" |
40 | @handler MiniCreateArticleDraft | 44 | @handler MiniCreateArticleDraft |
41 | - post /article_draft (MiniArticleSearchMeRequest) returns (MiniArticleSearchMeResponse) | 45 | + post /article_draft (MiniArticleDraftCreateRequest) returns (MiniArticleDraftCreateResponse) |
46 | + | ||
47 | + @doc "小程序更新文章草稿" | ||
48 | + @handler MiniUpdateArticleDraft | ||
49 | + put /article_draft (MiniArticleDraftUpdateRequest) returns (MiniArticleDraftUpdateResponse) | ||
50 | + | ||
51 | + @doc "小程序获取我的草稿箱列表" | ||
52 | + @handler MiniSearchArticleDraftMe | ||
53 | + post /article_draft/search/me (MiniArticleDraftSearchMeRequest) returns (MiniArticleDraftSearchMeResponse) | ||
54 | + | ||
55 | + @doc "小程序获取我的草稿内容" | ||
56 | + @handler MiniGetArticleDraftMe | ||
57 | + get /article_draft/me/:id (MiniArticleDraftGetMeRequest) returns (MiniArticleDraftGetMeResponse) | ||
58 | + | ||
59 | + @doc "小程序删除我的草稿内容" | ||
60 | + @handler MiniDeleteArticleDraftMe | ||
61 | + delete /article_draft/me/:id (MiniArticleDraftDeleteMeRequest) returns (MiniArticleDraftDeleteMeResponse) | ||
42 | 62 | ||
43 | @doc "小程序获取文章的编辑记录" | 63 | @doc "小程序获取文章的编辑记录" |
44 | @handler MiniArticleBackupSearch | 64 | @handler MiniArticleBackupSearch |
45 | post /article_backup/search (MiniArticleBackupSearchRequest) returns (MiniArticleBackupSearchResponse) | 65 | post /article_backup/search (MiniArticleBackupSearchRequest) returns (MiniArticleBackupSearchResponse) |
46 | - | ||
47 | } | 66 | } |
48 | 67 | ||
49 | // 管理后台接口 | 68 | // 管理后台接口 |
@@ -8,11 +8,10 @@ type Location { | @@ -8,11 +8,10 @@ type Location { | ||
8 | } | 8 | } |
9 | 9 | ||
10 | // 人员的简单展示信息 | 10 | // 人员的简单展示信息 |
11 | -type Author { | 11 | +type ArticleAuthor { |
12 | Id int64 `json:"id"` // 人员id | 12 | Id int64 `json:"id"` // 人员id |
13 | Name string `json:"name"` // 人员的名字 | 13 | Name string `json:"name"` // 人员的名字 |
14 | Avatar string `json:"avatar"` // 人员头像URL | 14 | Avatar string `json:"avatar"` // 人员头像URL |
15 | - Group string `json:"group"` // 人员的分组 | ||
16 | Position string `json:"position"` // 职位 | 15 | Position string `json:"position"` // 职位 |
17 | Company string `json:"company"` // 公司 | 16 | Company string `json:"company"` // 公司 |
18 | } | 17 | } |
@@ -37,13 +36,14 @@ type ( | @@ -37,13 +36,14 @@ type ( | ||
37 | type ( | 36 | type ( |
38 | MiniArticleGetRequest { | 37 | MiniArticleGetRequest { |
39 | Id int64 `path:"id"` //id | 38 | Id int64 `path:"id"` //id |
40 | - CompanyId int64 `path:",optional"` | 39 | + CompanyId int64 `path:",optional"`//当前公司 |
40 | + UserId int `path:",optional"` //当前用户 | ||
41 | } | 41 | } |
42 | MiniArticleGetResponse { | 42 | MiniArticleGetResponse { |
43 | Id int64 `json:"id"` //id | 43 | Id int64 `json:"id"` //id |
44 | Title string `json:"title"` //标题 | 44 | Title string `json:"title"` //标题 |
45 | AuthorId int64 `json:"authorId"` //发布人id | 45 | AuthorId int64 `json:"authorId"` //发布人id |
46 | - Author Author `json:"author"` //发布人 | 46 | + Author ArticleAuthor `json:"author"` //发布人 |
47 | CreatedAt int64 `json:"createdAt"` //文章的发布时间 | 47 | CreatedAt int64 `json:"createdAt"` //文章的发布时间 |
48 | Section []ArticleSection `json:"section"` //文章的文本内容 | 48 | Section []ArticleSection `json:"section"` //文章的文本内容 |
49 | Images []string `json:"images"` //图片 | 49 | Images []string `json:"images"` //图片 |
@@ -55,6 +55,7 @@ type ( | @@ -55,6 +55,7 @@ type ( | ||
55 | CountRead int `json:"countRead"` // 浏览数量 | 55 | CountRead int `json:"countRead"` // 浏览数量 |
56 | Show int `json:"show"` // 评论的展示状态(0显示、1不显示) | 56 | Show int `json:"show"` // 评论的展示状态(0显示、1不显示) |
57 | Edit int `json:"edit"` // 文章是否存在变更记录 (0 不存在 1存在) | 57 | Edit int `json:"edit"` // 文章是否存在变更记录 (0 不存在 1存在) |
58 | + MeLoveFlag int `json:"meLoveFlag"` //当前人员对文章的点赞标识 | ||
58 | } | 59 | } |
59 | ArticleSection { | 60 | ArticleSection { |
60 | Id int64 `json:"id"` //段落id | 61 | Id int64 `json:"id"` //段落id |
@@ -160,18 +161,126 @@ type ( | @@ -160,18 +161,126 @@ type ( | ||
160 | } | 161 | } |
161 | ) | 162 | ) |
162 | 163 | ||
163 | -//保存文章到草稿箱 | 164 | +//小程序端创建文章到草稿箱 |
164 | type ( | 165 | type ( |
165 | MiniArticleDraftCreateRequest { | 166 | MiniArticleDraftCreateRequest { |
167 | + CompanyId int64 `json:",optional"` | ||
168 | + AuthorId int64 `json:",optional"` // 发布人 | ||
166 | Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式 | 169 | Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式 |
167 | - Content []string `json:"content"` // 填写的内容 | ||
168 | - Title string `json:"title"` //标题 | ||
169 | - Images []string `json:"images"` //图片 | 170 | + Section []string `json:"section"` // 填写的内容 |
171 | + Title string `json:"title"` // 标题 | ||
172 | + Images []string `json:"images"` // 图片 | ||
173 | + WhoRead []int64 `json:"whoRead"` // 谁可以看 | ||
174 | + WhoReview []int64 `json:"whoReview"` // 评论人 | ||
175 | + Location Location `json:"location"` // 坐标 | ||
170 | } | 176 | } |
171 | 177 | ||
172 | - MiniArticleDraftCreateResponse struct{} | 178 | + MiniArticleDraftCreateResponse { |
179 | + Id int64 `json:"id"` | ||
180 | + } | ||
173 | ) | 181 | ) |
174 | 182 | ||
183 | +//小程序端更新文章草稿 | ||
184 | +type ( | ||
185 | + MiniArticleDraftUpdateRequest { | ||
186 | + Id int64 `json:"id"` | ||
187 | + CompanyId int64 `json:",optional"` | ||
188 | + AuthorId int64 `json:",optional"` // 发布人 | ||
189 | + Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式 | ||
190 | + Section []string `json:"section"` // 填写的内容 | ||
191 | + Title string `json:"title"` // 标题 | ||
192 | + Images []string `json:"images"` // 图片 | ||
193 | + WhoRead []int64 `json:"whoRead"` // 谁可以看 | ||
194 | + WhoReview []int64 `json:"whoReview"` // 评论人 | ||
195 | + Location Location `json:"location"` // 坐标 | ||
196 | + } | ||
197 | + | ||
198 | + MiniArticleDraftUpdateResponse { | ||
199 | + Id int64 `json:"id"` | ||
200 | + } | ||
201 | +) | ||
202 | + | ||
203 | +//小程序端获取我的草稿列表 | ||
204 | +type ( | ||
205 | + MiniArticleDraftSearchMeRequest { | ||
206 | + CompanyId int64 `json:",optional"` // 公司id | ||
207 | + AuthorId int64 `json:",optional"` // 发布人 | ||
208 | + Page int `json:"page"` | ||
209 | + Size int `json:"size"` | ||
210 | + } | ||
211 | + | ||
212 | + MiniArticleDraftSearchMeResponse { | ||
213 | + Total int64 `json:"total"` | ||
214 | + List []MiniArticleDraftItem `json:"list"` | ||
215 | + } | ||
216 | + MiniArticleDraftItem { | ||
217 | + Id int64 `json:"id"` | ||
218 | + Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式 | ||
219 | + Section []string `json:"section"` // 填写的内容 | ||
220 | + Title string `json:"title"` // 标题 | ||
221 | + Images []string `json:"images"` // 图片 | ||
222 | + CreatedAt int64 `json:"createdAt"` | ||
223 | + } | ||
224 | +) | ||
225 | + | ||
226 | +//小程序端获取我的草稿内容 | ||
227 | +type ( | ||
228 | + MiniArticleDraftGetMeRequest { | ||
229 | + CompanyId int64 `path:",optional"` // 公司id | ||
230 | + AuthorId int64 `path:",optional"` // 发布人 | ||
231 | + Id int64 `path:"id"` | ||
232 | + } | ||
233 | + | ||
234 | + MiniArticleDraftGetMeResponse { | ||
235 | + Id int64 `json:"id"` // | ||
236 | + Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式 | ||
237 | + Section []string `json:"Section"` // 填写的内容 | ||
238 | + Title string `json:"title"` // 标题 | ||
239 | + Images []string `json:"images"` // 图片 | ||
240 | + WhoRead []int64 `json:"whoRead"` // 谁可以看 | ||
241 | + WhoReview []int64 `json:"whoReview"` // 评论人 | ||
242 | + Location Location `json:"location"` // 坐标 | ||
243 | + } | ||
244 | +) | ||
245 | + | ||
246 | +// 小程序端删除我的草稿内容 | ||
247 | +type ( | ||
248 | + MiniArticleDraftDeleteMeRequest { | ||
249 | + CompanyId int64 `path:",optional"` // 公司id | ||
250 | + AuthorId int64 `path:",optional"` // 发布人 | ||
251 | + Id int64 `path:"id"` | ||
252 | + } | ||
253 | + | ||
254 | + MiniArticleDraftDeleteMeResponse { | ||
255 | + Id int64 `json:"id"` // | ||
256 | + } | ||
257 | +) | ||
258 | +// 小程序端获取我的浏览记录 | ||
259 | +type ( | ||
260 | + MiniArticleMarkListRequest { | ||
261 | + Page int `json:"page"` | ||
262 | + Size int `json:"size"` | ||
263 | + } | ||
264 | + | ||
265 | + MiniArticleMarkListResponse { | ||
266 | + Total int64 `json:"total"` | ||
267 | + List []MiniArticleMarkItem `json:"list"` | ||
268 | + } | ||
269 | + | ||
270 | + MiniArticleMarkItem { | ||
271 | + Id int64 `json:"id"` | ||
272 | + CompanyId int64 `json:"companyId"` | ||
273 | + UserId int64 `json:"userId"` | ||
274 | + ArticleId int64 `json:"articleId"` | ||
275 | + Title string `json:"title"` | ||
276 | + Author SimpleUser `json:"author"` // 发布人 | ||
277 | + UpdatedAt int64 `json:"updatedAt"` | ||
278 | + } | ||
279 | +) | ||
280 | + | ||
281 | + | ||
282 | + | ||
283 | + | ||
175 | //管理后台获取文章详情 | 284 | //管理后台获取文章详情 |
176 | type ( | 285 | type ( |
177 | SystemArticleGetRequest { | 286 | SystemArticleGetRequest { |
@@ -188,7 +297,7 @@ type ( | @@ -188,7 +297,7 @@ type ( | ||
188 | Id int64 `json:"id"` // id | 297 | Id int64 `json:"id"` // id |
189 | Title string `json:"title"` // 标题 | 298 | Title string `json:"title"` // 标题 |
190 | AuthorId int64 `json:"authorId"` // 发布人id | 299 | AuthorId int64 `json:"authorId"` // 发布人id |
191 | - Author Author `json:"author"` // 发布人 | 300 | + Author ArticleAuthor `json:"author"` // 发布人 |
192 | CreatedAt int64 `json:"createdAt"` // 文章的发布时间 | 301 | CreatedAt int64 `json:"createdAt"` // 文章的发布时间 |
193 | Section []ArticleSection `json:"section"` // 文章的文本内容 | 302 | Section []ArticleSection `json:"section"` // 文章的文本内容 |
194 | Images []string `json:"images"` // 图片 | 303 | Images []string `json:"images"` // 图片 |
1 | syntax = "v1" | 1 | syntax = "v1" |
2 | 2 | ||
3 | info( | 3 | info( |
4 | - title: "天联鹰蜓" | ||
5 | - desc: "天联鹰蜓" | ||
6 | - author: "email" | 4 | + title: "评论相关" |
5 | + desc: "编辑处理文章的评论" | ||
6 | + author: "author" | ||
7 | email: "email" | 7 | email: "email" |
8 | version: "v1" | 8 | version: "v1" |
9 | ) | 9 | ) |
10 | 10 | ||
11 | // 小程序接口 | 11 | // 小程序接口 |
12 | @server( | 12 | @server( |
13 | - prefix: v1 | 13 | + prefix: v1/mini |
14 | group: comment | 14 | group: comment |
15 | jwt: MiniAuth | 15 | jwt: MiniAuth |
16 | ) | 16 | ) |
17 | service Core { | 17 | service Core { |
18 | - @doc "小程序评论" | ||
19 | - @handler miniComment | ||
20 | - get /mini/comment (CommentRequest) returns (CommentResposne) | 18 | + |
19 | + @doc "小程序获取回复@人可选列表" | ||
20 | + @handler MiniArticleCommentAtUser | ||
21 | + post /article_comment/at_user/select (MiniArticleCommentAtUserRequest) returns (MiniArticleCommentAtUserResponse) | ||
22 | + | ||
23 | + @doc "小程序填写文章的评论" | ||
24 | + @handler MiniCreateArticleComment | ||
25 | + post /article_comment (MiniCreateArticleCommentRequest) returns (MiniCreateArticleCommentResponse) | ||
21 | } | 26 | } |
22 | 27 | ||
23 | -// 后台接口 | ||
24 | -@server( | ||
25 | - prefix: v1 | ||
26 | - group: comment | ||
27 | - jwt: SystemAuth | 28 | +// |
29 | +// 小程序获取回复@人可选列表 | ||
30 | +type ( | ||
31 | + MiniArticleCommentAtUserRequest { | ||
32 | + ArtitceId int64 `json:"articleId"` | ||
33 | + } | ||
34 | + | ||
35 | + MiniArticleCommentAtUserResponse { | ||
36 | + } | ||
28 | ) | 37 | ) |
29 | -service Core { | ||
30 | - @doc "系统评论" | ||
31 | - @handler systemComment | ||
32 | - get /system/comment (CommentRequest) returns (CommentResposne) | 38 | + |
39 | +//评论的填写人 | ||
40 | +type CommentAuthor { | ||
41 | + Id int64 `json:"id"` // 人员id | ||
42 | + Name string `json:"name"` // 人员的名字 | ||
43 | + Avatar string `json:"avatar"` // 人员头像URL | ||
44 | + Position string `json:"position"` // 职位 | ||
45 | + Company string `json:"company"` // 公司 | ||
33 | } | 46 | } |
34 | 47 | ||
48 | +// 小程序填写文章的评论 | ||
35 | type ( | 49 | type ( |
36 | - CommentRequest { | ||
37 | - } | ||
38 | - CommentResposne { | ||
39 | - List []Comment `json:"list"` | 50 | + MiniCreateArticleCommentRequest { |
51 | + ArtitceId int64 `json:"articleId"` // 文章id | ||
52 | + SectionId int64 `json:"sectionId"` // 段落id | ||
53 | + FromUserId int64 `json:",optional"` // 填写文章的人,服务端自动获取 | ||
54 | + Pid int64 `json:"commnet"` // 回复那个评论的id | ||
55 | + Content string `json:"content"` // 评论的内容 | ||
56 | + AtWho []int64 `json:"atWho"` // 填写评论时@的人 | ||
40 | } | 57 | } |
41 | 58 | ||
42 | - Comment { | 59 | + MiniCreateArticleCommentResponse { |
60 | + Id int64 `json:"id"` | ||
61 | + Pid int64 `json:"pid"` | ||
62 | + TopId int64 `json:"topId"` | ||
63 | + ArtitceId int64 `json:"articleId"` // 文章id | ||
64 | + SectionId int64 `json:"sectionId"` // 段落id | ||
65 | + FromUserId int64 `json:"fromUserId"` // 填写评论的人 | ||
66 | + FromUser CommentAuthor `json:"fromUser"` // 填写评论的人 | ||
67 | + ToUserId int64 `json:"toUserId"` // 回复哪个人 | ||
68 | + ToUser CommentAuthor `json:"toUser"` // 回复哪个人 | ||
69 | + SectionContent string `json:"sectionContent"` // 引用的文章内容文本 | ||
70 | + CountReply int `json:"countReply"` // 回复数量 | ||
71 | + CountUserLove int `json:"countUserLove"` // 用户点赞数量 | ||
72 | + CountAdminLove int `json:"countAdminLove"` // 运营点赞数量 | ||
73 | + AtWho []CommentAuthor `json:"atWho"` // 填写评论时@的人 | ||
43 | } | 74 | } |
44 | ) | 75 | ) |
cmd/discuss/api/dsl/core/department.api
0 → 100644
1 | +syntax = "v1" | ||
2 | + | ||
3 | +info( | ||
4 | + title: "部门分组" | ||
5 | + desc: "部门分组" | ||
6 | + author: "zz" | ||
7 | + email: "email" | ||
8 | + version: "v1" | ||
9 | +) | ||
10 | + | ||
11 | +@server( | ||
12 | + prefix: v1 | ||
13 | + group: department | ||
14 | + jwt: SystemAuth | ||
15 | +) | ||
16 | +service Core { | ||
17 | + @doc "部门列表" | ||
18 | + @handler systemList | ||
19 | + post /system/department/list (DepartmentListRequest) returns (DepartmentListResponse) | ||
20 | + | ||
21 | + @doc "部门-新增" | ||
22 | + @handler systemAdd | ||
23 | + post /system/department/add (DepartmentAddRequest) returns (DepartmentGetResponse) | ||
24 | + | ||
25 | + @doc "部门-详情" | ||
26 | + @handler systemGet | ||
27 | + get /system/department/:id (DepartmentGetRequest) returns (DepartmentGetResponse) | ||
28 | + | ||
29 | + @doc "部门-更新" | ||
30 | + @handler systemUpdate | ||
31 | + put /system/department/:id (DepartmentUpdateRequest) returns (DepartmentGetResponse) | ||
32 | +} | ||
33 | + | ||
34 | +type ( | ||
35 | + DepartmentAddRequest { | ||
36 | + Name string `json:"name"` // 分组名称 | ||
37 | + Ids []int64 `json:"ids"` // 用户ID | ||
38 | + } | ||
39 | + | ||
40 | + DepartmentGetRequest { | ||
41 | + Id int64 `path:"id"` | ||
42 | + } | ||
43 | + | ||
44 | + DepartmentGetResponse struct{ | ||
45 | + Department Department `json:"department"` | ||
46 | + } | ||
47 | + | ||
48 | + DepartmentUpdateRequest { | ||
49 | + Id int64 `path:"id"` | ||
50 | + Name string `json:"name"` | ||
51 | + } | ||
52 | + | ||
53 | + DepartmentListRequest { | ||
54 | + Page int `json:"page"` | ||
55 | + Size int `json:"size"` | ||
56 | + } | ||
57 | + | ||
58 | + DepartmentListResponse { | ||
59 | + List []Department `json:"list"` | ||
60 | + Total int64 `json:"total"` | ||
61 | + } | ||
62 | + | ||
63 | +) |
1 | +package article | ||
2 | + | ||
3 | +import ( | ||
4 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result" | ||
5 | + "net/http" | ||
6 | + | ||
7 | + "github.com/zeromicro/go-zero/rest/httpx" | ||
8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article" | ||
9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | ||
10 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | ||
11 | +) | ||
12 | + | ||
13 | +func MiniArticleMarkListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
14 | + return func(w http.ResponseWriter, r *http.Request) { | ||
15 | + var req types.MiniArticleMarkListRequest | ||
16 | + if err := httpx.Parse(r, &req); err != nil { | ||
17 | + httpx.ErrorCtx(r.Context(), w, err) | ||
18 | + return | ||
19 | + } | ||
20 | + | ||
21 | + l := article.NewMiniArticleMarkListLogic(r.Context(), svcCtx) | ||
22 | + resp, err := l.MiniArticleMarkList(&req) | ||
23 | + result.HttpResult(r, w, resp, err) | ||
24 | + } | ||
25 | +} |
@@ -7,22 +7,23 @@ import ( | @@ -7,22 +7,23 @@ 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 MiniCreateArticleDraftHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | 14 | func MiniCreateArticleDraftHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { |
13 | return func(w http.ResponseWriter, r *http.Request) { | 15 | return func(w http.ResponseWriter, r *http.Request) { |
14 | - var req types.MiniArticleSearchMeRequest | 16 | + var req types.MiniArticleDraftCreateRequest |
15 | if err := httpx.Parse(r, &req); err != nil { | 17 | if err := httpx.Parse(r, &req); err != nil { |
16 | httpx.ErrorCtx(r.Context(), w, err) | 18 | httpx.ErrorCtx(r.Context(), w, err) |
17 | return | 19 | return |
18 | } | 20 | } |
19 | 21 | ||
20 | l := article.NewMiniCreateArticleDraftLogic(r.Context(), svcCtx) | 22 | l := article.NewMiniCreateArticleDraftLogic(r.Context(), svcCtx) |
23 | + token := contextdata.GetUserTokenFromCtx(r.Context()) | ||
24 | + req.AuthorId = token.UserId | ||
25 | + req.CompanyId = token.CompanyId | ||
21 | resp, err := l.MiniCreateArticleDraft(&req) | 26 | resp, err := l.MiniCreateArticleDraft(&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 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 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" | ||
11 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result" | ||
12 | +) | ||
13 | + | ||
14 | +func MiniDeleteArticleDraftMeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
15 | + return func(w http.ResponseWriter, r *http.Request) { | ||
16 | + var req types.MiniArticleDraftDeleteMeRequest | ||
17 | + if err := httpx.Parse(r, &req); err != nil { | ||
18 | + httpx.ErrorCtx(r.Context(), w, err) | ||
19 | + return | ||
20 | + } | ||
21 | + | ||
22 | + l := article.NewMiniDeleteArticleDraftMeLogic(r.Context(), svcCtx) | ||
23 | + token := contextdata.GetUserTokenFromCtx(r.Context()) | ||
24 | + req.AuthorId = token.UserId | ||
25 | + req.CompanyId = token.CompanyId | ||
26 | + resp, err := l.MiniDeleteArticleDraftMe(&req) | ||
27 | + result.HttpResult(r, w, resp, err) | ||
28 | + } | ||
29 | +} |
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 MiniGetArticleDraftMeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
13 | + return func(w http.ResponseWriter, r *http.Request) { | ||
14 | + var req types.MiniArticleDraftGetMeRequest | ||
15 | + if err := httpx.Parse(r, &req); err != nil { | ||
16 | + httpx.ErrorCtx(r.Context(), w, err) | ||
17 | + return | ||
18 | + } | ||
19 | + | ||
20 | + l := article.NewMiniGetArticleDraftMeLogic(r.Context(), svcCtx) | ||
21 | + resp, err := l.MiniGetArticleDraftMe(&req) | ||
22 | + if err != nil { | ||
23 | + httpx.ErrorCtx(r.Context(), w, err) | ||
24 | + } else { | ||
25 | + httpx.OkJsonCtx(r.Context(), w, resp) | ||
26 | + } | ||
27 | + } | ||
28 | +} |
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 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" | ||
11 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result" | ||
12 | +) | ||
13 | + | ||
14 | +func MiniSearchArticleDraftMeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
15 | + return func(w http.ResponseWriter, r *http.Request) { | ||
16 | + var req types.MiniArticleDraftSearchMeRequest | ||
17 | + if err := httpx.Parse(r, &req); err != nil { | ||
18 | + httpx.ErrorCtx(r.Context(), w, err) | ||
19 | + return | ||
20 | + } | ||
21 | + | ||
22 | + l := article.NewMiniSearchArticleDraftMeLogic(r.Context(), svcCtx) | ||
23 | + token := contextdata.GetUserTokenFromCtx(r.Context()) | ||
24 | + req.AuthorId = token.UserId | ||
25 | + req.CompanyId = token.CompanyId | ||
26 | + resp, err := l.MiniSearchArticleDraftMe(&req) | ||
27 | + result.HttpResult(r, w, resp, err) | ||
28 | + } | ||
29 | +} |
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 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" | ||
11 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result" | ||
12 | +) | ||
13 | + | ||
14 | +func MiniUpdateArticleDraftHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
15 | + return func(w http.ResponseWriter, r *http.Request) { | ||
16 | + var req types.MiniArticleDraftUpdateRequest | ||
17 | + if err := httpx.Parse(r, &req); err != nil { | ||
18 | + httpx.ErrorCtx(r.Context(), w, err) | ||
19 | + return | ||
20 | + } | ||
21 | + l := article.NewMiniUpdateArticleDraftLogic(r.Context(), svcCtx) | ||
22 | + token := contextdata.GetUserTokenFromCtx(r.Context()) | ||
23 | + req.AuthorId = token.UserId | ||
24 | + req.CompanyId = token.CompanyId | ||
25 | + resp, err := l.MiniUpdateArticleDraft(&req) | ||
26 | + result.HttpResult(r, w, resp, err) | ||
27 | + } | ||
28 | +} |
@@ -9,16 +9,16 @@ import ( | @@ -9,16 +9,16 @@ import ( | ||
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 | ) | 10 | ) |
11 | 11 | ||
12 | -func MiniCommentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | 12 | +func MiniArticleCommentAtUserHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { |
13 | return func(w http.ResponseWriter, r *http.Request) { | 13 | return func(w http.ResponseWriter, r *http.Request) { |
14 | - var req types.CommentRequest | 14 | + var req types.MiniArticleCommentAtUserRequest |
15 | if err := httpx.Parse(r, &req); err != nil { | 15 | if err := httpx.Parse(r, &req); err != nil { |
16 | httpx.ErrorCtx(r.Context(), w, err) | 16 | httpx.ErrorCtx(r.Context(), w, err) |
17 | return | 17 | return |
18 | } | 18 | } |
19 | 19 | ||
20 | - l := comment.NewMiniCommentLogic(r.Context(), svcCtx) | ||
21 | - resp, err := l.MiniComment(&req) | 20 | + l := comment.NewMiniArticleCommentAtUserLogic(r.Context(), svcCtx) |
21 | + resp, err := l.MiniArticleCommentAtUser(&req) | ||
22 | if err != nil { | 22 | if err != nil { |
23 | httpx.ErrorCtx(r.Context(), w, err) | 23 | httpx.ErrorCtx(r.Context(), w, err) |
24 | } else { | 24 | } else { |
@@ -9,16 +9,16 @@ import ( | @@ -9,16 +9,16 @@ import ( | ||
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 | ) | 10 | ) |
11 | 11 | ||
12 | -func SystemCommentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | 12 | +func MiniCreateArticleCommentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { |
13 | return func(w http.ResponseWriter, r *http.Request) { | 13 | return func(w http.ResponseWriter, r *http.Request) { |
14 | - var req types.CommentRequest | 14 | + var req types.MiniCreateArticleCommentRequest |
15 | if err := httpx.Parse(r, &req); err != nil { | 15 | if err := httpx.Parse(r, &req); err != nil { |
16 | httpx.ErrorCtx(r.Context(), w, err) | 16 | httpx.ErrorCtx(r.Context(), w, err) |
17 | return | 17 | return |
18 | } | 18 | } |
19 | 19 | ||
20 | - l := comment.NewSystemCommentLogic(r.Context(), svcCtx) | ||
21 | - resp, err := l.SystemComment(&req) | 20 | + l := comment.NewMiniCreateArticleCommentLogic(r.Context(), svcCtx) |
21 | + resp, err := l.MiniCreateArticleComment(&req) | ||
22 | if err != nil { | 22 | if err != nil { |
23 | httpx.ErrorCtx(r.Context(), w, err) | 23 | httpx.ErrorCtx(r.Context(), w, err) |
24 | } else { | 24 | } else { |
1 | +package department | ||
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/department" | ||
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 SystemAddHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
13 | + return func(w http.ResponseWriter, r *http.Request) { | ||
14 | + var req types.DepartmentAddRequest | ||
15 | + if err := httpx.Parse(r, &req); err != nil { | ||
16 | + httpx.ErrorCtx(r.Context(), w, err) | ||
17 | + return | ||
18 | + } | ||
19 | + | ||
20 | + l := department.NewSystemAddLogic(r.Context(), svcCtx) | ||
21 | + resp, err := l.SystemAdd(&req) | ||
22 | + if err != nil { | ||
23 | + httpx.ErrorCtx(r.Context(), w, err) | ||
24 | + } else { | ||
25 | + httpx.OkJsonCtx(r.Context(), w, resp) | ||
26 | + } | ||
27 | + } | ||
28 | +} |
1 | +package department | ||
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/department" | ||
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 SystemGetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
13 | + return func(w http.ResponseWriter, r *http.Request) { | ||
14 | + var req types.DepartmentGetRequest | ||
15 | + if err := httpx.Parse(r, &req); err != nil { | ||
16 | + httpx.ErrorCtx(r.Context(), w, err) | ||
17 | + return | ||
18 | + } | ||
19 | + | ||
20 | + l := department.NewSystemGetLogic(r.Context(), svcCtx) | ||
21 | + resp, err := l.SystemGet(&req) | ||
22 | + if err != nil { | ||
23 | + httpx.ErrorCtx(r.Context(), w, err) | ||
24 | + } else { | ||
25 | + httpx.OkJsonCtx(r.Context(), w, resp) | ||
26 | + } | ||
27 | + } | ||
28 | +} |
1 | +package department | ||
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/department" | ||
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 SystemListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
13 | + return func(w http.ResponseWriter, r *http.Request) { | ||
14 | + var req types.DepartmentListRequest | ||
15 | + if err := httpx.Parse(r, &req); err != nil { | ||
16 | + httpx.ErrorCtx(r.Context(), w, err) | ||
17 | + return | ||
18 | + } | ||
19 | + | ||
20 | + l := department.NewSystemListLogic(r.Context(), svcCtx) | ||
21 | + resp, err := l.SystemList(&req) | ||
22 | + if err != nil { | ||
23 | + httpx.ErrorCtx(r.Context(), w, err) | ||
24 | + } else { | ||
25 | + httpx.OkJsonCtx(r.Context(), w, resp) | ||
26 | + } | ||
27 | + } | ||
28 | +} |
1 | +package department | ||
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/department" | ||
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 SystemUpdateHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
13 | + return func(w http.ResponseWriter, r *http.Request) { | ||
14 | + var req types.DepartmentUpdateRequest | ||
15 | + if err := httpx.Parse(r, &req); err != nil { | ||
16 | + httpx.ErrorCtx(r.Context(), w, err) | ||
17 | + return | ||
18 | + } | ||
19 | + | ||
20 | + l := department.NewSystemUpdateLogic(r.Context(), svcCtx) | ||
21 | + resp, err := l.SystemUpdate(&req) | ||
22 | + if err != nil { | ||
23 | + httpx.ErrorCtx(r.Context(), w, err) | ||
24 | + } else { | ||
25 | + httpx.OkJsonCtx(r.Context(), w, resp) | ||
26 | + } | ||
27 | + } | ||
28 | +} |
@@ -7,6 +7,7 @@ import ( | @@ -7,6 +7,7 @@ import ( | ||
7 | article "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/article" | 7 | article "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/article" |
8 | comment "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/comment" | 8 | comment "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/comment" |
9 | company "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/company" | 9 | company "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/company" |
10 | + department "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/department" | ||
10 | message "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/message" | 11 | message "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/message" |
11 | role "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/role" | 12 | role "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/role" |
12 | tags "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/tags" | 13 | tags "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/tags" |
@@ -20,25 +21,18 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | @@ -20,25 +21,18 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | ||
20 | server.AddRoutes( | 21 | server.AddRoutes( |
21 | []rest.Route{ | 22 | []rest.Route{ |
22 | { | 23 | { |
23 | - Method: http.MethodGet, | ||
24 | - Path: "/mini/comment", | ||
25 | - Handler: comment.MiniCommentHandler(serverCtx), | ||
26 | - }, | 24 | + Method: http.MethodPost, |
25 | + Path: "/article_comment/at_user/select", | ||
26 | + Handler: comment.MiniArticleCommentAtUserHandler(serverCtx), | ||
27 | }, | 27 | }, |
28 | - rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret), | ||
29 | - rest.WithPrefix("/v1"), | ||
30 | - ) | ||
31 | - | ||
32 | - server.AddRoutes( | ||
33 | - []rest.Route{ | ||
34 | { | 28 | { |
35 | - Method: http.MethodGet, | ||
36 | - Path: "/system/comment", | ||
37 | - Handler: comment.SystemCommentHandler(serverCtx), | 29 | + Method: http.MethodPost, |
30 | + Path: "/article_comment", | ||
31 | + Handler: comment.MiniCreateArticleCommentHandler(serverCtx), | ||
38 | }, | 32 | }, |
39 | }, | 33 | }, |
40 | - rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret), | ||
41 | - rest.WithPrefix("/v1"), | 34 | + rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret), |
35 | + rest.WithPrefix("/v1/mini"), | ||
42 | ) | 36 | ) |
43 | 37 | ||
44 | server.AddRoutes( | 38 | server.AddRoutes( |
@@ -284,6 +278,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | @@ -284,6 +278,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | ||
284 | }, | 278 | }, |
285 | { | 279 | { |
286 | Method: http.MethodPost, | 280 | Method: http.MethodPost, |
281 | + Path: "/article/mark/list", | ||
282 | + Handler: article.MiniArticleMarkListHandler(serverCtx), | ||
283 | + }, | ||
284 | + { | ||
285 | + Method: http.MethodPost, | ||
287 | Path: "/article/search/me", | 286 | Path: "/article/search/me", |
288 | Handler: article.MiniArticleSearchMeHandler(serverCtx), | 287 | Handler: article.MiniArticleSearchMeHandler(serverCtx), |
289 | }, | 288 | }, |
@@ -293,6 +292,26 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | @@ -293,6 +292,26 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | ||
293 | Handler: article.MiniCreateArticleDraftHandler(serverCtx), | 292 | Handler: article.MiniCreateArticleDraftHandler(serverCtx), |
294 | }, | 293 | }, |
295 | { | 294 | { |
295 | + Method: http.MethodPut, | ||
296 | + Path: "/article_draft", | ||
297 | + Handler: article.MiniUpdateArticleDraftHandler(serverCtx), | ||
298 | + }, | ||
299 | + { | ||
300 | + Method: http.MethodPost, | ||
301 | + Path: "/article_draft/search/me", | ||
302 | + Handler: article.MiniSearchArticleDraftMeHandler(serverCtx), | ||
303 | + }, | ||
304 | + { | ||
305 | + Method: http.MethodGet, | ||
306 | + Path: "/article_draft/me/:id", | ||
307 | + Handler: article.MiniGetArticleDraftMeHandler(serverCtx), | ||
308 | + }, | ||
309 | + { | ||
310 | + Method: http.MethodDelete, | ||
311 | + Path: "/article_draft/me/:id", | ||
312 | + Handler: article.MiniDeleteArticleDraftMeHandler(serverCtx), | ||
313 | + }, | ||
314 | + { | ||
296 | Method: http.MethodPost, | 315 | Method: http.MethodPost, |
297 | Path: "/article_backup/search", | 316 | Path: "/article_backup/search", |
298 | Handler: article.MiniArticleBackupSearchHandler(serverCtx), | 317 | Handler: article.MiniArticleBackupSearchHandler(serverCtx), |
@@ -350,4 +369,31 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | @@ -350,4 +369,31 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | ||
350 | rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret), | 369 | rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret), |
351 | rest.WithPrefix("/v1"), | 370 | rest.WithPrefix("/v1"), |
352 | ) | 371 | ) |
372 | + | ||
373 | + server.AddRoutes( | ||
374 | + []rest.Route{ | ||
375 | + { | ||
376 | + Method: http.MethodPost, | ||
377 | + Path: "/system/department/list", | ||
378 | + Handler: department.SystemListHandler(serverCtx), | ||
379 | + }, | ||
380 | + { | ||
381 | + Method: http.MethodPost, | ||
382 | + Path: "/system/department/add", | ||
383 | + Handler: department.SystemAddHandler(serverCtx), | ||
384 | + }, | ||
385 | + { | ||
386 | + Method: http.MethodGet, | ||
387 | + Path: "/system/department/:id", | ||
388 | + Handler: department.SystemGetHandler(serverCtx), | ||
389 | + }, | ||
390 | + { | ||
391 | + Method: http.MethodPut, | ||
392 | + Path: "/system/department/:id", | ||
393 | + Handler: department.SystemUpdateHandler(serverCtx), | ||
394 | + }, | ||
395 | + }, | ||
396 | + rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret), | ||
397 | + rest.WithPrefix("/v1"), | ||
398 | + ) | ||
353 | } | 399 | } |
1 | +package article | ||
2 | + | ||
3 | +import ( | ||
4 | + "context" | ||
5 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | ||
6 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" | ||
7 | + | ||
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 | + "github.com/zeromicro/go-zero/core/logx" | ||
12 | +) | ||
13 | + | ||
14 | +type MiniArticleMarkListLogic struct { | ||
15 | + logx.Logger | ||
16 | + ctx context.Context | ||
17 | + svcCtx *svc.ServiceContext | ||
18 | +} | ||
19 | + | ||
20 | +func NewMiniArticleMarkListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniArticleMarkListLogic { | ||
21 | + return &MiniArticleMarkListLogic{ | ||
22 | + Logger: logx.WithContext(ctx), | ||
23 | + ctx: ctx, | ||
24 | + svcCtx: svcCtx, | ||
25 | + } | ||
26 | +} | ||
27 | + | ||
28 | +func (l *MiniArticleMarkListLogic) MiniArticleMarkList(req *types.MiniArticleMarkListRequest) (resp *types.MiniArticleMarkListResponse, err error) { | ||
29 | + var userToken = contextdata.GetUserTokenFromCtx(l.ctx) | ||
30 | + | ||
31 | + total, list, err := l.svcCtx.UserReadArticleRepository.Find(l.ctx, l.svcCtx.DefaultDBConn(), domain.NewQueryOptions(). | ||
32 | + WithOffsetLimit(req.Page, req.Size). | ||
33 | + WithKV("userId", userToken.UserId)) | ||
34 | + if err != nil { | ||
35 | + return nil, err | ||
36 | + } | ||
37 | + resp = &types.MiniArticleMarkListResponse{} | ||
38 | + resp.Total = total | ||
39 | + resp.List = make([]types.MiniArticleMarkItem, 0) | ||
40 | + for _, item := range list { | ||
41 | + to := types.MiniArticleMarkItem{ | ||
42 | + Id: item.Id, | ||
43 | + CompanyId: item.CompanyId, | ||
44 | + ArticleId: item.ArticleId, | ||
45 | + Title: item.Title, | ||
46 | + Author: types.SimpleUser{ | ||
47 | + Id: item.Author.Id, | ||
48 | + CompanyId: item.Author.CompanyId, | ||
49 | + CompanyName: item.Author.Company, | ||
50 | + Name: item.Author.Name, | ||
51 | + Avatar: item.Author.Avatar, | ||
52 | + Position: item.Author.Position, | ||
53 | + }, | ||
54 | + UpdatedAt: item.UpdatedAt, | ||
55 | + } | ||
56 | + resp.List = append(resp.List, to) | ||
57 | + } | ||
58 | + return resp, nil | ||
59 | +} |
@@ -83,6 +83,7 @@ func (l *MiniArticleMarkUserReadLogic) MiniArticleMarkUserRead(req *types.MiniAr | @@ -83,6 +83,7 @@ func (l *MiniArticleMarkUserReadLogic) MiniArticleMarkUserRead(req *types.MiniAr | ||
83 | if err != nil { | 83 | if err != nil { |
84 | return err | 84 | return err |
85 | } | 85 | } |
86 | + //增加浏览计数 | ||
86 | err = l.svcCtx.ArticleRepository.IncreaseCountRead(ctx, c, 1, articleInfo) | 87 | err = l.svcCtx.ArticleRepository.IncreaseCountRead(ctx, c, 1, articleInfo) |
87 | return err | 88 | return err |
88 | }, true) | 89 | }, true) |
@@ -5,6 +5,8 @@ import ( | @@ -5,6 +5,8 @@ import ( | ||
5 | 5 | ||
6 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | 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" | 7 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" |
8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | ||
9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" | ||
8 | 10 | ||
9 | "github.com/zeromicro/go-zero/core/logx" | 11 | "github.com/zeromicro/go-zero/core/logx" |
10 | ) | 12 | ) |
@@ -23,8 +25,43 @@ func NewMiniCreateArticleDraftLogic(ctx context.Context, svcCtx *svc.ServiceCont | @@ -23,8 +25,43 @@ func NewMiniCreateArticleDraftLogic(ctx context.Context, svcCtx *svc.ServiceCont | ||
23 | } | 25 | } |
24 | } | 26 | } |
25 | 27 | ||
26 | -func (l *MiniCreateArticleDraftLogic) MiniCreateArticleDraft(req *types.MiniArticleSearchMeRequest) (resp *types.MiniArticleSearchMeResponse, err error) { | ||
27 | - // todo: add your logic here and delete this line | 28 | +// 保存文章进草稿箱 |
29 | +func (l *MiniCreateArticleDraftLogic) MiniCreateArticleDraft(req *types.MiniArticleDraftCreateRequest) (resp *types.MiniArticleDraftCreateResponse, err error) { | ||
30 | + var conn = l.svcCtx.DefaultDBConn() | ||
28 | 31 | ||
32 | + newDraft := domain.ArticleDraft{ | ||
33 | + Id: 0, | ||
34 | + CompanyId: req.CompanyId, | ||
35 | + CreatedAt: 0, | ||
36 | + UpdatedAt: 0, | ||
37 | + DeletedAt: 0, | ||
38 | + Version: 0, | ||
39 | + Template: req.Template, | ||
40 | + Content: req.Section, | ||
41 | + AuthorId: req.AuthorId, | ||
42 | + Title: req.Title, | ||
43 | + Images: []domain.Image{}, | ||
44 | + WhoRead: req.WhoRead, | ||
45 | + WhoReview: req.WhoReview, | ||
46 | + Location: domain.Location{ | ||
47 | + Longitude: req.Location.Longitude, | ||
48 | + Latitude: req.Location.Latitude, | ||
49 | + Descript: req.Location.Descript, | ||
50 | + }, | ||
51 | + } | ||
52 | + for _, val := range req.Images { | ||
53 | + newDraft.Images = append(newDraft.Images, domain.Image{ | ||
54 | + Url: val, | ||
55 | + }) | ||
56 | + } | ||
57 | + | ||
58 | + _, err = l.svcCtx.ArticleDraftRepository.Insert(l.ctx, conn, &newDraft) | ||
59 | + if err != nil { | ||
60 | + return nil, xerr.NewErrMsgErr("保存草稿失败", err) | ||
61 | + } | ||
62 | + | ||
63 | + resp = &types.MiniArticleDraftCreateResponse{ | ||
64 | + Id: newDraft.Id, | ||
65 | + } | ||
29 | return | 66 | return |
30 | } | 67 | } |
@@ -43,19 +43,10 @@ func (l *MiniCreateArticleLogic) MiniCreateArticle(req *types.MiniArticleCreateR | @@ -43,19 +43,10 @@ func (l *MiniCreateArticleLogic) MiniCreateArticle(req *types.MiniArticleCreateR | ||
43 | Id: author.Id, | 43 | Id: author.Id, |
44 | Name: author.Name, | 44 | Name: author.Name, |
45 | Avatar: author.Avatar, | 45 | Avatar: author.Avatar, |
46 | - GroupId: 0, | ||
47 | - Group: "", | ||
48 | Position: author.Position, | 46 | Position: author.Position, |
49 | Company: companyInfo.Name, | 47 | Company: companyInfo.Name, |
50 | CompanyId: author.CompanyId, | 48 | CompanyId: author.CompanyId, |
51 | } | 49 | } |
52 | - if author.DepartmentId > 0 { | ||
53 | - department, err := l.svcCtx.DepartmentRepository.FindOne(l.ctx, conn, author.DepartmentId) | ||
54 | - if err == nil { | ||
55 | - articleAuthor.GroupId = department.Id | ||
56 | - articleAuthor.Group = department.Name | ||
57 | - } | ||
58 | - } | ||
59 | if len(req.Images) > 9 { | 50 | if len(req.Images) > 9 { |
60 | return nil, xerr.NewErrMsg("图片数量最多9张") | 51 | return nil, xerr.NewErrMsg("图片数量最多9张") |
61 | } | 52 | } |
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 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" | ||
9 | + | ||
10 | + "github.com/zeromicro/go-zero/core/logx" | ||
11 | +) | ||
12 | + | ||
13 | +type MiniDeleteArticleDraftMeLogic struct { | ||
14 | + logx.Logger | ||
15 | + ctx context.Context | ||
16 | + svcCtx *svc.ServiceContext | ||
17 | +} | ||
18 | + | ||
19 | +func NewMiniDeleteArticleDraftMeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniDeleteArticleDraftMeLogic { | ||
20 | + return &MiniDeleteArticleDraftMeLogic{ | ||
21 | + Logger: logx.WithContext(ctx), | ||
22 | + ctx: ctx, | ||
23 | + svcCtx: svcCtx, | ||
24 | + } | ||
25 | +} | ||
26 | + | ||
27 | +// 删除我的草稿记录 | ||
28 | +func (l *MiniDeleteArticleDraftMeLogic) MiniDeleteArticleDraftMe(req *types.MiniArticleDraftDeleteMeRequest) (resp *types.MiniArticleDraftDeleteMeResponse, err error) { | ||
29 | + var conn = l.svcCtx.DefaultDBConn() | ||
30 | + | ||
31 | + draftInfo, err := l.svcCtx.ArticleDraftRepository.FindOne(l.ctx, conn, req.Id) | ||
32 | + if err != nil { | ||
33 | + return nil, xerr.NewErrMsgErr("删除草稿失败", err) | ||
34 | + } | ||
35 | + if draftInfo.AuthorId != req.AuthorId { | ||
36 | + if err != nil { | ||
37 | + return nil, xerr.NewErrMsg("删除草稿失败") | ||
38 | + } | ||
39 | + } | ||
40 | + _, err = l.svcCtx.ArticleDraftRepository.Delete(l.ctx, conn, draftInfo) | ||
41 | + if err != nil { | ||
42 | + return nil, xerr.NewErrMsgErr("删除草稿失败", err) | ||
43 | + } | ||
44 | + resp = &types.MiniArticleDraftDeleteMeResponse{ | ||
45 | + Id: draftInfo.Id, | ||
46 | + } | ||
47 | + return resp, nil | ||
48 | +} |
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 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" | ||
9 | + | ||
10 | + "github.com/zeromicro/go-zero/core/logx" | ||
11 | +) | ||
12 | + | ||
13 | +type MiniGetArticleDraftMeLogic struct { | ||
14 | + logx.Logger | ||
15 | + ctx context.Context | ||
16 | + svcCtx *svc.ServiceContext | ||
17 | +} | ||
18 | + | ||
19 | +func NewMiniGetArticleDraftMeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniGetArticleDraftMeLogic { | ||
20 | + return &MiniGetArticleDraftMeLogic{ | ||
21 | + Logger: logx.WithContext(ctx), | ||
22 | + ctx: ctx, | ||
23 | + svcCtx: svcCtx, | ||
24 | + } | ||
25 | +} | ||
26 | + | ||
27 | +// 获取我的草稿记录 | ||
28 | +func (l *MiniGetArticleDraftMeLogic) MiniGetArticleDraftMe(req *types.MiniArticleDraftGetMeRequest) (resp *types.MiniArticleDraftGetMeResponse, err error) { | ||
29 | + var conn = l.svcCtx.DefaultDBConn() | ||
30 | + | ||
31 | + draftInfo, err := l.svcCtx.ArticleDraftRepository.FindOne(l.ctx, conn, req.Id) | ||
32 | + if err != nil { | ||
33 | + return nil, xerr.NewErrMsgErr("获取草稿失败", err) | ||
34 | + } | ||
35 | + if draftInfo.AuthorId != req.AuthorId { | ||
36 | + if err != nil { | ||
37 | + return nil, xerr.NewErrMsg("获取草稿失败") | ||
38 | + } | ||
39 | + } | ||
40 | + resp = &types.MiniArticleDraftGetMeResponse{ | ||
41 | + Id: draftInfo.Id, | ||
42 | + Template: draftInfo.Template, | ||
43 | + Section: draftInfo.Content, | ||
44 | + Title: draftInfo.Title, | ||
45 | + Images: []string{}, | ||
46 | + WhoRead: draftInfo.WhoRead, | ||
47 | + WhoReview: draftInfo.WhoReview, | ||
48 | + Location: types.Location{ | ||
49 | + Longitude: draftInfo.Location.Longitude, | ||
50 | + Latitude: draftInfo.Location.Latitude, | ||
51 | + Descript: draftInfo.Location.Descript, | ||
52 | + }, | ||
53 | + } | ||
54 | + for _, val := range draftInfo.Images { | ||
55 | + resp.Images = append(resp.Images, val.Url) | ||
56 | + } | ||
57 | + return | ||
58 | +} |
@@ -38,7 +38,10 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) ( | @@ -38,7 +38,10 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) ( | ||
38 | return nil, xerr.NewErrMsg("没有查看权限") | 38 | return nil, xerr.NewErrMsg("没有查看权限") |
39 | } | 39 | } |
40 | 40 | ||
41 | + //TODO 检查可查看人 | ||
42 | + | ||
41 | if articleInfo.Show == domain.ArticleShowDisable { | 43 | if articleInfo.Show == domain.ArticleShowDisable { |
44 | + // 文章内容不显示 | ||
42 | resp = &types.MiniArticleGetResponse{ | 45 | resp = &types.MiniArticleGetResponse{ |
43 | Id: articleInfo.Id, | 46 | Id: articleInfo.Id, |
44 | Title: articleInfo.Title, | 47 | Title: articleInfo.Title, |
@@ -54,6 +57,20 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) ( | @@ -54,6 +57,20 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) ( | ||
54 | if err != nil { | 57 | if err != nil { |
55 | return nil, xerr.NewErrMsgErr("读取文章内容失败", err) | 58 | return nil, xerr.NewErrMsgErr("读取文章内容失败", err) |
56 | } | 59 | } |
60 | + var meLoveFlag int | ||
61 | + if req.UserId > 0 { | ||
62 | + // 获取我对文章的点赞标识 | ||
63 | + queryOption = domain.NewQueryOptions(). | ||
64 | + WithCountOnly(). | ||
65 | + MustWithKV("articleId", articleInfo.Id). | ||
66 | + MustWithKV("commentId", 0). | ||
67 | + MustWithKV("userId", req.UserId) | ||
68 | + cnt, _, _ := l.svcCtx.UserLoveFlagRepository.Find(l.ctx, conn, queryOption) | ||
69 | + if cnt > 0 { | ||
70 | + meLoveFlag = 1 | ||
71 | + } | ||
72 | + } | ||
73 | + | ||
57 | sortBy := domain.SortArticleSection(sectionList) | 74 | sortBy := domain.SortArticleSection(sectionList) |
58 | sort.Sort(sortBy) | 75 | sort.Sort(sortBy) |
59 | articleSection := []types.ArticleSection{} | 76 | articleSection := []types.ArticleSection{} |
@@ -70,11 +87,11 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) ( | @@ -70,11 +87,11 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) ( | ||
70 | Id: articleInfo.Id, | 87 | Id: articleInfo.Id, |
71 | Title: articleInfo.Title, | 88 | Title: articleInfo.Title, |
72 | AuthorId: articleInfo.AuthorId, | 89 | AuthorId: articleInfo.AuthorId, |
73 | - Author: types.Author{ | 90 | + Author: types.ArticleAuthor{ |
74 | Id: articleInfo.Author.Id, | 91 | Id: articleInfo.Author.Id, |
75 | Name: articleInfo.Author.Name, | 92 | Name: articleInfo.Author.Name, |
76 | Avatar: articleInfo.Author.Avatar, | 93 | Avatar: articleInfo.Author.Avatar, |
77 | - Group: articleInfo.Author.Group, | 94 | + // Group: articleInfo.Author.Group, |
78 | Position: articleInfo.Author.Position, | 95 | Position: articleInfo.Author.Position, |
79 | Company: articleInfo.Author.Company, | 96 | Company: articleInfo.Author.Company, |
80 | }, | 97 | }, |
@@ -93,6 +110,7 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) ( | @@ -93,6 +110,7 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) ( | ||
93 | CountRead: articleInfo.CountRead, | 110 | CountRead: articleInfo.CountRead, |
94 | Show: int(articleInfo.Show), | 111 | Show: int(articleInfo.Show), |
95 | Edit: 0, | 112 | Edit: 0, |
113 | + MeLoveFlag: meLoveFlag, | ||
96 | } | 114 | } |
97 | if articleInfo.CreatedAt != articleInfo.UpdatedAt { | 115 | if articleInfo.CreatedAt != articleInfo.UpdatedAt { |
98 | resp.Edit = 1 | 116 | resp.Edit = 1 |
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 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | ||
9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" | ||
10 | + | ||
11 | + "github.com/zeromicro/go-zero/core/logx" | ||
12 | +) | ||
13 | + | ||
14 | +type MiniSearchArticleDraftMeLogic struct { | ||
15 | + logx.Logger | ||
16 | + ctx context.Context | ||
17 | + svcCtx *svc.ServiceContext | ||
18 | +} | ||
19 | + | ||
20 | +func NewMiniSearchArticleDraftMeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniSearchArticleDraftMeLogic { | ||
21 | + return &MiniSearchArticleDraftMeLogic{ | ||
22 | + Logger: logx.WithContext(ctx), | ||
23 | + ctx: ctx, | ||
24 | + svcCtx: svcCtx, | ||
25 | + } | ||
26 | +} | ||
27 | + | ||
28 | +func (l *MiniSearchArticleDraftMeLogic) MiniSearchArticleDraftMe(req *types.MiniArticleDraftSearchMeRequest) (resp *types.MiniArticleDraftSearchMeResponse, err error) { | ||
29 | + var conn = l.svcCtx.DefaultDBConn() | ||
30 | + | ||
31 | + queryOption := domain.NewQueryOptions(). | ||
32 | + WithOffsetLimit(req.Page, req.Size). | ||
33 | + MustWithKV("authorId", req.AuthorId) | ||
34 | + | ||
35 | + cnt, draftList, err := l.svcCtx.ArticleDraftRepository.Find(l.ctx, conn, queryOption) | ||
36 | + if err != nil { | ||
37 | + return nil, xerr.NewErrMsgErr("获取草稿列表失败", err) | ||
38 | + } | ||
39 | + resp = &types.MiniArticleDraftSearchMeResponse{ | ||
40 | + Total: cnt, | ||
41 | + List: make([]types.MiniArticleDraftItem, len(draftList)), | ||
42 | + } | ||
43 | + | ||
44 | + for i := range draftList { | ||
45 | + images := []string{} | ||
46 | + for _, val := range draftList[i].Images { | ||
47 | + images = append(images, val.Url) | ||
48 | + } | ||
49 | + resp.List[i] = types.MiniArticleDraftItem{ | ||
50 | + Id: draftList[i].Id, | ||
51 | + Template: draftList[i].Template, | ||
52 | + Section: draftList[i].Content, | ||
53 | + Title: draftList[i].Title, | ||
54 | + Images: images, | ||
55 | + } | ||
56 | + } | ||
57 | + return resp, nil | ||
58 | +} |
@@ -233,7 +233,7 @@ func (l *MiniSetUserLikeLogic) setUserLikeArticle(req *types.MiniSetUserLikeRequ | @@ -233,7 +233,7 @@ func (l *MiniSetUserLikeLogic) setUserLikeArticle(req *types.MiniSetUserLikeRequ | ||
233 | CommentAuthor: 0, | 233 | CommentAuthor: 0, |
234 | UserId: req.UserId, | 234 | UserId: req.UserId, |
235 | } | 235 | } |
236 | - // 去除点赞标识 | 236 | + // 添加点赞标识 |
237 | _, err = l.svcCtx.UserLoveFlagRepository.Insert(ctx, c, &flagInfo) | 237 | _, err = l.svcCtx.UserLoveFlagRepository.Insert(ctx, c, &flagInfo) |
238 | if err != nil { | 238 | if err != nil { |
239 | return err | 239 | return err |
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 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | ||
9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" | ||
10 | + | ||
11 | + "github.com/zeromicro/go-zero/core/logx" | ||
12 | +) | ||
13 | + | ||
14 | +type MiniUpdateArticleDraftLogic struct { | ||
15 | + logx.Logger | ||
16 | + ctx context.Context | ||
17 | + svcCtx *svc.ServiceContext | ||
18 | +} | ||
19 | + | ||
20 | +func NewMiniUpdateArticleDraftLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniUpdateArticleDraftLogic { | ||
21 | + return &MiniUpdateArticleDraftLogic{ | ||
22 | + Logger: logx.WithContext(ctx), | ||
23 | + ctx: ctx, | ||
24 | + svcCtx: svcCtx, | ||
25 | + } | ||
26 | +} | ||
27 | + | ||
28 | +func (l *MiniUpdateArticleDraftLogic) MiniUpdateArticleDraft(req *types.MiniArticleDraftUpdateRequest) (resp *types.MiniArticleDraftUpdateResponse, err error) { | ||
29 | + var conn = l.svcCtx.DefaultDBConn() | ||
30 | + | ||
31 | + draftInfo, err := l.svcCtx.ArticleDraftRepository.FindOne(l.ctx, conn, req.Id) | ||
32 | + if err != nil { | ||
33 | + return nil, xerr.NewErrMsgErr("更新草稿失败", err) | ||
34 | + } | ||
35 | + if draftInfo.AuthorId != req.AuthorId { | ||
36 | + if err != nil { | ||
37 | + return nil, xerr.NewErrMsg("更新草稿失败") | ||
38 | + } | ||
39 | + } | ||
40 | + draftInfo.Content = req.Section | ||
41 | + draftInfo.Title = req.Title | ||
42 | + draftInfo.Location = domain.Location{ | ||
43 | + Longitude: req.Location.Longitude, | ||
44 | + Latitude: req.Location.Latitude, | ||
45 | + Descript: req.Location.Descript, | ||
46 | + } | ||
47 | + draftInfo.WhoRead = req.WhoRead | ||
48 | + draftInfo.WhoReview = req.WhoReview | ||
49 | + draftInfo.Images = []domain.Image{} | ||
50 | + for _, val := range req.Images { | ||
51 | + draftInfo.Images = append(draftInfo.Images, domain.Image{ | ||
52 | + Url: val, | ||
53 | + }) | ||
54 | + } | ||
55 | + _, err = l.svcCtx.ArticleDraftRepository.Update(l.ctx, conn, draftInfo) | ||
56 | + if err != nil { | ||
57 | + return nil, xerr.NewErrMsgErr("更新草稿失败", err) | ||
58 | + } | ||
59 | + resp = &types.MiniArticleDraftUpdateResponse{ | ||
60 | + Id: draftInfo.Id, | ||
61 | + } | ||
62 | + return | ||
63 | +} |
@@ -9,21 +9,21 @@ import ( | @@ -9,21 +9,21 @@ import ( | ||
9 | "github.com/zeromicro/go-zero/core/logx" | 9 | "github.com/zeromicro/go-zero/core/logx" |
10 | ) | 10 | ) |
11 | 11 | ||
12 | -type MiniCommentLogic struct { | 12 | +type MiniArticleCommentAtUserLogic struct { |
13 | logx.Logger | 13 | logx.Logger |
14 | ctx context.Context | 14 | ctx context.Context |
15 | svcCtx *svc.ServiceContext | 15 | svcCtx *svc.ServiceContext |
16 | } | 16 | } |
17 | 17 | ||
18 | -func NewMiniCommentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniCommentLogic { | ||
19 | - return &MiniCommentLogic{ | 18 | +func NewMiniArticleCommentAtUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniArticleCommentAtUserLogic { |
19 | + return &MiniArticleCommentAtUserLogic{ | ||
20 | Logger: logx.WithContext(ctx), | 20 | Logger: logx.WithContext(ctx), |
21 | ctx: ctx, | 21 | ctx: ctx, |
22 | svcCtx: svcCtx, | 22 | svcCtx: svcCtx, |
23 | } | 23 | } |
24 | } | 24 | } |
25 | 25 | ||
26 | -func (l *MiniCommentLogic) MiniComment(req *types.CommentRequest) (resp *types.CommentResposne, err error) { | 26 | +func (l *MiniArticleCommentAtUserLogic) MiniArticleCommentAtUser(req *types.MiniArticleCommentAtUserRequest) (resp *types.MiniArticleCommentAtUserResponse, err error) { |
27 | // todo: add your logic here and delete this line | 27 | // todo: add your logic here and delete this line |
28 | 28 | ||
29 | return | 29 | return |
@@ -9,21 +9,21 @@ import ( | @@ -9,21 +9,21 @@ import ( | ||
9 | "github.com/zeromicro/go-zero/core/logx" | 9 | "github.com/zeromicro/go-zero/core/logx" |
10 | ) | 10 | ) |
11 | 11 | ||
12 | -type SystemCommentLogic struct { | 12 | +type MiniCreateArticleCommentLogic struct { |
13 | logx.Logger | 13 | logx.Logger |
14 | ctx context.Context | 14 | ctx context.Context |
15 | svcCtx *svc.ServiceContext | 15 | svcCtx *svc.ServiceContext |
16 | } | 16 | } |
17 | 17 | ||
18 | -func NewSystemCommentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemCommentLogic { | ||
19 | - return &SystemCommentLogic{ | 18 | +func NewMiniCreateArticleCommentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniCreateArticleCommentLogic { |
19 | + return &MiniCreateArticleCommentLogic{ | ||
20 | Logger: logx.WithContext(ctx), | 20 | Logger: logx.WithContext(ctx), |
21 | ctx: ctx, | 21 | ctx: ctx, |
22 | svcCtx: svcCtx, | 22 | svcCtx: svcCtx, |
23 | } | 23 | } |
24 | } | 24 | } |
25 | 25 | ||
26 | -func (l *SystemCommentLogic) SystemComment(req *types.CommentRequest) (resp *types.CommentResposne, err error) { | 26 | +func (l *MiniCreateArticleCommentLogic) MiniCreateArticleComment(req *types.MiniCreateArticleCommentRequest) (resp *types.MiniCreateArticleCommentResponse, err error) { |
27 | // todo: add your logic here and delete this line | 27 | // todo: add your logic here and delete this line |
28 | 28 | ||
29 | return | 29 | return |
1 | +package department | ||
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 SystemAddLogic struct { | ||
13 | + logx.Logger | ||
14 | + ctx context.Context | ||
15 | + svcCtx *svc.ServiceContext | ||
16 | +} | ||
17 | + | ||
18 | +func NewSystemAddLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemAddLogic { | ||
19 | + return &SystemAddLogic{ | ||
20 | + Logger: logx.WithContext(ctx), | ||
21 | + ctx: ctx, | ||
22 | + svcCtx: svcCtx, | ||
23 | + } | ||
24 | +} | ||
25 | + | ||
26 | +func (l *SystemAddLogic) SystemAdd(req *types.DepartmentAddRequest) (resp *types.DepartmentGetResponse, err error) { | ||
27 | + // todo: add your logic here and delete this line | ||
28 | + | ||
29 | + return | ||
30 | +} |
1 | +package department | ||
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 SystemGetLogic struct { | ||
13 | + logx.Logger | ||
14 | + ctx context.Context | ||
15 | + svcCtx *svc.ServiceContext | ||
16 | +} | ||
17 | + | ||
18 | +func NewSystemGetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemGetLogic { | ||
19 | + return &SystemGetLogic{ | ||
20 | + Logger: logx.WithContext(ctx), | ||
21 | + ctx: ctx, | ||
22 | + svcCtx: svcCtx, | ||
23 | + } | ||
24 | +} | ||
25 | + | ||
26 | +func (l *SystemGetLogic) SystemGet(req *types.DepartmentGetRequest) (resp *types.DepartmentGetResponse, err error) { | ||
27 | + // todo: add your logic here and delete this line | ||
28 | + | ||
29 | + return | ||
30 | +} |
1 | +package department | ||
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 SystemListLogic struct { | ||
13 | + logx.Logger | ||
14 | + ctx context.Context | ||
15 | + svcCtx *svc.ServiceContext | ||
16 | +} | ||
17 | + | ||
18 | +func NewSystemListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemListLogic { | ||
19 | + return &SystemListLogic{ | ||
20 | + Logger: logx.WithContext(ctx), | ||
21 | + ctx: ctx, | ||
22 | + svcCtx: svcCtx, | ||
23 | + } | ||
24 | +} | ||
25 | + | ||
26 | +func (l *SystemListLogic) SystemList(req *types.DepartmentListRequest) (resp *types.DepartmentListResponse, err error) { | ||
27 | + // todo: add your logic here and delete this line | ||
28 | + | ||
29 | + return | ||
30 | +} |
1 | +package department | ||
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 SystemUpdateLogic struct { | ||
13 | + logx.Logger | ||
14 | + ctx context.Context | ||
15 | + svcCtx *svc.ServiceContext | ||
16 | +} | ||
17 | + | ||
18 | +func NewSystemUpdateLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemUpdateLogic { | ||
19 | + return &SystemUpdateLogic{ | ||
20 | + Logger: logx.WithContext(ctx), | ||
21 | + ctx: ctx, | ||
22 | + svcCtx: svcCtx, | ||
23 | + } | ||
24 | +} | ||
25 | + | ||
26 | +func (l *SystemUpdateLogic) SystemUpdate(req *types.DepartmentUpdateRequest) (resp *types.DepartmentGetResponse, 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 Location struct { | ||
5 | - Longitude float64 `json:"longitude,optional"` //经度 | ||
6 | - Latitude float64 `json:"latitude,optional"` //纬度 | ||
7 | - Descript string `json:"descript,optional"` //地点描述 | 4 | +type MiniArticleCommentAtUserRequest struct { |
5 | + ArtitceId int64 `json:"articleId"` | ||
8 | } | 6 | } |
9 | 7 | ||
10 | -type Author struct { | 8 | +type MiniArticleCommentAtUserResponse struct { |
9 | +} | ||
10 | + | ||
11 | +type CommentAuthor struct { | ||
11 | Id int64 `json:"id"` // 人员id | 12 | Id int64 `json:"id"` // 人员id |
12 | Name string `json:"name"` // 人员的名字 | 13 | Name string `json:"name"` // 人员的名字 |
13 | Avatar string `json:"avatar"` // 人员头像URL | 14 | Avatar string `json:"avatar"` // 人员头像URL |
14 | - Group string `json:"group"` // 人员的分组 | ||
15 | Position string `json:"position"` // 职位 | 15 | Position string `json:"position"` // 职位 |
16 | Company string `json:"company"` // 公司 | 16 | Company string `json:"company"` // 公司 |
17 | } | 17 | } |
18 | 18 | ||
19 | -type MiniArticleCreateRequest struct { | ||
20 | - Title string `json:"title"` //标题 | ||
21 | - Section []string `json:"section"` //文章的文本内容 | ||
22 | - AuthorId int64 `json:"authorId,optional"` //发布人id | ||
23 | - Images []string `json:"images,optional"` //图片 | ||
24 | - WhoRead []int64 `json:"whoRead,optional"` //谁可查看 | ||
25 | - WhoReview []int64 `json:"whoReview,optional"` //谁可评论 | ||
26 | - Location Location `json:"location,optional"` //定位坐标 | 19 | +type MiniCreateArticleCommentRequest struct { |
20 | + ArtitceId int64 `json:"articleId"` // 文章id | ||
21 | + SectionId int64 `json:"sectionId"` // 段落id | ||
22 | + FromUserId int64 `json:",optional"` // 填写文章的人,服务端自动获取 | ||
23 | + Pid int64 `json:"commnet"` // 回复那个评论的id | ||
24 | + Content string `json:"content"` // 评论的内容 | ||
25 | + AtWho []int64 `json:"atWho"` // 填写评论时@的人 | ||
27 | } | 26 | } |
28 | 27 | ||
29 | -type MiniArticleCreateResponse struct { | 28 | +type MiniCreateArticleCommentResponse struct { |
30 | Id int64 `json:"id"` | 29 | Id int64 `json:"id"` |
31 | -} | ||
32 | - | ||
33 | -type MiniArticleGetRequest struct { | ||
34 | - Id int64 `path:"id"` //id | ||
35 | - CompanyId int64 `path:",optional"` | ||
36 | -} | ||
37 | - | ||
38 | -type MiniArticleGetResponse struct { | ||
39 | - Id int64 `json:"id"` //id | ||
40 | - Title string `json:"title"` //标题 | ||
41 | - AuthorId int64 `json:"authorId"` //发布人id | ||
42 | - Author Author `json:"author"` //发布人 | ||
43 | - CreatedAt int64 `json:"createdAt"` //文章的发布时间 | ||
44 | - Section []ArticleSection `json:"section"` //文章的文本内容 | ||
45 | - Images []string `json:"images"` //图片 | ||
46 | - WhoRead []int64 `json:"whoRead"` //谁可查看 | ||
47 | - WhoReview []int64 `json:"whoReview"` //谁可评论 | ||
48 | - Location Location `json:"location"` //定位坐标 | ||
49 | - CountLove int `json:"countLove"` // 点赞数量 | ||
50 | - CountComment int `json:"countComment"` // 评论数量 | ||
51 | - CountRead int `json:"countRead"` // 浏览数量 | ||
52 | - Show int `json:"show"` // 评论的展示状态(0显示、1不显示) | ||
53 | - Edit int `json:"edit"` // 文章是否存在变更记录 (0 不存在 1存在) | ||
54 | -} | ||
55 | - | ||
56 | -type ArticleSection struct { | ||
57 | - Id int64 `json:"id"` //段落id | ||
58 | - Content string `json:"content"` // 文本内容 | ||
59 | - SortBy int `json:"sortBy"` // 排序 | ||
60 | - TotalComment int `json:"totalComment"` // 评论的数量 | ||
61 | -} | ||
62 | - | ||
63 | -type MiniArticleSearchMeRequest struct { | ||
64 | - AuthorId int64 `json:",optional"` | ||
65 | - CompanyId int64 `json:",optional"` | ||
66 | - Page int `json:"page"` | ||
67 | - Size int `json:"size"` | ||
68 | -} | ||
69 | - | ||
70 | -type MiniArticleSearchMeResponse struct { | ||
71 | - Total int `json:"total"` | ||
72 | - List []ArticleSearchMe `json:"list"` | ||
73 | -} | ||
74 | - | ||
75 | -type ArticleSearchMe struct { | ||
76 | - Id int64 `json:"id"` //id | ||
77 | - Title string `json:"title"` //标题 | ||
78 | - Images []string `json:"images"` //图片 | ||
79 | - CreatedAt int64 `json:"createdAt"` //文章的创建日期 | ||
80 | - CountLove int `json:"countLove"` //点赞数量 | ||
81 | - CountComment int `json:"CountComment"` //评论数量 | ||
82 | - Show int `json:"show"` //是否隐藏 [0显示、1不显示] | ||
83 | -} | ||
84 | - | ||
85 | -type MiniUserLikeArticleRequest struct { | ||
86 | - ArticleId int64 `json:"articleId"` // 文章id | ||
87 | - CompanyId int64 `json:",optional"` //公司id | ||
88 | - Page int `json:"page"` //分页,第几页 | ||
89 | - Size int `json:"size"` //分页,每页几条 | ||
90 | -} | ||
91 | - | ||
92 | -type MiniUserLikeArticleResponse struct { | ||
93 | - Total int64 `json:"total"` //总数 | ||
94 | - List []WhichUserLikeArticle `json:"list"` //列表 | ||
95 | -} | ||
96 | - | ||
97 | -type WhichUserLikeArticle struct { | ||
98 | - ArticleId int64 `json:"articleId"` // 文章id | ||
99 | - UserId int64 `json:"userId"` // 人员id | ||
100 | - Name string `json:"name"` // 人员名称 | ||
101 | - Avatar string `json:"avatar"` // 人员头像 | ||
102 | - CreatedAt int64 `json:"createdAt"` // 点赞记录的时间 | ||
103 | -} | ||
104 | - | ||
105 | -type MiniSetUserLikeRequset struct { | ||
106 | - ArticleId int64 `json:"articleId"` //文章id | ||
107 | - CommentId int64 `json:"commentId"` //评论id | ||
108 | - UserId int64 `json:",optional"` //操作人 | ||
109 | - Flag int `json:"flag"` //点赞标志 1、点赞 2 、取消点赞 | ||
110 | -} | ||
111 | - | ||
112 | -type MiniSetUserLikeResponse struct { | ||
113 | - ArticleId int64 `json:"articleId"` //文章id | ||
114 | - CommentId int64 `json:"commentId"` //评论id | ||
115 | - Count int `json:"count"` //现有的点赞数量 | ||
116 | -} | ||
117 | - | ||
118 | -type MiniArticleBackupSearchRequest struct { | ||
119 | - Page int `json:"page"` | ||
120 | - Size int `json:"size"` | ||
121 | - ArticleId int `json:"articleId"` | ||
122 | - CompanyId int64 `json:",optional"` // 服务端自动获取 | ||
123 | -} | ||
124 | - | ||
125 | -type MiniArticleBackupSearchResponse struct { | ||
126 | - Total int64 `json:"total"` | ||
127 | - List []MiniArticleBackupItem `json:"list"` | ||
128 | -} | ||
129 | - | ||
130 | -type MiniArticleBackupItem struct { | ||
131 | - Id int64 `json:"id"` | ||
132 | - Title string `json:"title"` | ||
133 | - Content string `json:"content"` | ||
134 | - Images []string `json:"images"` | ||
135 | - CreatedAt int64 `json:"createdAt"` | ||
136 | - Location Location `json:"location"` | ||
137 | -} | ||
138 | - | ||
139 | -type MiniArticleMarkUserReadRequest struct { | ||
140 | - UserId int64 `json:",optional"` // 当前操作人 | ||
141 | - CompanyId int64 `json:",optional"` // 当前公司 | ||
142 | - ArticleId int64 `json:"articleId"` // 文章id | ||
143 | -} | ||
144 | - | ||
145 | -type MiniArticleMarkUserReadResponse struct { | ||
146 | - Id int64 `json:"id"` | ||
147 | -} | ||
148 | - | ||
149 | -type MiniArticleDraftCreateRequest struct { | ||
150 | - Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式 | ||
151 | - Content []string `json:"content"` // 填写的内容 | ||
152 | - Title string `json:"title"` //标题 | ||
153 | - Images []string `json:"images"` //图片 | ||
154 | -} | ||
155 | - | ||
156 | -type MiniArticleDraftCreateResponse struct { | ||
157 | -} | ||
158 | - | ||
159 | -type SystemArticleGetRequest struct { | ||
160 | - Id int64 `path:"id"` //id | ||
161 | - CompanyId int64 `path:",optional"` | ||
162 | -} | ||
163 | - | ||
164 | -type UserShowName struct { | ||
165 | - Id int `json:"id"` | ||
166 | - Name int `json:"name"` | ||
167 | -} | ||
168 | - | ||
169 | -type SystemArticleGetResponse struct { | ||
170 | - Id int64 `json:"id"` // id | ||
171 | - Title string `json:"title"` // 标题 | ||
172 | - AuthorId int64 `json:"authorId"` // 发布人id | ||
173 | - Author Author `json:"author"` // 发布人 | ||
174 | - CreatedAt int64 `json:"createdAt"` // 文章的发布时间 | ||
175 | - Section []ArticleSection `json:"section"` // 文章的文本内容 | ||
176 | - Images []string `json:"images"` // 图片 | ||
177 | - WhoRead []int64 `json:"whoRead"` // 谁可查看 | ||
178 | - WhoReadInfo []UserShowName `json:"whoReadInfo"` // 谁可查看 | ||
179 | - WhoReview []int64 `json:"whoReview"` // 谁可评论 | ||
180 | - WhoReviewInfo []UserShowName `json:"whoReviewInfo"` // 谁可评论 | ||
181 | - Location Location `json:"location"` // 定位坐标 | ||
182 | - CountLove int `json:"countLove"` // 点赞数量 | ||
183 | - CountComment int `json:"countComment"` // 评论数量 | ||
184 | - CountRead int `json:"countRead"` // 浏览数量 | ||
185 | - Show int `json:"show"` // 评论的展示状态(0显示、1不显示) | ||
186 | -} | ||
187 | - | ||
188 | -type SystemArticleSearchRequest struct { | ||
189 | - CompanyId int64 `json:",optional"` | ||
190 | - Page int `json:"page"` | ||
191 | - Size int `json:"size"` | ||
192 | -} | ||
193 | - | ||
194 | -type SystemArticleSearchResponse struct { | ||
195 | - Total int `json:"total"` | ||
196 | - List []SystemArticleSearch `json:"list"` | ||
197 | -} | ||
198 | - | ||
199 | -type SystemArticleSearch struct { | ||
200 | - Id int64 `json:"id"` //id | ||
201 | - Title string `json:"title"` //标题 | ||
202 | - Author string `json:"author"` //发布人 | ||
203 | - Images []string `json:"images"` //图片 | ||
204 | - CreatedAt int64 `json:"createdAt"` //文章的创建日期 | ||
205 | - CountLove int `json:"countLove"` //点赞数量 | ||
206 | - CountComment int `json:"CountComment"` //评论数量 | ||
207 | - Show int `json:"show"` //是否隐藏 [0显示、1不显示] | ||
208 | - Tags []string `json:"tags"` //标签 | ||
209 | - TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] | ||
210 | -} | ||
211 | - | ||
212 | -type CommentRequest struct { | ||
213 | -} | ||
214 | - | ||
215 | -type CommentResposne struct { | ||
216 | - List []Comment `json:"list"` | ||
217 | -} | ||
218 | - | ||
219 | -type Comment struct { | 30 | + Pid int64 `json:"pid"` |
31 | + TopId int64 `json:"topId"` | ||
32 | + ArtitceId int64 `json:"articleId"` // 文章id | ||
33 | + SectionId int64 `json:"sectionId"` // 段落id | ||
34 | + FromUserId int64 `json:"fromUserId"` // 填写评论的人 | ||
35 | + FromUser CommentAuthor `json:"fromUser"` // 填写评论的人 | ||
36 | + ToUserId int64 `json:"toUserId"` // 回复哪个人 | ||
37 | + ToUser CommentAuthor `json:"toUser"` // 回复哪个人 | ||
38 | + SectionContent string `json:"sectionContent"` // 引用的文章内容文本 | ||
39 | + CountReply int `json:"countReply"` // 回复数量 | ||
40 | + CountUserLove int `json:"countUserLove"` // 用户点赞数量 | ||
41 | + CountAdminLove int `json:"countAdminLove"` // 运营点赞数量 | ||
42 | + AtWho []CommentAuthor `json:"atWho"` // 填写评论时@的人 | ||
220 | } | 43 | } |
221 | 44 | ||
222 | type MessageSystemRequest struct { | 45 | type MessageSystemRequest struct { |
@@ -646,6 +469,306 @@ type Company struct { | @@ -646,6 +469,306 @@ type Company struct { | ||
646 | Logo string `json:"logo,omitempty"` // 公司LOGO | 469 | Logo string `json:"logo,omitempty"` // 公司LOGO |
647 | } | 470 | } |
648 | 471 | ||
472 | +type Location struct { | ||
473 | + Longitude float64 `json:"longitude,optional"` //经度 | ||
474 | + Latitude float64 `json:"latitude,optional"` //纬度 | ||
475 | + Descript string `json:"descript,optional"` //地点描述 | ||
476 | +} | ||
477 | + | ||
478 | +type ArticleAuthor struct { | ||
479 | + Id int64 `json:"id"` // 人员id | ||
480 | + Name string `json:"name"` // 人员的名字 | ||
481 | + Avatar string `json:"avatar"` // 人员头像URL | ||
482 | + Position string `json:"position"` // 职位 | ||
483 | + Company string `json:"company"` // 公司 | ||
484 | +} | ||
485 | + | ||
486 | +type MiniArticleCreateRequest struct { | ||
487 | + Title string `json:"title"` //标题 | ||
488 | + Section []string `json:"section"` //文章的文本内容 | ||
489 | + AuthorId int64 `json:"authorId,optional"` //发布人id | ||
490 | + Images []string `json:"images,optional"` //图片 | ||
491 | + WhoRead []int64 `json:"whoRead,optional"` //谁可查看 | ||
492 | + WhoReview []int64 `json:"whoReview,optional"` //谁可评论 | ||
493 | + Location Location `json:"location,optional"` //定位坐标 | ||
494 | +} | ||
495 | + | ||
496 | +type MiniArticleCreateResponse struct { | ||
497 | + Id int64 `json:"id"` | ||
498 | +} | ||
499 | + | ||
500 | +type MiniArticleGetRequest struct { | ||
501 | + Id int64 `path:"id"` //id | ||
502 | + CompanyId int64 `path:",optional"` //当前公司 | ||
503 | + UserId int `path:",optional"` //当前用户 | ||
504 | +} | ||
505 | + | ||
506 | +type MiniArticleGetResponse struct { | ||
507 | + Id int64 `json:"id"` //id | ||
508 | + Title string `json:"title"` //标题 | ||
509 | + AuthorId int64 `json:"authorId"` //发布人id | ||
510 | + Author ArticleAuthor `json:"author"` //发布人 | ||
511 | + CreatedAt int64 `json:"createdAt"` //文章的发布时间 | ||
512 | + Section []ArticleSection `json:"section"` //文章的文本内容 | ||
513 | + Images []string `json:"images"` //图片 | ||
514 | + WhoRead []int64 `json:"whoRead"` //谁可查看 | ||
515 | + WhoReview []int64 `json:"whoReview"` //谁可评论 | ||
516 | + Location Location `json:"location"` //定位坐标 | ||
517 | + CountLove int `json:"countLove"` // 点赞数量 | ||
518 | + CountComment int `json:"countComment"` // 评论数量 | ||
519 | + CountRead int `json:"countRead"` // 浏览数量 | ||
520 | + Show int `json:"show"` // 评论的展示状态(0显示、1不显示) | ||
521 | + Edit int `json:"edit"` // 文章是否存在变更记录 (0 不存在 1存在) | ||
522 | + MeLoveFlag int `json:"meLoveFlag"` //当前人员对文章的点赞标识 | ||
523 | +} | ||
524 | + | ||
525 | +type ArticleSection struct { | ||
526 | + Id int64 `json:"id"` //段落id | ||
527 | + Content string `json:"content"` // 文本内容 | ||
528 | + SortBy int `json:"sortBy"` // 排序 | ||
529 | + TotalComment int `json:"totalComment"` // 评论的数量 | ||
530 | +} | ||
531 | + | ||
532 | +type MiniArticleSearchMeRequest struct { | ||
533 | + AuthorId int64 `json:",optional"` | ||
534 | + CompanyId int64 `json:",optional"` | ||
535 | + Page int `json:"page"` | ||
536 | + Size int `json:"size"` | ||
537 | +} | ||
538 | + | ||
539 | +type MiniArticleSearchMeResponse struct { | ||
540 | + Total int `json:"total"` | ||
541 | + List []ArticleSearchMe `json:"list"` | ||
542 | +} | ||
543 | + | ||
544 | +type ArticleSearchMe struct { | ||
545 | + Id int64 `json:"id"` //id | ||
546 | + Title string `json:"title"` //标题 | ||
547 | + Images []string `json:"images"` //图片 | ||
548 | + CreatedAt int64 `json:"createdAt"` //文章的创建日期 | ||
549 | + CountLove int `json:"countLove"` //点赞数量 | ||
550 | + CountComment int `json:"CountComment"` //评论数量 | ||
551 | + Show int `json:"show"` //是否隐藏 [0显示、1不显示] | ||
552 | +} | ||
553 | + | ||
554 | +type MiniUserLikeArticleRequest struct { | ||
555 | + ArticleId int64 `json:"articleId"` // 文章id | ||
556 | + CompanyId int64 `json:",optional"` //公司id | ||
557 | + Page int `json:"page"` //分页,第几页 | ||
558 | + Size int `json:"size"` //分页,每页几条 | ||
559 | +} | ||
560 | + | ||
561 | +type MiniUserLikeArticleResponse struct { | ||
562 | + Total int64 `json:"total"` //总数 | ||
563 | + List []WhichUserLikeArticle `json:"list"` //列表 | ||
564 | +} | ||
565 | + | ||
566 | +type WhichUserLikeArticle struct { | ||
567 | + ArticleId int64 `json:"articleId"` // 文章id | ||
568 | + UserId int64 `json:"userId"` // 人员id | ||
569 | + Name string `json:"name"` // 人员名称 | ||
570 | + Avatar string `json:"avatar"` // 人员头像 | ||
571 | + CreatedAt int64 `json:"createdAt"` // 点赞记录的时间 | ||
572 | +} | ||
573 | + | ||
574 | +type MiniSetUserLikeRequset struct { | ||
575 | + ArticleId int64 `json:"articleId"` //文章id | ||
576 | + CommentId int64 `json:"commentId"` //评论id | ||
577 | + UserId int64 `json:",optional"` //操作人 | ||
578 | + Flag int `json:"flag"` //点赞标志 1、点赞 2 、取消点赞 | ||
579 | +} | ||
580 | + | ||
581 | +type MiniSetUserLikeResponse struct { | ||
582 | + ArticleId int64 `json:"articleId"` //文章id | ||
583 | + CommentId int64 `json:"commentId"` //评论id | ||
584 | + Count int `json:"count"` //现有的点赞数量 | ||
585 | +} | ||
586 | + | ||
587 | +type MiniArticleBackupSearchRequest struct { | ||
588 | + Page int `json:"page"` | ||
589 | + Size int `json:"size"` | ||
590 | + ArticleId int `json:"articleId"` | ||
591 | + CompanyId int64 `json:",optional"` // 服务端自动获取 | ||
592 | +} | ||
593 | + | ||
594 | +type MiniArticleBackupSearchResponse struct { | ||
595 | + Total int64 `json:"total"` | ||
596 | + List []MiniArticleBackupItem `json:"list"` | ||
597 | +} | ||
598 | + | ||
599 | +type MiniArticleBackupItem struct { | ||
600 | + Id int64 `json:"id"` | ||
601 | + Title string `json:"title"` | ||
602 | + Content string `json:"content"` | ||
603 | + Images []string `json:"images"` | ||
604 | + CreatedAt int64 `json:"createdAt"` | ||
605 | + Location Location `json:"location"` | ||
606 | +} | ||
607 | + | ||
608 | +type MiniArticleMarkUserReadRequest struct { | ||
609 | + UserId int64 `json:",optional"` // 当前操作人 | ||
610 | + CompanyId int64 `json:",optional"` // 当前公司 | ||
611 | + ArticleId int64 `json:"articleId"` // 文章id | ||
612 | +} | ||
613 | + | ||
614 | +type MiniArticleMarkUserReadResponse struct { | ||
615 | + Id int64 `json:"id"` | ||
616 | +} | ||
617 | + | ||
618 | +type MiniArticleDraftCreateRequest struct { | ||
619 | + CompanyId int64 `json:",optional"` | ||
620 | + AuthorId int64 `json:",optional"` // 发布人 | ||
621 | + Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式 | ||
622 | + Section []string `json:"section"` // 填写的内容 | ||
623 | + Title string `json:"title"` // 标题 | ||
624 | + Images []string `json:"images"` // 图片 | ||
625 | + WhoRead []int64 `json:"whoRead"` // 谁可以看 | ||
626 | + WhoReview []int64 `json:"whoReview"` // 评论人 | ||
627 | + Location Location `json:"location"` // 坐标 | ||
628 | +} | ||
629 | + | ||
630 | +type MiniArticleDraftCreateResponse struct { | ||
631 | + Id int64 `json:"id"` | ||
632 | +} | ||
633 | + | ||
634 | +type MiniArticleDraftUpdateRequest struct { | ||
635 | + Id int64 `json:"id"` | ||
636 | + CompanyId int64 `json:",optional"` | ||
637 | + AuthorId int64 `json:",optional"` // 发布人 | ||
638 | + Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式 | ||
639 | + Section []string `json:"section"` // 填写的内容 | ||
640 | + Title string `json:"title"` // 标题 | ||
641 | + Images []string `json:"images"` // 图片 | ||
642 | + WhoRead []int64 `json:"whoRead"` // 谁可以看 | ||
643 | + WhoReview []int64 `json:"whoReview"` // 评论人 | ||
644 | + Location Location `json:"location"` // 坐标 | ||
645 | +} | ||
646 | + | ||
647 | +type MiniArticleDraftUpdateResponse struct { | ||
648 | + Id int64 `json:"id"` | ||
649 | +} | ||
650 | + | ||
651 | +type MiniArticleDraftSearchMeRequest struct { | ||
652 | + CompanyId int64 `json:",optional"` // 公司id | ||
653 | + AuthorId int64 `json:",optional"` // 发布人 | ||
654 | + Page int `json:"page"` | ||
655 | + Size int `json:"size"` | ||
656 | +} | ||
657 | + | ||
658 | +type MiniArticleDraftSearchMeResponse struct { | ||
659 | + Total int64 `json:"total"` | ||
660 | + List []MiniArticleDraftItem `json:"list"` | ||
661 | +} | ||
662 | + | ||
663 | +type MiniArticleDraftItem struct { | ||
664 | + Id int64 `json:"id"` | ||
665 | + Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式 | ||
666 | + Section []string `json:"section"` // 填写的内容 | ||
667 | + Title string `json:"title"` // 标题 | ||
668 | + Images []string `json:"images"` // 图片 | ||
669 | + CreatedAt int64 `json:"createdAt"` | ||
670 | +} | ||
671 | + | ||
672 | +type MiniArticleDraftGetMeRequest struct { | ||
673 | + CompanyId int64 `path:",optional"` // 公司id | ||
674 | + AuthorId int64 `path:",optional"` // 发布人 | ||
675 | + Id int64 `path:"id"` | ||
676 | +} | ||
677 | + | ||
678 | +type MiniArticleDraftGetMeResponse struct { | ||
679 | + Id int64 `json:"id"` // | ||
680 | + Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式 | ||
681 | + Section []string `json:"Section"` // 填写的内容 | ||
682 | + Title string `json:"title"` // 标题 | ||
683 | + Images []string `json:"images"` // 图片 | ||
684 | + WhoRead []int64 `json:"whoRead"` // 谁可以看 | ||
685 | + WhoReview []int64 `json:"whoReview"` // 评论人 | ||
686 | + Location Location `json:"location"` // 坐标 | ||
687 | +} | ||
688 | + | ||
689 | +type MiniArticleDraftDeleteMeRequest struct { | ||
690 | + CompanyId int64 `path:",optional"` // 公司id | ||
691 | + AuthorId int64 `path:",optional"` // 发布人 | ||
692 | + Id int64 `path:"id"` | ||
693 | +} | ||
694 | + | ||
695 | +type MiniArticleDraftDeleteMeResponse struct { | ||
696 | + Id int64 `json:"id"` // | ||
697 | +} | ||
698 | + | ||
699 | +type MiniArticleMarkListRequest struct { | ||
700 | + Page int `json:"page"` | ||
701 | + Size int `json:"size"` | ||
702 | +} | ||
703 | + | ||
704 | +type MiniArticleMarkListResponse struct { | ||
705 | + Total int64 `json:"total"` | ||
706 | + List []MiniArticleMarkItem `json:"list"` | ||
707 | +} | ||
708 | + | ||
709 | +type MiniArticleMarkItem struct { | ||
710 | + Id int64 `json:"id"` | ||
711 | + CompanyId int64 `json:"companyId"` | ||
712 | + UserId int64 `json:"userId"` | ||
713 | + ArticleId int64 `json:"articleId"` | ||
714 | + Title string `json:"title"` | ||
715 | + Author SimpleUser `json:"author"` // 发布人 | ||
716 | + UpdatedAt int64 `json:"updatedAt"` | ||
717 | +} | ||
718 | + | ||
719 | +type SystemArticleGetRequest struct { | ||
720 | + Id int64 `path:"id"` //id | ||
721 | + CompanyId int64 `path:",optional"` | ||
722 | +} | ||
723 | + | ||
724 | +type UserShowName struct { | ||
725 | + Id int `json:"id"` | ||
726 | + Name int `json:"name"` | ||
727 | +} | ||
728 | + | ||
729 | +type SystemArticleGetResponse struct { | ||
730 | + Id int64 `json:"id"` // id | ||
731 | + Title string `json:"title"` // 标题 | ||
732 | + AuthorId int64 `json:"authorId"` // 发布人id | ||
733 | + Author ArticleAuthor `json:"author"` // 发布人 | ||
734 | + CreatedAt int64 `json:"createdAt"` // 文章的发布时间 | ||
735 | + Section []ArticleSection `json:"section"` // 文章的文本内容 | ||
736 | + Images []string `json:"images"` // 图片 | ||
737 | + WhoRead []int64 `json:"whoRead"` // 谁可查看 | ||
738 | + WhoReadInfo []UserShowName `json:"whoReadInfo"` // 谁可查看 | ||
739 | + WhoReview []int64 `json:"whoReview"` // 谁可评论 | ||
740 | + WhoReviewInfo []UserShowName `json:"whoReviewInfo"` // 谁可评论 | ||
741 | + Location Location `json:"location"` // 定位坐标 | ||
742 | + CountLove int `json:"countLove"` // 点赞数量 | ||
743 | + CountComment int `json:"countComment"` // 评论数量 | ||
744 | + CountRead int `json:"countRead"` // 浏览数量 | ||
745 | + Show int `json:"show"` // 评论的展示状态(0显示、1不显示) | ||
746 | +} | ||
747 | + | ||
748 | +type SystemArticleSearchRequest struct { | ||
749 | + CompanyId int64 `json:",optional"` | ||
750 | + Page int `json:"page"` | ||
751 | + Size int `json:"size"` | ||
752 | +} | ||
753 | + | ||
754 | +type SystemArticleSearchResponse struct { | ||
755 | + Total int `json:"total"` | ||
756 | + List []SystemArticleSearch `json:"list"` | ||
757 | +} | ||
758 | + | ||
759 | +type SystemArticleSearch struct { | ||
760 | + Id int64 `json:"id"` //id | ||
761 | + Title string `json:"title"` //标题 | ||
762 | + Author string `json:"author"` //发布人 | ||
763 | + Images []string `json:"images"` //图片 | ||
764 | + CreatedAt int64 `json:"createdAt"` //文章的创建日期 | ||
765 | + CountLove int `json:"countLove"` //点赞数量 | ||
766 | + CountComment int `json:"CountComment"` //评论数量 | ||
767 | + Show int `json:"show"` //是否隐藏 [0显示、1不显示] | ||
768 | + Tags []string `json:"tags"` //标签 | ||
769 | + TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] | ||
770 | +} | ||
771 | + | ||
649 | type RoleGetRequest struct { | 772 | type RoleGetRequest struct { |
650 | Id int64 `path:"id"` | 773 | Id int64 `path:"id"` |
651 | } | 774 | } |
@@ -710,3 +833,31 @@ type Auth struct { | @@ -710,3 +833,31 @@ type Auth struct { | ||
710 | Name string `json:"name"` // 名称 | 833 | Name string `json:"name"` // 名称 |
711 | Code string `json:"code"` // 编码 | 834 | Code string `json:"code"` // 编码 |
712 | } | 835 | } |
836 | + | ||
837 | +type DepartmentAddRequest struct { | ||
838 | + Name string `json:"name"` // 分组名称 | ||
839 | + Ids []int64 `json:"ids"` // 用户ID | ||
840 | +} | ||
841 | + | ||
842 | +type DepartmentGetRequest struct { | ||
843 | + Id int64 `path:"id"` | ||
844 | +} | ||
845 | + | ||
846 | +type DepartmentGetResponse struct { | ||
847 | + Department Department `json:"department"` | ||
848 | +} | ||
849 | + | ||
850 | +type DepartmentUpdateRequest struct { | ||
851 | + Id int64 `path:"id"` | ||
852 | + Name string `json:"name"` | ||
853 | +} | ||
854 | + | ||
855 | +type DepartmentListRequest struct { | ||
856 | + Page int `json:"page"` | ||
857 | + Size int `json:"size"` | ||
858 | +} | ||
859 | + | ||
860 | +type DepartmentListResponse struct { | ||
861 | + List []Department `json:"list"` | ||
862 | + Total int64 `json:"total"` | ||
863 | +} |
@@ -20,12 +20,13 @@ type ArticleComment struct { | @@ -20,12 +20,13 @@ type ArticleComment struct { | ||
20 | Pid int64 // 对哪个评论进行回复 | 20 | Pid int64 // 对哪个评论进行回复 |
21 | TopId int64 // 归属于最上级的哪个评论 | 21 | TopId int64 // 归属于最上级的哪个评论 |
22 | ArticleId int64 // 文章id | 22 | ArticleId int64 // 文章id |
23 | - ArticleSectionId int64 // 文本内容id | 23 | + SectionId int64 // 文本内容id |
24 | SectionContent string // 引用的文章内容文本 | 24 | SectionContent string // 引用的文章内容文本 |
25 | FromUserId int64 // 谁填写的评论 | 25 | FromUserId int64 // 谁填写的评论 |
26 | FromUser domain.UserSimple `gorm:"type:jsonb;serializer:json"` // 谁填写的评论 | 26 | FromUser domain.UserSimple `gorm:"type:jsonb;serializer:json"` // 谁填写的评论 |
27 | ToUserId int64 // 回复谁的评论 | 27 | ToUserId int64 // 回复谁的评论 |
28 | ToUser domain.UserSimple `gorm:"type:jsonb;serializer:json"` // 回复谁的评论 | 28 | ToUser domain.UserSimple `gorm:"type:jsonb;serializer:json"` // 回复谁的评论 |
29 | + AtWho []domain.UserSimple `gorm:"type:jsonb;serializer:json"` // 填写评论@的人 | ||
29 | Content string // 评论内容 | 30 | Content string // 评论内容 |
30 | CountReply int // 回复数量 | 31 | CountReply int // 回复数量 |
31 | CountUserLove int // 用户点赞数量 | 32 | CountUserLove int // 用户点赞数量 |
@@ -2,6 +2,7 @@ package models | @@ -2,6 +2,7 @@ package models | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "fmt" | 4 | "fmt" |
5 | + "time" | ||
5 | 6 | ||
6 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | 7 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" |
7 | "gorm.io/gorm" | 8 | "gorm.io/gorm" |
@@ -31,13 +32,14 @@ func (m *ArticleDraft) TableName() string { | @@ -31,13 +32,14 @@ func (m *ArticleDraft) TableName() string { | ||
31 | } | 32 | } |
32 | 33 | ||
33 | func (m *ArticleDraft) BeforeCreate(tx *gorm.DB) (err error) { | 34 | func (m *ArticleDraft) BeforeCreate(tx *gorm.DB) (err error) { |
34 | - // m.CreatedAt = time.Now().Unix() | ||
35 | - // m.UpdatedAt = time.Now().Unix() | 35 | + nowTime := time.Now().Unix() |
36 | + m.CreatedAt = nowTime | ||
37 | + m.UpdatedAt = nowTime | ||
36 | return | 38 | return |
37 | } | 39 | } |
38 | 40 | ||
39 | func (m *ArticleDraft) BeforeUpdate(tx *gorm.DB) (err error) { | 41 | func (m *ArticleDraft) BeforeUpdate(tx *gorm.DB) (err error) { |
40 | - // m.UpdatedAt = time.Now().Unix() | 42 | + m.UpdatedAt = time.Now().Unix() |
41 | return | 43 | return |
42 | } | 44 | } |
43 | 45 |
@@ -5,6 +5,7 @@ import ( | @@ -5,6 +5,7 @@ import ( | ||
5 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | 5 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" |
6 | "gorm.io/gorm" | 6 | "gorm.io/gorm" |
7 | "gorm.io/plugin/soft_delete" | 7 | "gorm.io/plugin/soft_delete" |
8 | + "time" | ||
8 | ) | 9 | ) |
9 | 10 | ||
10 | type Department struct { | 11 | type Department struct { |
@@ -12,7 +13,6 @@ type Department struct { | @@ -12,7 +13,6 @@ type Department struct { | ||
12 | CompanyId int64 `json:"companyId,omitempty"` // 公司ID | 13 | CompanyId int64 `json:"companyId,omitempty"` // 公司ID |
13 | ParentId int64 `json:"parentId,omitempty"` // 父级ID | 14 | ParentId int64 `json:"parentId,omitempty"` // 父级ID |
14 | Name string `json:"name,omitempty"` // 部门名称 | 15 | Name string `json:"name,omitempty"` // 部门名称 |
15 | - | ||
16 | CreatedAt int64 `json:"createdAt,omitempty"` | 16 | CreatedAt int64 `json:"createdAt,omitempty"` |
17 | UpdatedAt int64 `json:"updatedAt,omitempty"` | 17 | UpdatedAt int64 `json:"updatedAt,omitempty"` |
18 | DeletedAt int64 `json:"deletedAt,omitempty"` | 18 | DeletedAt int64 `json:"deletedAt,omitempty"` |
@@ -25,13 +25,13 @@ func (m *Department) TableName() string { | @@ -25,13 +25,13 @@ func (m *Department) TableName() string { | ||
25 | } | 25 | } |
26 | 26 | ||
27 | func (m *Department) BeforeCreate(tx *gorm.DB) (err error) { | 27 | func (m *Department) BeforeCreate(tx *gorm.DB) (err error) { |
28 | - // m.CreatedAt = time.Now().Unix() | ||
29 | - // m.UpdatedAt = time.Now().Unix() | 28 | + m.CreatedAt = time.Now().Unix() |
29 | + m.UpdatedAt = time.Now().Unix() | ||
30 | return | 30 | return |
31 | } | 31 | } |
32 | 32 | ||
33 | func (m *Department) BeforeUpdate(tx *gorm.DB) (err error) { | 33 | func (m *Department) BeforeUpdate(tx *gorm.DB) (err error) { |
34 | - // m.UpdatedAt = time.Now().Unix() | 34 | + m.UpdatedAt = time.Now().Unix() |
35 | return | 35 | return |
36 | } | 36 | } |
37 | 37 |
@@ -6,6 +6,7 @@ import ( | @@ -6,6 +6,7 @@ import ( | ||
6 | 6 | ||
7 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | 7 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" |
8 | "gorm.io/gorm" | 8 | "gorm.io/gorm" |
9 | + "gorm.io/plugin/soft_delete" | ||
9 | ) | 10 | ) |
10 | 11 | ||
11 | type UserReadArticle struct { | 12 | type UserReadArticle struct { |
@@ -13,6 +14,7 @@ type UserReadArticle struct { | @@ -13,6 +14,7 @@ type UserReadArticle struct { | ||
13 | CreatedAt int64 | 14 | CreatedAt int64 |
14 | UpdatedAt int64 | 15 | UpdatedAt int64 |
15 | DeletedAt int64 | 16 | DeletedAt int64 |
17 | + IsDel soft_delete.DeletedAt `gorm:"softDelete:flag,DeletedAtField:DeletedAt"` | ||
16 | Version int | 18 | Version int |
17 | CompanyId int64 | 19 | CompanyId int64 |
18 | UserId int64 | 20 | UserId int64 |
@@ -151,7 +151,7 @@ func (repository *ArticleCommentRepository) ModelToDomainModel(from *models.Arti | @@ -151,7 +151,7 @@ func (repository *ArticleCommentRepository) ModelToDomainModel(from *models.Arti | ||
151 | Pid: from.Pid, | 151 | Pid: from.Pid, |
152 | TopId: from.TopId, | 152 | TopId: from.TopId, |
153 | ArticleId: from.ArticleId, | 153 | ArticleId: from.ArticleId, |
154 | - ArticleSectionId: from.ArticleSectionId, | 154 | + SectionId: from.SectionId, |
155 | SectionContent: from.SectionContent, | 155 | SectionContent: from.SectionContent, |
156 | FromUserId: from.FromUserId, | 156 | FromUserId: from.FromUserId, |
157 | FromUser: from.FromUser, | 157 | FromUser: from.FromUser, |
@@ -178,7 +178,7 @@ func (repository *ArticleCommentRepository) DomainModelToModel(from *domain.Arti | @@ -178,7 +178,7 @@ func (repository *ArticleCommentRepository) DomainModelToModel(from *domain.Arti | ||
178 | Pid: from.Pid, | 178 | Pid: from.Pid, |
179 | TopId: from.TopId, | 179 | TopId: from.TopId, |
180 | ArticleId: from.ArticleId, | 180 | ArticleId: from.ArticleId, |
181 | - ArticleSectionId: from.ArticleSectionId, | 181 | + SectionId: from.SectionId, |
182 | SectionContent: from.SectionContent, | 182 | SectionContent: from.SectionContent, |
183 | FromUserId: from.FromUserId, | 183 | FromUserId: from.FromUserId, |
184 | FromUser: from.FromUser, | 184 | FromUser: from.FromUser, |
@@ -17,7 +17,7 @@ type ArticleComment struct { | @@ -17,7 +17,7 @@ type ArticleComment struct { | ||
17 | Pid int64 `json:"pid"` // 对哪个评论进行回复 | 17 | Pid int64 `json:"pid"` // 对哪个评论进行回复 |
18 | TopId int64 `json:"topId"` // 归属于最上级的哪个评论 | 18 | TopId int64 `json:"topId"` // 归属于最上级的哪个评论 |
19 | ArticleId int64 `json:"articleId"` // 文章id | 19 | ArticleId int64 `json:"articleId"` // 文章id |
20 | - ArticleSectionId int64 `json:"articleSectionId"` // 文本内容id | 20 | + SectionId int64 `json:"sectionId"` // 文本段落内容id |
21 | SectionContent string `json:"sectionContent"` // 引用的文章内容文本 | 21 | SectionContent string `json:"sectionContent"` // 引用的文章内容文本 |
22 | FromUserId int64 `json:"fromUserId"` // 谁填写的评论 | 22 | FromUserId int64 `json:"fromUserId"` // 谁填写的评论 |
23 | FromUser UserSimple `json:"fromUser"` // 谁填写的评论 | 23 | FromUser UserSimple `json:"fromUser"` // 谁填写的评论 |
@@ -28,6 +28,7 @@ type ArticleComment struct { | @@ -28,6 +28,7 @@ type ArticleComment struct { | ||
28 | CountUserLove int `json:"countUserLove"` // 用户点赞数量 | 28 | CountUserLove int `json:"countUserLove"` // 用户点赞数量 |
29 | CountAdminLove int `json:"countAdminLove"` // 运营点赞数量 | 29 | CountAdminLove int `json:"countAdminLove"` // 运营点赞数量 |
30 | Show CommentShow `json:"showState"` // 评论的展示状态(0显示、1不显示) | 30 | Show CommentShow `json:"showState"` // 评论的展示状态(0显示、1不显示) |
31 | + AtWho []UserSimple `json:"atWho"` // 填写评论时@的人 | ||
31 | // ...more | 32 | // ...more |
32 | } | 33 | } |
33 | 34 |
@@ -32,8 +32,8 @@ type UserSimple struct { | @@ -32,8 +32,8 @@ type UserSimple struct { | ||
32 | Id int64 `json:"id"` // 人员id | 32 | Id int64 `json:"id"` // 人员id |
33 | Name string `json:"name"` // 人员的名字 | 33 | Name string `json:"name"` // 人员的名字 |
34 | Avatar string `json:"avatar,omitempty"` // 人员头像URL | 34 | Avatar string `json:"avatar,omitempty"` // 人员头像URL |
35 | - GroupId int64 `json:"groupId,omitempty"` | ||
36 | - Group string `json:"group,omitempty"` // 人员的分组 | 35 | + // GroupId int64 `json:"groupId"` //分组id |
36 | + //Group string `json:"group,omitempty"` // 人员的分组 | ||
37 | Position string `json:"position,omitempty"` // 职位 | 37 | Position string `json:"position,omitempty"` // 职位 |
38 | Company string `json:"company,omitempty"` // 公司 | 38 | Company string `json:"company,omitempty"` // 公司 |
39 | CompanyId int64 `json:"companyId"` | 39 | CompanyId int64 `json:"companyId"` |
-
请 注册 或 登录 后发表评论