Merge branch 'dev' of http://gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss into dev
正在显示
61 个修改的文件
包含
1530 行增加
和
504 行删除
@@ -293,34 +293,6 @@ | @@ -293,34 +293,6 @@ | ||
293 | ] | 293 | ] |
294 | } | 294 | } |
295 | }, | 295 | }, |
296 | - "v1/mini/article_comment/at_user/select": { | ||
297 | - "post": { | ||
298 | - "summary": "小程序获取回复@人可选列表", | ||
299 | - "operationId": "MiniArticleCommentAtUser", | ||
300 | - "responses": { | ||
301 | - "200": { | ||
302 | - "description": "A successful response.", | ||
303 | - "schema": { | ||
304 | - "$ref": "#/definitions/MiniArticleCommentAtUserResponse" | ||
305 | - } | ||
306 | - } | ||
307 | - }, | ||
308 | - "parameters": [ | ||
309 | - { | ||
310 | - "name": "body", | ||
311 | - "in": "body", | ||
312 | - "required": true, | ||
313 | - "schema": { | ||
314 | - "$ref": "#/definitions/MiniArticleCommentAtUserRequest" | ||
315 | - } | ||
316 | - } | ||
317 | - ], | ||
318 | - "requestBody": {}, | ||
319 | - "tags": [ | ||
320 | - "comment" | ||
321 | - ] | ||
322 | - } | ||
323 | - }, | ||
324 | "v1/mini/article_comment/at_who/list": { | 296 | "v1/mini/article_comment/at_who/list": { |
325 | "post": { | 297 | "post": { |
326 | "summary": "小程序展示评论时@人可选列表", | 298 | "summary": "小程序展示评论时@人可选列表", |
@@ -631,22 +603,6 @@ | @@ -631,22 +603,6 @@ | ||
631 | "required": false, | 603 | "required": false, |
632 | "type": "integer", | 604 | "type": "integer", |
633 | "format": "int64" | 605 | "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 | } | 606 | } |
651 | ], | 607 | ], |
652 | "requestBody": {}, | 608 | "requestBody": {}, |
@@ -1211,6 +1167,64 @@ | @@ -1211,6 +1167,64 @@ | ||
1211 | ] | 1167 | ] |
1212 | } | 1168 | } |
1213 | }, | 1169 | }, |
1170 | + "v1/system/article": { | ||
1171 | + "put": { | ||
1172 | + "summary": "管理后台编辑帖子", | ||
1173 | + "operationId": "SystemUpdateArticle", | ||
1174 | + "responses": { | ||
1175 | + "200": { | ||
1176 | + "description": "A successful response.", | ||
1177 | + "schema": { | ||
1178 | + "$ref": "#/definitions/SystemArticleUpdateResponse" | ||
1179 | + } | ||
1180 | + } | ||
1181 | + }, | ||
1182 | + "parameters": [ | ||
1183 | + { | ||
1184 | + "name": "body", | ||
1185 | + "description": "编辑", | ||
1186 | + "in": "body", | ||
1187 | + "required": true, | ||
1188 | + "schema": { | ||
1189 | + "$ref": "#/definitions/SystemArticleUpdateRequest" | ||
1190 | + } | ||
1191 | + } | ||
1192 | + ], | ||
1193 | + "requestBody": {}, | ||
1194 | + "tags": [ | ||
1195 | + "article" | ||
1196 | + ] | ||
1197 | + } | ||
1198 | + }, | ||
1199 | + "v1/system/article/history": { | ||
1200 | + "post": { | ||
1201 | + "summary": "管理后台编辑历史", | ||
1202 | + "operationId": "SystemHistoryArticle", | ||
1203 | + "responses": { | ||
1204 | + "200": { | ||
1205 | + "description": "A successful response.", | ||
1206 | + "schema": { | ||
1207 | + "$ref": "#/definitions/SystemArticleHistoryResponse" | ||
1208 | + } | ||
1209 | + } | ||
1210 | + }, | ||
1211 | + "parameters": [ | ||
1212 | + { | ||
1213 | + "name": "body", | ||
1214 | + "description": "历史", | ||
1215 | + "in": "body", | ||
1216 | + "required": true, | ||
1217 | + "schema": { | ||
1218 | + "$ref": "#/definitions/SystemArticleHistoryRequest" | ||
1219 | + } | ||
1220 | + } | ||
1221 | + ], | ||
1222 | + "requestBody": {}, | ||
1223 | + "tags": [ | ||
1224 | + "article" | ||
1225 | + ] | ||
1226 | + } | ||
1227 | + }, | ||
1214 | "v1/system/article/search": { | 1228 | "v1/system/article/search": { |
1215 | "post": { | 1229 | "post": { |
1216 | "summary": "管理后台获取文章列表", | 1230 | "summary": "管理后台获取文章列表", |
@@ -2240,6 +2254,25 @@ | @@ -2240,6 +2254,25 @@ | ||
2240 | "totalComment" | 2254 | "totalComment" |
2241 | ] | 2255 | ] |
2242 | }, | 2256 | }, |
2257 | + "ArticleTagGroup": { | ||
2258 | + "type": "object", | ||
2259 | + "properties": { | ||
2260 | + "group": { | ||
2261 | + "type": "string" | ||
2262 | + }, | ||
2263 | + "tags": { | ||
2264 | + "type": "array", | ||
2265 | + "items": { | ||
2266 | + "$ref": "#/definitions/ArticleTagItem" | ||
2267 | + } | ||
2268 | + } | ||
2269 | + }, | ||
2270 | + "title": "ArticleTagGroup", | ||
2271 | + "required": [ | ||
2272 | + "group", | ||
2273 | + "tags" | ||
2274 | + ] | ||
2275 | + }, | ||
2243 | "ArticleTagItem": { | 2276 | "ArticleTagItem": { |
2244 | "type": "object", | 2277 | "type": "object", |
2245 | "properties": { | 2278 | "properties": { |
@@ -2252,13 +2285,17 @@ | @@ -2252,13 +2285,17 @@ | ||
2252 | }, | 2285 | }, |
2253 | "name": { | 2286 | "name": { |
2254 | "type": "string" | 2287 | "type": "string" |
2288 | + }, | ||
2289 | + "image": { | ||
2290 | + "type": "string" | ||
2255 | } | 2291 | } |
2256 | }, | 2292 | }, |
2257 | "title": "ArticleTagItem", | 2293 | "title": "ArticleTagItem", |
2258 | "required": [ | 2294 | "required": [ |
2259 | "id", | 2295 | "id", |
2260 | "group", | 2296 | "group", |
2261 | - "name" | 2297 | + "name", |
2298 | + "image" | ||
2262 | ] | 2299 | ] |
2263 | }, | 2300 | }, |
2264 | "Auth": { | 2301 | "Auth": { |
@@ -2294,6 +2331,9 @@ | @@ -2294,6 +2331,9 @@ | ||
2294 | }, | 2331 | }, |
2295 | "name": { | 2332 | "name": { |
2296 | "type": "string" | 2333 | "type": "string" |
2334 | + }, | ||
2335 | + "firstLetter": { | ||
2336 | + "type": "string" | ||
2297 | } | 2337 | } |
2298 | }, | 2338 | }, |
2299 | "title": "CommentAtWho", | 2339 | "title": "CommentAtWho", |
@@ -2806,23 +2846,9 @@ | @@ -2806,23 +2846,9 @@ | ||
2806 | "type": "integer", | 2846 | "type": "integer", |
2807 | "format": "int64", | 2847 | "format": "int64", |
2808 | "description": " 公司id" | 2848 | "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 | } | 2849 | } |
2820 | }, | 2850 | }, |
2821 | - "title": "MiniAllArticleTagRequest", | ||
2822 | - "required": [ | ||
2823 | - "articleId", | ||
2824 | - "tagId" | ||
2825 | - ] | 2851 | + "title": "MiniAllArticleTagRequest" |
2826 | }, | 2852 | }, |
2827 | "MiniAllArticleTagResponse": { | 2853 | "MiniAllArticleTagResponse": { |
2828 | "type": "object", | 2854 | "type": "object", |
@@ -2830,20 +2856,13 @@ | @@ -2830,20 +2856,13 @@ | ||
2830 | "tagGroup": { | 2856 | "tagGroup": { |
2831 | "type": "array", | 2857 | "type": "array", |
2832 | "items": { | 2858 | "items": { |
2833 | - "type": "string" | ||
2834 | - } | ||
2835 | - }, | ||
2836 | - "tags": { | ||
2837 | - "type": "array", | ||
2838 | - "items": { | ||
2839 | - "$ref": "#/definitions/ArticleTagItem" | 2859 | + "$ref": "#/definitions/ArticleTagGroup" |
2840 | } | 2860 | } |
2841 | } | 2861 | } |
2842 | }, | 2862 | }, |
2843 | "title": "MiniAllArticleTagResponse", | 2863 | "title": "MiniAllArticleTagResponse", |
2844 | "required": [ | 2864 | "required": [ |
2845 | - "tagGroup", | ||
2846 | - "tags" | 2865 | + "tagGroup" |
2847 | ] | 2866 | ] |
2848 | }, | 2867 | }, |
2849 | "MiniArticleBackupItem": { | 2868 | "MiniArticleBackupItem": { |
@@ -2931,23 +2950,6 @@ | @@ -2931,23 +2950,6 @@ | ||
2931 | "list" | 2950 | "list" |
2932 | ] | 2951 | ] |
2933 | }, | 2952 | }, |
2934 | - "MiniArticleCommentAtUserRequest": { | ||
2935 | - "type": "object", | ||
2936 | - "properties": { | ||
2937 | - "articleId": { | ||
2938 | - "type": "integer", | ||
2939 | - "format": "int64" | ||
2940 | - } | ||
2941 | - }, | ||
2942 | - "title": "MiniArticleCommentAtUserRequest", | ||
2943 | - "required": [ | ||
2944 | - "articleId" | ||
2945 | - ] | ||
2946 | - }, | ||
2947 | - "MiniArticleCommentAtUserResponse": { | ||
2948 | - "type": "object", | ||
2949 | - "title": "MiniArticleCommentAtUserResponse" | ||
2950 | - }, | ||
2951 | "MiniArticleCommentAtWhoRequest": { | 2953 | "MiniArticleCommentAtWhoRequest": { |
2952 | "type": "object", | 2954 | "type": "object", |
2953 | "properties": { | 2955 | "properties": { |
@@ -5022,6 +5024,96 @@ | @@ -5022,6 +5024,96 @@ | ||
5022 | "show" | 5024 | "show" |
5023 | ] | 5025 | ] |
5024 | }, | 5026 | }, |
5027 | + "SystemArticleHistory": { | ||
5028 | + "type": "object", | ||
5029 | + "properties": { | ||
5030 | + "id": { | ||
5031 | + "type": "integer", | ||
5032 | + "format": "int64", | ||
5033 | + "description": "id" | ||
5034 | + }, | ||
5035 | + "author": { | ||
5036 | + "type": "string", | ||
5037 | + "description": "编辑人" | ||
5038 | + }, | ||
5039 | + "action": { | ||
5040 | + "type": "string", | ||
5041 | + "description": "编辑类型" | ||
5042 | + }, | ||
5043 | + "updatedAt": { | ||
5044 | + "type": "integer", | ||
5045 | + "format": "int64", | ||
5046 | + "description": "编辑时间" | ||
5047 | + } | ||
5048 | + }, | ||
5049 | + "title": "SystemArticleHistory", | ||
5050 | + "required": [ | ||
5051 | + "id", | ||
5052 | + "author", | ||
5053 | + "action", | ||
5054 | + "updatedAt" | ||
5055 | + ] | ||
5056 | + }, | ||
5057 | + "SystemArticleHistoryRequest": { | ||
5058 | + "type": "object", | ||
5059 | + "properties": { | ||
5060 | + "articleId": { | ||
5061 | + "type": "integer", | ||
5062 | + "format": "int64", | ||
5063 | + "description": "文章ID" | ||
5064 | + }, | ||
5065 | + "author": { | ||
5066 | + "type": "string", | ||
5067 | + "description": "发布人" | ||
5068 | + }, | ||
5069 | + "beginTime": { | ||
5070 | + "type": "integer", | ||
5071 | + "format": "int64", | ||
5072 | + "description": "开始时间" | ||
5073 | + }, | ||
5074 | + "endTime": { | ||
5075 | + "type": "integer", | ||
5076 | + "format": "int64", | ||
5077 | + "description": "结束时间" | ||
5078 | + }, | ||
5079 | + "page": { | ||
5080 | + "type": "integer", | ||
5081 | + "format": "int32", | ||
5082 | + "description": "页码" | ||
5083 | + }, | ||
5084 | + "size": { | ||
5085 | + "type": "integer", | ||
5086 | + "format": "int32", | ||
5087 | + "description": "每页行数" | ||
5088 | + } | ||
5089 | + }, | ||
5090 | + "title": "SystemArticleHistoryRequest", | ||
5091 | + "required": [ | ||
5092 | + "articleId", | ||
5093 | + "page", | ||
5094 | + "size" | ||
5095 | + ] | ||
5096 | + }, | ||
5097 | + "SystemArticleHistoryResponse": { | ||
5098 | + "type": "object", | ||
5099 | + "properties": { | ||
5100 | + "total": { | ||
5101 | + "type": "integer", | ||
5102 | + "format": "int32" | ||
5103 | + }, | ||
5104 | + "list": { | ||
5105 | + "type": "array", | ||
5106 | + "items": { | ||
5107 | + "$ref": "#/definitions/SystemArticleHistory" | ||
5108 | + } | ||
5109 | + } | ||
5110 | + }, | ||
5111 | + "title": "SystemArticleHistoryResponse", | ||
5112 | + "required": [ | ||
5113 | + "total", | ||
5114 | + "list" | ||
5115 | + ] | ||
5116 | + }, | ||
5025 | "SystemArticleSearch": { | 5117 | "SystemArticleSearch": { |
5026 | "type": "object", | 5118 | "type": "object", |
5027 | "properties": { | 5119 | "properties": { |
@@ -5149,17 +5241,37 @@ | @@ -5149,17 +5241,37 @@ | ||
5149 | "SystemArticleSearchRequest": { | 5241 | "SystemArticleSearchRequest": { |
5150 | "type": "object", | 5242 | "type": "object", |
5151 | "properties": { | 5243 | "properties": { |
5152 | - "": { | 5244 | + "companyId": { |
5153 | "type": "integer", | 5245 | "type": "integer", |
5154 | "format": "int64" | 5246 | "format": "int64" |
5155 | }, | 5247 | }, |
5248 | + "title": { | ||
5249 | + "type": "string", | ||
5250 | + "description": "标题" | ||
5251 | + }, | ||
5252 | + "author": { | ||
5253 | + "type": "string", | ||
5254 | + "description": "发布人" | ||
5255 | + }, | ||
5256 | + "beginTime": { | ||
5257 | + "type": "integer", | ||
5258 | + "format": "int64", | ||
5259 | + "description": "开始时间" | ||
5260 | + }, | ||
5261 | + "endTime": { | ||
5262 | + "type": "integer", | ||
5263 | + "format": "int64", | ||
5264 | + "description": "结束时间" | ||
5265 | + }, | ||
5156 | "page": { | 5266 | "page": { |
5157 | "type": "integer", | 5267 | "type": "integer", |
5158 | - "format": "int32" | 5268 | + "format": "int32", |
5269 | + "description": "页码" | ||
5159 | }, | 5270 | }, |
5160 | "size": { | 5271 | "size": { |
5161 | "type": "integer", | 5272 | "type": "integer", |
5162 | - "format": "int32" | 5273 | + "format": "int32", |
5274 | + "description": "每页行数" | ||
5163 | } | 5275 | } |
5164 | }, | 5276 | }, |
5165 | "title": "SystemArticleSearchRequest", | 5277 | "title": "SystemArticleSearchRequest", |
@@ -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,20 @@ service Core { | @@ -89,7 +89,20 @@ 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 | + | ||
100 | + @doc "管理后台帖子历史详情" | ||
101 | + @handler SystemArticleGetHistory | ||
102 | + get /article/history/:id (SystemArticleGetHistoryRequest) returns (SystemArticleGetHistoryResponse) | ||
103 | + | ||
92 | @doc "管理后台获取我发布的文章" | 104 | @doc "管理后台获取我发布的文章" |
93 | @handler SystemArticleSearchMe | 105 | @handler SystemArticleSearchMe |
94 | post /article/search/me (SystemArticleSearchMeRequest) returns (SystemArticleSearchMeResponse) | 106 | post /article/search/me (SystemArticleSearchMeRequest) returns (SystemArticleSearchMeResponse) |
107 | + | ||
95 | } | 108 | } |
@@ -8,14 +8,42 @@ info( | @@ -8,14 +8,42 @@ info( | ||
8 | version: "v1" | 8 | version: "v1" |
9 | ) | 9 | ) |
10 | 10 | ||
11 | +@server( | ||
12 | + prefix: v1/system | ||
13 | + group: tags | ||
14 | + jwt: SystemAuth | ||
15 | +) | ||
16 | +service Core { | ||
17 | + @doc "后台创建文章标签" | ||
18 | + @handler CreateTag | ||
19 | + post /article_tag (TagCreateRequest) returns (TagCreateResponse) | ||
20 | + | ||
21 | + @doc "后台编辑文章标签" | ||
22 | + @handler EditTag | ||
23 | + put /article_tag (TagEditRequest) returns (TagEditResponse) | ||
24 | + | ||
25 | + @doc "后台获取文章标签" | ||
26 | + @handler GetTag | ||
27 | + get /article_tag/:id (TagGetRequest) returns (TagGetResponse) | ||
28 | + | ||
29 | + @doc "后台删除文章标签" | ||
30 | + @handler DeleteTag | ||
31 | + delete /article_tag/:id (TagDeleteRequest) returns (TagDeleteResponse) | ||
32 | + | ||
33 | + @doc "后台搜索标签" | ||
34 | + @handler SearchTag | ||
35 | + post/article_tag/search (TagListRequest) returns (TagListResponse) | ||
36 | +} | ||
37 | + | ||
11 | // 创建标签 | 38 | // 创建标签 |
12 | type ( | 39 | type ( |
13 | TagCreateRequest { | 40 | TagCreateRequest { |
14 | - CompanyId int64 `json:"companyId"` | 41 | + CompanyId int64 `json:",optional"` |
15 | Image string `json:"image"` | 42 | Image string `json:"image"` |
16 | Name string `json:"name"` // 标签名称 | 43 | Name string `json:"name"` // 标签名称 |
17 | - Group string `json:"group"` // 标签分类 | 44 | + Category string `json:"category"` // 标签分类 |
18 | Remark string `json:"remark,optional"` // 备注 | 45 | Remark string `json:"remark,optional"` // 备注 |
46 | + Other string `json:"other"` | ||
19 | } | 47 | } |
20 | 48 | ||
21 | TagCreateResponse { | 49 | TagCreateResponse { |
@@ -27,11 +55,12 @@ type ( | @@ -27,11 +55,12 @@ type ( | ||
27 | type ( | 55 | type ( |
28 | TagEditRequest { | 56 | TagEditRequest { |
29 | Id int64 `json:"id"` | 57 | Id int64 `json:"id"` |
30 | - CompanyId int64 `json:"-"` | 58 | + CompanyId int64 `json:",optional"` |
31 | Image string `json:"image"` | 59 | Image string `json:"image"` |
32 | Name string `json:"name"` // 标签名称 | 60 | Name string `json:"name"` // 标签名称 |
33 | - Group string `json:"group"` // 标签分类 | 61 | + Category string `json:"category"` // 标签分类 |
34 | Remark string `json:"remark,optional"` // 备注 | 62 | Remark string `json:"remark,optional"` // 备注 |
63 | + Other string `json:"other"` | ||
35 | } | 64 | } |
36 | 65 | ||
37 | TagEditResponse { | 66 | TagEditResponse { |
@@ -43,14 +72,15 @@ type ( | @@ -43,14 +72,15 @@ type ( | ||
43 | type ( | 72 | type ( |
44 | TagGetRequest { | 73 | TagGetRequest { |
45 | Id int64 `path:"id"` | 74 | Id int64 `path:"id"` |
46 | - CompanyId int64 `path:"-"` | 75 | + CompanyId int64 `path:",optional"` |
47 | } | 76 | } |
48 | TagGetResponse { | 77 | TagGetResponse { |
49 | - Id int64 `json:"id"` | ||
50 | - Image string `json:"image"` | ||
51 | - Name string `json:"name"` // 标签名称 | ||
52 | - Group string `json:"group"` // 标签分类 | ||
53 | - Remark string `json:"remark"` // 备注 | 78 | + Id int64 `json:"id"` |
79 | + Image string `json:"image"` | ||
80 | + Name string `json:"name"` // 标签名称 | ||
81 | + Category string `json:"category"` // 标签分类 | ||
82 | + Remark string `json:"remark"` // 备注 | ||
83 | + Other string `json:"other"` | ||
54 | } | 84 | } |
55 | ) | 85 | ) |
56 | 86 | ||
@@ -59,9 +89,9 @@ type ( | @@ -59,9 +89,9 @@ type ( | ||
59 | TagListRequest { | 89 | TagListRequest { |
60 | Page int `json:"page"` | 90 | Page int `json:"page"` |
61 | Size int `json:"size"` | 91 | Size int `json:"size"` |
62 | - CompanyId int64 `json:"-"` | 92 | + CompanyId int64 `json:",optional"` |
63 | TagName string `json:"tagName,optional"` | 93 | TagName string `json:"tagName,optional"` |
64 | - Group string `json:"group,optional"` | 94 | + Category string `json:"category,optional"` |
65 | Remark string `json:"remark,optional"` | 95 | Remark string `json:"remark,optional"` |
66 | } | 96 | } |
67 | TagListResponse { | 97 | TagListResponse { |
@@ -71,9 +101,9 @@ type ( | @@ -71,9 +101,9 @@ type ( | ||
71 | TagItem { | 101 | TagItem { |
72 | Id int64 `json:"id"` | 102 | Id int64 `json:"id"` |
73 | Image string `json:"image"` | 103 | Image string `json:"image"` |
74 | - Name string `json:"name"` // 标签名称 | ||
75 | - Group string `json:"group"` // 标签分类 | ||
76 | - Remark string `json:"remark"` // 备注 | 104 | + Name string `json:"name"` // 标签名称 |
105 | + Category string `json:"category"` // 标签分类 | ||
106 | + Remark string `json:"remark"` // 备注 | ||
77 | CreatedAt int64 `json:"createdAt"` | 107 | CreatedAt int64 `json:"createdAt"` |
78 | } | 108 | } |
79 | ) | 109 | ) |
@@ -82,36 +112,9 @@ type ( | @@ -82,36 +112,9 @@ type ( | ||
82 | type ( | 112 | type ( |
83 | TagDeleteRequest { | 113 | TagDeleteRequest { |
84 | Id int64 `path:"id"` | 114 | Id int64 `path:"id"` |
85 | - CompanyId int64 `path:"-"` | 115 | + CompanyId int64 `path:",optional"` |
86 | } | 116 | } |
87 | TagDeleteResponse { | 117 | TagDeleteResponse { |
88 | Id int64 `json:"id"` | 118 | Id int64 `json:"id"` |
89 | } | 119 | } |
90 | -) | ||
91 | - | ||
92 | -@server( | ||
93 | - prefix: v1/system | ||
94 | - group: tags | ||
95 | - jwt: MiniAuth | ||
96 | -) | ||
97 | -service Core { | ||
98 | - @doc "后台创建文章标签" | ||
99 | - @handler CreateTag | ||
100 | - post /article_tag (TagCreateRequest) returns (TagCreateResponse) | ||
101 | - | ||
102 | - @doc "后台编辑文章标签" | ||
103 | - @handler EditTag | ||
104 | - put /article_tag (TagEditRequest) returns (TagEditResponse) | ||
105 | - | ||
106 | - @doc "后台获取文章标签" | ||
107 | - @handler GetTag | ||
108 | - get /article_tag/:id (TagGetRequest) returns (TagGetResponse) | ||
109 | - | ||
110 | - @doc "后台删除文章标签" | ||
111 | - @handler DeleteTag | ||
112 | - delete /article_tag/:id (TagDeleteRequest) returns (TagDeleteResponse) | ||
113 | - | ||
114 | - @doc "后台搜索标签" | ||
115 | - @handler SearchTag | ||
116 | - post/article_tag/search (TagListRequest) returns (TagListResponse) | ||
117 | -} | ||
120 | +) |
@@ -35,15 +35,15 @@ type ( | @@ -35,15 +35,15 @@ type ( | ||
35 | //小程序端查看文章的详情 | 35 | //小程序端查看文章的详情 |
36 | type ( | 36 | type ( |
37 | MiniArticleGetRequest { | 37 | MiniArticleGetRequest { |
38 | - Id int64 `path:"id"` //id | ||
39 | - CompanyId int64 `path:",optional"`//当前公司 | ||
40 | - UserId int `path:",optional"` //当前用户 | 38 | + Id int64 `path:"id"` //id |
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 ArticleAuthor `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,7 +55,7 @@ type ( | @@ -55,7 +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"` // 当前人员对文章的点赞标识 (0 没有点赞 1有点赞) | 58 | + MeLoveFlag int `json:"meLoveFlag"` // 当前人员对文章的点赞标识 (0 没有点赞 1有点赞) |
59 | } | 59 | } |
60 | ArticleSection { | 60 | ArticleSection { |
61 | Id int64 `json:"id"` //段落id | 61 | Id int64 `json:"id"` //段落id |
@@ -92,9 +92,9 @@ type ( | @@ -92,9 +92,9 @@ type ( | ||
92 | SystemArticleSearchMeRequest { | 92 | SystemArticleSearchMeRequest { |
93 | Page int `json:"page"` | 93 | Page int `json:"page"` |
94 | Size int `json:"size"` | 94 | Size int `json:"size"` |
95 | - AuthorId int64 `json:"authorId"` // 用户 | 95 | + AuthorId int64 `json:"authorId"` // 用户 |
96 | BeginTime int64 `json:"beginTime,optional"` // 开始时间 | 96 | BeginTime int64 `json:"beginTime,optional"` // 开始时间 |
97 | - EndTime int64 `json:"endTime,optional"` // 结束时间 | 97 | + EndTime int64 `json:"endTime,optional"` // 结束时间 |
98 | } | 98 | } |
99 | SystemArticleSearchMeResponse { | 99 | SystemArticleSearchMeResponse { |
100 | Total int `json:"total"` | 100 | Total int `json:"total"` |
@@ -119,6 +119,7 @@ type ( | @@ -119,6 +119,7 @@ type ( | ||
119 | UserId int64 `json:"userId"` // 人员id | 119 | UserId int64 `json:"userId"` // 人员id |
120 | Name string `json:"name"` // 人员名称 | 120 | Name string `json:"name"` // 人员名称 |
121 | Avatar string `json:"avatar"` // 人员头像 | 121 | Avatar string `json:"avatar"` // 人员头像 |
122 | + Position string `json:"position"` // 职位 | ||
122 | CreatedAt int64 `json:"createdAt"` // 点赞记录的时间 | 123 | CreatedAt int64 `json:"createdAt"` // 点赞记录的时间 |
123 | } | 124 | } |
124 | ) | 125 | ) |
@@ -270,8 +271,8 @@ type ( | @@ -270,8 +271,8 @@ type ( | ||
270 | // 小程序端获取我的浏览记录 | 271 | // 小程序端获取我的浏览记录 |
271 | type ( | 272 | type ( |
272 | MiniArticleMarkListRequest { | 273 | MiniArticleMarkListRequest { |
273 | - Page int `json:"page"` | ||
274 | - Size int `json:"size"` | 274 | + Page int `json:"page"` |
275 | + Size int `json:"size"` | ||
275 | } | 276 | } |
276 | 277 | ||
277 | MiniArticleMarkListResponse { | 278 | MiniArticleMarkListResponse { |
@@ -292,42 +293,38 @@ type ( | @@ -292,42 +293,38 @@ type ( | ||
292 | 293 | ||
293 | //小程序端设置文章的定性标签 | 294 | //小程序端设置文章的定性标签 |
294 | type ( | 295 | type ( |
295 | - MiniArticleSetTagRequest{ | 296 | + MiniArticleSetTagRequest { |
296 | CompanyId int64 `json:",optional"` // 公司id | 297 | CompanyId int64 `json:",optional"` // 公司id |
297 | UserId int64 `json:",optional"` // 公司id | 298 | UserId int64 `json:",optional"` // 公司id |
298 | ArticleId int64 `json:"articleId"` // 文章id | 299 | ArticleId int64 `json:"articleId"` // 文章id |
299 | TagId int64 `json:"tagId"` // 标签id | 300 | TagId int64 `json:"tagId"` // 标签id |
300 | } | 301 | } |
301 | - MiniArticleSetTagResponse{ | 302 | + MiniArticleSetTagResponse { |
302 | Id int64 `json:"id"` | 303 | Id int64 `json:"id"` |
303 | } | 304 | } |
304 | ) | 305 | ) |
305 | 306 | ||
306 | - | ||
307 | //小程序端获取所有的定性标签 | 307 | //小程序端获取所有的定性标签 |
308 | type ( | 308 | type ( |
309 | - MiniAllArticleTagRequest{ | 309 | + MiniAllArticleTagRequest { |
310 | CompanyId int64 `json:",optional"` // 公司id | 310 | CompanyId int64 `json:",optional"` // 公司id |
311 | UserId int64 `json:",optional"` // 公司id | 311 | UserId int64 `json:",optional"` // 公司id |
312 | - ArticleId int64 `json:"articleId"` // 文章id | ||
313 | - TagId int64 `json:"tagId"` // 标签id | ||
314 | } | 312 | } |
315 | - MiniAllArticleTagResponse{ | ||
316 | - TagGroup []ArticleTagGroup `json:"tagGroup"` | ||
317 | - } | 313 | + MiniAllArticleTagResponse { |
314 | + TagGroup []ArticleTagGroup `json:"tagGroup"` | ||
315 | + } | ||
318 | ArticleTagGroup { | 316 | ArticleTagGroup { |
319 | - Group string `json:"group"` | ||
320 | - Tags []ArticleTagItem `json:"tags"` | 317 | + Group string `json:"group"` |
318 | + Tags []ArticleTagItem `json:"tags"` | ||
321 | } | 319 | } |
322 | ArticleTagItem { | 320 | ArticleTagItem { |
323 | - Id int64 `json:"id"` | ||
324 | - Group string `json:"group"` | ||
325 | - Name string `json:"name"` | 321 | + Id int64 `json:"id"` |
322 | + Group string `json:"group"` | ||
323 | + Name string `json:"name"` | ||
324 | + Image string `json:"image"` | ||
326 | } | 325 | } |
327 | ) | 326 | ) |
328 | 327 | ||
329 | - | ||
330 | - | ||
331 | //管理后台获取文章详情 | 328 | //管理后台获取文章详情 |
332 | type ( | 329 | type ( |
333 | SystemArticleGetRequest { | 330 | SystemArticleGetRequest { |
@@ -336,15 +333,15 @@ type ( | @@ -336,15 +333,15 @@ type ( | ||
336 | } | 333 | } |
337 | 334 | ||
338 | UserShowName { | 335 | UserShowName { |
339 | - Id int `json:"id"` | ||
340 | - Name int `json:"name"` | 336 | + Id int `json:"id"` |
337 | + Name string `json:"name"` | ||
341 | } | 338 | } |
342 | 339 | ||
343 | SystemArticleGetResponse { | 340 | SystemArticleGetResponse { |
344 | Id int64 `json:"id"` // id | 341 | Id int64 `json:"id"` // id |
345 | Title string `json:"title"` // 标题 | 342 | Title string `json:"title"` // 标题 |
346 | AuthorId int64 `json:"authorId"` // 发布人id | 343 | AuthorId int64 `json:"authorId"` // 发布人id |
347 | - Author ArticleAuthor `json:"author"` // 发布人 | 344 | + Author ArticleAuthor `json:"author"` // 发布人 |
348 | CreatedAt int64 `json:"createdAt"` // 文章的发布时间 | 345 | CreatedAt int64 `json:"createdAt"` // 文章的发布时间 |
349 | Section []ArticleSection `json:"section"` // 文章的文本内容 | 346 | Section []ArticleSection `json:"section"` // 文章的文本内容 |
350 | Images []string `json:"images"` // 图片 | 347 | Images []string `json:"images"` // 图片 |
@@ -357,15 +354,21 @@ type ( | @@ -357,15 +354,21 @@ type ( | ||
357 | CountComment int `json:"countComment"` // 评论数量 | 354 | CountComment int `json:"countComment"` // 评论数量 |
358 | CountRead int `json:"countRead"` // 浏览数量 | 355 | CountRead int `json:"countRead"` // 浏览数量 |
359 | Show int `json:"show"` // 评论的展示状态(0显示、1不显示) | 356 | Show int `json:"show"` // 评论的展示状态(0显示、1不显示) |
357 | + Tags []ArticleTagItem `json:"tags"` //标签 | ||
360 | } | 358 | } |
361 | ) | 359 | ) |
362 | 360 | ||
363 | //管理后台获取文章列表 | 361 | //管理后台获取文章列表 |
364 | type ( | 362 | type ( |
365 | SystemArticleSearchRequest { | 363 | SystemArticleSearchRequest { |
366 | - CompanyId int64 `json:",optional"` | ||
367 | - Page int `json:"page"` | ||
368 | - Size int `json:"size"` | 364 | + CompanyId int64 `json:"companyId,optional"` |
365 | + Title string `json:"title,optional"` //标题 | ||
366 | + Author string `json:"author,optional"` //发布人 | ||
367 | + BeginTime int64 `json:"beginTime,optional"` //开始时间 | ||
368 | + EndTime int64 `json:"endTime,optional"` //结束时间 | ||
369 | + Tags []int64 `json:"tags,optional"` //标签 | ||
370 | + Page int `json:"page"` //页码 | ||
371 | + Size int `json:"size"` //每页行数 | ||
369 | } | 372 | } |
370 | 373 | ||
371 | SystemArticleSearchResponse { | 374 | SystemArticleSearchResponse { |
@@ -384,4 +387,73 @@ type ( | @@ -384,4 +387,73 @@ 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 | + Tags []int64 `json:"tags"` // 标签 | ||
403 | + } | ||
404 | + SystemArticleUpdateResponse { | ||
405 | + Id int64 `json:"id"` //id | ||
406 | + Title string `json:"title"` //标题 | ||
407 | + Author string `json:"author"` //发布人 | ||
408 | + Images []string `json:"images"` //图片 | ||
409 | + CreatedAt int64 `json:"createdAt"` //文章的创建日期 | ||
410 | + CountLove int `json:"countLove"` //点赞数量 | ||
411 | + CountComment int `json:"CountComment"` //评论数量 | ||
412 | + Show int `json:"show"` //是否隐藏 [0显示、1不显示] | ||
413 | + Tags []int64 `json:"tags"` //标签 | ||
414 | + TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] | ||
415 | + } | ||
416 | + //历史 | ||
417 | + SystemArticleHistoryRequest { | ||
418 | + ArticleId int64 `json:"articleId"` //文章ID | ||
419 | + Author string `json:"author,optional"` //发布人 | ||
420 | + BeginTime int64 `json:"beginTime,optional"` //开始时间 | ||
421 | + EndTime int64 `json:"endTime,optional"` //结束时间 | ||
422 | + Page int `json:"page"` //页码 | ||
423 | + Size int `json:"size"` //每页行数 | ||
424 | + } | ||
425 | + SystemArticleHistoryResponse { | ||
426 | + Total int `json:"total"` | ||
427 | + List []SystemArticleHistory `json:"list"` | ||
428 | + } | ||
429 | + SystemArticleHistory { | ||
430 | + Id int64 `json:"id"` //id | ||
431 | + Author string `json:"author"` //编辑人 | ||
432 | + Action string `json:"action"` //编辑类型 | ||
433 | + UpdatedAt int64 `json:"updatedAt"` //编辑时间 | ||
434 | + } | ||
435 | + SystemArticleGetHistoryRequest { | ||
436 | + Id int64 `path:"id"` //id | ||
437 | + CompanyId int64 `path:",optional"` | ||
438 | + } | ||
439 | + SystemArticleGetHistoryResponse { | ||
440 | + Id int64 `json:"id"` // id | ||
441 | + ArticleId int64 `json:"articleId"` // 文章ID | ||
442 | + Title string `json:"title"` // 标题 | ||
443 | + AuthorId int64 `json:"authorId"` // 发布人id | ||
444 | + Author ArticleAuthor `json:"author"` // 发布人 | ||
445 | + CreatedAt int64 `json:"createdAt"` // 文章的发布时间 | ||
446 | + Section []ArticleSection `json:"section"` // 文章的文本内容 | ||
447 | + Images []string `json:"images"` // 图片 | ||
448 | + WhoRead []int64 `json:"whoRead"` // 谁可查看 | ||
449 | + WhoReadInfo []UserShowName `json:"whoReadInfo"` // 谁可查看 | ||
450 | + WhoReview []int64 `json:"whoReview"` // 谁可评论 | ||
451 | + WhoReviewInfo []UserShowName `json:"whoReviewInfo"` // 谁可评论 | ||
452 | + Location Location `json:"location"` // 定位坐标 | ||
453 | + CountLove int `json:"countLove"` // 点赞数量 | ||
454 | + CountComment int `json:"countComment"` // 评论数量 | ||
455 | + CountRead int `json:"countRead"` // 浏览数量 | ||
456 | + Show int `json:"show"` // 评论的展示状态(0显示、1不显示) | ||
457 | + TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] | ||
458 | + } | ||
387 | ) | 459 | ) |
@@ -16,10 +16,6 @@ info( | @@ -16,10 +16,6 @@ info( | ||
16 | ) | 16 | ) |
17 | service Core { | 17 | service Core { |
18 | 18 | ||
19 | - @doc "小程序获取回复@人可选列表" | ||
20 | - @handler MiniArticleCommentAtUser | ||
21 | - post /article_comment/at_user/select (MiniArticleCommentAtUserRequest) returns (MiniArticleCommentAtUserResponse) | ||
22 | - | ||
23 | @doc "小程序填写文章的评论" | 19 | @doc "小程序填写文章的评论" |
24 | @handler MiniCreateArticleComment | 20 | @handler MiniCreateArticleComment |
25 | post /article_comment (MiniCreateArticleCommentRequest) returns (MiniCreateArticleCommentResponse) | 21 | post /article_comment (MiniCreateArticleCommentRequest) returns (MiniCreateArticleCommentResponse) |
@@ -58,17 +54,6 @@ service Core { | @@ -58,17 +54,6 @@ service Core { | ||
58 | post /article_comment/search/me (SystemArticleCommentSearchMeRequest) returns (SystemArticleCommentSearchMeResponse) | 54 | post /article_comment/search/me (SystemArticleCommentSearchMeRequest) returns (SystemArticleCommentSearchMeResponse) |
59 | } | 55 | } |
60 | 56 | ||
61 | -// | ||
62 | -// 小程序获取回复@人可选列表 | ||
63 | -type ( | ||
64 | - MiniArticleCommentAtUserRequest { | ||
65 | - ArtitceId int64 `json:"articleId"` | ||
66 | - } | ||
67 | - | ||
68 | - MiniArticleCommentAtUserResponse { | ||
69 | - } | ||
70 | -) | ||
71 | - | ||
72 | //评论的填写人 | 57 | //评论的填写人 |
73 | type CommentAuthor { | 58 | type CommentAuthor { |
74 | Id int64 `json:"id"` // 人员id | 59 | Id int64 `json:"id"` // 人员id |
@@ -91,8 +76,9 @@ type ( | @@ -91,8 +76,9 @@ type ( | ||
91 | } | 76 | } |
92 | 77 | ||
93 | CommentAtWho { | 78 | CommentAtWho { |
94 | - Id int64 `json:"id"` | ||
95 | - Name string `json:"name,optional"` | 79 | + Id int64 `json:"id"` |
80 | + Name string `json:"name,optional"` | ||
81 | + FirstLetter string `json:"firstLetter,optional"` | ||
96 | } | 82 | } |
97 | MiniCreateArticleCommentResponse { | 83 | MiniCreateArticleCommentResponse { |
98 | Id int64 `json:"id"` | 84 | Id int64 `json:"id"` |
@@ -151,7 +137,7 @@ type ( | @@ -151,7 +137,7 @@ type ( | ||
151 | AtWho []CommentAtWho `json:"atWho"` // 填写评论时@的人 | 137 | AtWho []CommentAtWho `json:"atWho"` // 填写评论时@的人 |
152 | CreatedAt int64 `json:"createdAt"` // | 138 | CreatedAt int64 `json:"createdAt"` // |
153 | MeLoveFlag int `json:"meLoveFlag"` //当前人员对评论的点赞标识 (0 没有点赞 1有点赞) | 139 | MeLoveFlag int `json:"meLoveFlag"` //当前人员对评论的点赞标识 (0 没有点赞 1有点赞) |
154 | - Content string `json:"content"` // 评论的内容 | 140 | + Content string `json:"content"` // 评论的内容 |
155 | } | 141 | } |
156 | ) | 142 | ) |
157 | 143 | ||
@@ -205,16 +191,16 @@ type ( | @@ -205,16 +191,16 @@ type ( | ||
205 | } | 191 | } |
206 | ) | 192 | ) |
207 | 193 | ||
208 | -type( | ||
209 | - SystemArticleCommentSearchMeRequest{ | 194 | +type ( |
195 | + SystemArticleCommentSearchMeRequest { | ||
210 | Page int `json:"page"` | 196 | Page int `json:"page"` |
211 | Size int `json:"size"` | 197 | Size int `json:"size"` |
212 | - AuthorId int64 `json:"authorId"` // 用户 | 198 | + AuthorId int64 `json:"authorId"` // 用户 |
213 | BeginTime int64 `json:"beginTime,optional"` // 开始时间 | 199 | BeginTime int64 `json:"beginTime,optional"` // 开始时间 |
214 | - EndTime int64 `json:"endTime,optional"` // 结束时间 | 200 | + EndTime int64 `json:"endTime,optional"` // 结束时间 |
215 | } | 201 | } |
216 | - SystemArticleCommentSearchMeResponse{ | 202 | + SystemArticleCommentSearchMeResponse { |
217 | List []ArticleCommentItem `json:"list"` | 203 | List []ArticleCommentItem `json:"list"` |
218 | - Total int64 `json:"total"` | 204 | + Total int64 `json:"total"` |
219 | } | 205 | } |
220 | ) | 206 | ) |
1 | syntax = "v1" | 1 | syntax = "v1" |
2 | 2 | ||
3 | info( | 3 | info( |
4 | - title: "天联鹰蜓" | ||
5 | - desc: "天联鹰蜓" | ||
6 | - author: "email" | ||
7 | - email: "email" | ||
8 | - version: "v1" | 4 | + title: "天联鹰蜓" |
5 | + desc: "天联鹰蜓" | ||
6 | + author: "email" | ||
7 | + email: "email" | ||
8 | + version: "v1" | ||
9 | ) | 9 | ) |
10 | 10 | ||
11 | // 小程序接口 | 11 | // 小程序接口 |
12 | @server( | 12 | @server( |
13 | - prefix: v1 | ||
14 | - group: company | 13 | + prefix: v1 |
14 | + group: company | ||
15 | ) | 15 | ) |
16 | service Core { | 16 | service Core { |
17 | - @doc "公司搜索(公开的)" | ||
18 | - @handler miniCompanySearch | ||
19 | - post /mini/company/search(CompanySearchRequest) returns (CompanySearchResponse) | 17 | + @doc "公司搜索(公开的)" |
18 | + @handler miniCompanySearch | ||
19 | + post /mini/company/search(CompanySearchRequest) returns (CompanySearchResponse) | ||
20 | } | 20 | } |
21 | 21 | ||
22 | // 小程序接口 | 22 | // 小程序接口 |
23 | @server( | 23 | @server( |
24 | - prefix: v1 | ||
25 | - group: company | ||
26 | - jwt : MiniAuth | 24 | + prefix: v1 |
25 | + group: company | ||
26 | + jwt : MiniAuth | ||
27 | ) | 27 | ) |
28 | service Core { | 28 | service Core { |
29 | - @doc "搜索已加入的公司" | ||
30 | - @handler miniCompanySearchJoined | ||
31 | - post /mini/company/search-joined(CompanySearchRequest) returns (CompanySearchResponse) | 29 | + @doc "搜索已加入的公司" |
30 | + @handler miniCompanySearchJoined | ||
31 | + post /mini/company/search-joined(CompanySearchRequest) returns (CompanySearchResponse) | ||
32 | } | 32 | } |
33 | 33 | ||
34 | // 小程序接口 | 34 | // 小程序接口 |
35 | @server( | 35 | @server( |
36 | - prefix: v1 | ||
37 | - group: company | ||
38 | - jwt : SystemAuth | 36 | + prefix: v1 |
37 | + group: company | ||
38 | + jwt : SystemAuth | ||
39 | ) | 39 | ) |
40 | service Core { | 40 | service Core { |
41 | - @doc "公司搜索" | ||
42 | - @handler systemCompanySearch | ||
43 | - post /system/company/search(CompanySearchRequest) returns (CompanySearchResponse) | 41 | + @doc "公司搜索" |
42 | + @handler systemCompanySearch | ||
43 | + post /system/company/search(CompanySearchRequest) returns (CompanySearchResponse) | ||
44 | } | 44 | } |
45 | 45 | ||
46 | type ( | 46 | type ( |
47 | - CompanySearchRequest struct{ | ||
48 | - Page int `json:"page,optional"` | ||
49 | - Size int `json:"size,optional"` | ||
50 | - Flag int `json:"flag,optional"` // 1:用户已加入的 2:用户未加入的公司 | ||
51 | - UserId int64 `json:"userId,optional"` // 按用户搜索(用户所加入的企业) | ||
52 | - Code string `json:"code,optional"` // 按编码搜索 | ||
53 | - } | ||
54 | - CompanySearchResponse{ | ||
55 | - List []Company `json:"list"` | ||
56 | - Total int64 `json:"total"` | ||
57 | - } | ||
58 | - Company struct{ | ||
59 | - Id int64 `json:"id,omitempty"` // 唯一标识 | ||
60 | - Name string `json:"name,omitempty"` // 名称 | ||
61 | - Code string `json:"code,omitempty"` // 编码(搜索使用,4位字母数字) | ||
62 | - Logo string `json:"logo,omitempty"` // 公司LOGO | ||
63 | - } | 47 | + CompanySearchRequest { |
48 | + Page int `json:"page,optional"` | ||
49 | + Size int `json:"size,optional"` | ||
50 | + Flag int `json:"flag,optional"` // 1:用户已加入的 2:用户未加入的公司 | ||
51 | + UserId int64 `json:"userId,optional"` // 按用户搜索(用户所加入的企业) | ||
52 | + Code string `json:"code,optional"` // 按编码搜索 | ||
53 | + } | ||
54 | + CompanySearchResponse { | ||
55 | + List []Company `json:"list"` | ||
56 | + Total int64 `json:"total"` | ||
57 | + } | ||
58 | + Company { | ||
59 | + Id int64 `json:"id,omitempty"` // 唯一标识 | ||
60 | + Name string `json:"name,omitempty"` // 名称 | ||
61 | + Code string `json:"code,omitempty"` // 编码(搜索使用,4位字母数字) | ||
62 | + Logo string `json:"logo,omitempty"` // 公司LOGO | ||
63 | + } | ||
64 | ) | 64 | ) |
1 | syntax = "v1" | 1 | syntax = "v1" |
2 | 2 | ||
3 | info( | 3 | info( |
4 | - title: "天联鹰蜓" | ||
5 | - desc: "天联鹰蜓" | ||
6 | - author: "email" | ||
7 | - email: "email" | ||
8 | - version: "v1" | 4 | + title: "天联鹰蜓" |
5 | + desc: "天联鹰蜓" | ||
6 | + author: "email" | ||
7 | + email: "email" | ||
8 | + version: "v1" | ||
9 | ) | 9 | ) |
10 | 10 | ||
11 | @server( | 11 | @server( |
12 | - prefix: v1 | ||
13 | - group: role | ||
14 | - middleware: LoginStatusCheck | ||
15 | - jwt: SystemAuth | 12 | + prefix: v1 |
13 | + group: role | ||
14 | + middleware: LoginStatusCheck | ||
15 | + jwt: SystemAuth | ||
16 | ) | 16 | ) |
17 | service Core { | 17 | service Core { |
18 | - @doc "角色详情" | ||
19 | - @handler systemGetRole | ||
20 | - get /system/role/:id (RoleGetRequest) returns (RoleGetResponse) | ||
21 | - @doc "角色新增" | ||
22 | - @handler systemSaveRole | ||
23 | - post /system/role (RoleSaveRequest) returns (RoleSaveResponse) | ||
24 | - @doc "角色删除" | ||
25 | - @handler systemDeleteRole | ||
26 | - delete /system/role/:id (RoleDeleteRequest) returns (RoleDeleteResponse) | ||
27 | - @doc "角色更新" | ||
28 | - @handler systemUpdateRole | ||
29 | - put /system/role/:id (RoleUpdateRequest) returns (RoleUpdateResponse) | ||
30 | - @doc "角色列表搜索" | ||
31 | - @handler systemSearchRole | ||
32 | - post /system/role/search (RoleSearchRequest) returns (RoleSearchResponse) | 18 | + @doc "角色详情" |
19 | + @handler systemGetRole | ||
20 | + get /system/role/:id (RoleGetRequest) returns (RoleGetResponse) | ||
21 | + @doc "角色新增" | ||
22 | + @handler systemSaveRole | ||
23 | + post /system/role (RoleSaveRequest) returns (RoleSaveResponse) | ||
24 | + @doc "角色删除" | ||
25 | + @handler systemDeleteRole | ||
26 | + delete /system/role/:id (RoleDeleteRequest) returns (RoleDeleteResponse) | ||
27 | + @doc "角色更新" | ||
28 | + @handler systemUpdateRole | ||
29 | + put /system/role/:id (RoleUpdateRequest) returns (RoleUpdateResponse) | ||
30 | + @doc "角色列表搜索" | ||
31 | + @handler systemSearchRole | ||
32 | + post /system/role/search (RoleSearchRequest) returns (RoleSearchResponse) | ||
33 | } | 33 | } |
34 | 34 | ||
35 | type ( | 35 | type ( |
36 | - RoleGetRequest { | ||
37 | - Id int64 `path:"id"` | ||
38 | - } | ||
39 | - RoleGetResponse struct{ | ||
40 | - Role RoleItem `json:"role"` | ||
41 | - AuthList []Auth `json:"authList"` | ||
42 | - } | 36 | + RoleGetRequest { |
37 | + Id int64 `path:"id"` | ||
38 | + } | ||
39 | + RoleGetResponse { | ||
40 | + Role RoleItem `json:"role"` | ||
41 | + AuthList []Auth `json:"authList"` | ||
42 | + } | ||
43 | 43 | ||
44 | - RoleSaveRequest struct{ | ||
45 | - Role RoleItem `json:"role"` | ||
46 | - } | ||
47 | - RoleSaveResponse struct{} | 44 | + RoleSaveRequest { |
45 | + Role RoleItem `json:"role"` | ||
46 | + } | ||
47 | + RoleSaveResponse struct{} | ||
48 | 48 | ||
49 | - RoleDeleteRequest struct{ | ||
50 | - Id int64 `path:"id"` | ||
51 | - } | ||
52 | - RoleDeleteResponse struct{} | 49 | + RoleDeleteRequest { |
50 | + Id int64 `path:"id"` | ||
51 | + } | ||
52 | + RoleDeleteResponse struct{} | ||
53 | 53 | ||
54 | - RoleUpdateRequest struct{ | ||
55 | - Id int64 `path:"id"` | ||
56 | - Role RoleItem `json:"role"` | ||
57 | - } | ||
58 | - RoleUpdateResponse struct{} | 54 | + RoleUpdateRequest { |
55 | + Id int64 `path:"id"` | ||
56 | + Role RoleItem `json:"role"` | ||
57 | + } | ||
58 | + RoleUpdateResponse struct{} | ||
59 | 59 | ||
60 | - RoleSearchRequest struct{ | ||
61 | - Page int `json:"page,optional"` | ||
62 | - Size int `json:"size,optional"` | ||
63 | - Style string `json:"style,options=[simple,,full]"` // simple:只返回角色ID名称 full:所有字段都返回 | ||
64 | - } | ||
65 | - RoleSearchResponse{ | ||
66 | - List []RoleItem `json:"list"` | ||
67 | - Total int64 `json:"total"` | ||
68 | - } | ||
69 | - RoleItem struct{ | ||
70 | - Id int64 `json:"id,optional"` // 角色ID | ||
71 | - CompanyId int64 `json:"companyId,optional,omitempty"` // 公司ID | ||
72 | - Name string `json:"name"` // 角色名称 | ||
73 | - AuthIds []int64 `json:"authIds,optional,omitempty"` // 角色权限列表 | ||
74 | - AuthsDesc string `json:"authsDesc,optional,omitempty"` // 权限列表描述 | ||
75 | - UsersDesc string `json:"usersDesc,optional,omitempty"` // 用户列表描述 | ||
76 | - Remark string `json:"remark,optional,omitempty"` // 备注 | ||
77 | - Users []RoleUser `json:"users,optional,omitempty"` // 绑定的用户 | ||
78 | - UpdatedAt int64 `json:"updatedAt,optional,omitempty"` // 更新时间 | ||
79 | - } | ||
80 | - RoleUser { | ||
81 | - Id int64 `json:"id"` | ||
82 | - Name string `json:"name"` | ||
83 | - } | ||
84 | - Auth { | ||
85 | - Id int64 `json:"id"` // ID | ||
86 | - Name string `json:"name"` // 名称 | ||
87 | - Code string `json:"code"` // 编码 | ||
88 | - } | 60 | + RoleSearchRequest { |
61 | + Page int `json:"page,optional"` | ||
62 | + Size int `json:"size,optional"` | ||
63 | + Style string `json:"style,options=[simple,,full]"` // simple:只返回角色ID名称 full:所有字段都返回 | ||
64 | + } | ||
65 | + RoleSearchResponse { | ||
66 | + List []RoleItem `json:"list"` | ||
67 | + Total int64 `json:"total"` | ||
68 | + } | ||
69 | + RoleItem { | ||
70 | + Id int64 `json:"id,optional"` // 角色ID | ||
71 | + CompanyId int64 `json:"companyId,optional,omitempty"` // 公司ID | ||
72 | + Name string `json:"name"` // 角色名称 | ||
73 | + AuthIds []int64 `json:"authIds,optional,omitempty"` // 角色权限列表 | ||
74 | + AuthsDesc string `json:"authsDesc,optional,omitempty"` // 权限列表描述 | ||
75 | + UsersDesc string `json:"usersDesc,optional,omitempty"` // 用户列表描述 | ||
76 | + Remark string `json:"remark,optional,omitempty"` // 备注 | ||
77 | + Users []RoleUser `json:"users,optional,omitempty"` // 绑定的用户 | ||
78 | + UpdatedAt int64 `json:"updatedAt,optional,omitempty"` // 更新时间 | ||
79 | + } | ||
80 | + RoleUser { | ||
81 | + Id int64 `json:"id"` | ||
82 | + Name string `json:"name"` | ||
83 | + } | ||
84 | + Auth { | ||
85 | + Id int64 `json:"id"` // ID | ||
86 | + Name string `json:"name"` // 名称 | ||
87 | + Code string `json:"code"` // 编码 | ||
88 | + } | ||
89 | ) | 89 | ) |
@@ -7,6 +7,8 @@ import ( | @@ -7,6 +7,8 @@ import ( | ||
7 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article" | 7 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article" |
8 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | 8 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" |
9 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | 9 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" |
10 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" | ||
11 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result" | ||
10 | ) | 12 | ) |
11 | 13 | ||
12 | func MiniAllArticleTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | 14 | func MiniAllArticleTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { |
@@ -18,11 +20,10 @@ func MiniAllArticleTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | @@ -18,11 +20,10 @@ func MiniAllArticleTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
18 | } | 20 | } |
19 | 21 | ||
20 | l := article.NewMiniAllArticleTagLogic(r.Context(), svcCtx) | 22 | l := article.NewMiniAllArticleTagLogic(r.Context(), svcCtx) |
23 | + token := contextdata.GetUserTokenFromCtx(r.Context()) | ||
24 | + req.CompanyId = token.CompanyId | ||
25 | + req.UserId = token.UserId | ||
21 | resp, err := l.MiniAllArticleTag(&req) | 26 | resp, err := l.MiniAllArticleTag(&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 | } |
@@ -7,6 +7,8 @@ import ( | @@ -7,6 +7,8 @@ import ( | ||
7 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article" | 7 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article" |
8 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | 8 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" |
9 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | 9 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" |
10 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" | ||
11 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result" | ||
10 | ) | 12 | ) |
11 | 13 | ||
12 | func MiniArticleSetTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | 14 | func MiniArticleSetTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { |
@@ -18,11 +20,10 @@ func MiniArticleSetTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | @@ -18,11 +20,10 @@ func MiniArticleSetTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
18 | } | 20 | } |
19 | 21 | ||
20 | l := article.NewMiniArticleSetTagLogic(r.Context(), svcCtx) | 22 | l := article.NewMiniArticleSetTagLogic(r.Context(), svcCtx) |
23 | + token := contextdata.GetUserTokenFromCtx(r.Context()) | ||
24 | + req.UserId = token.UserId | ||
25 | + req.CompanyId = token.CompanyId | ||
21 | resp, err := l.MiniArticleSetTag(&req) | 26 | resp, err := l.MiniArticleSetTag(&req) |
22 | - if err != nil { | ||
23 | - httpx.ErrorCtx(r.Context(), w, err) | ||
24 | - } else { | ||
25 | - httpx.OkJsonCtx(r.Context(), w, resp) | ||
26 | - } | 27 | + result.HttpResult(r, w, resp, err) |
27 | } | 28 | } |
28 | } | 29 | } |
1 | +package 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 SystemArticleGetHistoryHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
14 | + return func(w http.ResponseWriter, r *http.Request) { | ||
15 | + var req types.SystemArticleGetHistoryRequest | ||
16 | + if err := httpx.Parse(r, &req); err != nil { | ||
17 | + result.ParamErrorResult(r, w, err) | ||
18 | + return | ||
19 | + } | ||
20 | + | ||
21 | + l := article.NewSystemArticleGetHistoryLogic(r.Context(), svcCtx) | ||
22 | + resp, err := l.SystemArticleGetHistory(&req) | ||
23 | + result.HttpResult(r, w, resp, err) | ||
24 | + } | ||
25 | +} |
@@ -15,7 +15,7 @@ func SystemGetArticleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | @@ -15,7 +15,7 @@ func SystemGetArticleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
15 | return func(w http.ResponseWriter, r *http.Request) { | 15 | return func(w http.ResponseWriter, r *http.Request) { |
16 | var req types.SystemArticleGetRequest | 16 | var req types.SystemArticleGetRequest |
17 | if err := httpx.Parse(r, &req); err != nil { | 17 | if err := httpx.Parse(r, &req); err != nil { |
18 | - httpx.ErrorCtx(r.Context(), w, err) | 18 | + result.ParamErrorResult(r, w, err) |
19 | return | 19 | return |
20 | } | 20 | } |
21 | 21 |
1 | -package comment | 1 | +package article |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result" | ||
4 | "net/http" | 5 | "net/http" |
5 | 6 | ||
6 | "github.com/zeromicro/go-zero/rest/httpx" | 7 | "github.com/zeromicro/go-zero/rest/httpx" |
7 | - "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/comment" | 8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/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/svc" |
9 | "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" |
10 | ) | 11 | ) |
11 | 12 | ||
12 | -func MiniArticleCommentAtUserHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | 13 | +func SystemHistoryArticleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { |
13 | return func(w http.ResponseWriter, r *http.Request) { | 14 | return func(w http.ResponseWriter, r *http.Request) { |
14 | - var req types.MiniArticleCommentAtUserRequest | 15 | + var req types.SystemArticleHistoryRequest |
15 | if err := httpx.Parse(r, &req); err != nil { | 16 | if err := httpx.Parse(r, &req); err != nil { |
16 | - httpx.ErrorCtx(r.Context(), w, err) | 17 | + result.ParamErrorResult(r, w, err) |
17 | return | 18 | return |
18 | } | 19 | } |
19 | 20 | ||
20 | - l := comment.NewMiniArticleCommentAtUserLogic(r.Context(), svcCtx) | ||
21 | - resp, err := l.MiniArticleCommentAtUser(&req) | ||
22 | - if err != nil { | ||
23 | - httpx.ErrorCtx(r.Context(), w, err) | ||
24 | - } else { | ||
25 | - httpx.OkJsonCtx(r.Context(), w, resp) | ||
26 | - } | 21 | + l := article.NewSystemHistoryArticleLogic(r.Context(), svcCtx) |
22 | + resp, err := l.SystemHistoryArticle(&req) | ||
23 | + result.HttpResult(r, w, resp, err) | ||
27 | } | 24 | } |
28 | } | 25 | } |
@@ -15,7 +15,7 @@ func SystemSearchArticleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | @@ -15,7 +15,7 @@ func SystemSearchArticleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
15 | return func(w http.ResponseWriter, r *http.Request) { | 15 | return func(w http.ResponseWriter, r *http.Request) { |
16 | var req types.SystemArticleSearchRequest | 16 | var req types.SystemArticleSearchRequest |
17 | if err := httpx.Parse(r, &req); err != nil { | 17 | if err := httpx.Parse(r, &req); err != nil { |
18 | - httpx.ErrorCtx(r.Context(), w, err) | 18 | + result.ParamErrorResult(r, w, err) |
19 | return | 19 | return |
20 | } | 20 | } |
21 | 21 |
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 SystemUpdateArticleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
14 | + return func(w http.ResponseWriter, r *http.Request) { | ||
15 | + var req types.SystemArticleUpdateRequest | ||
16 | + if err := httpx.Parse(r, &req); err != nil { | ||
17 | + result.ParamErrorResult(r, w, err) | ||
18 | + return | ||
19 | + } | ||
20 | + l := article.NewSystemUpdateArticleLogic(r.Context(), svcCtx) | ||
21 | + resp, err := l.SystemUpdateArticle(&req, r.Header.Get("x-mmm-accesstoken")) | ||
22 | + result.HttpResult(r, w, resp, err) | ||
23 | + } | ||
24 | +} |
@@ -14,7 +14,7 @@ func SystemAddHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | @@ -14,7 +14,7 @@ func SystemAddHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
14 | return func(w http.ResponseWriter, r *http.Request) { | 14 | return func(w http.ResponseWriter, r *http.Request) { |
15 | var req types.DepartmentAddRequest | 15 | var req types.DepartmentAddRequest |
16 | if err := httpx.Parse(r, &req); err != nil { | 16 | if err := httpx.Parse(r, &req); err != nil { |
17 | - httpx.ErrorCtx(r.Context(), w, err) | 17 | + result.ParamErrorResult(r, w, err) |
18 | return | 18 | return |
19 | } | 19 | } |
20 | 20 |
@@ -14,7 +14,7 @@ func SystemDeleteHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | @@ -14,7 +14,7 @@ func SystemDeleteHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
14 | return func(w http.ResponseWriter, r *http.Request) { | 14 | return func(w http.ResponseWriter, r *http.Request) { |
15 | var req types.DepartmentGetRequest | 15 | var req types.DepartmentGetRequest |
16 | if err := httpx.Parse(r, &req); err != nil { | 16 | if err := httpx.Parse(r, &req); err != nil { |
17 | - httpx.ErrorCtx(r.Context(), w, err) | 17 | + result.ParamErrorResult(r, w, err) |
18 | return | 18 | return |
19 | } | 19 | } |
20 | 20 |
@@ -14,7 +14,7 @@ func SystemGetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | @@ -14,7 +14,7 @@ func SystemGetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
14 | return func(w http.ResponseWriter, r *http.Request) { | 14 | return func(w http.ResponseWriter, r *http.Request) { |
15 | var req types.DepartmentGetRequest | 15 | var req types.DepartmentGetRequest |
16 | if err := httpx.Parse(r, &req); err != nil { | 16 | if err := httpx.Parse(r, &req); err != nil { |
17 | - httpx.ErrorCtx(r.Context(), w, err) | 17 | + result.ParamErrorResult(r, w, err) |
18 | return | 18 | return |
19 | } | 19 | } |
20 | 20 |
@@ -14,7 +14,7 @@ func SystemListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | @@ -14,7 +14,7 @@ func SystemListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
14 | return func(w http.ResponseWriter, r *http.Request) { | 14 | return func(w http.ResponseWriter, r *http.Request) { |
15 | var req types.DepartmentListRequest | 15 | var req types.DepartmentListRequest |
16 | if err := httpx.Parse(r, &req); err != nil { | 16 | if err := httpx.Parse(r, &req); err != nil { |
17 | - httpx.ErrorCtx(r.Context(), w, err) | 17 | + result.ParamErrorResult(r, w, err) |
18 | return | 18 | return |
19 | } | 19 | } |
20 | 20 |
@@ -14,7 +14,7 @@ func SystemUpdateHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | @@ -14,7 +14,7 @@ func SystemUpdateHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
14 | return func(w http.ResponseWriter, r *http.Request) { | 14 | return func(w http.ResponseWriter, r *http.Request) { |
15 | var req types.DepartmentUpdateRequest | 15 | var req types.DepartmentUpdateRequest |
16 | if err := httpx.Parse(r, &req); err != nil { | 16 | if err := httpx.Parse(r, &req); err != nil { |
17 | - httpx.ErrorCtx(r.Context(), w, err) | 17 | + result.ParamErrorResult(r, w, err) |
18 | return | 18 | return |
19 | } | 19 | } |
20 | 20 |
@@ -14,7 +14,7 @@ func MiniBusinessHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | @@ -14,7 +14,7 @@ func MiniBusinessHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
14 | return func(w http.ResponseWriter, r *http.Request) { | 14 | return func(w http.ResponseWriter, r *http.Request) { |
15 | var req types.MessageBusinessRequest | 15 | var req types.MessageBusinessRequest |
16 | if err := httpx.Parse(r, &req); err != nil { | 16 | if err := httpx.Parse(r, &req); err != nil { |
17 | - httpx.ErrorCtx(r.Context(), w, err) | 17 | + result.ParamErrorResult(r, w, err) |
18 | return | 18 | return |
19 | } | 19 | } |
20 | 20 |
@@ -14,7 +14,7 @@ func MiniSystemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | @@ -14,7 +14,7 @@ func MiniSystemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
14 | return func(w http.ResponseWriter, r *http.Request) { | 14 | return func(w http.ResponseWriter, r *http.Request) { |
15 | var req types.MessageSystemRequest | 15 | var req types.MessageSystemRequest |
16 | if err := httpx.Parse(r, &req); err != nil { | 16 | if err := httpx.Parse(r, &req); err != nil { |
17 | - httpx.ErrorCtx(r.Context(), w, err) | 17 | + result.ParamErrorResult(r, w, err) |
18 | return | 18 | return |
19 | } | 19 | } |
20 | 20 |
@@ -22,11 +22,6 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | @@ -22,11 +22,6 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | ||
22 | []rest.Route{ | 22 | []rest.Route{ |
23 | { | 23 | { |
24 | Method: http.MethodPost, | 24 | Method: http.MethodPost, |
25 | - Path: "/article_comment/at_user/select", | ||
26 | - Handler: comment.MiniArticleCommentAtUserHandler(serverCtx), | ||
27 | - }, | ||
28 | - { | ||
29 | - Method: http.MethodPost, | ||
30 | Path: "/article_comment", | 25 | Path: "/article_comment", |
31 | Handler: comment.MiniCreateArticleCommentHandler(serverCtx), | 26 | Handler: comment.MiniCreateArticleCommentHandler(serverCtx), |
32 | }, | 27 | }, |
@@ -120,7 +115,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | @@ -120,7 +115,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | ||
120 | Handler: tags.SearchTagHandler(serverCtx), | 115 | Handler: tags.SearchTagHandler(serverCtx), |
121 | }, | 116 | }, |
122 | }, | 117 | }, |
123 | - rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret), | 118 | + rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret), |
124 | rest.WithPrefix("/v1/system"), | 119 | rest.WithPrefix("/v1/system"), |
125 | ) | 120 | ) |
126 | 121 | ||
@@ -387,6 +382,21 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | @@ -387,6 +382,21 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | ||
387 | Handler: article.SystemSearchArticleHandler(serverCtx), | 382 | Handler: article.SystemSearchArticleHandler(serverCtx), |
388 | }, | 383 | }, |
389 | { | 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 | + { | ||
395 | + Method: http.MethodGet, | ||
396 | + Path: "/article/history/:id", | ||
397 | + Handler: article.SystemArticleGetHistoryHandler(serverCtx), | ||
398 | + }, | ||
399 | + { | ||
390 | Method: http.MethodPost, | 400 | Method: http.MethodPost, |
391 | Path: "/article/search/me", | 401 | Path: "/article/search/me", |
392 | Handler: article.SystemArticleSearchMeHandler(serverCtx), | 402 | Handler: article.SystemArticleSearchMeHandler(serverCtx), |
@@ -7,6 +7,8 @@ import ( | @@ -7,6 +7,8 @@ import ( | ||
7 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/tags" | 7 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/tags" |
8 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | 8 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" |
9 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | 9 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" |
10 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" | ||
11 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result" | ||
10 | ) | 12 | ) |
11 | 13 | ||
12 | func CreateTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | 14 | func CreateTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { |
@@ -18,11 +20,9 @@ func CreateTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | @@ -18,11 +20,9 @@ func CreateTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
18 | } | 20 | } |
19 | 21 | ||
20 | l := tags.NewCreateTagLogic(r.Context(), svcCtx) | 22 | l := tags.NewCreateTagLogic(r.Context(), svcCtx) |
23 | + token := contextdata.GetUserTokenFromCtx(r.Context()) | ||
24 | + req.CompanyId = token.CompanyId | ||
21 | resp, err := l.CreateTag(&req) | 25 | resp, err := l.CreateTag(&req) |
22 | - if err != nil { | ||
23 | - httpx.ErrorCtx(r.Context(), w, err) | ||
24 | - } else { | ||
25 | - httpx.OkJsonCtx(r.Context(), w, resp) | ||
26 | - } | 26 | + result.HttpResult(r, w, resp, err) |
27 | } | 27 | } |
28 | } | 28 | } |
@@ -7,6 +7,8 @@ import ( | @@ -7,6 +7,8 @@ import ( | ||
7 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/tags" | 7 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/tags" |
8 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | 8 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" |
9 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | 9 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" |
10 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" | ||
11 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result" | ||
10 | ) | 12 | ) |
11 | 13 | ||
12 | func DeleteTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | 14 | func DeleteTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { |
@@ -18,11 +20,9 @@ func DeleteTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | @@ -18,11 +20,9 @@ func DeleteTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
18 | } | 20 | } |
19 | 21 | ||
20 | l := tags.NewDeleteTagLogic(r.Context(), svcCtx) | 22 | l := tags.NewDeleteTagLogic(r.Context(), svcCtx) |
23 | + token := contextdata.GetUserTokenFromCtx(r.Context()) | ||
24 | + req.CompanyId = token.CompanyId | ||
21 | resp, err := l.DeleteTag(&req) | 25 | resp, err := l.DeleteTag(&req) |
22 | - if err != nil { | ||
23 | - httpx.ErrorCtx(r.Context(), w, err) | ||
24 | - } else { | ||
25 | - httpx.OkJsonCtx(r.Context(), w, resp) | ||
26 | - } | 26 | + result.HttpResult(r, w, resp, err) |
27 | } | 27 | } |
28 | } | 28 | } |
@@ -7,6 +7,8 @@ import ( | @@ -7,6 +7,8 @@ import ( | ||
7 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/tags" | 7 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/tags" |
8 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | 8 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" |
9 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | 9 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" |
10 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" | ||
11 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result" | ||
10 | ) | 12 | ) |
11 | 13 | ||
12 | func EditTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | 14 | func EditTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { |
@@ -18,11 +20,9 @@ func EditTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | @@ -18,11 +20,9 @@ func EditTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
18 | } | 20 | } |
19 | 21 | ||
20 | l := tags.NewEditTagLogic(r.Context(), svcCtx) | 22 | l := tags.NewEditTagLogic(r.Context(), svcCtx) |
23 | + token := contextdata.GetUserTokenFromCtx(r.Context()) | ||
24 | + req.CompanyId = token.CompanyId | ||
21 | resp, err := l.EditTag(&req) | 25 | resp, err := l.EditTag(&req) |
22 | - if err != nil { | ||
23 | - httpx.ErrorCtx(r.Context(), w, err) | ||
24 | - } else { | ||
25 | - httpx.OkJsonCtx(r.Context(), w, resp) | ||
26 | - } | 26 | + result.HttpResult(r, w, resp, err) |
27 | } | 27 | } |
28 | } | 28 | } |
@@ -7,6 +7,8 @@ import ( | @@ -7,6 +7,8 @@ import ( | ||
7 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/tags" | 7 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/tags" |
8 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | 8 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" |
9 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | 9 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" |
10 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" | ||
11 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result" | ||
10 | ) | 12 | ) |
11 | 13 | ||
12 | func GetTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | 14 | func GetTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { |
@@ -16,13 +18,10 @@ func GetTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | @@ -16,13 +18,10 @@ func GetTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
16 | httpx.ErrorCtx(r.Context(), w, err) | 18 | httpx.ErrorCtx(r.Context(), w, err) |
17 | return | 19 | return |
18 | } | 20 | } |
19 | - | 21 | + token := contextdata.GetUserTokenFromCtx(r.Context()) |
22 | + req.CompanyId = token.CompanyId | ||
20 | l := tags.NewGetTagLogic(r.Context(), svcCtx) | 23 | l := tags.NewGetTagLogic(r.Context(), svcCtx) |
21 | resp, err := l.GetTag(&req) | 24 | resp, err := l.GetTag(&req) |
22 | - if err != nil { | ||
23 | - httpx.ErrorCtx(r.Context(), w, err) | ||
24 | - } else { | ||
25 | - httpx.OkJsonCtx(r.Context(), w, resp) | ||
26 | - } | 25 | + result.HttpResult(r, w, resp, err) |
27 | } | 26 | } |
28 | } | 27 | } |
@@ -7,6 +7,8 @@ import ( | @@ -7,6 +7,8 @@ import ( | ||
7 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/tags" | 7 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/tags" |
8 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | 8 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" |
9 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | 9 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" |
10 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" | ||
11 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result" | ||
10 | ) | 12 | ) |
11 | 13 | ||
12 | func SearchTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | 14 | func SearchTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { |
@@ -18,11 +20,9 @@ func SearchTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | @@ -18,11 +20,9 @@ func SearchTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
18 | } | 20 | } |
19 | 21 | ||
20 | l := tags.NewSearchTagLogic(r.Context(), svcCtx) | 22 | l := tags.NewSearchTagLogic(r.Context(), svcCtx) |
23 | + token := contextdata.GetUserTokenFromCtx(r.Context()) | ||
24 | + req.CompanyId = token.CompanyId | ||
21 | resp, err := l.SearchTag(&req) | 25 | resp, err := l.SearchTag(&req) |
22 | - if err != nil { | ||
23 | - httpx.ErrorCtx(r.Context(), w, err) | ||
24 | - } else { | ||
25 | - httpx.OkJsonCtx(r.Context(), w, resp) | ||
26 | - } | 26 | + result.HttpResult(r, w, resp, err) |
27 | } | 27 | } |
28 | } | 28 | } |
@@ -14,7 +14,7 @@ func MiniMyLikeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | @@ -14,7 +14,7 @@ func MiniMyLikeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
14 | return func(w http.ResponseWriter, r *http.Request) { | 14 | return func(w http.ResponseWriter, r *http.Request) { |
15 | var req types.MiniMyLikeRequest | 15 | var req types.MiniMyLikeRequest |
16 | if err := httpx.Parse(r, &req); err != nil { | 16 | if err := httpx.Parse(r, &req); err != nil { |
17 | - httpx.ErrorCtx(r.Context(), w, err) | 17 | + result.ParamErrorResult(r, w, err) |
18 | return | 18 | return |
19 | } | 19 | } |
20 | 20 |
@@ -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 | ) |
@@ -24,7 +26,44 @@ func NewMiniAllArticleTagLogic(ctx context.Context, svcCtx *svc.ServiceContext) | @@ -24,7 +26,44 @@ func NewMiniAllArticleTagLogic(ctx context.Context, svcCtx *svc.ServiceContext) | ||
24 | } | 26 | } |
25 | 27 | ||
26 | func (l *MiniAllArticleTagLogic) MiniAllArticleTag(req *types.MiniAllArticleTagRequest) (resp *types.MiniAllArticleTagResponse, err error) { | 28 | func (l *MiniAllArticleTagLogic) MiniAllArticleTag(req *types.MiniAllArticleTagRequest) (resp *types.MiniAllArticleTagResponse, err error) { |
27 | - // todo: add your logic here and delete this line | ||
28 | - | ||
29 | - return | 29 | + var conn = l.svcCtx.DefaultDBConn() |
30 | + queryOption := domain.NewQueryOptions().WithFindOnly() | ||
31 | + _, tagList, err := l.svcCtx.ArticleTagRepository.Find(l.ctx, conn, req.CompanyId, queryOption) | ||
32 | + if err != nil { | ||
33 | + return nil, xerr.NewErrMsgErr("获取标签列表失败", err) | ||
34 | + } | ||
35 | + // 合并输出数据 | ||
36 | + var group []string | ||
37 | + tagMap := map[string][]types.ArticleTagItem{} | ||
38 | + for _, val := range tagList { | ||
39 | + if m, ok := tagMap[val.Category]; ok { | ||
40 | + m = append(m, types.ArticleTagItem{ | ||
41 | + Id: val.Id, | ||
42 | + Group: val.Category, | ||
43 | + Name: val.Name, | ||
44 | + Image: val.Image.Url, | ||
45 | + }) | ||
46 | + tagMap[val.Category] = m | ||
47 | + } else { | ||
48 | + group = append(group, val.Category) | ||
49 | + tagMap[val.Category] = []types.ArticleTagItem{ | ||
50 | + { | ||
51 | + Id: val.Id, | ||
52 | + Group: val.Category, | ||
53 | + Name: val.Name, | ||
54 | + Image: val.Image.Url, | ||
55 | + }, | ||
56 | + } | ||
57 | + } | ||
58 | + } | ||
59 | + resp = &types.MiniAllArticleTagResponse{ | ||
60 | + TagGroup: make([]types.ArticleTagGroup, 0), | ||
61 | + } | ||
62 | + for i := range group { | ||
63 | + resp.TagGroup = append(resp.TagGroup, types.ArticleTagGroup{ | ||
64 | + Group: group[i], | ||
65 | + Tags: tagMap[group[i]], | ||
66 | + }) | ||
67 | + } | ||
68 | + return resp, nil | ||
30 | } | 69 | } |
@@ -2,6 +2,7 @@ package article | @@ -2,6 +2,7 @@ package article | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "context" | 4 | "context" |
5 | + | ||
5 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | 6 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" |
6 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" | 7 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" |
7 | 8 | ||
@@ -25,6 +26,7 @@ func NewMiniArticleMarkListLogic(ctx context.Context, svcCtx *svc.ServiceContext | @@ -25,6 +26,7 @@ func NewMiniArticleMarkListLogic(ctx context.Context, svcCtx *svc.ServiceContext | ||
25 | } | 26 | } |
26 | } | 27 | } |
27 | 28 | ||
29 | +// 获取我的文章浏览记录 | ||
28 | func (l *MiniArticleMarkListLogic) MiniArticleMarkList(req *types.MiniArticleMarkListRequest) (resp *types.MiniArticleMarkListResponse, err error) { | 30 | func (l *MiniArticleMarkListLogic) MiniArticleMarkList(req *types.MiniArticleMarkListRequest) (resp *types.MiniArticleMarkListResponse, err error) { |
29 | var userToken = contextdata.GetUserTokenFromCtx(l.ctx) | 31 | var userToken = contextdata.GetUserTokenFromCtx(l.ctx) |
30 | 32 |
@@ -5,6 +5,9 @@ import ( | @@ -5,6 +5,9 @@ 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/db/transaction" | ||
9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | ||
10 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" | ||
8 | 11 | ||
9 | "github.com/zeromicro/go-zero/core/logx" | 12 | "github.com/zeromicro/go-zero/core/logx" |
10 | ) | 13 | ) |
@@ -23,8 +26,65 @@ func NewMiniArticleSetTagLogic(ctx context.Context, svcCtx *svc.ServiceContext) | @@ -23,8 +26,65 @@ func NewMiniArticleSetTagLogic(ctx context.Context, svcCtx *svc.ServiceContext) | ||
23 | } | 26 | } |
24 | } | 27 | } |
25 | 28 | ||
29 | +// 设置文章的定性标签 | ||
26 | func (l *MiniArticleSetTagLogic) MiniArticleSetTag(req *types.MiniArticleSetTagRequest) (resp *types.MiniArticleSetTagResponse, err error) { | 30 | func (l *MiniArticleSetTagLogic) MiniArticleSetTag(req *types.MiniArticleSetTagRequest) (resp *types.MiniArticleSetTagResponse, err error) { |
27 | - // todo: add your logic here and delete this line | 31 | + var conn = l.svcCtx.DefaultDBConn() |
32 | + // | ||
33 | + articleInfo, err := l.svcCtx.ArticleRepository.FindOne(l.ctx, conn, req.ArticleId) | ||
34 | + if err != nil { | ||
35 | + return nil, xerr.NewErrMsgErr("获取文章信息失败", err) | ||
36 | + } | ||
37 | + if articleInfo.CompanyId != req.CompanyId { | ||
38 | + return nil, xerr.NewErrMsg("获取文章信息失败") | ||
39 | + } | ||
28 | 40 | ||
29 | - return | 41 | + tagInfo, err := l.svcCtx.ArticleTagRepository.FindOne(l.ctx, conn, req.TagId) |
42 | + if err != nil { | ||
43 | + return nil, xerr.NewErrMsgErr("获取标签信息失败", err) | ||
44 | + } | ||
45 | + | ||
46 | + if tagInfo.CompanyId != req.CompanyId { | ||
47 | + return nil, xerr.NewErrMsg("获取标签信息失败") | ||
48 | + } | ||
49 | + // 查询可能存在的 ArticleAndTag | ||
50 | + queryOption := domain.NewQueryOptions().WithFindOnly().MustWithKV("articleId", articleInfo.Id) | ||
51 | + _, oldTags, err := l.svcCtx.ArticleAndTagRepository.Find(l.ctx, conn, queryOption) | ||
52 | + if err != nil { | ||
53 | + return nil, xerr.NewErrMsgErr("检查文章的标签失败", err) | ||
54 | + } | ||
55 | + // 更新article中的tags | ||
56 | + articleInfo.Tags = []int64{tagInfo.Id} | ||
57 | + // 额外保存一份ArticleAndTag | ||
58 | + articleAndTag := domain.ArticleAndTag{ | ||
59 | + Id: 0, | ||
60 | + CompanyId: articleInfo.CompanyId, | ||
61 | + CreatedAt: 0, | ||
62 | + UpdatedAt: 0, | ||
63 | + ArticleId: articleInfo.Id, | ||
64 | + TagId: tagInfo.Id, | ||
65 | + } | ||
66 | + err = transaction.UseTrans(l.ctx, conn.DB(), func(ctx context.Context, c transaction.Conn) error { | ||
67 | + //清理可能存在的 ArticleAndTag | ||
68 | + for _, v := range oldTags { | ||
69 | + _, err = l.svcCtx.ArticleAndTagRepository.Delete(ctx, c, v) | ||
70 | + if err != nil { | ||
71 | + return err | ||
72 | + } | ||
73 | + } | ||
74 | + // 更新article | ||
75 | + _, err = l.svcCtx.ArticleRepository.UpdateWithVersion(ctx, c, articleInfo) | ||
76 | + if err != nil { | ||
77 | + return err | ||
78 | + } | ||
79 | + _, err = l.svcCtx.ArticleAndTagRepository.Insert(ctx, c, &articleAndTag) | ||
80 | + if err != nil { | ||
81 | + return err | ||
82 | + } | ||
83 | + return nil | ||
84 | + }, true) | ||
85 | + | ||
86 | + resp = &types.MiniArticleSetTagResponse{ | ||
87 | + Id: articleAndTag.Id, | ||
88 | + } | ||
89 | + return resp, nil | ||
30 | } | 90 | } |
@@ -71,6 +71,7 @@ func (l *MiniUserLikeArticleLogic) MiniUserLikeArticle(req *types.MiniUserLikeAr | @@ -71,6 +71,7 @@ func (l *MiniUserLikeArticleLogic) MiniUserLikeArticle(req *types.MiniUserLikeAr | ||
71 | if u, ok := userMap[val.UserId]; ok { | 71 | if u, ok := userMap[val.UserId]; ok { |
72 | item.Name = u.Name | 72 | item.Name = u.Name |
73 | item.Avatar = u.Avatar | 73 | item.Avatar = u.Avatar |
74 | + item.Position = u.Position | ||
74 | } | 75 | } |
75 | resp.List[i] = item | 76 | resp.List[i] = item |
76 | } | 77 | } |
1 | -package comment | 1 | +package article |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "context" | 4 | "context" |
@@ -9,22 +9,22 @@ import ( | @@ -9,22 +9,22 @@ import ( | ||
9 | "github.com/zeromicro/go-zero/core/logx" | 9 | "github.com/zeromicro/go-zero/core/logx" |
10 | ) | 10 | ) |
11 | 11 | ||
12 | -type MiniArticleCommentAtUserLogic struct { | 12 | +type SystemArticleGetHistoryLogic 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 NewMiniArticleCommentAtUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniArticleCommentAtUserLogic { | ||
19 | - return &MiniArticleCommentAtUserLogic{ | 18 | +func NewSystemArticleGetHistoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemArticleGetHistoryLogic { |
19 | + return &SystemArticleGetHistoryLogic{ | ||
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 *MiniArticleCommentAtUserLogic) MiniArticleCommentAtUser(req *types.MiniArticleCommentAtUserRequest) (resp *types.MiniArticleCommentAtUserResponse, err error) { | ||
27 | - // todo: add your logic here and delete this line | 26 | +func (l *SystemArticleGetHistoryLogic) SystemArticleGetHistory(req *types.SystemArticleGetHistoryRequest) (resp *types.SystemArticleGetHistoryResponse, err error) { |
27 | + //var conn = l.svcCtx.DefaultDBConn() | ||
28 | 28 | ||
29 | return | 29 | return |
30 | } | 30 | } |
@@ -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,94 @@ func NewSystemGetArticleLogic(ctx context.Context, svcCtx *svc.ServiceContext) * | @@ -24,7 +27,94 @@ 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 | + Tags: make([]types.ArticleTagItem, 0), | ||
67 | + } | ||
68 | + //标签 | ||
69 | + if len(article.Tags) > 0 { | ||
70 | + _, tags, err := l.svcCtx.ArticleTagRepository.Find(l.ctx, conn, article.CompanyId, domain.NewQueryOptions().WithKV("ids", article.Tags)) | ||
71 | + if err == nil && len(tags) > 0 { | ||
72 | + lo.ForEach(tags, func(tag *domain.ArticleTag, index int) { | ||
73 | + resp.Tags = append(resp.Tags, types.ArticleTagItem{ | ||
74 | + Id: tag.Id, | ||
75 | + Group: tag.Category, | ||
76 | + Name: tag.Name, | ||
77 | + Image: tag.Image.Url, | ||
78 | + }) | ||
79 | + }) | ||
80 | + } | ||
81 | + } | ||
82 | + //文章段落 | ||
83 | + _, articleSections, err := l.svcCtx.ArticleSectionRepository.Find(l.ctx, conn, domain.NewQueryOptions().WithKV("articleId", req.Id)) | ||
84 | + if err != nil { | ||
85 | + return nil, xerr.NewErrMsgErr("获取帖子异常", err) | ||
86 | + } | ||
87 | + lo.ForEach(articleSections, func(item *domain.ArticleSection, index int) { | ||
88 | + resp.Section = append(resp.Section, types.ArticleSection{ | ||
89 | + Id: item.Id, | ||
90 | + Content: item.Content, | ||
91 | + SortBy: item.SortBy, | ||
92 | + TotalComment: item.TotalComment, | ||
93 | + }) | ||
94 | + }) | ||
95 | + userIds := lo.Union(resp.WhoRead, resp.WhoReview) | ||
96 | + if len(userIds) > 0 { | ||
97 | + _, users, err := l.svcCtx.UserRepository.Find(l.ctx, conn, domain.NewQueryOptions().WithKV("ids", userIds)) | ||
98 | + if err != nil { | ||
99 | + return nil, xerr.NewErrMsgErr("获取帖子异常", err) | ||
100 | + } | ||
101 | + userSlices := make(map[int64]types.UserShowName) | ||
102 | + lo.ForEach(users, func(user *domain.User, index int) { | ||
103 | + userSlices[user.Id] = types.UserShowName{ | ||
104 | + Id: int(user.Id), | ||
105 | + Name: user.Name, | ||
106 | + } | ||
107 | + }) | ||
108 | + lo.ForEach(resp.WhoRead, func(userId int64, index int) { | ||
109 | + if value, ok := userSlices[userId]; ok { | ||
110 | + resp.WhoReadInfo = append(resp.WhoReadInfo, value) | ||
111 | + } | ||
112 | + }) | ||
113 | + lo.ForEach(resp.WhoReview, func(userId int64, index int) { | ||
114 | + if value, ok := userSlices[userId]; ok { | ||
115 | + resp.WhoReviewInfo = append(resp.WhoReviewInfo, value) | ||
116 | + } | ||
117 | + }) | ||
118 | + } | ||
119 | + return resp, nil | ||
30 | } | 120 | } |
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/domain" | ||
7 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" | ||
8 | + | ||
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 | + "github.com/zeromicro/go-zero/core/logx" | ||
13 | +) | ||
14 | + | ||
15 | +type SystemHistoryArticleLogic struct { | ||
16 | + logx.Logger | ||
17 | + ctx context.Context | ||
18 | + svcCtx *svc.ServiceContext | ||
19 | +} | ||
20 | + | ||
21 | +func NewSystemHistoryArticleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemHistoryArticleLogic { | ||
22 | + return &SystemHistoryArticleLogic{ | ||
23 | + Logger: logx.WithContext(ctx), | ||
24 | + ctx: ctx, | ||
25 | + svcCtx: svcCtx, | ||
26 | + } | ||
27 | +} | ||
28 | + | ||
29 | +func (l *SystemHistoryArticleLogic) SystemHistoryArticle(req *types.SystemArticleHistoryRequest) (resp *types.SystemArticleHistoryResponse, err error) { | ||
30 | + var conn = l.svcCtx.DefaultDBConn() | ||
31 | + total, list, err := l.svcCtx.ArticleBackupRepository.Find( | ||
32 | + l.ctx, | ||
33 | + conn, | ||
34 | + domain.NewQueryOptions(). | ||
35 | + WithOffsetLimit(req.Page, req.Size). | ||
36 | + WithKV("articleId", req.ArticleId). | ||
37 | + WithKV("operator", req.Author). | ||
38 | + WithKV("beginCreatedAt", req.BeginTime). | ||
39 | + WithKV("endCreatedAt", req.EndTime), | ||
40 | + ) | ||
41 | + if err != nil { | ||
42 | + return nil, xerr.NewErrMsgErr("搜索编辑历史异常", err) | ||
43 | + } | ||
44 | + resp = &types.SystemArticleHistoryResponse{ | ||
45 | + Total: int(total), | ||
46 | + List: make([]types.SystemArticleHistory, 0), | ||
47 | + } | ||
48 | + lo.ForEach(list, func(item *domain.ArticleBackup, index int) { | ||
49 | + resp.List = append(resp.List, types.SystemArticleHistory{ | ||
50 | + Id: item.Id, | ||
51 | + Author: item.Operator.Name, | ||
52 | + Action: item.Action, | ||
53 | + UpdatedAt: item.CreatedAt, | ||
54 | + }) | ||
55 | + }) | ||
56 | + return | ||
57 | +} |
@@ -2,9 +2,11 @@ package article | @@ -2,9 +2,11 @@ package article | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "context" | 4 | "context" |
5 | - | 5 | + "github.com/samber/lo" |
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 | ) |
@@ -24,7 +26,38 @@ func NewSystemSearchArticleLogic(ctx context.Context, svcCtx *svc.ServiceContext | @@ -24,7 +26,38 @@ func NewSystemSearchArticleLogic(ctx context.Context, svcCtx *svc.ServiceContext | ||
24 | } | 26 | } |
25 | 27 | ||
26 | func (l *SystemSearchArticleLogic) SystemSearchArticle(req *types.SystemArticleSearchRequest) (resp *types.SystemArticleSearchResponse, err error) { | 28 | 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 | 29 | + var conn = l.svcCtx.DefaultDBConn() |
30 | + queryOptions := domain.NewQueryOptions(). | ||
31 | + WithOffsetLimit(req.Page, req.Size). | ||
32 | + WithKV("title", req.Title). | ||
33 | + WithKV("author", req.Author). | ||
34 | + WithKV("beginCreatedAt", req.BeginTime). | ||
35 | + WithKV("endCreatedAt", req.EndTime) | ||
36 | + total, articles, err := l.svcCtx.ArticleRepository.Find(l.ctx, conn, req.CompanyId, queryOptions) | ||
37 | + if err != nil { | ||
38 | + return nil, xerr.NewErrMsgErr("搜索帖子异常", err) | ||
39 | + } | ||
40 | + resp = &types.SystemArticleSearchResponse{ | ||
41 | + Total: int(total), | ||
42 | + List: make([]types.SystemArticleSearch, 0), | ||
43 | + } | ||
44 | + lo.ForEach(articles, func(item *domain.Article, index int) { | ||
45 | + images := make([]string, 0) | ||
46 | + lo.ForEach(item.Images, func(img domain.Image, n int) { | ||
47 | + images = append(images, img.Url) | ||
48 | + }) | ||
49 | + resp.List = append(resp.List, types.SystemArticleSearch{ | ||
50 | + Id: item.Id, | ||
51 | + Title: item.Title, | ||
52 | + Author: item.Author.Name, | ||
53 | + Images: images, | ||
54 | + CreatedAt: item.CreatedAt, | ||
55 | + CountLove: item.CountLove, | ||
56 | + CountComment: item.CountComment, | ||
57 | + Show: int(item.Show), | ||
58 | + Tags: nil, | ||
59 | + TargetUser: int(item.TargetUser), | ||
60 | + }) | ||
61 | + }) | ||
62 | + return resp, nil | ||
30 | } | 63 | } |
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/cmd/discuss/interanl/pkg/gateway/authlib" | ||
9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" | ||
10 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" | ||
11 | + | ||
12 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | ||
13 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | ||
14 | + | ||
15 | + "github.com/zeromicro/go-zero/core/logx" | ||
16 | +) | ||
17 | + | ||
18 | +type SystemUpdateArticleLogic struct { | ||
19 | + logx.Logger | ||
20 | + ctx context.Context | ||
21 | + svcCtx *svc.ServiceContext | ||
22 | +} | ||
23 | + | ||
24 | +func NewSystemUpdateArticleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemUpdateArticleLogic { | ||
25 | + return &SystemUpdateArticleLogic{ | ||
26 | + Logger: logx.WithContext(ctx), | ||
27 | + ctx: ctx, | ||
28 | + svcCtx: svcCtx, | ||
29 | + } | ||
30 | +} | ||
31 | + | ||
32 | +func (l *SystemUpdateArticleLogic) SystemUpdateArticle(req *types.SystemArticleUpdateRequest, accessToken string) (resp *types.SystemArticleUpdateResponse, err error) { | ||
33 | + var conn = l.svcCtx.DefaultDBConn() | ||
34 | + userToken := contextdata.GetUserTokenFromCtx(l.ctx) | ||
35 | + article, err := l.svcCtx.ArticleRepository.FindOne(l.ctx, conn, req.Id) | ||
36 | + if err != nil { | ||
37 | + return nil, xerr.NewErrMsgErr("帖子不存在", err) | ||
38 | + } | ||
39 | + //TODO 获取图片的尺寸大小 | ||
40 | + images := []domain.Image{} | ||
41 | + for _, val := range req.Images { | ||
42 | + images = append(images, domain.Image{ | ||
43 | + Url: val, | ||
44 | + Width: 0, | ||
45 | + Height: 0, | ||
46 | + }) | ||
47 | + } | ||
48 | + article.Title = req.Title | ||
49 | + article.Version = article.Version + 1 | ||
50 | + article.Images = images | ||
51 | + article.WhoRead = req.WhoRead | ||
52 | + article.WhoReview = req.WhoReview | ||
53 | + article.TargetUser = domain.ArticleTarget(req.TargetUser) | ||
54 | + article.Location = domain.Location{ | ||
55 | + Longitude: req.Location.Longitude, | ||
56 | + Latitude: req.Location.Latitude, | ||
57 | + Descript: req.Location.Descript, | ||
58 | + } | ||
59 | + article.Tags = req.Tags | ||
60 | + //文章内容 | ||
61 | + articleSections := []domain.ArticleSection{} | ||
62 | + lo.ForEach(req.Section, func(item types.ArticleSection, index int) { | ||
63 | + articleSections = append(articleSections, domain.ArticleSection{ | ||
64 | + Id: item.Id, | ||
65 | + CompanyId: article.CompanyId, | ||
66 | + Version: article.Version, | ||
67 | + ArticleId: article.Id, | ||
68 | + Content: item.Content, | ||
69 | + SortBy: index + 1, | ||
70 | + }) | ||
71 | + }) | ||
72 | + //设置内容概要 | ||
73 | + if len(req.Section) > 0 { | ||
74 | + // 截取内容 30个字 | ||
75 | + runeNumber := 0 //字数 | ||
76 | + stringIndex := 0 //字符串长度 | ||
77 | + for i := range req.Section[0].Content { | ||
78 | + if runeNumber > 30 { | ||
79 | + break | ||
80 | + } | ||
81 | + runeNumber += 1 | ||
82 | + stringIndex = i | ||
83 | + } | ||
84 | + article.Summary = req.Section[0].Content[0:stringIndex] | ||
85 | + } | ||
86 | + //获取当前用户信息 | ||
87 | + userMe, err := l.svcCtx.ApiAuthService.MeInfo(l.ctx, authlib.RequestUserMeQuery{Token: accessToken}) | ||
88 | + if err != nil { | ||
89 | + return nil, xerr.NewErrMsgErr("获取当前用户信息失败", err) | ||
90 | + } | ||
91 | + err = transaction.UseTrans(l.ctx, conn.DB(), func(ctx context.Context, c transaction.Conn) error { | ||
92 | + _, err = l.svcCtx.ArticleRepository.Update(l.ctx, c, article) | ||
93 | + if err != nil { | ||
94 | + return xerr.NewErrMsgErr("保存文章失败", err) | ||
95 | + } | ||
96 | + //文章内容 | ||
97 | + updateSectionIds := []int64{} | ||
98 | + for _, item := range articleSections { | ||
99 | + if item.Id > 0 { | ||
100 | + section, err := l.svcCtx.ArticleSectionRepository.FindOne(ctx, c, item.Id) | ||
101 | + if err != nil { | ||
102 | + return xerr.NewErrMsgErr("获取文章段落内容失败", err) | ||
103 | + } | ||
104 | + section.Content = item.Content | ||
105 | + section.ArticleId = item.ArticleId | ||
106 | + section.Version = item.Version | ||
107 | + section.SortBy = item.SortBy | ||
108 | + section.CompanyId = item.CompanyId | ||
109 | + _, err = l.svcCtx.ArticleSectionRepository.Update(ctx, c, section) | ||
110 | + if err != nil { | ||
111 | + return xerr.NewErrMsgErr("保存文章段落内容失败", err) | ||
112 | + } | ||
113 | + } else { | ||
114 | + _, err = l.svcCtx.ArticleSectionRepository.Insert(ctx, c, &item) | ||
115 | + if err != nil { | ||
116 | + return xerr.NewErrMsgErr("保存文章段落内容失败", err) | ||
117 | + } | ||
118 | + } | ||
119 | + updateSectionIds = append(updateSectionIds, item.Id) | ||
120 | + } | ||
121 | + if len(updateSectionIds) > 0 { | ||
122 | + err = l.svcCtx.ArticleSectionRepository.DeleteBy(ctx, c, domain.NewQueryOptions().WithKV("articleId", article.Id).WithKV("notIds", updateSectionIds)) | ||
123 | + if err != nil { | ||
124 | + return xerr.NewErrMsgErr("保存文章内容失败", err) | ||
125 | + } | ||
126 | + } | ||
127 | + //备份数据 | ||
128 | + backup := article.MakeBackup(domain.UserSimple{ | ||
129 | + Id: userToken.UserId, | ||
130 | + Name: userMe.User.NickName, | ||
131 | + Avatar: userMe.User.Avatar, | ||
132 | + CompanyId: userToken.CompanyId, | ||
133 | + Company: userMe.CurrentCompany.Name, | ||
134 | + }, articleSections) | ||
135 | + backup.Action = "编辑" | ||
136 | + _, err = l.svcCtx.ArticleBackupRepository.Insert(ctx, c, backup) | ||
137 | + if err != nil { | ||
138 | + return xerr.NewErrMsgErr("保存文章内容失败", err) | ||
139 | + } | ||
140 | + return nil | ||
141 | + }, true) | ||
142 | + resp = &types.SystemArticleUpdateResponse{ | ||
143 | + Id: article.Id, | ||
144 | + Title: article.Title, | ||
145 | + Images: req.Images, | ||
146 | + CreatedAt: article.CreatedAt, | ||
147 | + CountLove: article.CountLove, | ||
148 | + CountComment: article.CountComment, | ||
149 | + Show: int(article.Show), | ||
150 | + TargetUser: int(article.TargetUser), | ||
151 | + Tags: article.Tags, | ||
152 | + } | ||
153 | + return | ||
154 | +} |
@@ -2,9 +2,12 @@ package comment | @@ -2,9 +2,12 @@ package comment | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "context" | 4 | "context" |
5 | + "sort" | ||
6 | + "strings" | ||
5 | 7 | ||
6 | "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" |
7 | "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/cmd/discuss/interanl/pkg/domain" | ||
8 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" | 11 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" |
9 | 12 | ||
10 | "github.com/zeromicro/go-zero/core/logx" | 13 | "github.com/zeromicro/go-zero/core/logx" |
@@ -24,6 +27,7 @@ func NewMiniArticleCommentAtWhoLogic(ctx context.Context, svcCtx *svc.ServiceCon | @@ -24,6 +27,7 @@ func NewMiniArticleCommentAtWhoLogic(ctx context.Context, svcCtx *svc.ServiceCon | ||
24 | } | 27 | } |
25 | } | 28 | } |
26 | 29 | ||
30 | +// MiniArticleCommentAtWho 填写评估时@谁 的可选择者列表 | ||
27 | func (l *MiniArticleCommentAtWhoLogic) MiniArticleCommentAtWho(req *types.MiniArticleCommentAtWhoRequest) (resp *types.MiniArticleCommentAtWhoResponse, err error) { | 31 | func (l *MiniArticleCommentAtWhoLogic) MiniArticleCommentAtWho(req *types.MiniArticleCommentAtWhoRequest) (resp *types.MiniArticleCommentAtWhoResponse, err error) { |
28 | var conn = l.svcCtx.DefaultDBConn() | 32 | var conn = l.svcCtx.DefaultDBConn() |
29 | articleInfo, err := l.svcCtx.ArticleRepository.FindOne(l.ctx, conn, req.ArticleId) | 33 | articleInfo, err := l.svcCtx.ArticleRepository.FindOne(l.ctx, conn, req.ArticleId) |
@@ -35,11 +39,42 @@ func (l *MiniArticleCommentAtWhoLogic) MiniArticleCommentAtWho(req *types.MiniAr | @@ -35,11 +39,42 @@ func (l *MiniArticleCommentAtWhoLogic) MiniArticleCommentAtWho(req *types.MiniAr | ||
35 | return resp, nil | 39 | return resp, nil |
36 | } | 40 | } |
37 | 41 | ||
38 | - // userList := []*domain.User{} | ||
39 | - // if len(articleInfo.WhoRead) == 0 { | 42 | + var userList []*domain.User |
43 | + if len(articleInfo.WhoRead) == 0 { | ||
44 | + //获取所有人 | ||
45 | + queryOption := domain.NewQueryOptions().WithFindOnly().MustWithKV("companyId", articleInfo.CompanyId) | ||
46 | + _, userList, err = l.svcCtx.UserRepository.Find(l.ctx, conn, queryOption) | ||
47 | + if err != nil { | ||
48 | + resp = &types.MiniArticleCommentAtWhoResponse{} | ||
49 | + return resp, nil | ||
50 | + } | ||
51 | + } else { | ||
52 | + queryOption := domain.NewQueryOptions().WithFindOnly().MustWithKV("ids", articleInfo.WhoRead) | ||
53 | + _, userList, err = l.svcCtx.UserRepository.Find(l.ctx, conn, queryOption) | ||
54 | + if err != nil { | ||
55 | + resp = &types.MiniArticleCommentAtWhoResponse{} | ||
56 | + return resp, nil | ||
57 | + } | ||
58 | + } | ||
40 | 59 | ||
41 | - // return | ||
42 | - // } | 60 | + uList := make([]types.CommentAtWho, len(userList)) |
43 | 61 | ||
44 | - return | 62 | + for i := range userList { |
63 | + uList[i] = types.CommentAtWho{ | ||
64 | + Id: userList[i].Id, | ||
65 | + Name: userList[i].Name, | ||
66 | + FirstLetter: "", | ||
67 | + } | ||
68 | + for _, val := range userList[i].PinYinName { | ||
69 | + uList[i].FirstLetter = strings.ToUpper(string(val)) | ||
70 | + break | ||
71 | + } | ||
72 | + } | ||
73 | + sort.Slice(uList, func(i, j int) bool { | ||
74 | + return uList[i].FirstLetter < uList[j].FirstLetter | ||
75 | + }) | ||
76 | + resp = &types.MiniArticleCommentAtWhoResponse{ | ||
77 | + List: uList, | ||
78 | + } | ||
79 | + return resp, nil | ||
45 | } | 80 | } |
@@ -52,12 +52,12 @@ func (l *MiniCreateArticleCommentLogic) MiniCreateArticleComment(req *types.Mini | @@ -52,12 +52,12 @@ func (l *MiniCreateArticleCommentLogic) MiniCreateArticleComment(req *types.Mini | ||
52 | return nil, xerr.NewErrMsg("没有评论权限") | 52 | return nil, xerr.NewErrMsg("没有评论权限") |
53 | } | 53 | } |
54 | //查看评论权限, | 54 | //查看评论权限, |
55 | - // if len(articleInfo.WhoReview) > 0 { | ||
56 | - // ok := lo.IndexOf(articleInfo.WhoReview, req.FromUserId) | ||
57 | - // if ok < 0 { | ||
58 | - // return nil, xerr.NewErrMsg("没有评论权限") | ||
59 | - // } | ||
60 | - // } | 55 | + if len(articleInfo.WhoReview) > 0 { |
56 | + ok := lo.IndexOf(articleInfo.WhoReview, req.FromUserId) | ||
57 | + if ok < 0 { | ||
58 | + return nil, xerr.NewErrMsg("没有评论权限") | ||
59 | + } | ||
60 | + } | ||
61 | // 对段落进行评论 | 61 | // 对段落进行评论 |
62 | var selctionInfo *domain.ArticleSection | 62 | var selctionInfo *domain.ArticleSection |
63 | if req.SectionId > 0 { | 63 | if req.SectionId > 0 { |
@@ -43,7 +43,6 @@ func (l *SystemAddLogic) SystemAdd(req *types.DepartmentAddRequest) (resp *types | @@ -43,7 +43,6 @@ func (l *SystemAddLogic) SystemAdd(req *types.DepartmentAddRequest) (resp *types | ||
43 | } | 43 | } |
44 | 44 | ||
45 | insert := &domain.Department{ | 45 | insert := &domain.Department{ |
46 | - Id: 0, | ||
47 | ParentId: 0, | 46 | ParentId: 0, |
48 | CompanyId: userToken.CompanyId, | 47 | CompanyId: userToken.CompanyId, |
49 | Name: req.Name, | 48 | Name: req.Name, |
@@ -32,14 +32,14 @@ func (l *CreateTagLogic) CreateTag(req *types.TagCreateRequest) (resp *types.Tag | @@ -32,14 +32,14 @@ func (l *CreateTagLogic) CreateTag(req *types.TagCreateRequest) (resp *types.Tag | ||
32 | //检查重复 | 32 | //检查重复 |
33 | cnt, _, err := l.svcCtx.ArticleTagRepository.Find(l.ctx, conn, req.CompanyId, map[string]interface{}{ | 33 | cnt, _, err := l.svcCtx.ArticleTagRepository.Find(l.ctx, conn, req.CompanyId, map[string]interface{}{ |
34 | "name": req.Name, | 34 | "name": req.Name, |
35 | - "group": req.Group, | 35 | + "category": req.Category, |
36 | "countOnly": true, | 36 | "countOnly": true, |
37 | }) | 37 | }) |
38 | if err != nil { | 38 | if err != nil { |
39 | return nil, xerr.NewErrMsgErr("添加标签失败", err) | 39 | return nil, xerr.NewErrMsgErr("添加标签失败", err) |
40 | } | 40 | } |
41 | if cnt > 0 { | 41 | if cnt > 0 { |
42 | - return nil, xerr.NewErrMsg(fmt.Sprintf("已存在标签 分类[%s]名称[%s]", req.Group, req.Name)) | 42 | + return nil, xerr.NewErrMsg(fmt.Sprintf("已存在标签 分类[%s]名称[%s]", req.Category, req.Name)) |
43 | } | 43 | } |
44 | //TODO 获取图片的尺寸大小 | 44 | //TODO 获取图片的尺寸大小 |
45 | 45 | ||
@@ -55,9 +55,10 @@ func (l *CreateTagLogic) CreateTag(req *types.TagCreateRequest) (resp *types.Tag | @@ -55,9 +55,10 @@ func (l *CreateTagLogic) CreateTag(req *types.TagCreateRequest) (resp *types.Tag | ||
55 | Width: 0, | 55 | Width: 0, |
56 | Height: 0, | 56 | Height: 0, |
57 | }, | 57 | }, |
58 | - Name: req.Name, | ||
59 | - Group: req.Group, | ||
60 | - Remark: req.Remark, | 58 | + Name: req.Name, |
59 | + Category: req.Category, | ||
60 | + Remark: req.Remark, | ||
61 | + Other: req.Other, | ||
61 | } | 62 | } |
62 | 63 | ||
63 | newTag, err = l.svcCtx.ArticleTagRepository.Insert(l.ctx, conn, newTag) | 64 | newTag, err = l.svcCtx.ArticleTagRepository.Insert(l.ctx, conn, newTag) |
@@ -33,7 +33,7 @@ func (l *EditTagLogic) EditTag(req *types.TagEditRequest) (resp *types.TagEditRe | @@ -33,7 +33,7 @@ func (l *EditTagLogic) EditTag(req *types.TagEditRequest) (resp *types.TagEditRe | ||
33 | queryOptions := domain.NewQueryOptions(). | 33 | queryOptions := domain.NewQueryOptions(). |
34 | WithFindOnly(). | 34 | WithFindOnly(). |
35 | MustWithKV("name", req.Name). | 35 | MustWithKV("name", req.Name). |
36 | - MustWithKV("group", req.Group). | 36 | + MustWithKV("category", req.Category). |
37 | WithOffsetLimit(1, 1) | 37 | WithOffsetLimit(1, 1) |
38 | 38 | ||
39 | _, tagList, err := l.svcCtx.ArticleTagRepository.Find(l.ctx, conn, req.CompanyId, queryOptions) | 39 | _, tagList, err := l.svcCtx.ArticleTagRepository.Find(l.ctx, conn, req.CompanyId, queryOptions) |
@@ -42,7 +42,7 @@ func (l *EditTagLogic) EditTag(req *types.TagEditRequest) (resp *types.TagEditRe | @@ -42,7 +42,7 @@ func (l *EditTagLogic) EditTag(req *types.TagEditRequest) (resp *types.TagEditRe | ||
42 | } | 42 | } |
43 | if len(tagList) > 0 { | 43 | if len(tagList) > 0 { |
44 | if tagList[0].Id != req.Id { | 44 | if tagList[0].Id != req.Id { |
45 | - return nil, xerr.NewErrMsg(fmt.Sprintf("已存在标签 分类[%s]名称[%s]", req.Group, req.Name)) | 45 | + return nil, xerr.NewErrMsg(fmt.Sprintf("已存在标签 分类[%s]名称[%s]", req.Category, req.Name)) |
46 | } | 46 | } |
47 | } | 47 | } |
48 | oldTag, err := l.svcCtx.ArticleTagRepository.FindOne(l.ctx, conn, req.Id) | 48 | oldTag, err := l.svcCtx.ArticleTagRepository.FindOne(l.ctx, conn, req.Id) |
@@ -55,11 +55,11 @@ func (l *EditTagLogic) EditTag(req *types.TagEditRequest) (resp *types.TagEditRe | @@ -55,11 +55,11 @@ func (l *EditTagLogic) EditTag(req *types.TagEditRequest) (resp *types.TagEditRe | ||
55 | 55 | ||
56 | //TODO 获取图片的尺寸大小 | 56 | //TODO 获取图片的尺寸大小 |
57 | 57 | ||
58 | - oldTag.Group = req.Group | 58 | + oldTag.Category = req.Category |
59 | oldTag.Image.Url = req.Image | 59 | oldTag.Image.Url = req.Image |
60 | oldTag.Name = req.Name | 60 | oldTag.Name = req.Name |
61 | oldTag.Remark = req.Remark | 61 | oldTag.Remark = req.Remark |
62 | - | 62 | + oldTag.Other = req.Other |
63 | oldTag, err = l.svcCtx.ArticleTagRepository.Update(l.ctx, conn, oldTag) | 63 | oldTag, err = l.svcCtx.ArticleTagRepository.Update(l.ctx, conn, oldTag) |
64 | if err != nil { | 64 | if err != nil { |
65 | return nil, xerr.NewErrMsgErr("添加标签失败", err) | 65 | return nil, xerr.NewErrMsgErr("添加标签失败", err) |
@@ -35,11 +35,12 @@ func (l *GetTagLogic) GetTag(req *types.TagGetRequest) (resp *types.TagGetRespon | @@ -35,11 +35,12 @@ func (l *GetTagLogic) GetTag(req *types.TagGetRequest) (resp *types.TagGetRespon | ||
35 | return nil, xerr.NewErrMsg("获取标签失败") | 35 | return nil, xerr.NewErrMsg("获取标签失败") |
36 | } | 36 | } |
37 | resp = &types.TagGetResponse{ | 37 | resp = &types.TagGetResponse{ |
38 | - Id: oldTag.Id, | ||
39 | - Image: oldTag.Image.Url, | ||
40 | - Name: oldTag.Name, | ||
41 | - Group: oldTag.Group, | ||
42 | - Remark: oldTag.Remark, | 38 | + Id: oldTag.Id, |
39 | + Image: oldTag.Image.Url, | ||
40 | + Name: oldTag.Name, | ||
41 | + Category: oldTag.Category, | ||
42 | + Remark: oldTag.Remark, | ||
43 | + Other: oldTag.Other, | ||
43 | } | 44 | } |
44 | return | 45 | return |
45 | } | 46 | } |
@@ -27,8 +27,8 @@ func (l *SearchTagLogic) SearchTag(req *types.TagListRequest) (resp *types.TagLi | @@ -27,8 +27,8 @@ func (l *SearchTagLogic) SearchTag(req *types.TagListRequest) (resp *types.TagLi | ||
27 | var conn = l.svcCtx.DefaultDBConn() | 27 | var conn = l.svcCtx.DefaultDBConn() |
28 | queryOptions := domain.NewQueryOptions().WithOffsetLimit(req.Page, req.Size) | 28 | queryOptions := domain.NewQueryOptions().WithOffsetLimit(req.Page, req.Size) |
29 | 29 | ||
30 | - if len(req.Group) > 0 { | ||
31 | - queryOptions = queryOptions.MustWithKV("group", req.Group) | 30 | + if len(req.Category) > 0 { |
31 | + queryOptions = queryOptions.MustWithKV("group", req.Category) | ||
32 | } | 32 | } |
33 | if len(req.TagName) > 0 { | 33 | if len(req.TagName) > 0 { |
34 | queryOptions = queryOptions.MustWithKV("name", req.TagName) | 34 | queryOptions = queryOptions.MustWithKV("name", req.TagName) |
@@ -50,10 +50,10 @@ func (l *SearchTagLogic) SearchTag(req *types.TagListRequest) (resp *types.TagLi | @@ -50,10 +50,10 @@ func (l *SearchTagLogic) SearchTag(req *types.TagListRequest) (resp *types.TagLi | ||
50 | Id: tagList[i].Id, | 50 | Id: tagList[i].Id, |
51 | Image: tagList[i].Image.Url, | 51 | Image: tagList[i].Image.Url, |
52 | Name: tagList[i].Name, | 52 | Name: tagList[i].Name, |
53 | - Group: tagList[i].Group, | 53 | + Category: tagList[i].Category, |
54 | Remark: tagList[i].Remark, | 54 | Remark: tagList[i].Remark, |
55 | CreatedAt: tagList[i].CreatedAt, | 55 | CreatedAt: tagList[i].CreatedAt, |
56 | } | 56 | } |
57 | } | 57 | } |
58 | - return | 58 | + return resp, nil |
59 | } | 59 | } |
@@ -26,6 +26,7 @@ type ServiceContext struct { | @@ -26,6 +26,7 @@ type ServiceContext struct { | ||
26 | ArticleRepository domain.ArticleRepository | 26 | ArticleRepository domain.ArticleRepository |
27 | ArticleSectionRepository domain.ArticleSectionRepository | 27 | ArticleSectionRepository domain.ArticleSectionRepository |
28 | ArticleTagRepository domain.ArticleTagRepository | 28 | ArticleTagRepository domain.ArticleTagRepository |
29 | + ArticleAndTagRepository domain.ArticleAndTagRepository | ||
29 | 30 | ||
30 | CompanyRepository domain.CompanyRepository | 31 | CompanyRepository domain.CompanyRepository |
31 | CommentRepository domain.CommentRepository // 待移除 | 32 | CommentRepository domain.CommentRepository // 待移除 |
@@ -59,12 +60,14 @@ func NewServiceContext(c config.Config) *ServiceContext { | @@ -59,12 +60,14 @@ func NewServiceContext(c config.Config) *ServiceContext { | ||
59 | ApiAuthService: apiAuth, | 60 | ApiAuthService: apiAuth, |
60 | LoginStatusCheck: middleware.NewLoginStatusCheckMiddleware(apiAuth).Handle, | 61 | LoginStatusCheck: middleware.NewLoginStatusCheckMiddleware(apiAuth).Handle, |
61 | 62 | ||
62 | - CommentRepository: repository.NewCommentRepository(cache.NewCachedRepository(mlCache)), | ||
63 | - ArticleBackupRepository: repository.NewArticleBackupRepository(cache.NewCachedRepository(mlCache)), | ||
64 | - ArticleCommentRepository: repository.NewArticleCommentRepository(cache.NewCachedRepository(mlCache)), | ||
65 | - ArticleDraftRepository: repository.NewArticleDraftRepository(cache.NewCachedRepository(mlCache)), | ||
66 | - ArticleRepository: repository.NewArticleRepository(cache.NewCachedRepository(mlCache)), | ||
67 | - ArticleSectionRepository: repository.NewArticleSectionRepository(cache.NewCachedRepository(mlCache)), | 63 | + CommentRepository: repository.NewCommentRepository(cache.NewCachedRepository(mlCache)), |
64 | + ArticleBackupRepository: repository.NewArticleBackupRepository(cache.NewCachedRepository(mlCache)), | ||
65 | + ArticleCommentRepository: repository.NewArticleCommentRepository(cache.NewCachedRepository(mlCache)), | ||
66 | + ArticleDraftRepository: repository.NewArticleDraftRepository(cache.NewCachedRepository(mlCache)), | ||
67 | + ArticleRepository: repository.NewArticleRepository(cache.NewCachedRepository(mlCache)), | ||
68 | + ArticleSectionRepository: repository.NewArticleSectionRepository(cache.NewCachedRepository(mlCache)), | ||
69 | + ArticleAndTagRepository: repository.NewArticleAndTagRepository(cache.NewCachedRepository(mlCache)), | ||
70 | + | ||
68 | CompanyRepository: repository.NewCompanyRepository(cache.NewCachedRepository(mlCache)), | 71 | CompanyRepository: repository.NewCompanyRepository(cache.NewCachedRepository(mlCache)), |
69 | DepartmentRepository: repository.NewDepartmentRepository(cache.NewCachedRepository(mlCache)), | 72 | DepartmentRepository: repository.NewDepartmentRepository(cache.NewCachedRepository(mlCache)), |
70 | MessageBusinessRepository: repository.NewMessageBusinessRepository(cache.NewCachedRepository(mlCache)), | 73 | MessageBusinessRepository: repository.NewMessageBusinessRepository(cache.NewCachedRepository(mlCache)), |
1 | // Code generated by goctl. DO NOT EDIT. | 1 | // Code generated by goctl. DO NOT EDIT. |
2 | package types | 2 | package types |
3 | 3 | ||
4 | -type MiniArticleCommentAtUserRequest struct { | ||
5 | - ArtitceId int64 `json:"articleId"` | ||
6 | -} | ||
7 | - | ||
8 | -type MiniArticleCommentAtUserResponse struct { | ||
9 | -} | ||
10 | - | ||
11 | type CommentAuthor struct { | 4 | type CommentAuthor struct { |
12 | Id int64 `json:"id"` // 人员id | 5 | Id int64 `json:"id"` // 人员id |
13 | Name string `json:"name"` // 人员的名字 | 6 | Name string `json:"name"` // 人员的名字 |
@@ -27,8 +20,9 @@ type MiniCreateArticleCommentRequest struct { | @@ -27,8 +20,9 @@ type MiniCreateArticleCommentRequest struct { | ||
27 | } | 20 | } |
28 | 21 | ||
29 | type CommentAtWho struct { | 22 | type CommentAtWho struct { |
30 | - Id int64 `json:"id"` | ||
31 | - Name string `json:"name,optional"` | 23 | + Id int64 `json:"id"` |
24 | + Name string `json:"name,optional"` | ||
25 | + FirstLetter string `json:"firstLetter,optional"` | ||
32 | } | 26 | } |
33 | 27 | ||
34 | type MiniCreateArticleCommentResponse struct { | 28 | type MiniCreateArticleCommentResponse struct { |
@@ -208,11 +202,12 @@ type SimpleArticle struct { | @@ -208,11 +202,12 @@ type SimpleArticle struct { | ||
208 | } | 202 | } |
209 | 203 | ||
210 | type TagCreateRequest struct { | 204 | type TagCreateRequest struct { |
211 | - CompanyId int64 `json:"companyId"` | 205 | + CompanyId int64 `json:",optional"` |
212 | Image string `json:"image"` | 206 | Image string `json:"image"` |
213 | Name string `json:"name"` // 标签名称 | 207 | Name string `json:"name"` // 标签名称 |
214 | - Group string `json:"group"` // 标签分类 | 208 | + Category string `json:"category"` // 标签分类 |
215 | Remark string `json:"remark,optional"` // 备注 | 209 | Remark string `json:"remark,optional"` // 备注 |
210 | + Other string `json:"other"` | ||
216 | } | 211 | } |
217 | 212 | ||
218 | type TagCreateResponse struct { | 213 | type TagCreateResponse struct { |
@@ -221,11 +216,12 @@ type TagCreateResponse struct { | @@ -221,11 +216,12 @@ type TagCreateResponse struct { | ||
221 | 216 | ||
222 | type TagEditRequest struct { | 217 | type TagEditRequest struct { |
223 | Id int64 `json:"id"` | 218 | Id int64 `json:"id"` |
224 | - CompanyId int64 `json:"-"` | 219 | + CompanyId int64 `json:",optional"` |
225 | Image string `json:"image"` | 220 | Image string `json:"image"` |
226 | Name string `json:"name"` // 标签名称 | 221 | Name string `json:"name"` // 标签名称 |
227 | - Group string `json:"group"` // 标签分类 | 222 | + Category string `json:"category"` // 标签分类 |
228 | Remark string `json:"remark,optional"` // 备注 | 223 | Remark string `json:"remark,optional"` // 备注 |
224 | + Other string `json:"other"` | ||
229 | } | 225 | } |
230 | 226 | ||
231 | type TagEditResponse struct { | 227 | type TagEditResponse struct { |
@@ -234,23 +230,24 @@ type TagEditResponse struct { | @@ -234,23 +230,24 @@ type TagEditResponse struct { | ||
234 | 230 | ||
235 | type TagGetRequest struct { | 231 | type TagGetRequest struct { |
236 | Id int64 `path:"id"` | 232 | Id int64 `path:"id"` |
237 | - CompanyId int64 `path:"-"` | 233 | + CompanyId int64 `path:",optional"` |
238 | } | 234 | } |
239 | 235 | ||
240 | type TagGetResponse struct { | 236 | type TagGetResponse struct { |
241 | - Id int64 `json:"id"` | ||
242 | - Image string `json:"image"` | ||
243 | - Name string `json:"name"` // 标签名称 | ||
244 | - Group string `json:"group"` // 标签分类 | ||
245 | - Remark string `json:"remark"` // 备注 | 237 | + Id int64 `json:"id"` |
238 | + Image string `json:"image"` | ||
239 | + Name string `json:"name"` // 标签名称 | ||
240 | + Category string `json:"category"` // 标签分类 | ||
241 | + Remark string `json:"remark"` // 备注 | ||
242 | + Other string `json:"other"` | ||
246 | } | 243 | } |
247 | 244 | ||
248 | type TagListRequest struct { | 245 | type TagListRequest struct { |
249 | Page int `json:"page"` | 246 | Page int `json:"page"` |
250 | Size int `json:"size"` | 247 | Size int `json:"size"` |
251 | - CompanyId int64 `json:"-"` | 248 | + CompanyId int64 `json:",optional"` |
252 | TagName string `json:"tagName,optional"` | 249 | TagName string `json:"tagName,optional"` |
253 | - Group string `json:"group,optional"` | 250 | + Category string `json:"category,optional"` |
254 | Remark string `json:"remark,optional"` | 251 | Remark string `json:"remark,optional"` |
255 | } | 252 | } |
256 | 253 | ||
@@ -262,15 +259,15 @@ type TagListResponse struct { | @@ -262,15 +259,15 @@ type TagListResponse struct { | ||
262 | type TagItem struct { | 259 | type TagItem struct { |
263 | Id int64 `json:"id"` | 260 | Id int64 `json:"id"` |
264 | Image string `json:"image"` | 261 | Image string `json:"image"` |
265 | - Name string `json:"name"` // 标签名称 | ||
266 | - Group string `json:"group"` // 标签分类 | ||
267 | - Remark string `json:"remark"` // 备注 | 262 | + Name string `json:"name"` // 标签名称 |
263 | + Category string `json:"category"` // 标签分类 | ||
264 | + Remark string `json:"remark"` // 备注 | ||
268 | CreatedAt int64 `json:"createdAt"` | 265 | CreatedAt int64 `json:"createdAt"` |
269 | } | 266 | } |
270 | 267 | ||
271 | type TagDeleteRequest struct { | 268 | type TagDeleteRequest struct { |
272 | Id int64 `path:"id"` | 269 | Id int64 `path:"id"` |
273 | - CompanyId int64 `path:"-"` | 270 | + CompanyId int64 `path:",optional"` |
274 | } | 271 | } |
275 | 272 | ||
276 | type TagDeleteResponse struct { | 273 | type TagDeleteResponse struct { |
@@ -682,6 +679,7 @@ type WhichUserLikeArticle struct { | @@ -682,6 +679,7 @@ type WhichUserLikeArticle struct { | ||
682 | UserId int64 `json:"userId"` // 人员id | 679 | UserId int64 `json:"userId"` // 人员id |
683 | Name string `json:"name"` // 人员名称 | 680 | Name string `json:"name"` // 人员名称 |
684 | Avatar string `json:"avatar"` // 人员头像 | 681 | Avatar string `json:"avatar"` // 人员头像 |
682 | + Position string `json:"position"` // 职位 | ||
685 | CreatedAt int64 `json:"createdAt"` // 点赞记录的时间 | 683 | CreatedAt int64 `json:"createdAt"` // 点赞记录的时间 |
686 | } | 684 | } |
687 | 685 | ||
@@ -844,8 +842,6 @@ type MiniArticleSetTagResponse struct { | @@ -844,8 +842,6 @@ type MiniArticleSetTagResponse struct { | ||
844 | type MiniAllArticleTagRequest struct { | 842 | type MiniAllArticleTagRequest struct { |
845 | CompanyId int64 `json:",optional"` // 公司id | 843 | CompanyId int64 `json:",optional"` // 公司id |
846 | UserId int64 `json:",optional"` // 公司id | 844 | UserId int64 `json:",optional"` // 公司id |
847 | - ArticleId int64 `json:"articleId"` // 文章id | ||
848 | - TagId int64 `json:"tagId"` // 标签id | ||
849 | } | 845 | } |
850 | 846 | ||
851 | type MiniAllArticleTagResponse struct { | 847 | type MiniAllArticleTagResponse struct { |
@@ -861,6 +857,7 @@ type ArticleTagItem struct { | @@ -861,6 +857,7 @@ type ArticleTagItem struct { | ||
861 | Id int64 `json:"id"` | 857 | Id int64 `json:"id"` |
862 | Group string `json:"group"` | 858 | Group string `json:"group"` |
863 | Name string `json:"name"` | 859 | Name string `json:"name"` |
860 | + Image string `json:"image"` | ||
864 | } | 861 | } |
865 | 862 | ||
866 | type SystemArticleGetRequest struct { | 863 | type SystemArticleGetRequest struct { |
@@ -869,8 +866,8 @@ type SystemArticleGetRequest struct { | @@ -869,8 +866,8 @@ type SystemArticleGetRequest struct { | ||
869 | } | 866 | } |
870 | 867 | ||
871 | type UserShowName struct { | 868 | type UserShowName struct { |
872 | - Id int `json:"id"` | ||
873 | - Name int `json:"name"` | 869 | + Id int `json:"id"` |
870 | + Name string `json:"name"` | ||
874 | } | 871 | } |
875 | 872 | ||
876 | type SystemArticleGetResponse struct { | 873 | type SystemArticleGetResponse struct { |
@@ -890,12 +887,18 @@ type SystemArticleGetResponse struct { | @@ -890,12 +887,18 @@ type SystemArticleGetResponse struct { | ||
890 | CountComment int `json:"countComment"` // 评论数量 | 887 | CountComment int `json:"countComment"` // 评论数量 |
891 | CountRead int `json:"countRead"` // 浏览数量 | 888 | CountRead int `json:"countRead"` // 浏览数量 |
892 | Show int `json:"show"` // 评论的展示状态(0显示、1不显示) | 889 | Show int `json:"show"` // 评论的展示状态(0显示、1不显示) |
890 | + Tags []ArticleTagItem `json:"tags"` //标签 | ||
893 | } | 891 | } |
894 | 892 | ||
895 | type SystemArticleSearchRequest struct { | 893 | type SystemArticleSearchRequest struct { |
896 | - CompanyId int64 `json:",optional"` | ||
897 | - Page int `json:"page"` | ||
898 | - Size int `json:"size"` | 894 | + CompanyId int64 `json:"companyId,optional"` |
895 | + Title string `json:"title,optional"` //标题 | ||
896 | + Author string `json:"author,optional"` //发布人 | ||
897 | + BeginTime int64 `json:"beginTime,optional"` //开始时间 | ||
898 | + EndTime int64 `json:"endTime,optional"` //结束时间 | ||
899 | + Tags []int64 `json:"tags,optional"` //标签 | ||
900 | + Page int `json:"page"` //页码 | ||
901 | + Size int `json:"size"` //每页行数 | ||
899 | } | 902 | } |
900 | 903 | ||
901 | type SystemArticleSearchResponse struct { | 904 | type SystemArticleSearchResponse struct { |
@@ -916,6 +919,80 @@ type SystemArticleSearch struct { | @@ -916,6 +919,80 @@ 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:"companyId,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 | + Tags []int64 `json:"tags"` // 标签 | ||
934 | +} | ||
935 | + | ||
936 | +type SystemArticleUpdateResponse struct { | ||
937 | + Id int64 `json:"id"` //id | ||
938 | + Title string `json:"title"` //标题 | ||
939 | + Author string `json:"author"` //发布人 | ||
940 | + Images []string `json:"images"` //图片 | ||
941 | + CreatedAt int64 `json:"createdAt"` //文章的创建日期 | ||
942 | + CountLove int `json:"countLove"` //点赞数量 | ||
943 | + CountComment int `json:"CountComment"` //评论数量 | ||
944 | + Show int `json:"show"` //是否隐藏 [0显示、1不显示] | ||
945 | + Tags []int64 `json:"tags"` //标签 | ||
946 | + TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] | ||
947 | +} | ||
948 | + | ||
949 | +type SystemArticleHistoryRequest struct { | ||
950 | + ArticleId int64 `json:"articleId"` //文章ID | ||
951 | + Author string `json:"author,optional"` //发布人 | ||
952 | + BeginTime int64 `json:"beginTime,optional"` //开始时间 | ||
953 | + EndTime int64 `json:"endTime,optional"` //结束时间 | ||
954 | + Page int `json:"page"` //页码 | ||
955 | + Size int `json:"size"` //每页行数 | ||
956 | +} | ||
957 | + | ||
958 | +type SystemArticleHistoryResponse struct { | ||
959 | + Total int `json:"total"` | ||
960 | + List []SystemArticleHistory `json:"list"` | ||
961 | +} | ||
962 | + | ||
963 | +type SystemArticleHistory struct { | ||
964 | + Id int64 `json:"id"` //id | ||
965 | + Author string `json:"author"` //编辑人 | ||
966 | + Action string `json:"action"` //编辑类型 | ||
967 | + UpdatedAt int64 `json:"updatedAt"` //编辑时间 | ||
968 | +} | ||
969 | + | ||
970 | +type SystemArticleGetHistoryRequest struct { | ||
971 | + Id int64 `path:"id"` //id | ||
972 | + CompanyId int64 `path:",optional"` | ||
973 | +} | ||
974 | + | ||
975 | +type SystemArticleGetHistoryResponse struct { | ||
976 | + Id int64 `json:"id"` // id | ||
977 | + ArticleId int64 `json:"articleId"` // 文章ID | ||
978 | + Title string `json:"title"` // 标题 | ||
979 | + AuthorId int64 `json:"authorId"` // 发布人id | ||
980 | + Author ArticleAuthor `json:"author"` // 发布人 | ||
981 | + CreatedAt int64 `json:"createdAt"` // 文章的发布时间 | ||
982 | + Section []ArticleSection `json:"section"` // 文章的文本内容 | ||
983 | + Images []string `json:"images"` // 图片 | ||
984 | + WhoRead []int64 `json:"whoRead"` // 谁可查看 | ||
985 | + WhoReadInfo []UserShowName `json:"whoReadInfo"` // 谁可查看 | ||
986 | + WhoReview []int64 `json:"whoReview"` // 谁可评论 | ||
987 | + WhoReviewInfo []UserShowName `json:"whoReviewInfo"` // 谁可评论 | ||
988 | + Location Location `json:"location"` // 定位坐标 | ||
989 | + CountLove int `json:"countLove"` // 点赞数量 | ||
990 | + CountComment int `json:"countComment"` // 评论数量 | ||
991 | + CountRead int `json:"countRead"` // 浏览数量 | ||
992 | + Show int `json:"show"` // 评论的展示状态(0显示、1不显示) | ||
993 | + TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] | ||
994 | +} | ||
995 | + | ||
919 | type RoleGetRequest struct { | 996 | type RoleGetRequest struct { |
920 | Id int64 `path:"id"` | 997 | Id int64 `path:"id"` |
921 | } | 998 | } |
@@ -22,6 +22,7 @@ func Migrate(db *gorm.DB) { | @@ -22,6 +22,7 @@ func Migrate(db *gorm.DB) { | ||
22 | &models.MessageSystem{}, | 22 | &models.MessageSystem{}, |
23 | &models.MessageBusiness{}, | 23 | &models.MessageBusiness{}, |
24 | &models.Department{}, | 24 | &models.Department{}, |
25 | + &models.ArticleAndTag{}, | ||
25 | } | 26 | } |
26 | 27 | ||
27 | db.AutoMigrate(modelsList...) | 28 | db.AutoMigrate(modelsList...) |
@@ -10,12 +10,12 @@ import ( | @@ -10,12 +10,12 @@ import ( | ||
10 | 10 | ||
11 | // 保存文章和标签的关系,主要用于分组统计用 | 11 | // 保存文章和标签的关系,主要用于分组统计用 |
12 | type ArticleAndTag struct { | 12 | type ArticleAndTag struct { |
13 | - Id int64 // 唯一标识 | ||
14 | - CompanyId int64 `json:"companyId"` | ||
15 | - CreatedAt int64 `json:"createdAt,omitempty"` | ||
16 | - UpdatedAt int64 `json:"updatedAt,omitempty"` | ||
17 | - ArticleId int64 `json:"articleId"` | ||
18 | - TagId int64 `json:"tagId"` | 13 | + Id int64 `gorm:"primaryKey"` // 唯一标识 |
14 | + CompanyId int64 | ||
15 | + CreatedAt int64 | ||
16 | + UpdatedAt int64 | ||
17 | + ArticleId int64 | ||
18 | + TagId int64 | ||
19 | } | 19 | } |
20 | 20 | ||
21 | func (m *ArticleAndTag) TableName() string { | 21 | func (m *ArticleAndTag) TableName() string { |
@@ -20,9 +20,10 @@ type ArticleTag struct { | @@ -20,9 +20,10 @@ type ArticleTag struct { | ||
20 | Version int | 20 | Version int |
21 | Image domain.Image `gorm:"type:jsonb;serializer:json"` // 图片 | 21 | Image domain.Image `gorm:"type:jsonb;serializer:json"` // 图片 |
22 | Name string // 标签名称 | 22 | Name string // 标签名称 |
23 | - Group string // 标签分类 | ||
24 | Remark string // 备注 | 23 | Remark string // 备注 |
24 | + Category string // 标签分类 | ||
25 | SortBy int64 // 顺序 | 25 | SortBy int64 // 顺序 |
26 | + Other string // 其他 | ||
26 | } | 27 | } |
27 | 28 | ||
28 | func (m *ArticleTag) TableName() string { | 29 | func (m *ArticleTag) TableName() string { |
@@ -2,9 +2,10 @@ package models | @@ -2,9 +2,10 @@ package models | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "fmt" | 4 | "fmt" |
5 | + "time" | ||
6 | + | ||
5 | "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" |
6 | "gorm.io/gorm" | 8 | "gorm.io/gorm" |
7 | - "time" | ||
8 | ) | 9 | ) |
9 | 10 | ||
10 | type UserFollow struct { | 11 | type UserFollow struct { |
@@ -97,6 +97,9 @@ func (repository *ArticleAndTagRepository) Find(ctx context.Context, conn transa | @@ -97,6 +97,9 @@ func (repository *ArticleAndTagRepository) Find(ctx context.Context, conn transa | ||
97 | ) | 97 | ) |
98 | queryFunc := func() (interface{}, error) { | 98 | queryFunc := func() (interface{}, error) { |
99 | tx = tx.Model(&ms).Order("id desc") | 99 | tx = tx.Model(&ms).Order("id desc") |
100 | + if v, ok := queryOptions["articleId"]; ok { | ||
101 | + tx = tx.Where("article_id=?", v) | ||
102 | + } | ||
100 | if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil { | 103 | if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil { |
101 | return dms, tx.Error | 104 | return dms, tx.Error |
102 | } | 105 | } |
@@ -120,6 +120,18 @@ func (repository *ArticleBackupRepository) Find(ctx context.Context, conn transa | @@ -120,6 +120,18 @@ func (repository *ArticleBackupRepository) Find(ctx context.Context, conn transa | ||
120 | ) | 120 | ) |
121 | queryFunc := func() (interface{}, error) { | 121 | queryFunc := func() (interface{}, error) { |
122 | tx = tx.Model(&ms).Order("id desc") | 122 | tx = tx.Model(&ms).Order("id desc") |
123 | + if v, ok := queryOptions["beginCreatedAt"]; ok { | ||
124 | + tx = tx.Where("created_at >= ?", v) | ||
125 | + } | ||
126 | + if v, ok := queryOptions["endCreatedAt"]; ok { | ||
127 | + tx = tx.Where("created_at < ?", v) | ||
128 | + } | ||
129 | + if v, ok := queryOptions["articleId"]; ok { | ||
130 | + tx = tx.Where("article_id = ?", v) | ||
131 | + } | ||
132 | + if v, ok := queryOptions["operator"]; ok && v.(string) != "" { | ||
133 | + tx = tx.Where(`operator #>> '{"name"}' like ?`, "%"+v.(string)+"%") | ||
134 | + } | ||
123 | if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil { | 135 | if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil { |
124 | return dms, tx.Error | 136 | return dms, tx.Error |
125 | } | 137 | } |
@@ -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 && v.(string) != "" { | ||
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) |
@@ -275,3 +277,35 @@ func (repository *ArticleRepository) IncreaseCountComment(ctx context.Context, c | @@ -275,3 +277,35 @@ func (repository *ArticleRepository) IncreaseCountComment(ctx context.Context, c | ||
275 | func NewArticleRepository(cache *cache.CachedRepository) domain.ArticleRepository { | 277 | func NewArticleRepository(cache *cache.CachedRepository) domain.ArticleRepository { |
276 | return &ArticleRepository{CachedRepository: cache} | 278 | return &ArticleRepository{CachedRepository: cache} |
277 | } | 279 | } |
280 | + | ||
281 | +// with | ||
282 | +// -- 按查看权限查询文章 | ||
283 | +// t_article as( | ||
284 | +// select article.id | ||
285 | +// from article | ||
286 | +// where article.deleted_at=0 | ||
287 | +// and article.company_id =1598224576532189184 | ||
288 | +// and article."show" =0 | ||
289 | +// and (article.target_user =0 or article.who_read @>'[1]') | ||
290 | +// ), | ||
291 | +// -- 获取有标签的文章 | ||
292 | +// t_article_and_tag as ( | ||
293 | +// select article_and_tag.article_id ,article_and_tag.tag_id | ||
294 | +// from article_and_tag | ||
295 | +// where article_and_tag.company_id =1598224576532189184 | ||
296 | +// ), | ||
297 | +// -- 过滤出可展示的文章id | ||
298 | +// t_article_and_tag_2 as ( | ||
299 | +// select t_article_and_tag.article_id, t_article_and_tag.tag_id | ||
300 | +// from t_article_and_tag | ||
301 | +// join t_article on t_article_and_tag.article_id = t_article.id | ||
302 | +// ), | ||
303 | +// -- 查询人员已查看的文章 | ||
304 | +// t_user_read as( | ||
305 | +// select user_read_article.article_id from user_read_article where user_read_article.user_id =1 | ||
306 | +// ) | ||
307 | +// -- 汇总统计 cnt_1符合条件的文章总数,cnt_2 已浏览的数量 | ||
308 | +// select count(t_article_and_tag_2.article_id) as cnt_1 ,count(t_user_read.article_id) as cnt_2, t_article_and_tag_2.tag_id | ||
309 | +// from t_article_and_tag_2 | ||
310 | +// left join t_user_read on t_article_and_tag_2.article_id=t_user_read.article_id | ||
311 | +// group by t_article_and_tag_2.tag_id |
@@ -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 |
@@ -122,13 +122,16 @@ func (repository *ArticleTagRepository) Find(ctx context.Context, conn transacti | @@ -122,13 +122,16 @@ func (repository *ArticleTagRepository) Find(ctx context.Context, conn transacti | ||
122 | queryFunc := func() (interface{}, error) { | 122 | queryFunc := func() (interface{}, error) { |
123 | tx = tx.Model(&ms). | 123 | tx = tx.Model(&ms). |
124 | Where("company_id=?", companyId). | 124 | Where("company_id=?", companyId). |
125 | - Order("id desc") | 125 | + Order("id asc") |
126 | 126 | ||
127 | if v, ok := queryOptions["name"]; ok { | 127 | if v, ok := queryOptions["name"]; ok { |
128 | tx = tx.Where("name like ?", v) | 128 | tx = tx.Where("name like ?", v) |
129 | } | 129 | } |
130 | - if v, ok := queryOptions["group"]; ok { | ||
131 | - tx = tx.Where("group like ?", v) | 130 | + if v, ok := queryOptions["category"]; ok { |
131 | + tx = tx.Where("category like ?", v) | ||
132 | + } | ||
133 | + if v, ok := queryOptions["ids"]; ok { | ||
134 | + tx = tx.Where("id in (?)", v) | ||
132 | } | 135 | } |
133 | 136 | ||
134 | if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil { | 137 | if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil { |
@@ -86,7 +86,7 @@ func (m *Article) MakeBackup(operator UserSimple, section []ArticleSection) *Art | @@ -86,7 +86,7 @@ func (m *Article) MakeBackup(operator UserSimple, section []ArticleSection) *Art | ||
86 | CreatedAt: 0, | 86 | CreatedAt: 0, |
87 | UpdatedAt: 0, | 87 | UpdatedAt: 0, |
88 | DeletedAt: 0, | 88 | DeletedAt: 0, |
89 | - Version: 0, | 89 | + Version: m.Version, |
90 | Operator: operator, | 90 | Operator: operator, |
91 | ArticleId: m.Id, | 91 | ArticleId: m.Id, |
92 | Title: m.Title, | 92 | Title: m.Title, |
@@ -14,8 +14,8 @@ type ArticleBackup struct { | @@ -14,8 +14,8 @@ type ArticleBackup struct { | ||
14 | UpdatedAt int64 `json:"updatedAt,omitempty"` | 14 | UpdatedAt int64 `json:"updatedAt,omitempty"` |
15 | DeletedAt int64 `json:"deletedAt,omitempty"` | 15 | DeletedAt int64 `json:"deletedAt,omitempty"` |
16 | Version int `json:"version,omitempty"` | 16 | Version int `json:"version,omitempty"` |
17 | - Operator UserSimple `json:"operator"` // 操作人 | ||
18 | - ArticleId int64 `json:"articleId"` | 17 | + Operator UserSimple `json:"operator"` // 操作人 |
18 | + ArticleId int64 `json:"articleId"` // | ||
19 | Title string `json:"title"` // 标题 | 19 | Title string `json:"title"` // 标题 |
20 | Section []ArticleSection `json:"section"` // 分段内容 | 20 | Section []ArticleSection `json:"section"` // 分段内容 |
21 | Images []Image `json:"images"` // 图片 | 21 | Images []Image `json:"images"` // 图片 |
@@ -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 //评论数量变动 |
@@ -15,11 +15,12 @@ type ArticleTag struct { | @@ -15,11 +15,12 @@ type ArticleTag struct { | ||
15 | UpdatedAt int64 `json:"updatedAt,omitempty"` | 15 | UpdatedAt int64 `json:"updatedAt,omitempty"` |
16 | DeletedAt int64 `json:"deletedAt,omitempty"` | 16 | DeletedAt int64 `json:"deletedAt,omitempty"` |
17 | Version int `json:"version,omitempty"` | 17 | Version int `json:"version,omitempty"` |
18 | - Image Image `json:"image"` // 图片 | ||
19 | - Name string `json:"name"` // 标签名称 | ||
20 | - Group string `json:"group"` // 标签分类 | ||
21 | - Remark string `json:"remark"` // 备注 | ||
22 | - SortBy int64 `json:"sortBy"` // 顺序 | 18 | + Image Image `json:"image"` // 图片 |
19 | + Name string `json:"name"` // 标签名称 | ||
20 | + Category string `json:"category"` // 标签分类 [紧急重要]、[机会风险] | ||
21 | + Remark string `json:"remark"` // 备注 | ||
22 | + SortBy int64 `json:"sortBy"` // 顺序 | ||
23 | + Other string `json:"other"` // | ||
23 | } | 24 | } |
24 | type ArticleTagRepository interface { | 25 | type ArticleTagRepository interface { |
25 | Insert(ctx context.Context, conn transaction.Conn, dm *ArticleTag) (*ArticleTag, error) | 26 | Insert(ctx context.Context, conn transaction.Conn, dm *ArticleTag) (*ArticleTag, error) |
@@ -29,11 +29,9 @@ type Opinion struct { | @@ -29,11 +29,9 @@ type Opinion struct { | ||
29 | } | 29 | } |
30 | 30 | ||
31 | type UserSimple struct { | 31 | type UserSimple struct { |
32 | - Id int64 `json:"id"` // 人员id | ||
33 | - Name string `json:"name"` // 人员的名字 | ||
34 | - Avatar string `json:"avatar,omitempty"` // 人员头像URL | ||
35 | - // GroupId int64 `json:"groupId"` //分组id | ||
36 | - //Group string `json:"group,omitempty"` // 人员的分组 | 32 | + Id int64 `json:"id"` // 人员id |
33 | + Name string `json:"name"` // 人员的名字 | ||
34 | + Avatar string `json:"avatar,omitempty"` // 人员头像URL | ||
37 | Position string `json:"position,omitempty"` // 职位 | 35 | Position string `json:"position,omitempty"` // 职位 |
38 | Company string `json:"company,omitempty"` // 公司 | 36 | Company string `json:"company,omitempty"` // 公司 |
39 | CompanyId int64 `json:"companyId"` | 37 | CompanyId int64 `json:"companyId"` |
-
请 注册 或 登录 后发表评论