Merge branch 'dev' of http://gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss into dev
正在显示
16 个修改的文件
包含
827 行增加
和
100 行删除
@@ -631,22 +631,6 @@ | @@ -631,22 +631,6 @@ | ||
631 | "required": false, | 631 | "required": false, |
632 | "type": "integer", | 632 | "type": "integer", |
633 | "format": "int64" | 633 | "format": "int64" |
634 | - }, | ||
635 | - { | ||
636 | - "name": "articleId", | ||
637 | - "description": " 文章id", | ||
638 | - "in": "query", | ||
639 | - "required": true, | ||
640 | - "type": "integer", | ||
641 | - "format": "int64" | ||
642 | - }, | ||
643 | - { | ||
644 | - "name": "tagId", | ||
645 | - "description": " 标签id", | ||
646 | - "in": "query", | ||
647 | - "required": true, | ||
648 | - "type": "integer", | ||
649 | - "format": "int64" | ||
650 | } | 634 | } |
651 | ], | 635 | ], |
652 | "requestBody": {}, | 636 | "requestBody": {}, |
@@ -1211,6 +1195,64 @@ | @@ -1211,6 +1195,64 @@ | ||
1211 | ] | 1195 | ] |
1212 | } | 1196 | } |
1213 | }, | 1197 | }, |
1198 | + "v1/system/article": { | ||
1199 | + "put": { | ||
1200 | + "summary": "管理后台编辑帖子", | ||
1201 | + "operationId": "SystemUpdateArticle", | ||
1202 | + "responses": { | ||
1203 | + "200": { | ||
1204 | + "description": "A successful response.", | ||
1205 | + "schema": { | ||
1206 | + "$ref": "#/definitions/SystemArticleUpdateResponse" | ||
1207 | + } | ||
1208 | + } | ||
1209 | + }, | ||
1210 | + "parameters": [ | ||
1211 | + { | ||
1212 | + "name": "body", | ||
1213 | + "description": "编辑", | ||
1214 | + "in": "body", | ||
1215 | + "required": true, | ||
1216 | + "schema": { | ||
1217 | + "$ref": "#/definitions/SystemArticleUpdateRequest" | ||
1218 | + } | ||
1219 | + } | ||
1220 | + ], | ||
1221 | + "requestBody": {}, | ||
1222 | + "tags": [ | ||
1223 | + "article" | ||
1224 | + ] | ||
1225 | + } | ||
1226 | + }, | ||
1227 | + "v1/system/article/history": { | ||
1228 | + "post": { | ||
1229 | + "summary": "管理后台编辑历史", | ||
1230 | + "operationId": "SystemHistoryArticle", | ||
1231 | + "responses": { | ||
1232 | + "200": { | ||
1233 | + "description": "A successful response.", | ||
1234 | + "schema": { | ||
1235 | + "$ref": "#/definitions/SystemArticleHistoryResponse" | ||
1236 | + } | ||
1237 | + } | ||
1238 | + }, | ||
1239 | + "parameters": [ | ||
1240 | + { | ||
1241 | + "name": "body", | ||
1242 | + "description": "历史", | ||
1243 | + "in": "body", | ||
1244 | + "required": true, | ||
1245 | + "schema": { | ||
1246 | + "$ref": "#/definitions/SystemArticleHistoryRequest" | ||
1247 | + } | ||
1248 | + } | ||
1249 | + ], | ||
1250 | + "requestBody": {}, | ||
1251 | + "tags": [ | ||
1252 | + "article" | ||
1253 | + ] | ||
1254 | + } | ||
1255 | + }, | ||
1214 | "v1/system/article/search": { | 1256 | "v1/system/article/search": { |
1215 | "post": { | 1257 | "post": { |
1216 | "summary": "管理后台获取文章列表", | 1258 | "summary": "管理后台获取文章列表", |
@@ -2240,6 +2282,25 @@ | @@ -2240,6 +2282,25 @@ | ||
2240 | "totalComment" | 2282 | "totalComment" |
2241 | ] | 2283 | ] |
2242 | }, | 2284 | }, |
2285 | + "ArticleTagGroup": { | ||
2286 | + "type": "object", | ||
2287 | + "properties": { | ||
2288 | + "group": { | ||
2289 | + "type": "string" | ||
2290 | + }, | ||
2291 | + "tags": { | ||
2292 | + "type": "array", | ||
2293 | + "items": { | ||
2294 | + "$ref": "#/definitions/ArticleTagItem" | ||
2295 | + } | ||
2296 | + } | ||
2297 | + }, | ||
2298 | + "title": "ArticleTagGroup", | ||
2299 | + "required": [ | ||
2300 | + "group", | ||
2301 | + "tags" | ||
2302 | + ] | ||
2303 | + }, | ||
2243 | "ArticleTagItem": { | 2304 | "ArticleTagItem": { |
2244 | "type": "object", | 2305 | "type": "object", |
2245 | "properties": { | 2306 | "properties": { |
@@ -2252,13 +2313,17 @@ | @@ -2252,13 +2313,17 @@ | ||
2252 | }, | 2313 | }, |
2253 | "name": { | 2314 | "name": { |
2254 | "type": "string" | 2315 | "type": "string" |
2316 | + }, | ||
2317 | + "image": { | ||
2318 | + "type": "string" | ||
2255 | } | 2319 | } |
2256 | }, | 2320 | }, |
2257 | "title": "ArticleTagItem", | 2321 | "title": "ArticleTagItem", |
2258 | "required": [ | 2322 | "required": [ |
2259 | "id", | 2323 | "id", |
2260 | "group", | 2324 | "group", |
2261 | - "name" | 2325 | + "name", |
2326 | + "image" | ||
2262 | ] | 2327 | ] |
2263 | }, | 2328 | }, |
2264 | "Auth": { | 2329 | "Auth": { |
@@ -2294,6 +2359,9 @@ | @@ -2294,6 +2359,9 @@ | ||
2294 | }, | 2359 | }, |
2295 | "name": { | 2360 | "name": { |
2296 | "type": "string" | 2361 | "type": "string" |
2362 | + }, | ||
2363 | + "firstLetter": { | ||
2364 | + "type": "string" | ||
2297 | } | 2365 | } |
2298 | }, | 2366 | }, |
2299 | "title": "CommentAtWho", | 2367 | "title": "CommentAtWho", |
@@ -2806,23 +2874,9 @@ | @@ -2806,23 +2874,9 @@ | ||
2806 | "type": "integer", | 2874 | "type": "integer", |
2807 | "format": "int64", | 2875 | "format": "int64", |
2808 | "description": " 公司id" | 2876 | "description": " 公司id" |
2809 | - }, | ||
2810 | - "articleId": { | ||
2811 | - "type": "integer", | ||
2812 | - "format": "int64", | ||
2813 | - "description": " 文章id" | ||
2814 | - }, | ||
2815 | - "tagId": { | ||
2816 | - "type": "integer", | ||
2817 | - "format": "int64", | ||
2818 | - "description": " 标签id" | ||
2819 | } | 2877 | } |
2820 | }, | 2878 | }, |
2821 | - "title": "MiniAllArticleTagRequest", | ||
2822 | - "required": [ | ||
2823 | - "articleId", | ||
2824 | - "tagId" | ||
2825 | - ] | 2879 | + "title": "MiniAllArticleTagRequest" |
2826 | }, | 2880 | }, |
2827 | "MiniAllArticleTagResponse": { | 2881 | "MiniAllArticleTagResponse": { |
2828 | "type": "object", | 2882 | "type": "object", |
@@ -2830,20 +2884,13 @@ | @@ -2830,20 +2884,13 @@ | ||
2830 | "tagGroup": { | 2884 | "tagGroup": { |
2831 | "type": "array", | 2885 | "type": "array", |
2832 | "items": { | 2886 | "items": { |
2833 | - "type": "string" | ||
2834 | - } | ||
2835 | - }, | ||
2836 | - "tags": { | ||
2837 | - "type": "array", | ||
2838 | - "items": { | ||
2839 | - "$ref": "#/definitions/ArticleTagItem" | 2887 | + "$ref": "#/definitions/ArticleTagGroup" |
2840 | } | 2888 | } |
2841 | } | 2889 | } |
2842 | }, | 2890 | }, |
2843 | "title": "MiniAllArticleTagResponse", | 2891 | "title": "MiniAllArticleTagResponse", |
2844 | "required": [ | 2892 | "required": [ |
2845 | - "tagGroup", | ||
2846 | - "tags" | 2893 | + "tagGroup" |
2847 | ] | 2894 | ] |
2848 | }, | 2895 | }, |
2849 | "MiniArticleBackupItem": { | 2896 | "MiniArticleBackupItem": { |
@@ -5022,6 +5069,57 @@ | @@ -5022,6 +5069,57 @@ | ||
5022 | "show" | 5069 | "show" |
5023 | ] | 5070 | ] |
5024 | }, | 5071 | }, |
5072 | + "SystemArticleHistoryRequest": { | ||
5073 | + "type": "object", | ||
5074 | + "properties": { | ||
5075 | + "articleId": { | ||
5076 | + "type": "integer", | ||
5077 | + "format": "int64", | ||
5078 | + "description": "文章ID" | ||
5079 | + }, | ||
5080 | + "author": { | ||
5081 | + "type": "string", | ||
5082 | + "description": "发布人" | ||
5083 | + }, | ||
5084 | + "updatedAt": { | ||
5085 | + "type": "string", | ||
5086 | + "description": "修改日期" | ||
5087 | + } | ||
5088 | + }, | ||
5089 | + "title": "SystemArticleHistoryRequest", | ||
5090 | + "required": [ | ||
5091 | + "articleId" | ||
5092 | + ] | ||
5093 | + }, | ||
5094 | + "SystemArticleHistoryResponse": { | ||
5095 | + "type": "object", | ||
5096 | + "properties": { | ||
5097 | + "id": { | ||
5098 | + "type": "integer", | ||
5099 | + "format": "int64", | ||
5100 | + "description": "id" | ||
5101 | + }, | ||
5102 | + "author": { | ||
5103 | + "type": "string", | ||
5104 | + "description": "编辑人" | ||
5105 | + }, | ||
5106 | + "action": { | ||
5107 | + "type": "string", | ||
5108 | + "description": "编辑类型" | ||
5109 | + }, | ||
5110 | + "updatedAt": { | ||
5111 | + "type": "string", | ||
5112 | + "description": "编辑时间" | ||
5113 | + } | ||
5114 | + }, | ||
5115 | + "title": "SystemArticleHistoryResponse", | ||
5116 | + "required": [ | ||
5117 | + "id", | ||
5118 | + "author", | ||
5119 | + "action", | ||
5120 | + "updatedAt" | ||
5121 | + ] | ||
5122 | + }, | ||
5025 | "SystemArticleSearch": { | 5123 | "SystemArticleSearch": { |
5026 | "type": "object", | 5124 | "type": "object", |
5027 | "properties": { | 5125 | "properties": { |
@@ -5149,23 +5247,37 @@ | @@ -5149,23 +5247,37 @@ | ||
5149 | "SystemArticleSearchRequest": { | 5247 | "SystemArticleSearchRequest": { |
5150 | "type": "object", | 5248 | "type": "object", |
5151 | "properties": { | 5249 | "properties": { |
5152 | - "": { | 5250 | + "companyId": { |
5153 | "type": "integer", | 5251 | "type": "integer", |
5154 | "format": "int64" | 5252 | "format": "int64" |
5155 | }, | 5253 | }, |
5156 | - "page": { | 5254 | + "title": { |
5255 | + "type": "string", | ||
5256 | + "description": "标题" | ||
5257 | + }, | ||
5258 | + "author": { | ||
5259 | + "type": "string", | ||
5260 | + "description": "发布人" | ||
5261 | + }, | ||
5262 | + "publishDate": { | ||
5263 | + "type": "string", | ||
5264 | + "description": "发布日期" | ||
5265 | + }, | ||
5266 | + "pageNumber": { | ||
5157 | "type": "integer", | 5267 | "type": "integer", |
5158 | - "format": "int32" | 5268 | + "format": "int32", |
5269 | + "description": "页码" | ||
5159 | }, | 5270 | }, |
5160 | - "size": { | 5271 | + "pageSize": { |
5161 | "type": "integer", | 5272 | "type": "integer", |
5162 | - "format": "int32" | 5273 | + "format": "int32", |
5274 | + "description": "每页行数" | ||
5163 | } | 5275 | } |
5164 | }, | 5276 | }, |
5165 | "title": "SystemArticleSearchRequest", | 5277 | "title": "SystemArticleSearchRequest", |
5166 | "required": [ | 5278 | "required": [ |
5167 | - "page", | ||
5168 | - "size" | 5279 | + "pageNumber", |
5280 | + "pageSize" | ||
5169 | ] | 5281 | ] |
5170 | }, | 5282 | }, |
5171 | "SystemArticleSearchResponse": { | 5283 | "SystemArticleSearchResponse": { |
@@ -5188,6 +5300,149 @@ | @@ -5188,6 +5300,149 @@ | ||
5188 | "list" | 5300 | "list" |
5189 | ] | 5301 | ] |
5190 | }, | 5302 | }, |
5303 | + "SystemArticleUpdateRequest": { | ||
5304 | + "type": "object", | ||
5305 | + "properties": { | ||
5306 | + "id": { | ||
5307 | + "type": "integer", | ||
5308 | + "format": "int64" | ||
5309 | + }, | ||
5310 | + "companyId": { | ||
5311 | + "type": "integer", | ||
5312 | + "format": "int64" | ||
5313 | + }, | ||
5314 | + "template": { | ||
5315 | + "type": "integer", | ||
5316 | + "format": "int32", | ||
5317 | + "description": " 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式" | ||
5318 | + }, | ||
5319 | + "section": { | ||
5320 | + "type": "array", | ||
5321 | + "items": { | ||
5322 | + "$ref": "#/definitions/ArticleSection" | ||
5323 | + }, | ||
5324 | + "description": " 填写的内容" | ||
5325 | + }, | ||
5326 | + "title": { | ||
5327 | + "type": "string", | ||
5328 | + "description": " 标题" | ||
5329 | + }, | ||
5330 | + "images": { | ||
5331 | + "type": "array", | ||
5332 | + "items": { | ||
5333 | + "type": "string" | ||
5334 | + }, | ||
5335 | + "description": " 图片" | ||
5336 | + }, | ||
5337 | + "whoRead": { | ||
5338 | + "type": "array", | ||
5339 | + "items": { | ||
5340 | + "type": "integer", | ||
5341 | + "format": "int64" | ||
5342 | + }, | ||
5343 | + "description": " 谁可以看" | ||
5344 | + }, | ||
5345 | + "whoReview": { | ||
5346 | + "type": "array", | ||
5347 | + "items": { | ||
5348 | + "type": "integer", | ||
5349 | + "format": "int64" | ||
5350 | + }, | ||
5351 | + "description": " 评论人" | ||
5352 | + }, | ||
5353 | + "location": { | ||
5354 | + "$ref": "#/definitions/Location", | ||
5355 | + "description": " 坐标" | ||
5356 | + }, | ||
5357 | + "targetUser": { | ||
5358 | + "type": "integer", | ||
5359 | + "format": "int32", | ||
5360 | + "description": "分发方式 [0分发给所有人、1分发给指定的人]" | ||
5361 | + } | ||
5362 | + }, | ||
5363 | + "title": "SystemArticleUpdateRequest", | ||
5364 | + "required": [ | ||
5365 | + "id", | ||
5366 | + "template", | ||
5367 | + "section", | ||
5368 | + "title", | ||
5369 | + "images", | ||
5370 | + "whoRead", | ||
5371 | + "whoReview", | ||
5372 | + "location", | ||
5373 | + "targetUser" | ||
5374 | + ] | ||
5375 | + }, | ||
5376 | + "SystemArticleUpdateResponse": { | ||
5377 | + "type": "object", | ||
5378 | + "properties": { | ||
5379 | + "id": { | ||
5380 | + "type": "integer", | ||
5381 | + "format": "int64", | ||
5382 | + "description": "id" | ||
5383 | + }, | ||
5384 | + "title": { | ||
5385 | + "type": "string", | ||
5386 | + "description": "标题" | ||
5387 | + }, | ||
5388 | + "author": { | ||
5389 | + "type": "string", | ||
5390 | + "description": "发布人" | ||
5391 | + }, | ||
5392 | + "images": { | ||
5393 | + "type": "array", | ||
5394 | + "items": { | ||
5395 | + "type": "string" | ||
5396 | + }, | ||
5397 | + "description": "图片" | ||
5398 | + }, | ||
5399 | + "createdAt": { | ||
5400 | + "type": "integer", | ||
5401 | + "format": "int64", | ||
5402 | + "description": "文章的创建日期" | ||
5403 | + }, | ||
5404 | + "countLove": { | ||
5405 | + "type": "integer", | ||
5406 | + "format": "int32", | ||
5407 | + "description": "点赞数量" | ||
5408 | + }, | ||
5409 | + "CountComment": { | ||
5410 | + "type": "integer", | ||
5411 | + "format": "int32", | ||
5412 | + "description": "评论数量" | ||
5413 | + }, | ||
5414 | + "show": { | ||
5415 | + "type": "integer", | ||
5416 | + "format": "int32", | ||
5417 | + "description": "是否隐藏 [0显示、1不显示]" | ||
5418 | + }, | ||
5419 | + "tags": { | ||
5420 | + "type": "array", | ||
5421 | + "items": { | ||
5422 | + "type": "string" | ||
5423 | + }, | ||
5424 | + "description": "标签" | ||
5425 | + }, | ||
5426 | + "targetUser": { | ||
5427 | + "type": "integer", | ||
5428 | + "format": "int32", | ||
5429 | + "description": "分发方式 [0分发给所有人、1分发给指定的人]" | ||
5430 | + } | ||
5431 | + }, | ||
5432 | + "title": "SystemArticleUpdateResponse", | ||
5433 | + "required": [ | ||
5434 | + "id", | ||
5435 | + "title", | ||
5436 | + "author", | ||
5437 | + "images", | ||
5438 | + "createdAt", | ||
5439 | + "countLove", | ||
5440 | + "CountComment", | ||
5441 | + "show", | ||
5442 | + "tags", | ||
5443 | + "targetUser" | ||
5444 | + ] | ||
5445 | + }, | ||
5191 | "SystemUser": { | 5446 | "SystemUser": { |
5192 | "type": "object", | 5447 | "type": "object", |
5193 | "properties": { | 5448 | "properties": { |
@@ -5608,7 +5863,7 @@ | @@ -5608,7 +5863,7 @@ | ||
5608 | "TagCreateRequest": { | 5863 | "TagCreateRequest": { |
5609 | "type": "object", | 5864 | "type": "object", |
5610 | "properties": { | 5865 | "properties": { |
5611 | - "companyId": { | 5866 | + "": { |
5612 | "type": "integer", | 5867 | "type": "integer", |
5613 | "format": "int64" | 5868 | "format": "int64" |
5614 | }, | 5869 | }, |
@@ -5619,21 +5874,24 @@ | @@ -5619,21 +5874,24 @@ | ||
5619 | "type": "string", | 5874 | "type": "string", |
5620 | "description": " 标签名称" | 5875 | "description": " 标签名称" |
5621 | }, | 5876 | }, |
5622 | - "group": { | 5877 | + "category": { |
5623 | "type": "string", | 5878 | "type": "string", |
5624 | "description": " 标签分类" | 5879 | "description": " 标签分类" |
5625 | }, | 5880 | }, |
5626 | "remark": { | 5881 | "remark": { |
5627 | "type": "string", | 5882 | "type": "string", |
5628 | "description": " 备注" | 5883 | "description": " 备注" |
5884 | + }, | ||
5885 | + "other": { | ||
5886 | + "type": "string" | ||
5629 | } | 5887 | } |
5630 | }, | 5888 | }, |
5631 | "title": "TagCreateRequest", | 5889 | "title": "TagCreateRequest", |
5632 | "required": [ | 5890 | "required": [ |
5633 | - "companyId", | ||
5634 | "image", | 5891 | "image", |
5635 | "name", | 5892 | "name", |
5636 | - "group" | 5893 | + "category", |
5894 | + "other" | ||
5637 | ] | 5895 | ] |
5638 | }, | 5896 | }, |
5639 | "TagCreateResponse": { | 5897 | "TagCreateResponse": { |
@@ -5656,15 +5914,14 @@ | @@ -5656,15 +5914,14 @@ | ||
5656 | "type": "integer", | 5914 | "type": "integer", |
5657 | "format": "int64" | 5915 | "format": "int64" |
5658 | }, | 5916 | }, |
5659 | - "companyId": { | 5917 | + "": { |
5660 | "type": "integer", | 5918 | "type": "integer", |
5661 | "format": "int64" | 5919 | "format": "int64" |
5662 | } | 5920 | } |
5663 | }, | 5921 | }, |
5664 | "title": "TagDeleteRequest", | 5922 | "title": "TagDeleteRequest", |
5665 | "required": [ | 5923 | "required": [ |
5666 | - "id", | ||
5667 | - "-" | 5924 | + "id" |
5668 | ] | 5925 | ] |
5669 | }, | 5926 | }, |
5670 | "TagDeleteResponse": { | 5927 | "TagDeleteResponse": { |
@@ -5687,7 +5944,7 @@ | @@ -5687,7 +5944,7 @@ | ||
5687 | "type": "integer", | 5944 | "type": "integer", |
5688 | "format": "int64" | 5945 | "format": "int64" |
5689 | }, | 5946 | }, |
5690 | - "companyId": { | 5947 | + "": { |
5691 | "type": "integer", | 5948 | "type": "integer", |
5692 | "format": "int64" | 5949 | "format": "int64" |
5693 | }, | 5950 | }, |
@@ -5698,22 +5955,25 @@ | @@ -5698,22 +5955,25 @@ | ||
5698 | "type": "string", | 5955 | "type": "string", |
5699 | "description": " 标签名称" | 5956 | "description": " 标签名称" |
5700 | }, | 5957 | }, |
5701 | - "group": { | 5958 | + "category": { |
5702 | "type": "string", | 5959 | "type": "string", |
5703 | "description": " 标签分类" | 5960 | "description": " 标签分类" |
5704 | }, | 5961 | }, |
5705 | "remark": { | 5962 | "remark": { |
5706 | "type": "string", | 5963 | "type": "string", |
5707 | "description": " 备注" | 5964 | "description": " 备注" |
5965 | + }, | ||
5966 | + "other": { | ||
5967 | + "type": "string" | ||
5708 | } | 5968 | } |
5709 | }, | 5969 | }, |
5710 | "title": "TagEditRequest", | 5970 | "title": "TagEditRequest", |
5711 | "required": [ | 5971 | "required": [ |
5712 | "id", | 5972 | "id", |
5713 | - "-", | ||
5714 | "image", | 5973 | "image", |
5715 | "name", | 5974 | "name", |
5716 | - "group" | 5975 | + "category", |
5976 | + "other" | ||
5717 | ] | 5977 | ] |
5718 | }, | 5978 | }, |
5719 | "TagEditResponse": { | 5979 | "TagEditResponse": { |
@@ -5736,15 +5996,14 @@ | @@ -5736,15 +5996,14 @@ | ||
5736 | "type": "integer", | 5996 | "type": "integer", |
5737 | "format": "int64" | 5997 | "format": "int64" |
5738 | }, | 5998 | }, |
5739 | - "companyId": { | 5999 | + "": { |
5740 | "type": "integer", | 6000 | "type": "integer", |
5741 | "format": "int64" | 6001 | "format": "int64" |
5742 | } | 6002 | } |
5743 | }, | 6003 | }, |
5744 | "title": "TagGetRequest", | 6004 | "title": "TagGetRequest", |
5745 | "required": [ | 6005 | "required": [ |
5746 | - "id", | ||
5747 | - "-" | 6006 | + "id" |
5748 | ] | 6007 | ] |
5749 | }, | 6008 | }, |
5750 | "TagGetResponse": { | 6009 | "TagGetResponse": { |
@@ -5761,13 +6020,16 @@ | @@ -5761,13 +6020,16 @@ | ||
5761 | "type": "string", | 6020 | "type": "string", |
5762 | "description": " 标签名称" | 6021 | "description": " 标签名称" |
5763 | }, | 6022 | }, |
5764 | - "group": { | 6023 | + "category": { |
5765 | "type": "string", | 6024 | "type": "string", |
5766 | "description": " 标签分类" | 6025 | "description": " 标签分类" |
5767 | }, | 6026 | }, |
5768 | "remark": { | 6027 | "remark": { |
5769 | "type": "string", | 6028 | "type": "string", |
5770 | "description": " 备注" | 6029 | "description": " 备注" |
6030 | + }, | ||
6031 | + "other": { | ||
6032 | + "type": "string" | ||
5771 | } | 6033 | } |
5772 | }, | 6034 | }, |
5773 | "title": "TagGetResponse", | 6035 | "title": "TagGetResponse", |
@@ -5775,8 +6037,9 @@ | @@ -5775,8 +6037,9 @@ | ||
5775 | "id", | 6037 | "id", |
5776 | "image", | 6038 | "image", |
5777 | "name", | 6039 | "name", |
5778 | - "group", | ||
5779 | - "remark" | 6040 | + "category", |
6041 | + "remark", | ||
6042 | + "other" | ||
5780 | ] | 6043 | ] |
5781 | }, | 6044 | }, |
5782 | "TagItem": { | 6045 | "TagItem": { |
@@ -5793,7 +6056,7 @@ | @@ -5793,7 +6056,7 @@ | ||
5793 | "type": "string", | 6056 | "type": "string", |
5794 | "description": " 标签名称" | 6057 | "description": " 标签名称" |
5795 | }, | 6058 | }, |
5796 | - "group": { | 6059 | + "category": { |
5797 | "type": "string", | 6060 | "type": "string", |
5798 | "description": " 标签分类" | 6061 | "description": " 标签分类" |
5799 | }, | 6062 | }, |
@@ -5811,7 +6074,7 @@ | @@ -5811,7 +6074,7 @@ | ||
5811 | "id", | 6074 | "id", |
5812 | "image", | 6075 | "image", |
5813 | "name", | 6076 | "name", |
5814 | - "group", | 6077 | + "category", |
5815 | "remark", | 6078 | "remark", |
5816 | "createdAt" | 6079 | "createdAt" |
5817 | ] | 6080 | ] |
@@ -5827,14 +6090,14 @@ | @@ -5827,14 +6090,14 @@ | ||
5827 | "type": "integer", | 6090 | "type": "integer", |
5828 | "format": "int32" | 6091 | "format": "int32" |
5829 | }, | 6092 | }, |
5830 | - "companyId": { | 6093 | + "": { |
5831 | "type": "integer", | 6094 | "type": "integer", |
5832 | "format": "int64" | 6095 | "format": "int64" |
5833 | }, | 6096 | }, |
5834 | "tagName": { | 6097 | "tagName": { |
5835 | "type": "string" | 6098 | "type": "string" |
5836 | }, | 6099 | }, |
5837 | - "group": { | 6100 | + "category": { |
5838 | "type": "string" | 6101 | "type": "string" |
5839 | }, | 6102 | }, |
5840 | "remark": { | 6103 | "remark": { |
@@ -5844,8 +6107,7 @@ | @@ -5844,8 +6107,7 @@ | ||
5844 | "title": "TagListRequest", | 6107 | "title": "TagListRequest", |
5845 | "required": [ | 6108 | "required": [ |
5846 | "page", | 6109 | "page", |
5847 | - "size", | ||
5848 | - "-" | 6110 | + "size" |
5849 | ] | 6111 | ] |
5850 | }, | 6112 | }, |
5851 | "TagListResponse": { | 6113 | "TagListResponse": { |
@@ -6054,8 +6316,7 @@ | @@ -6054,8 +6316,7 @@ | ||
6054 | "format": "int32" | 6316 | "format": "int32" |
6055 | }, | 6317 | }, |
6056 | "name": { | 6318 | "name": { |
6057 | - "type": "integer", | ||
6058 | - "format": "int32" | 6319 | + "type": "string" |
6059 | } | 6320 | } |
6060 | }, | 6321 | }, |
6061 | "title": "UserShowName", | 6322 | "title": "UserShowName", |
@@ -6126,6 +6387,10 @@ | @@ -6126,6 +6387,10 @@ | ||
6126 | "type": "string", | 6387 | "type": "string", |
6127 | "description": " 人员头像" | 6388 | "description": " 人员头像" |
6128 | }, | 6389 | }, |
6390 | + "position": { | ||
6391 | + "type": "string", | ||
6392 | + "description": " 职位" | ||
6393 | + }, | ||
6129 | "createdAt": { | 6394 | "createdAt": { |
6130 | "type": "integer", | 6395 | "type": "integer", |
6131 | "format": "int64", | 6396 | "format": "int64", |
@@ -6138,6 +6403,7 @@ | @@ -6138,6 +6403,7 @@ | ||
6138 | "userId", | 6403 | "userId", |
6139 | "name", | 6404 | "name", |
6140 | "avatar", | 6405 | "avatar", |
6406 | + "position", | ||
6141 | "createdAt" | 6407 | "createdAt" |
6142 | ] | 6408 | ] |
6143 | } | 6409 | } |
@@ -89,7 +89,16 @@ service Core { | @@ -89,7 +89,16 @@ service Core { | ||
89 | @handler SystemSearchArticle | 89 | @handler SystemSearchArticle |
90 | post /article/search (SystemArticleSearchRequest) returns (SystemArticleSearchResponse) | 90 | post /article/search (SystemArticleSearchRequest) returns (SystemArticleSearchResponse) |
91 | 91 | ||
92 | + @doc "管理后台编辑帖子" | ||
93 | + @handler SystemUpdateArticle | ||
94 | + put /article (SystemArticleUpdateRequest) returns (SystemArticleUpdateResponse) | ||
95 | + | ||
96 | + @doc "管理后台编辑历史" | ||
97 | + @handler SystemHistoryArticle | ||
98 | + post /article/history (SystemArticleHistoryRequest) returns (SystemArticleHistoryResponse) | ||
99 | + | ||
92 | @doc "管理后台获取我发布的文章" | 100 | @doc "管理后台获取我发布的文章" |
93 | @handler SystemArticleSearchMe | 101 | @handler SystemArticleSearchMe |
94 | post /article/search/me (SystemArticleSearchMeRequest) returns (SystemArticleSearchMeResponse) | 102 | post /article/search/me (SystemArticleSearchMeRequest) returns (SystemArticleSearchMeResponse) |
103 | + | ||
95 | } | 104 | } |
@@ -337,7 +337,7 @@ type ( | @@ -337,7 +337,7 @@ type ( | ||
337 | 337 | ||
338 | UserShowName { | 338 | UserShowName { |
339 | Id int `json:"id"` | 339 | Id int `json:"id"` |
340 | - Name int `json:"name"` | 340 | + Name string `json:"name"` |
341 | } | 341 | } |
342 | 342 | ||
343 | SystemArticleGetResponse { | 343 | SystemArticleGetResponse { |
@@ -363,9 +363,12 @@ type ( | @@ -363,9 +363,12 @@ type ( | ||
363 | //管理后台获取文章列表 | 363 | //管理后台获取文章列表 |
364 | type ( | 364 | type ( |
365 | SystemArticleSearchRequest { | 365 | SystemArticleSearchRequest { |
366 | - CompanyId int64 `json:",optional"` | ||
367 | - Page int `json:"page"` | ||
368 | - Size int `json:"size"` | 366 | + CompanyId int64 `json:"companyId,optional"` |
367 | + Title string `json:"title,optional"` //标题 | ||
368 | + Author string `json:"author,optional"` //发布人 | ||
369 | + PublishDate string `json:"publishDate,optional"` //发布日期 | ||
370 | + PageNumber int `json:"pageNumber"` //页码 | ||
371 | + PageSize int `json:"pageSize"` //每页行数 | ||
369 | } | 372 | } |
370 | 373 | ||
371 | SystemArticleSearchResponse { | 374 | SystemArticleSearchResponse { |
@@ -384,4 +387,41 @@ type ( | @@ -384,4 +387,41 @@ type ( | ||
384 | Tags []string `json:"tags"` //标签 | 387 | Tags []string `json:"tags"` //标签 |
385 | TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] | 388 | TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] |
386 | } | 389 | } |
390 | + //编辑 | ||
391 | + SystemArticleUpdateRequest { | ||
392 | + Id int64 `json:"id"` | ||
393 | + CompanyId int64 `json:"companyId,optional"` | ||
394 | + Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式 | ||
395 | + Section []ArticleSection `json:"section"` // 填写的内容 | ||
396 | + Title string `json:"title"` // 标题 | ||
397 | + Images []string `json:"images"` // 图片 | ||
398 | + WhoRead []int64 `json:"whoRead"` // 谁可以看 | ||
399 | + WhoReview []int64 `json:"whoReview"` // 评论人 | ||
400 | + Location Location `json:"location"` // 坐标 | ||
401 | + TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] | ||
402 | + } | ||
403 | + SystemArticleUpdateResponse { | ||
404 | + Id int64 `json:"id"` //id | ||
405 | + Title string `json:"title"` //标题 | ||
406 | + Author string `json:"author"` //发布人 | ||
407 | + Images []string `json:"images"` //图片 | ||
408 | + CreatedAt int64 `json:"createdAt"` //文章的创建日期 | ||
409 | + CountLove int `json:"countLove"` //点赞数量 | ||
410 | + CountComment int `json:"CountComment"` //评论数量 | ||
411 | + Show int `json:"show"` //是否隐藏 [0显示、1不显示] | ||
412 | + Tags []string `json:"tags"` //标签 | ||
413 | + TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] | ||
414 | + } | ||
415 | + //历史 | ||
416 | + SystemArticleHistoryRequest { | ||
417 | + ArticleId int64 `json:"articleId"` //文章ID | ||
418 | + Author string `json:"author,optional"` //发布人 | ||
419 | + UpdatedAt string `json:"updatedAt,optional"` //修改日期 | ||
420 | + } | ||
421 | + SystemArticleHistoryResponse { | ||
422 | + Id int64 `json:"id"` //id | ||
423 | + Author string `json:"author"` //编辑人 | ||
424 | + Action string `json:"action"` //编辑类型 | ||
425 | + UpdatedAt string `json:"updatedAt"` //编辑时间 | ||
426 | + } | ||
387 | ) | 427 | ) |
@@ -44,18 +44,18 @@ service Core { | @@ -44,18 +44,18 @@ service Core { | ||
44 | } | 44 | } |
45 | 45 | ||
46 | type ( | 46 | type ( |
47 | - CompanySearchRequest struct{ | 47 | + CompanySearchRequest { |
48 | Page int `json:"page,optional"` | 48 | Page int `json:"page,optional"` |
49 | Size int `json:"size,optional"` | 49 | Size int `json:"size,optional"` |
50 | Flag int `json:"flag,optional"` // 1:用户已加入的 2:用户未加入的公司 | 50 | Flag int `json:"flag,optional"` // 1:用户已加入的 2:用户未加入的公司 |
51 | UserId int64 `json:"userId,optional"` // 按用户搜索(用户所加入的企业) | 51 | UserId int64 `json:"userId,optional"` // 按用户搜索(用户所加入的企业) |
52 | Code string `json:"code,optional"` // 按编码搜索 | 52 | Code string `json:"code,optional"` // 按编码搜索 |
53 | } | 53 | } |
54 | - CompanySearchResponse{ | 54 | + CompanySearchResponse { |
55 | List []Company `json:"list"` | 55 | List []Company `json:"list"` |
56 | Total int64 `json:"total"` | 56 | Total int64 `json:"total"` |
57 | } | 57 | } |
58 | - Company struct{ | 58 | + Company { |
59 | Id int64 `json:"id,omitempty"` // 唯一标识 | 59 | Id int64 `json:"id,omitempty"` // 唯一标识 |
60 | Name string `json:"name,omitempty"` // 名称 | 60 | Name string `json:"name,omitempty"` // 名称 |
61 | Code string `json:"code,omitempty"` // 编码(搜索使用,4位字母数字) | 61 | Code string `json:"code,omitempty"` // 编码(搜索使用,4位字母数字) |
@@ -36,37 +36,37 @@ type ( | @@ -36,37 +36,37 @@ type ( | ||
36 | RoleGetRequest { | 36 | RoleGetRequest { |
37 | Id int64 `path:"id"` | 37 | Id int64 `path:"id"` |
38 | } | 38 | } |
39 | - RoleGetResponse struct{ | 39 | + RoleGetResponse { |
40 | Role RoleItem `json:"role"` | 40 | Role RoleItem `json:"role"` |
41 | AuthList []Auth `json:"authList"` | 41 | AuthList []Auth `json:"authList"` |
42 | } | 42 | } |
43 | 43 | ||
44 | - RoleSaveRequest struct{ | 44 | + RoleSaveRequest { |
45 | Role RoleItem `json:"role"` | 45 | Role RoleItem `json:"role"` |
46 | } | 46 | } |
47 | RoleSaveResponse struct{} | 47 | RoleSaveResponse struct{} |
48 | 48 | ||
49 | - RoleDeleteRequest struct{ | 49 | + RoleDeleteRequest { |
50 | Id int64 `path:"id"` | 50 | Id int64 `path:"id"` |
51 | } | 51 | } |
52 | RoleDeleteResponse struct{} | 52 | RoleDeleteResponse struct{} |
53 | 53 | ||
54 | - RoleUpdateRequest struct{ | 54 | + RoleUpdateRequest { |
55 | Id int64 `path:"id"` | 55 | Id int64 `path:"id"` |
56 | Role RoleItem `json:"role"` | 56 | Role RoleItem `json:"role"` |
57 | } | 57 | } |
58 | RoleUpdateResponse struct{} | 58 | RoleUpdateResponse struct{} |
59 | 59 | ||
60 | - RoleSearchRequest struct{ | 60 | + RoleSearchRequest { |
61 | Page int `json:"page,optional"` | 61 | Page int `json:"page,optional"` |
62 | Size int `json:"size,optional"` | 62 | Size int `json:"size,optional"` |
63 | Style string `json:"style,options=[simple,,full]"` // simple:只返回角色ID名称 full:所有字段都返回 | 63 | Style string `json:"style,options=[simple,,full]"` // simple:只返回角色ID名称 full:所有字段都返回 |
64 | } | 64 | } |
65 | - RoleSearchResponse{ | 65 | + RoleSearchResponse { |
66 | List []RoleItem `json:"list"` | 66 | List []RoleItem `json:"list"` |
67 | Total int64 `json:"total"` | 67 | Total int64 `json:"total"` |
68 | } | 68 | } |
69 | - RoleItem struct{ | 69 | + RoleItem { |
70 | Id int64 `json:"id,optional"` // 角色ID | 70 | Id int64 `json:"id,optional"` // 角色ID |
71 | CompanyId int64 `json:"companyId,optional,omitempty"` // 公司ID | 71 | CompanyId int64 `json:"companyId,optional,omitempty"` // 公司ID |
72 | Name string `json:"name"` // 角色名称 | 72 | Name string `json:"name"` // 角色名称 |
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 SystemHistoryArticleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
13 | + return func(w http.ResponseWriter, r *http.Request) { | ||
14 | + var req types.SystemArticleHistoryRequest | ||
15 | + if err := httpx.Parse(r, &req); err != nil { | ||
16 | + httpx.ErrorCtx(r.Context(), w, err) | ||
17 | + return | ||
18 | + } | ||
19 | + | ||
20 | + l := article.NewSystemHistoryArticleLogic(r.Context(), svcCtx) | ||
21 | + resp, err := l.SystemHistoryArticle(&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 | +) | ||
11 | + | ||
12 | +func SystemUpdateArticleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
13 | + return func(w http.ResponseWriter, r *http.Request) { | ||
14 | + var req types.SystemArticleUpdateRequest | ||
15 | + if err := httpx.Parse(r, &req); err != nil { | ||
16 | + httpx.ErrorCtx(r.Context(), w, err) | ||
17 | + return | ||
18 | + } | ||
19 | + | ||
20 | + l := article.NewSystemUpdateArticleLogic(r.Context(), svcCtx) | ||
21 | + resp, err := l.SystemUpdateArticle(&req) | ||
22 | + if err != nil { | ||
23 | + httpx.ErrorCtx(r.Context(), w, err) | ||
24 | + } else { | ||
25 | + httpx.OkJsonCtx(r.Context(), w, resp) | ||
26 | + } | ||
27 | + } | ||
28 | +} |
@@ -382,6 +382,16 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | @@ -382,6 +382,16 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | ||
382 | Handler: article.SystemSearchArticleHandler(serverCtx), | 382 | Handler: article.SystemSearchArticleHandler(serverCtx), |
383 | }, | 383 | }, |
384 | { | 384 | { |
385 | + Method: http.MethodPut, | ||
386 | + Path: "/article", | ||
387 | + Handler: article.SystemUpdateArticleHandler(serverCtx), | ||
388 | + }, | ||
389 | + { | ||
390 | + Method: http.MethodPost, | ||
391 | + Path: "/article/history", | ||
392 | + Handler: article.SystemHistoryArticleHandler(serverCtx), | ||
393 | + }, | ||
394 | + { | ||
385 | Method: http.MethodPost, | 395 | Method: http.MethodPost, |
386 | Path: "/article/search/me", | 396 | Path: "/article/search/me", |
387 | Handler: article.SystemArticleSearchMeHandler(serverCtx), | 397 | Handler: article.SystemArticleSearchMeHandler(serverCtx), |
@@ -2,6 +2,9 @@ package article | @@ -2,6 +2,9 @@ package article | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "context" | 4 | "context" |
5 | + "github.com/samber/lo" | ||
6 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | ||
7 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" | ||
5 | 8 | ||
6 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | 9 | "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" | 10 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" |
@@ -24,7 +27,79 @@ func NewSystemGetArticleLogic(ctx context.Context, svcCtx *svc.ServiceContext) * | @@ -24,7 +27,79 @@ func NewSystemGetArticleLogic(ctx context.Context, svcCtx *svc.ServiceContext) * | ||
24 | } | 27 | } |
25 | 28 | ||
26 | func (l *SystemGetArticleLogic) SystemGetArticle(req *types.SystemArticleGetRequest) (resp *types.SystemArticleGetResponse, err error) { | 29 | func (l *SystemGetArticleLogic) SystemGetArticle(req *types.SystemArticleGetRequest) (resp *types.SystemArticleGetResponse, err error) { |
27 | - // todo: add your logic here and delete this line | ||
28 | - | ||
29 | - return | 30 | + var conn = l.svcCtx.DefaultDBConn() |
31 | + article, err := l.svcCtx.ArticleRepository.FindOne(l.ctx, conn, req.Id) | ||
32 | + if err != nil { | ||
33 | + return nil, xerr.NewErrMsgErr("获取帖子异常", err) | ||
34 | + } | ||
35 | + images := make([]string, 0) | ||
36 | + lo.ForEach(article.Images, func(img domain.Image, n int) { | ||
37 | + images = append(images, img.Url) | ||
38 | + }) | ||
39 | + resp = &types.SystemArticleGetResponse{ | ||
40 | + Id: article.Id, | ||
41 | + Title: article.Title, | ||
42 | + AuthorId: article.AuthorId, | ||
43 | + Author: types.ArticleAuthor{ | ||
44 | + Id: article.Author.Id, | ||
45 | + Name: article.Author.Name, | ||
46 | + Avatar: article.Author.Avatar, | ||
47 | + Position: article.Author.Position, | ||
48 | + Company: article.Author.Company, | ||
49 | + }, | ||
50 | + CreatedAt: article.CreatedAt, | ||
51 | + Section: make([]types.ArticleSection, 0), | ||
52 | + Images: images, | ||
53 | + WhoRead: article.WhoRead, | ||
54 | + WhoReadInfo: make([]types.UserShowName, 0), | ||
55 | + WhoReview: article.WhoReview, | ||
56 | + WhoReviewInfo: make([]types.UserShowName, 0), | ||
57 | + Location: types.Location{ | ||
58 | + Longitude: article.Location.Longitude, | ||
59 | + Latitude: article.Location.Latitude, | ||
60 | + Descript: article.Location.Descript, | ||
61 | + }, | ||
62 | + CountLove: article.CountLove, | ||
63 | + CountComment: article.CountComment, | ||
64 | + CountRead: article.CountRead, | ||
65 | + Show: int(article.Show), | ||
66 | + } | ||
67 | + //文章段落 | ||
68 | + _, articleSections, err := l.svcCtx.ArticleSectionRepository.Find(l.ctx, conn, domain.NewQueryOptions().WithKV("articleId", req.Id)) | ||
69 | + if err != nil { | ||
70 | + return nil, xerr.NewErrMsgErr("获取帖子异常", err) | ||
71 | + } | ||
72 | + lo.ForEach(articleSections, func(item *domain.ArticleSection, index int) { | ||
73 | + resp.Section = append(resp.Section, types.ArticleSection{ | ||
74 | + Id: item.Id, | ||
75 | + Content: item.Content, | ||
76 | + SortBy: item.SortBy, | ||
77 | + TotalComment: item.TotalComment, | ||
78 | + }) | ||
79 | + }) | ||
80 | + userIds := lo.Union(resp.WhoRead, resp.WhoReview) | ||
81 | + if len(userIds) > 0 { | ||
82 | + _, users, err := l.svcCtx.UserRepository.Find(l.ctx, conn, domain.NewQueryOptions().WithKV("ids", userIds)) | ||
83 | + if err != nil { | ||
84 | + return nil, xerr.NewErrMsgErr("获取帖子异常", err) | ||
85 | + } | ||
86 | + userSlices := make(map[int64]types.UserShowName) | ||
87 | + lo.ForEach(users, func(user *domain.User, index int) { | ||
88 | + userSlices[user.Id] = types.UserShowName{ | ||
89 | + Id: int(user.Id), | ||
90 | + Name: user.Name, | ||
91 | + } | ||
92 | + }) | ||
93 | + lo.ForEach(resp.WhoRead, func(userId int64, index int) { | ||
94 | + if value, ok := userSlices[userId]; ok { | ||
95 | + resp.WhoReadInfo = append(resp.WhoReadInfo, value) | ||
96 | + } | ||
97 | + }) | ||
98 | + lo.ForEach(resp.WhoReview, func(userId int64, index int) { | ||
99 | + if value, ok := userSlices[userId]; ok { | ||
100 | + resp.WhoReviewInfo = append(resp.WhoReviewInfo, value) | ||
101 | + } | ||
102 | + }) | ||
103 | + } | ||
104 | + return resp, nil | ||
30 | } | 105 | } |
1 | +package article | ||
2 | + | ||
3 | +import ( | ||
4 | + "context" | ||
5 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | ||
6 | + | ||
7 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | ||
8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | ||
9 | + | ||
10 | + "github.com/zeromicro/go-zero/core/logx" | ||
11 | +) | ||
12 | + | ||
13 | +type SystemHistoryArticleLogic struct { | ||
14 | + logx.Logger | ||
15 | + ctx context.Context | ||
16 | + svcCtx *svc.ServiceContext | ||
17 | +} | ||
18 | + | ||
19 | +func NewSystemHistoryArticleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemHistoryArticleLogic { | ||
20 | + return &SystemHistoryArticleLogic{ | ||
21 | + Logger: logx.WithContext(ctx), | ||
22 | + ctx: ctx, | ||
23 | + svcCtx: svcCtx, | ||
24 | + } | ||
25 | +} | ||
26 | + | ||
27 | +func (l *SystemHistoryArticleLogic) SystemHistoryArticle(req *types.SystemArticleHistoryRequest) (resp *types.SystemArticleHistoryResponse, err error) { | ||
28 | + var conn = l.svcCtx.DefaultDBConn() | ||
29 | + l.svcCtx.ArticleBackupRepository.Find( | ||
30 | + l.ctx, | ||
31 | + conn, | ||
32 | + domain.NewQueryOptions(). | ||
33 | + WithKV("articleId", req.ArticleId). | ||
34 | + WithKV("author", req.Author). | ||
35 | + WithKV("updatedAt", req.UpdatedAt), | ||
36 | + ) | ||
37 | + return | ||
38 | +} |
@@ -2,6 +2,11 @@ package article | @@ -2,6 +2,11 @@ package article | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "context" | 4 | "context" |
5 | + "github.com/jinzhu/now" | ||
6 | + "github.com/samber/lo" | ||
7 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | ||
8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" | ||
9 | + "time" | ||
5 | 10 | ||
6 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | 11 | "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" | 12 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" |
@@ -24,7 +29,40 @@ func NewSystemSearchArticleLogic(ctx context.Context, svcCtx *svc.ServiceContext | @@ -24,7 +29,40 @@ func NewSystemSearchArticleLogic(ctx context.Context, svcCtx *svc.ServiceContext | ||
24 | } | 29 | } |
25 | 30 | ||
26 | func (l *SystemSearchArticleLogic) SystemSearchArticle(req *types.SystemArticleSearchRequest) (resp *types.SystemArticleSearchResponse, err error) { | 31 | func (l *SystemSearchArticleLogic) SystemSearchArticle(req *types.SystemArticleSearchRequest) (resp *types.SystemArticleSearchResponse, err error) { |
27 | - // todo: add your logic here and delete this line | ||
28 | - | ||
29 | - return | 32 | + var conn = l.svcCtx.DefaultDBConn() |
33 | + queryOptions := domain.NewQueryOptions().WithOffsetLimit(req.PageNumber, req.PageSize).WithKV("title", req.Title).WithKV("author", req.Author) | ||
34 | + if req.PublishDate != "" { | ||
35 | + publishTime, err := now.ParseInLocation(time.Local, req.PublishDate) | ||
36 | + if err == nil { | ||
37 | + queryOptions.WithKV("beginCreatedAt", now.With(publishTime).BeginningOfDay().Unix()) | ||
38 | + queryOptions.WithKV("endCreatedAt", now.With(publishTime).EndOfDay().Unix()) | ||
39 | + } | ||
40 | + } | ||
41 | + total, articles, err := l.svcCtx.ArticleRepository.Find(l.ctx, conn, req.CompanyId, queryOptions) | ||
42 | + if err != nil { | ||
43 | + return nil, xerr.NewErrMsgErr("搜索帖子异常", err) | ||
44 | + } | ||
45 | + resp = &types.SystemArticleSearchResponse{ | ||
46 | + Total: int(total), | ||
47 | + List: make([]types.SystemArticleSearch, 0), | ||
48 | + } | ||
49 | + lo.ForEach(articles, func(item *domain.Article, index int) { | ||
50 | + images := make([]string, 0) | ||
51 | + lo.ForEach(item.Images, func(img domain.Image, n int) { | ||
52 | + images = append(images, img.Url) | ||
53 | + }) | ||
54 | + resp.List = append(resp.List, types.SystemArticleSearch{ | ||
55 | + Id: item.Id, | ||
56 | + Title: item.Title, | ||
57 | + Author: item.Author.Name, | ||
58 | + Images: images, | ||
59 | + CreatedAt: item.CreatedAt, | ||
60 | + CountLove: item.CountLove, | ||
61 | + CountComment: item.CountComment, | ||
62 | + Show: int(item.Show), | ||
63 | + Tags: nil, | ||
64 | + TargetUser: int(item.TargetUser), | ||
65 | + }) | ||
66 | + }) | ||
67 | + return resp, nil | ||
30 | } | 68 | } |
1 | +package article | ||
2 | + | ||
3 | +import ( | ||
4 | + "context" | ||
5 | + "github.com/samber/lo" | ||
6 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction" | ||
7 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | ||
8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" | ||
9 | + | ||
10 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | ||
11 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | ||
12 | + | ||
13 | + "github.com/zeromicro/go-zero/core/logx" | ||
14 | +) | ||
15 | + | ||
16 | +type SystemUpdateArticleLogic struct { | ||
17 | + logx.Logger | ||
18 | + ctx context.Context | ||
19 | + svcCtx *svc.ServiceContext | ||
20 | +} | ||
21 | + | ||
22 | +func NewSystemUpdateArticleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemUpdateArticleLogic { | ||
23 | + return &SystemUpdateArticleLogic{ | ||
24 | + Logger: logx.WithContext(ctx), | ||
25 | + ctx: ctx, | ||
26 | + svcCtx: svcCtx, | ||
27 | + } | ||
28 | +} | ||
29 | + | ||
30 | +func (l *SystemUpdateArticleLogic) SystemUpdateArticle(req *types.SystemArticleUpdateRequest) (resp *types.SystemArticleUpdateResponse, err error) { | ||
31 | + var conn = l.svcCtx.DefaultDBConn() | ||
32 | + article, err := l.svcCtx.ArticleRepository.FindOne(l.ctx, conn, req.Id) | ||
33 | + if err != nil { | ||
34 | + return nil, xerr.NewErrMsgErr("帖子不存在", err) | ||
35 | + } | ||
36 | + //TODO 获取图片的尺寸大小 | ||
37 | + images := []domain.Image{} | ||
38 | + for _, val := range req.Images { | ||
39 | + images = append(images, domain.Image{ | ||
40 | + Url: val, | ||
41 | + Width: 0, | ||
42 | + Height: 0, | ||
43 | + }) | ||
44 | + } | ||
45 | + article.Title = req.Title | ||
46 | + article.Version = article.Version + 1 | ||
47 | + article.Images = images | ||
48 | + article.WhoRead = req.WhoRead | ||
49 | + article.WhoReview = req.WhoReview | ||
50 | + article.TargetUser = domain.ArticleTarget(req.TargetUser) | ||
51 | + article.Location = domain.Location{ | ||
52 | + Longitude: req.Location.Longitude, | ||
53 | + Latitude: req.Location.Latitude, | ||
54 | + Descript: req.Location.Descript, | ||
55 | + } | ||
56 | + //文章内容 | ||
57 | + articleSections := []domain.ArticleSection{} | ||
58 | + lo.ForEach(req.Section, func(item types.ArticleSection, index int) { | ||
59 | + articleSections = append(articleSections, domain.ArticleSection{ | ||
60 | + Id: item.Id, | ||
61 | + CompanyId: article.CompanyId, | ||
62 | + Version: article.Version, | ||
63 | + ArticleId: article.Id, | ||
64 | + Content: item.Content, | ||
65 | + SortBy: index + 1, | ||
66 | + }) | ||
67 | + }) | ||
68 | + //设置内容概要 | ||
69 | + if len(req.Section) > 0 { | ||
70 | + // 截取内容 30个字 | ||
71 | + runeNumber := 0 //字数 | ||
72 | + stringIndex := 0 //字符串长度 | ||
73 | + for i := range req.Section[0].Content { | ||
74 | + if runeNumber > 30 { | ||
75 | + break | ||
76 | + } | ||
77 | + runeNumber += 1 | ||
78 | + stringIndex = i | ||
79 | + } | ||
80 | + article.Summary = req.Section[0].Content[0:stringIndex] | ||
81 | + } | ||
82 | + err = transaction.UseTrans(l.ctx, conn.DB(), func(ctx context.Context, c transaction.Conn) error { | ||
83 | + _, err = l.svcCtx.ArticleRepository.Update(l.ctx, conn, article) | ||
84 | + if err != nil { | ||
85 | + return xerr.NewErrMsgErr("保存文章失败", err) | ||
86 | + } | ||
87 | + //文章内容 | ||
88 | + updateSectionIds := []int64{} | ||
89 | + for _, item := range articleSections { | ||
90 | + if item.Id > 0 { | ||
91 | + section, err := l.svcCtx.ArticleSectionRepository.FindOne(ctx, c, item.Id) | ||
92 | + if err != nil { | ||
93 | + return xerr.NewErrMsgErr("获取文章段落内容失败", err) | ||
94 | + } | ||
95 | + section.Content = item.Content | ||
96 | + section.ArticleId = item.ArticleId | ||
97 | + section.Version = item.Version | ||
98 | + section.SortBy = item.SortBy | ||
99 | + section.CompanyId = item.CompanyId | ||
100 | + _, err = l.svcCtx.ArticleSectionRepository.Update(ctx, c, section) | ||
101 | + if err != nil { | ||
102 | + return xerr.NewErrMsgErr("保存文章段落内容失败", err) | ||
103 | + } | ||
104 | + } else { | ||
105 | + _, err = l.svcCtx.ArticleSectionRepository.Insert(ctx, c, &item) | ||
106 | + if err != nil { | ||
107 | + return xerr.NewErrMsgErr("保存文章段落内容失败", err) | ||
108 | + } | ||
109 | + } | ||
110 | + updateSectionIds = append(updateSectionIds, item.Id) | ||
111 | + } | ||
112 | + if len(updateSectionIds) > 0 { | ||
113 | + err = l.svcCtx.ArticleSectionRepository.DeleteBy(ctx, c, domain.NewQueryOptions().WithKV("articleId", article.Id).WithKV("notIds", updateSectionIds)) | ||
114 | + if err != nil { | ||
115 | + return xerr.NewErrMsgErr("保存文章内容失败", err) | ||
116 | + } | ||
117 | + } | ||
118 | + //备份数据 | ||
119 | + backup := article.MakeBackup(article.Author, articleSections) | ||
120 | + backup.Action = "编辑" | ||
121 | + _, err = l.svcCtx.ArticleBackupRepository.Insert(ctx, c, backup) | ||
122 | + if err != nil { | ||
123 | + return xerr.NewErrMsgErr("保存文章内容失败", err) | ||
124 | + } | ||
125 | + return nil | ||
126 | + }, true) | ||
127 | + return | ||
128 | +} |
@@ -870,7 +870,7 @@ type SystemArticleGetRequest struct { | @@ -870,7 +870,7 @@ type SystemArticleGetRequest struct { | ||
870 | 870 | ||
871 | type UserShowName struct { | 871 | type UserShowName struct { |
872 | Id int `json:"id"` | 872 | Id int `json:"id"` |
873 | - Name int `json:"name"` | 873 | + Name string `json:"name"` |
874 | } | 874 | } |
875 | 875 | ||
876 | type SystemArticleGetResponse struct { | 876 | type SystemArticleGetResponse struct { |
@@ -894,8 +894,11 @@ type SystemArticleGetResponse struct { | @@ -894,8 +894,11 @@ type SystemArticleGetResponse struct { | ||
894 | 894 | ||
895 | type SystemArticleSearchRequest struct { | 895 | type SystemArticleSearchRequest struct { |
896 | CompanyId int64 `json:",optional"` | 896 | CompanyId int64 `json:",optional"` |
897 | - Page int `json:"page"` | ||
898 | - Size int `json:"size"` | 897 | + Title string `json:"title"` //标题 |
898 | + Author string `json:"author"` //发布人 | ||
899 | + PublishDate string `json:"publishDate"` //发布日期 | ||
900 | + PageNumber int `json:"pageNumber"` //页码 | ||
901 | + PageSize int `json:"pageSize"` //每页行数 | ||
899 | } | 902 | } |
900 | 903 | ||
901 | type SystemArticleSearchResponse struct { | 904 | type SystemArticleSearchResponse struct { |
@@ -916,6 +919,45 @@ type SystemArticleSearch struct { | @@ -916,6 +919,45 @@ type SystemArticleSearch struct { | ||
916 | TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] | 919 | TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] |
917 | } | 920 | } |
918 | 921 | ||
922 | +type SystemArticleUpdateRequest struct { | ||
923 | + Id int64 `json:"id"` | ||
924 | + CompanyId int64 `json:",optional"` | ||
925 | + Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式 | ||
926 | + Section []ArticleSection `json:"section"` // 填写的内容 | ||
927 | + Title string `json:"title"` // 标题 | ||
928 | + Images []string `json:"images"` // 图片 | ||
929 | + WhoRead []int64 `json:"whoRead"` // 谁可以看 | ||
930 | + WhoReview []int64 `json:"whoReview"` // 评论人 | ||
931 | + Location Location `json:"location"` // 坐标 | ||
932 | + TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] | ||
933 | +} | ||
934 | + | ||
935 | +type SystemArticleUpdateResponse struct { | ||
936 | + Id int64 `json:"id"` //id | ||
937 | + Title string `json:"title"` //标题 | ||
938 | + Author string `json:"author"` //发布人 | ||
939 | + Images []string `json:"images"` //图片 | ||
940 | + CreatedAt int64 `json:"createdAt"` //文章的创建日期 | ||
941 | + CountLove int `json:"countLove"` //点赞数量 | ||
942 | + CountComment int `json:"CountComment"` //评论数量 | ||
943 | + Show int `json:"show"` //是否隐藏 [0显示、1不显示] | ||
944 | + Tags []string `json:"tags"` //标签 | ||
945 | + TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] | ||
946 | +} | ||
947 | + | ||
948 | +type SystemArticleHistoryRequest struct { | ||
949 | + ArticleId int64 `json:"articleId"` //文章ID | ||
950 | + Author string `json:"author,optional"` //发布人 | ||
951 | + UpdatedAt string `json:"updatedAt,optional"` //修改日期 | ||
952 | +} | ||
953 | + | ||
954 | +type SystemArticleHistoryResponse struct { | ||
955 | + Id int64 `json:"id"` //id | ||
956 | + Author string `json:"author"` //编辑人 | ||
957 | + Action string `json:"action"` //编辑类型 | ||
958 | + UpdatedAt string `json:"updatedAt"` //编辑时间 | ||
959 | +} | ||
960 | + | ||
919 | type RoleGetRequest struct { | 961 | type RoleGetRequest struct { |
920 | Id int64 `path:"id"` | 962 | Id int64 `path:"id"` |
921 | } | 963 | } |
@@ -121,11 +121,13 @@ func (repository *ArticleRepository) Find(ctx context.Context, conn transaction. | @@ -121,11 +121,13 @@ func (repository *ArticleRepository) Find(ctx context.Context, conn transaction. | ||
121 | queryFunc := func() (interface{}, error) { | 121 | queryFunc := func() (interface{}, error) { |
122 | tx = tx.Model(&ms).Order("id desc").Where("company_id=?", companyId) | 122 | tx = tx.Model(&ms).Order("id desc").Where("company_id=?", companyId) |
123 | if v, ok := queryOptions["ids"]; ok { | 123 | if v, ok := queryOptions["ids"]; ok { |
124 | - tx.Where("id in (?)", v) | 124 | + tx = tx.Where("id in (?)", v) |
125 | } | 125 | } |
126 | - | ||
127 | - if v, ok := queryOptions["authorId"]; ok { | ||
128 | - tx = tx.Where("author_id = ?", v) | 126 | + if v, ok := queryOptions["title"]; ok && v.(string) != "" { |
127 | + tx = tx.Where("title like ?", "%"+v.(string)+"%") | ||
128 | + } | ||
129 | + if v, ok := queryOptions["author"]; ok { | ||
130 | + tx = tx.Where(`author #>> '{"name"}' like ?`, "%"+v.(string)+"%") | ||
129 | } | 131 | } |
130 | if v, ok := queryOptions["beginCreatedAt"]; ok { | 132 | if v, ok := queryOptions["beginCreatedAt"]; ok { |
131 | tx = tx.Where("created_at >= ?", v) | 133 | tx = tx.Where("created_at >= ?", v) |
@@ -90,6 +90,28 @@ func (repository *ArticleSectionRepository) Delete(ctx context.Context, conn tra | @@ -90,6 +90,28 @@ func (repository *ArticleSectionRepository) Delete(ctx context.Context, conn tra | ||
90 | return repository.ModelToDomainModel(m) | 90 | return repository.ModelToDomainModel(m) |
91 | } | 91 | } |
92 | 92 | ||
93 | +func (repository *ArticleSectionRepository) DeleteBy(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) error { | ||
94 | + var ( | ||
95 | + tx = conn.DB() | ||
96 | + m = &models.ArticleSection{} | ||
97 | + ) | ||
98 | + queryFunc := func() (interface{}, error) { | ||
99 | + tx = tx.Where("id = ?", m.Id) | ||
100 | + if v, ok := queryOptions["articleId"]; ok { | ||
101 | + tx = tx.Where("article_id = ?", v) | ||
102 | + } | ||
103 | + if v, ok := queryOptions["notIds"]; ok { | ||
104 | + tx = tx.Where("id not in (?)", v) | ||
105 | + } | ||
106 | + tx.Delete(m) | ||
107 | + return m, tx.Error | ||
108 | + } | ||
109 | + if _, err := repository.Query(queryFunc, m.CacheKeyFunc()); err != nil { | ||
110 | + return err | ||
111 | + } | ||
112 | + return nil | ||
113 | +} | ||
114 | + | ||
93 | func (repository *ArticleSectionRepository) FindOne(ctx context.Context, conn transaction.Conn, id int64) (*domain.ArticleSection, error) { | 115 | func (repository *ArticleSectionRepository) FindOne(ctx context.Context, conn transaction.Conn, id int64) (*domain.ArticleSection, error) { |
94 | var ( | 116 | var ( |
95 | err error | 117 | err error |
@@ -25,6 +25,7 @@ type ArticleSectionRepository interface { | @@ -25,6 +25,7 @@ type ArticleSectionRepository interface { | ||
25 | Update(ctx context.Context, conn transaction.Conn, dm *ArticleSection) (*ArticleSection, error) | 25 | Update(ctx context.Context, conn transaction.Conn, dm *ArticleSection) (*ArticleSection, error) |
26 | UpdateWithVersion(ctx context.Context, conn transaction.Conn, dm *ArticleSection) (*ArticleSection, error) | 26 | UpdateWithVersion(ctx context.Context, conn transaction.Conn, dm *ArticleSection) (*ArticleSection, error) |
27 | Delete(ctx context.Context, conn transaction.Conn, dm *ArticleSection) (*ArticleSection, error) | 27 | Delete(ctx context.Context, conn transaction.Conn, dm *ArticleSection) (*ArticleSection, error) |
28 | + DeleteBy(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) error | ||
28 | FindOne(ctx context.Context, conn transaction.Conn, id int64) (*ArticleSection, error) | 29 | FindOne(ctx context.Context, conn transaction.Conn, id int64) (*ArticleSection, error) |
29 | Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*ArticleSection, error) | 30 | Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*ArticleSection, error) |
30 | IncreaseCountComment(ctx context.Context, conn transaction.Conn, incr int, sectionId int64) error //评论数量变动 | 31 | IncreaseCountComment(ctx context.Context, conn transaction.Conn, incr int, sectionId int64) error //评论数量变动 |
-
请 注册 或 登录 后发表评论