作者 tangxvhui
@@ -723,6 +723,24 @@ @@ -723,6 +723,24 @@
723 ] 723 ]
724 } 724 }
725 }, 725 },
  726 + "v1/mini/show/home_page": {
  727 + "get": {
  728 + "summary": "小程序首页数据展示",
  729 + "operationId": "MiniShowHomePage",
  730 + "responses": {
  731 + "200": {
  732 + "description": "A successful response.",
  733 + "schema": {
  734 + "$ref": "#/definitions/MiniHomePageRespose"
  735 + }
  736 + }
  737 + },
  738 + "requestBody": {},
  739 + "tags": [
  740 + "article"
  741 + ]
  742 + }
  743 + },
726 "v1/mini/user/apply-join-company": { 744 "v1/mini/user/apply-join-company": {
727 "post": { 745 "post": {
728 "summary": "用户申请加入公司", 746 "summary": "用户申请加入公司",
@@ -1361,6 +1379,34 @@ @@ -1361,6 +1379,34 @@
1361 ] 1379 ]
1362 } 1380 }
1363 }, 1381 },
  1382 + "v1/system/article_comment/search": {
  1383 + "post": {
  1384 + "summary": "管理后台文章评论列表",
  1385 + "operationId": "SystemArticleCommentSearch",
  1386 + "responses": {
  1387 + "200": {
  1388 + "description": "A successful response.",
  1389 + "schema": {
  1390 + "$ref": "#/definitions/SystemArticleCommentSearchResponse"
  1391 + }
  1392 + }
  1393 + },
  1394 + "parameters": [
  1395 + {
  1396 + "name": "body",
  1397 + "in": "body",
  1398 + "required": true,
  1399 + "schema": {
  1400 + "$ref": "#/definitions/SystemArticleCommentSearchRequest"
  1401 + }
  1402 + }
  1403 + ],
  1404 + "requestBody": {},
  1405 + "tags": [
  1406 + "comment"
  1407 + ]
  1408 + }
  1409 + },
1364 "v1/system/article_comment/search/me": { 1410 "v1/system/article_comment/search/me": {
1365 "post": { 1411 "post": {
1366 "summary": "小程序获取回复@人可选列表", 1412 "summary": "小程序获取回复@人可选列表",
@@ -1443,6 +1489,24 @@ @@ -1443,6 +1489,24 @@
1443 ] 1489 ]
1444 } 1490 }
1445 }, 1491 },
  1492 + "v1/system/article_tag/options": {
  1493 + "get": {
  1494 + "summary": "后台标签下拉列表",
  1495 + "operationId": "Options",
  1496 + "responses": {
  1497 + "200": {
  1498 + "description": "A successful response.",
  1499 + "schema": {
  1500 + "$ref": "#/definitions/TagOptionsResponse"
  1501 + }
  1502 + }
  1503 + },
  1504 + "requestBody": {},
  1505 + "tags": [
  1506 + "tags"
  1507 + ]
  1508 + }
  1509 + },
1446 "v1/system/article_tag/search": { 1510 "v1/system/article_tag/search": {
1447 "post": { 1511 "post": {
1448 "summary": "后台搜索标签", 1512 "summary": "后台搜索标签",
@@ -2308,6 +2372,52 @@ @@ -2308,6 +2372,52 @@
2308 "totalComment" 2372 "totalComment"
2309 ] 2373 ]
2310 }, 2374 },
  2375 + "ArticleTagCount": {
  2376 + "type": "object",
  2377 + "properties": {
  2378 + "tagGroup": {
  2379 + "type": "string",
  2380 + "description": " 标签分组"
  2381 + },
  2382 + "tagId": {
  2383 + "type": "integer",
  2384 + "format": "int64",
  2385 + "description": " 标签id"
  2386 + },
  2387 + "tagImage": {
  2388 + "type": "string",
  2389 + "description": " 对应的图标"
  2390 + },
  2391 + "tagName": {
  2392 + "type": "string",
  2393 + "description": " 标签名称"
  2394 + },
  2395 + "tagRemark": {
  2396 + "type": "string",
  2397 + "description": " 标签备注"
  2398 + },
  2399 + "totalArticle": {
  2400 + "type": "integer",
  2401 + "format": "int32",
  2402 + "description": " 总的文章数量"
  2403 + },
  2404 + "readArticle": {
  2405 + "type": "integer",
  2406 + "format": "int32",
  2407 + "description": " 已读的标签数量"
  2408 + }
  2409 + },
  2410 + "title": "ArticleTagCount",
  2411 + "required": [
  2412 + "tagGroup",
  2413 + "tagId",
  2414 + "tagImage",
  2415 + "tagName",
  2416 + "tagRemark",
  2417 + "totalArticle",
  2418 + "readArticle"
  2419 + ]
  2420 + },
2311 "ArticleTagGroup": { 2421 "ArticleTagGroup": {
2312 "type": "object", 2422 "type": "object",
2313 "properties": { 2423 "properties": {
@@ -4033,6 +4143,35 @@ @@ -4033,6 +4143,35 @@
4033 }, 4143 },
4034 "title": "MiniGetArticleCommentResponse" 4144 "title": "MiniGetArticleCommentResponse"
4035 }, 4145 },
  4146 + "MiniHomePageRequest": {
  4147 + "type": "object",
  4148 + "properties": {
  4149 + "": {
  4150 + "type": "integer",
  4151 + "format": "int64"
  4152 + },
  4153 + "": {
  4154 + "type": "integer",
  4155 + "format": "int64"
  4156 + }
  4157 + },
  4158 + "title": "MiniHomePageRequest"
  4159 + },
  4160 + "MiniHomePageRespose": {
  4161 + "type": "object",
  4162 + "properties": {
  4163 + "tags": {
  4164 + "type": "array",
  4165 + "items": {
  4166 + "$ref": "#/definitions/ArticleTagCount"
  4167 + }
  4168 + }
  4169 + },
  4170 + "title": "MiniHomePageRespose",
  4171 + "required": [
  4172 + "tags"
  4173 + ]
  4174 + },
4036 "MiniListArticleCommentRequest": { 4175 "MiniListArticleCommentRequest": {
4037 "type": "object", 4176 "type": "object",
4038 "properties": { 4177 "properties": {
@@ -4330,21 +4469,6 @@ @@ -4330,21 +4469,6 @@
4330 "$ref": "#/definitions/UserItem", 4469 "$ref": "#/definitions/UserItem",
4331 "description": " 用户信息" 4470 "description": " 用户信息"
4332 }, 4471 },
4333 - "totalArticle": {  
4334 - "type": "integer",  
4335 - "format": "int64",  
4336 - "description": " 累计信息发布"  
4337 - },  
4338 - "totalLoved": {  
4339 - "type": "integer",  
4340 - "format": "int64",  
4341 - "description": " 累计收到的赞"  
4342 - },  
4343 - "totalAccepted": {  
4344 - "type": "integer",  
4345 - "format": "int64",  
4346 - "description": " 累计被采纳"  
4347 - },  
4348 "accounts": { 4472 "accounts": {
4349 "type": "array", 4473 "type": "array",
4350 "items": { 4474 "items": {
@@ -4363,9 +4487,6 @@ @@ -4363,9 +4487,6 @@
4363 "title": "MiniUserInfoResponse", 4487 "title": "MiniUserInfoResponse",
4364 "required": [ 4488 "required": [
4365 "user", 4489 "user",
4366 - "totalArticle",  
4367 - "totalLoved",  
4368 - "totalAccepted",  
4369 "accounts", 4490 "accounts",
4370 "auths" 4491 "auths"
4371 ] 4492 ]
@@ -4891,6 +5012,87 @@ @@ -4891,6 +5012,87 @@
4891 "value" 5012 "value"
4892 ] 5013 ]
4893 }, 5014 },
  5015 + "SystemArticleCommentSearchItem": {
  5016 + "type": "object",
  5017 + "properties": {
  5018 + "id": {
  5019 + "type": "integer",
  5020 + "format": "int64"
  5021 + },
  5022 + "pid": {
  5023 + "type": "integer",
  5024 + "format": "int64"
  5025 + },
  5026 + "topId": {
  5027 + "type": "integer",
  5028 + "format": "int64"
  5029 + },
  5030 + "articleId": {
  5031 + "type": "integer",
  5032 + "format": "int64",
  5033 + "description": " 文章id"
  5034 + },
  5035 + "sectionId": {
  5036 + "type": "integer",
  5037 + "format": "int64",
  5038 + "description": " 段落id"
  5039 + },
  5040 + "fromUserId": {
  5041 + "type": "integer",
  5042 + "format": "int64",
  5043 + "description": " 填写评论的人"
  5044 + },
  5045 + "fromUser": {
  5046 + "$ref": "#/definitions/CommentAuthor",
  5047 + "description": " 填写评论的人"
  5048 + },
  5049 + "countReply": {
  5050 + "type": "integer",
  5051 + "format": "int32",
  5052 + "description": " 回复数量"
  5053 + },
  5054 + "countUserLove": {
  5055 + "type": "integer",
  5056 + "format": "int32",
  5057 + "description": " 用户点赞数量"
  5058 + },
  5059 + "countAdminLove": {
  5060 + "type": "integer",
  5061 + "format": "int32",
  5062 + "description": " 运营点赞数量"
  5063 + },
  5064 + "createdAt": {
  5065 + "type": "integer",
  5066 + "format": "int64",
  5067 + "description": " 评论时间"
  5068 + },
  5069 + "content": {
  5070 + "type": "string",
  5071 + "description": " 评论的内容"
  5072 + },
  5073 + "show": {
  5074 + "type": "integer",
  5075 + "format": "int32",
  5076 + "description": " 显示状态"
  5077 + }
  5078 + },
  5079 + "title": "SystemArticleCommentSearchItem",
  5080 + "required": [
  5081 + "id",
  5082 + "pid",
  5083 + "topId",
  5084 + "articleId",
  5085 + "sectionId",
  5086 + "fromUserId",
  5087 + "fromUser",
  5088 + "countReply",
  5089 + "countUserLove",
  5090 + "countAdminLove",
  5091 + "createdAt",
  5092 + "content",
  5093 + "show"
  5094 + ]
  5095 + },
4894 "SystemArticleCommentSearchMeRequest": { 5096 "SystemArticleCommentSearchMeRequest": {
4895 "type": "object", 5097 "type": "object",
4896 "properties": { 5098 "properties": {
@@ -4945,6 +5147,76 @@ @@ -4945,6 +5147,76 @@
4945 "total" 5147 "total"
4946 ] 5148 ]
4947 }, 5149 },
  5150 + "SystemArticleCommentSearchRequest": {
  5151 + "type": "object",
  5152 + "properties": {
  5153 + "page": {
  5154 + "type": "integer",
  5155 + "format": "int32"
  5156 + },
  5157 + "size": {
  5158 + "type": "integer",
  5159 + "format": "int32"
  5160 + },
  5161 + "articleId": {
  5162 + "type": "integer",
  5163 + "format": "int64",
  5164 + "description": " 文章ID"
  5165 + },
  5166 + "topId": {
  5167 + "type": "integer",
  5168 + "format": "int64",
  5169 + "description": " 文章顶层ID"
  5170 + },
  5171 + "authorId": {
  5172 + "type": "integer",
  5173 + "format": "int64",
  5174 + "description": " 用户"
  5175 + },
  5176 + "show": {
  5177 + "type": "integer",
  5178 + "format": "int32",
  5179 + "description": " 显示状态"
  5180 + },
  5181 + "beginTime": {
  5182 + "type": "integer",
  5183 + "format": "int64",
  5184 + "description": " 开始时间"
  5185 + },
  5186 + "endTime": {
  5187 + "type": "integer",
  5188 + "format": "int64",
  5189 + "description": " 结束时间"
  5190 + }
  5191 + },
  5192 + "title": "SystemArticleCommentSearchRequest",
  5193 + "required": [
  5194 + "page",
  5195 + "size",
  5196 + "articleId",
  5197 + "topId"
  5198 + ]
  5199 + },
  5200 + "SystemArticleCommentSearchResponse": {
  5201 + "type": "object",
  5202 + "properties": {
  5203 + "total": {
  5204 + "type": "integer",
  5205 + "format": "int64"
  5206 + },
  5207 + "list": {
  5208 + "type": "array",
  5209 + "items": {
  5210 + "$ref": "#/definitions/SystemArticleCommentSearchItem"
  5211 + }
  5212 + }
  5213 + },
  5214 + "title": "SystemArticleCommentSearchResponse",
  5215 + "required": [
  5216 + "total",
  5217 + "list"
  5218 + ]
  5219 + },
4948 "SystemArticleGetHistoryRequest": { 5220 "SystemArticleGetHistoryRequest": {
4949 "type": "object", 5221 "type": "object",
4950 "properties": { 5222 "properties": {
@@ -5578,14 +5850,10 @@ @@ -5578,14 +5850,10 @@
5578 }, 5850 },
5579 "description": " 评论人" 5851 "description": " 评论人"
5580 }, 5852 },
5581 - "location": {  
5582 - "$ref": "#/definitions/Location",  
5583 - "description": " 坐标"  
5584 - },  
5585 "targetUser": { 5853 "targetUser": {
5586 "type": "integer", 5854 "type": "integer",
5587 "format": "int32", 5855 "format": "int32",
5588 - "description": "分发方式 [0分发给所有人、1分发给指定的人]" 5856 + "description": " 分发方式 [0分发给所有人、1分发给指定的人]"
5589 }, 5857 },
5590 "tags": { 5858 "tags": {
5591 "type": "array", 5859 "type": "array",
@@ -5594,6 +5862,10 @@ @@ -5594,6 +5862,10 @@
5594 "format": "int64" 5862 "format": "int64"
5595 }, 5863 },
5596 "description": " 标签" 5864 "description": " 标签"
  5865 + },
  5866 + "AccessToken": {
  5867 + "type": "string",
  5868 + "description": " 授权token"
5597 } 5869 }
5598 }, 5870 },
5599 "title": "SystemArticleUpdateRequest", 5871 "title": "SystemArticleUpdateRequest",
@@ -5605,9 +5877,9 @@ @@ -5605,9 +5877,9 @@
5605 "images", 5877 "images",
5606 "whoRead", 5878 "whoRead",
5607 "whoReview", 5879 "whoReview",
5608 - "location",  
5609 "targetUser", 5880 "targetUser",
5610 - "tags" 5881 + "tags",
  5882 + "x-mmm-accesstoken"
5611 ] 5883 ]
5612 }, 5884 },
5613 "SystemArticleUpdateResponse": { 5885 "SystemArticleUpdateResponse": {
@@ -5643,7 +5915,7 @@ @@ -5643,7 +5915,7 @@
5643 "format": "int32", 5915 "format": "int32",
5644 "description": "点赞数量" 5916 "description": "点赞数量"
5645 }, 5917 },
5646 - "CountComment": { 5918 + "countComment": {
5647 "type": "integer", 5919 "type": "integer",
5648 "format": "int32", 5920 "format": "int32",
5649 "description": "评论数量" 5921 "description": "评论数量"
@@ -5675,7 +5947,7 @@ @@ -5675,7 +5947,7 @@
5675 "images", 5947 "images",
5676 "createdAt", 5948 "createdAt",
5677 "countLove", 5949 "countLove",
5678 - "CountComment", 5950 + "countComment",
5679 "show", 5951 "show",
5680 "tags", 5952 "tags",
5681 "targetUser" 5953 "targetUser"
@@ -6368,6 +6640,71 @@ @@ -6368,6 +6640,71 @@
6368 "list" 6640 "list"
6369 ] 6641 ]
6370 }, 6642 },
  6643 + "TagOptionValue": {
  6644 + "type": "object",
  6645 + "properties": {
  6646 + "label": {
  6647 + "type": "string",
  6648 + "description": " 名称"
  6649 + },
  6650 + "value": {
  6651 + "type": "integer",
  6652 + "format": "int64",
  6653 + "description": " 标签ID"
  6654 + }
  6655 + },
  6656 + "title": "TagOptionValue",
  6657 + "required": [
  6658 + "label",
  6659 + "value"
  6660 + ]
  6661 + },
  6662 + "TagOptions": {
  6663 + "type": "object",
  6664 + "properties": {
  6665 + "label": {
  6666 + "type": "string",
  6667 + "description": " 分组名称"
  6668 + },
  6669 + "options": {
  6670 + "type": "array",
  6671 + "items": {
  6672 + "$ref": "#/definitions/TagOptionValue"
  6673 + }
  6674 + }
  6675 + },
  6676 + "title": "TagOptions",
  6677 + "required": [
  6678 + "label",
  6679 + "options"
  6680 + ]
  6681 + },
  6682 + "TagOptionsRequest": {
  6683 + "type": "object",
  6684 + "properties": {
  6685 + "": {
  6686 + "type": "integer",
  6687 + "format": "int64",
  6688 + "description": " 公司ID"
  6689 + }
  6690 + },
  6691 + "title": "TagOptionsRequest"
  6692 + },
  6693 + "TagOptionsResponse": {
  6694 + "type": "object",
  6695 + "properties": {
  6696 + "options": {
  6697 + "type": "array",
  6698 + "items": {
  6699 + "$ref": "#/definitions/TagOptions"
  6700 + }
  6701 + }
  6702 + },
  6703 + "title": "TagOptionsResponse",
  6704 + "required": [
  6705 + "options"
  6706 + ]
  6707 + },
6371 "UserFollowItem": { 6708 "UserFollowItem": {
6372 "type": "object", 6709 "type": "object",
6373 "properties": { 6710 "properties": {
@@ -32,7 +32,11 @@ service Core { @@ -32,7 +32,11 @@ service Core {
32 32
33 @doc "后台搜索标签" 33 @doc "后台搜索标签"
34 @handler SearchTag 34 @handler SearchTag
35 - post/article_tag/search (TagListRequest) returns (TagListResponse) 35 + post /article_tag/search (TagListRequest) returns (TagListResponse)
  36 +
  37 + @doc "后台标签下拉列表"
  38 + @handler Options
  39 + get /article_tag/options (TagOptionsRequest) returns (TagOptionsResponse)
36 } 40 }
37 41
38 // 创建标签 42 // 创建标签
@@ -118,3 +122,21 @@ type ( @@ -118,3 +122,21 @@ type (
118 Id int64 `json:"id"` 122 Id int64 `json:"id"`
119 } 123 }
120 ) 124 )
  125 +
  126 +//标签下拉列表
  127 +type (
  128 + TagOptionsRequest {
  129 + CompanyId int64 `path:",optional"` // 公司ID
  130 + }
  131 + TagOptionsResponse {
  132 + Options []TagOptions `json:"options"`
  133 + }
  134 + TagOptions {
  135 + Label string `json:"label"` // 分组名称
  136 + Options []TagOptionValue `json:"options"`
  137 + }
  138 + TagOptionValue {
  139 + Label string `json:"label"` // 名称
  140 + Value int64 `json:"value"` // 标签ID
  141 + }
  142 +)
@@ -388,6 +388,9 @@ type ( @@ -388,6 +388,9 @@ type (
388 Tags []string `json:"tags"` //标签 388 Tags []string `json:"tags"` //标签
389 TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] 389 TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人]
390 } 390 }
  391 +)
  392 +// 管理后台编辑文章
  393 +type (
391 //编辑 394 //编辑
392 SystemArticleUpdateRequest { 395 SystemArticleUpdateRequest {
393 Id int64 `json:"id"` 396 Id int64 `json:"id"`
@@ -398,7 +401,6 @@ type ( @@ -398,7 +401,6 @@ type (
398 Images []string `json:"images"` // 图片 401 Images []string `json:"images"` // 图片
399 WhoRead []int64 `json:"whoRead"` // 谁可以看 402 WhoRead []int64 `json:"whoRead"` // 谁可以看
400 WhoReview []int64 `json:"whoReview"` // 评论人 403 WhoReview []int64 `json:"whoReview"` // 评论人
401 - Location Location `json:"location"` // 坐标  
402 TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人] 404 TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人]
403 Tags []int64 `json:"tags"` // 标签 405 Tags []int64 `json:"tags"` // 标签
404 AccessToken string `header:"x-mmm-accesstoken"` // 授权token 406 AccessToken string `header:"x-mmm-accesstoken"` // 授权token
@@ -415,6 +417,9 @@ type ( @@ -415,6 +417,9 @@ type (
415 Tags []int64 `json:"tags"` //标签 417 Tags []int64 `json:"tags"` //标签
416 TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] 418 TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人]
417 } 419 }
  420 +)
  421 +// 管理后台编辑历史列表
  422 +type (
418 //历史 423 //历史
419 SystemArticleHistoryRequest { 424 SystemArticleHistoryRequest {
420 ArticleId int64 `json:"articleId"` //文章ID 425 ArticleId int64 `json:"articleId"` //文章ID
@@ -434,6 +439,9 @@ type ( @@ -434,6 +439,9 @@ type (
434 Action string `json:"action"` //编辑类型 439 Action string `json:"action"` //编辑类型
435 UpdatedAt int64 `json:"updatedAt"` //编辑时间 440 UpdatedAt int64 `json:"updatedAt"` //编辑时间
436 } 441 }
  442 +)
  443 +// 管理后台历史记录详情
  444 +type (
437 SystemArticleGetHistoryRequest { 445 SystemArticleGetHistoryRequest {
438 Id int64 `path:"id"` //id 446 Id int64 `path:"id"` //id
439 CompanyId int64 `path:",optional"` 447 CompanyId int64 `path:",optional"`
@@ -453,6 +461,9 @@ type ( @@ -453,6 +461,9 @@ type (
453 TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人] 461 TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人]
454 Tags []int64 `json:"tags"` // 标签 462 Tags []int64 `json:"tags"` // 标签
455 } 463 }
  464 +)
  465 +// 管理后台文章恢复
  466 +type (
456 SystemArticleRestoreRequest { 467 SystemArticleRestoreRequest {
457 Id int64 `json:"id"` //ID 468 Id int64 `json:"id"` //ID
458 AccessToken string `header:"x-mmm-accesstoken"` // 授权token 469 AccessToken string `header:"x-mmm-accesstoken"` // 授权token
@@ -15,7 +15,6 @@ info( @@ -15,7 +15,6 @@ info(
15 jwt: MiniAuth 15 jwt: MiniAuth
16 ) 16 )
17 service Core { 17 service Core {
18 -  
19 @doc "小程序填写文章的评论" 18 @doc "小程序填写文章的评论"
20 @handler MiniCreateArticleComment 19 @handler MiniCreateArticleComment
21 post /article_comment (MiniCreateArticleCommentRequest) returns (MiniCreateArticleCommentResponse) 20 post /article_comment (MiniCreateArticleCommentRequest) returns (MiniCreateArticleCommentResponse)
@@ -52,6 +51,11 @@ service Core { @@ -52,6 +51,11 @@ service Core {
52 @doc "小程序获取回复@人可选列表" 51 @doc "小程序获取回复@人可选列表"
53 @handler SystemArticleCommentSearchMe 52 @handler SystemArticleCommentSearchMe
54 post /article_comment/search/me (SystemArticleCommentSearchMeRequest) returns (SystemArticleCommentSearchMeResponse) 53 post /article_comment/search/me (SystemArticleCommentSearchMeRequest) returns (SystemArticleCommentSearchMeResponse)
  54 +
  55 + @doc "管理后台文章评论列表"
  56 + @handler SystemArticleCommentSearch
  57 + post /article_comment/search (SystemArticleCommentSearchRequest) returns (SystemArticleCommentSearchResponse)
  58 +
55 } 59 }
56 60
57 //评论的填写人 61 //评论的填写人
@@ -204,3 +208,35 @@ type ( @@ -204,3 +208,35 @@ type (
204 Total int64 `json:"total"` 208 Total int64 `json:"total"`
205 } 209 }
206 ) 210 )
  211 +// 文章里的评论列表
  212 +type (
  213 + SystemArticleCommentSearchRequest {
  214 + Page int `json:"page"`
  215 + Size int `json:"size"`
  216 + ArticleId int64 `json:"articleId"` // 文章ID
  217 + TopId int64 `json:"topId"` // 文章顶层ID
  218 + AuthorId int64 `json:"authorId,optional"` // 用户
  219 + Show int `json:"show,optional"` // 显示状态
  220 + BeginTime int64 `json:"beginTime,optional"` // 开始时间
  221 + EndTime int64 `json:"endTime,optional"` // 结束时间
  222 + }
  223 + SystemArticleCommentSearchResponse {
  224 + Total int64 `json:"total"`
  225 + List []SystemArticleCommentSearchItem `json:"list"`
  226 + }
  227 + SystemArticleCommentSearchItem {
  228 + Id int64 `json:"id"`
  229 + Pid int64 `json:"pid"`
  230 + TopId int64 `json:"topId"`
  231 + ArtitcleId int64 `json:"articleId"` // 文章id
  232 + SectionId int64 `json:"sectionId"` // 段落id
  233 + FromUserId int64 `json:"fromUserId"` // 填写评论的人
  234 + FromUser CommentAuthor `json:"fromUser"` // 填写评论的人
  235 + CountReply int `json:"countReply"` // 回复数量
  236 + CountUserLove int `json:"countUserLove"` // 用户点赞数量
  237 + CountAdminLove int `json:"countAdminLove"` // 运营点赞数量
  238 + CreatedAt int64 `json:"createdAt"` // 评论时间
  239 + Content string `json:"content"` // 评论的内容
  240 + Show int `json:"show"` // 显示状态
  241 + }
  242 +)
  1 +package comment
  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/comment"
  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 SystemArticleCommentSearchHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  14 + return func(w http.ResponseWriter, r *http.Request) {
  15 + var req types.SystemArticleCommentSearchRequest
  16 + if err := httpx.Parse(r, &req); err != nil {
  17 + httpx.ErrorCtx(r.Context(), w, err)
  18 + return
  19 + }
  20 +
  21 + l := comment.NewSystemArticleCommentSearchLogic(r.Context(), svcCtx)
  22 + resp, err := l.SystemArticleCommentSearch(&req)
  23 + result.HttpResult(r, w, resp, err)
  24 + }
  25 +}
@@ -64,6 +64,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { @@ -64,6 +64,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
64 Path: "/article_comment/search/me", 64 Path: "/article_comment/search/me",
65 Handler: comment.SystemArticleCommentSearchMeHandler(serverCtx), 65 Handler: comment.SystemArticleCommentSearchMeHandler(serverCtx),
66 }, 66 },
  67 + {
  68 + Method: http.MethodPost,
  69 + Path: "/article_comment/search",
  70 + Handler: comment.SystemArticleCommentSearchHandler(serverCtx),
  71 + },
67 }..., 72 }...,
68 ), 73 ),
69 rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret), 74 rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret),
@@ -114,6 +119,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { @@ -114,6 +119,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
114 Path: "/article_tag/search", 119 Path: "/article_tag/search",
115 Handler: tags.SearchTagHandler(serverCtx), 120 Handler: tags.SearchTagHandler(serverCtx),
116 }, 121 },
  122 + {
  123 + Method: http.MethodGet,
  124 + Path: "/article_tag/options",
  125 + Handler: tags.OptionsHandler(serverCtx),
  126 + },
117 }, 127 },
118 rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret), 128 rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret),
119 rest.WithPrefix("/v1/system"), 129 rest.WithPrefix("/v1/system"),
  1 +package tags
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  5 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  6 + "net/http"
  7 +
  8 + "github.com/zeromicro/go-zero/rest/httpx"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/tags"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  12 +)
  13 +
  14 +func OptionsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  15 + return func(w http.ResponseWriter, r *http.Request) {
  16 + var req types.TagOptionsRequest
  17 + if err := httpx.Parse(r, &req); err != nil {
  18 + httpx.ErrorCtx(r.Context(), w, err)
  19 + return
  20 + }
  21 +
  22 + l := tags.NewOptionsLogic(r.Context(), svcCtx)
  23 + token := contextdata.GetUserTokenFromCtx(r.Context())
  24 + req.CompanyId = token.CompanyId
  25 + resp, err := l.Options(&req)
  26 + result.HttpResult(r, w, resp, err)
  27 + }
  28 +}
@@ -11,6 +11,7 @@ import ( @@ -11,6 +11,7 @@ import (
11 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" 11 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
12 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/tool/oss" 12 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/tool/oss"
13 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" 13 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
  14 + "strings"
14 15
15 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" 16 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
16 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" 17 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
@@ -51,29 +52,98 @@ func (l *SystemUpdateArticleLogic) SystemUpdateArticle(req *types.SystemArticleU @@ -51,29 +52,98 @@ func (l *SystemUpdateArticleLogic) SystemUpdateArticle(req *types.SystemArticleU
51 Height: h, 52 Height: h,
52 }) 53 })
53 } 54 }
  55 + //检查文章可被哪些人查看
  56 + whoRead := []int64{}
  57 + if len(req.WhoRead) > 0 {
  58 + whoRead = lo.Uniq(req.WhoRead)
  59 + var u *domain.User
  60 + for _, val := range whoRead {
  61 + u, err = l.svcCtx.UserRepository.FindOne(l.ctx, conn, val)
  62 + if err != nil {
  63 + return nil, xerr.NewErrMsgErr("文章可查看人设置错误", err)
  64 + }
  65 + if u.CompanyId != article.CompanyId {
  66 + return nil, xerr.NewErrMsg("文章可查看人设置错误")
  67 + }
  68 + }
  69 + }
  70 + //检查文章可被哪些人评论
  71 + whoReview := []int64{}
  72 + if len(req.WhoReview) > 0 {
  73 + whoReview = lo.Uniq(req.WhoReview)
  74 + }
  75 + //有指定可查看人的情况
  76 + if len(whoRead) > 0 {
  77 + if len(whoReview) > 0 {
  78 + // 检查 whoRead 是否 完全包含 whoReview
  79 + ok := lo.Every(whoRead, whoReview)
  80 + if !ok {
  81 + return nil, xerr.NewErrMsg("文章可评论人设置错误")
  82 + }
  83 + }
  84 + if len(whoReview) == 0 {
  85 + //有指定可查看人 ,但未指定可评论人
  86 + return nil, xerr.NewErrMsg("文章可评论人设置错误")
  87 + }
  88 + }
  89 + //没有指定可查看人的情况
  90 + if len(whoRead) == 0 {
  91 + if len(whoReview) > 0 {
  92 + // 未指定可查看人(全员可看),有指定可评论人,
  93 + var u *domain.User
  94 + for _, val := range whoReview {
  95 + u, err = l.svcCtx.UserRepository.FindOne(l.ctx, conn, val)
  96 + if err != nil {
  97 + return nil, xerr.NewErrMsgErr("文章可评论人设置错误", err)
  98 + }
  99 + if u.CompanyId != article.CompanyId {
  100 + return nil, xerr.NewErrMsg("文章可评论人设置错误")
  101 + }
  102 + }
  103 + }
  104 + }
  105 + //验证tag
  106 + if len(req.Tags) > 0 {
  107 + req.Tags = lo.Uniq(req.Tags)
  108 + for _, value := range req.Tags {
  109 + t, err := l.svcCtx.ArticleTagRepository.FindOne(l.ctx, conn, value)
  110 + if err != nil {
  111 + return nil, xerr.NewErrMsgErr("文章标签设置错误", err)
  112 + }
  113 + if t.CompanyId != article.CompanyId {
  114 + return nil, xerr.NewErrMsgErr("文章标签设置错误", err)
  115 + }
  116 + }
  117 + }
54 article.Title = req.Title 118 article.Title = req.Title
55 article.Version = article.Version + 1 119 article.Version = article.Version + 1
56 article.Images = images 120 article.Images = images
57 - article.WhoRead = req.WhoRead  
58 - article.WhoReview = req.WhoReview 121 + article.WhoRead = whoRead
  122 + article.WhoReview = whoReview
59 article.TargetUser = domain.ArticleTarget(req.TargetUser) 123 article.TargetUser = domain.ArticleTarget(req.TargetUser)
60 - article.Location = domain.Location{  
61 - Longitude: req.Location.Longitude,  
62 - Latitude: req.Location.Latitude,  
63 - Descript: req.Location.Descript,  
64 - }  
65 article.Tags = req.Tags 124 article.Tags = req.Tags
66 //文章内容 125 //文章内容
67 articleSections := []domain.ArticleSection{} 126 articleSections := []domain.ArticleSection{}
  127 + sortBy := 1
68 lo.ForEach(req.Section, func(item types.ArticleSection, index int) { 128 lo.ForEach(req.Section, func(item types.ArticleSection, index int) {
69 - articleSections = append(articleSections, domain.ArticleSection{  
70 - Id: item.Id, 129 + strList := strings.Split(item.Content, "\n")
  130 + for key, value := range strList {
  131 + if value == "" {
  132 + continue
  133 + }
  134 + section := domain.ArticleSection{
71 CompanyId: article.CompanyId, 135 CompanyId: article.CompanyId,
72 Version: article.Version, 136 Version: article.Version,
73 ArticleId: article.Id, 137 ArticleId: article.Id,
74 - Content: item.Content,  
75 - SortBy: index + 1,  
76 - }) 138 + Content: value,
  139 + SortBy: sortBy,
  140 + }
  141 + if key == 0 {
  142 + section.Id = item.Id
  143 + }
  144 + articleSections = append(articleSections, section)
  145 + sortBy++
  146 + }
77 }) 147 })
78 //设置内容概要 148 //设置内容概要
79 if len(req.Section) > 0 { 149 if len(req.Section) > 0 {
  1 +package comment
  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 SystemArticleCommentSearchLogic struct {
  16 + logx.Logger
  17 + ctx context.Context
  18 + svcCtx *svc.ServiceContext
  19 +}
  20 +
  21 +func NewSystemArticleCommentSearchLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemArticleCommentSearchLogic {
  22 + return &SystemArticleCommentSearchLogic{
  23 + Logger: logx.WithContext(ctx),
  24 + ctx: ctx,
  25 + svcCtx: svcCtx,
  26 + }
  27 +}
  28 +
  29 +func (l *SystemArticleCommentSearchLogic) SystemArticleCommentSearch(req *types.SystemArticleCommentSearchRequest) (resp *types.SystemArticleCommentSearchResponse, err error) {
  30 + var conn = l.svcCtx.DefaultDBConn()
  31 + queryOptions := domain.NewQueryOptions().
  32 + WithOffsetLimit(req.Page, req.Size).
  33 + WithKV("articleId", req.ArticleId).
  34 + WithKV("topId", req.TopId).
  35 + WithKV("fromUserId", req.AuthorId).
  36 + WithKV("beginCreatedAt", req.BeginTime).
  37 + WithKV("endCreatedAt", req.EndTime)
  38 + total, comments, err := l.svcCtx.ArticleCommentRepository.Find(l.ctx, conn, queryOptions)
  39 + if err != nil {
  40 + return nil, xerr.NewErrMsgErr("获取文章评论失败", err)
  41 + }
  42 + resp = &types.SystemArticleCommentSearchResponse{
  43 + Total: total,
  44 + List: make([]types.SystemArticleCommentSearchItem, 0),
  45 + }
  46 + lo.ForEach(comments, func(item *domain.ArticleComment, index int) {
  47 + resp.List = append(resp.List, types.SystemArticleCommentSearchItem{
  48 + Id: item.Id,
  49 + Pid: item.Pid,
  50 + TopId: item.TopId,
  51 + ArtitcleId: item.ArticleId,
  52 + SectionId: item.SectionId,
  53 + FromUserId: item.FromUserId,
  54 + FromUser: types.CommentAuthor{
  55 + Id: item.FromUser.Id,
  56 + Name: item.FromUser.Name,
  57 + Avatar: item.FromUser.Avatar,
  58 + Company: item.FromUser.Company,
  59 + Position: item.FromUser.Position,
  60 + },
  61 + CountReply: item.CountReply,
  62 + CountUserLove: item.CountUserLove,
  63 + CountAdminLove: item.CountAdminLove,
  64 + CreatedAt: item.CreatedAt,
  65 + Content: item.Content,
  66 + Show: int(item.Show),
  67 + })
  68 + })
  69 + return
  70 +}
  1 +package tags
  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 OptionsLogic struct {
  16 + logx.Logger
  17 + ctx context.Context
  18 + svcCtx *svc.ServiceContext
  19 +}
  20 +
  21 +func NewOptionsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *OptionsLogic {
  22 + return &OptionsLogic{
  23 + Logger: logx.WithContext(ctx),
  24 + ctx: ctx,
  25 + svcCtx: svcCtx,
  26 + }
  27 +}
  28 +
  29 +func (l *OptionsLogic) Options(req *types.TagOptionsRequest) (resp *types.TagOptionsResponse, err error) {
  30 + var conn = l.svcCtx.DefaultDBConn()
  31 + queryOption := domain.NewQueryOptions().WithFindOnly()
  32 + _, tagList, err := l.svcCtx.ArticleTagRepository.Find(l.ctx, conn, req.CompanyId, queryOption)
  33 + if err != nil {
  34 + return nil, xerr.NewErrMsgErr("获取标签列表失败", err)
  35 + }
  36 + var group []string
  37 + options := make(map[string][]types.TagOptionValue)
  38 + lo.ForEach(tagList, func(tag *domain.ArticleTag, index int) {
  39 + if _, ok := options[tag.Category]; !ok {
  40 + options[tag.Category] = make([]types.TagOptionValue, 0)
  41 + group = append(group, tag.Category)
  42 + }
  43 + options[tag.Category] = append(options[tag.Category], types.TagOptionValue{
  44 + Label: tag.Name,
  45 + Value: tag.Id,
  46 + })
  47 + })
  48 + resp = &types.TagOptionsResponse{Options: []types.TagOptions{}}
  49 + for _, value := range group {
  50 + ops := []types.TagOptionValue{}
  51 + if _, ok := options[value]; ok {
  52 + ops = options[value]
  53 + }
  54 + resp.Options = append(resp.Options, types.TagOptions{
  55 + Label: value,
  56 + Options: ops,
  57 + })
  58 + }
  59 + return
  60 +}
@@ -136,6 +136,38 @@ type SystemArticleCommentSearchMeResponse struct { @@ -136,6 +136,38 @@ type SystemArticleCommentSearchMeResponse struct {
136 Total int64 `json:"total"` 136 Total int64 `json:"total"`
137 } 137 }
138 138
  139 +type SystemArticleCommentSearchRequest struct {
  140 + Page int `json:"page"`
  141 + Size int `json:"size"`
  142 + ArticleId int64 `json:"articleId"` // 文章ID
  143 + TopId int64 `json:"topId"` // 文章顶层ID
  144 + AuthorId int64 `json:"authorId,optional"` // 用户
  145 + Show int `json:"show,optional"` // 显示状态
  146 + BeginTime int64 `json:"beginTime,optional"` // 开始时间
  147 + EndTime int64 `json:"endTime,optional"` // 结束时间
  148 +}
  149 +
  150 +type SystemArticleCommentSearchResponse struct {
  151 + Total int64 `json:"total"`
  152 + List []SystemArticleCommentSearchItem `json:"list"`
  153 +}
  154 +
  155 +type SystemArticleCommentSearchItem struct {
  156 + Id int64 `json:"id"`
  157 + Pid int64 `json:"pid"`
  158 + TopId int64 `json:"topId"`
  159 + ArtitcleId int64 `json:"articleId"` // 文章id
  160 + SectionId int64 `json:"sectionId"` // 段落id
  161 + FromUserId int64 `json:"fromUserId"` // 填写评论的人
  162 + FromUser CommentAuthor `json:"fromUser"` // 填写评论的人
  163 + CountReply int `json:"countReply"` // 回复数量
  164 + CountUserLove int `json:"countUserLove"` // 用户点赞数量
  165 + CountAdminLove int `json:"countAdminLove"` // 运营点赞数量
  166 + CreatedAt int64 `json:"createdAt"` // 评论时间
  167 + Content string `json:"content"` // 评论的内容
  168 + Show int `json:"show"` // 显示状态
  169 +}
  170 +
139 type MessageSystemRequest struct { 171 type MessageSystemRequest struct {
140 Page int `json:"page"` 172 Page int `json:"page"`
141 Size int `json:"size"` 173 Size int `json:"size"`
@@ -274,6 +306,24 @@ type TagDeleteResponse struct { @@ -274,6 +306,24 @@ type TagDeleteResponse struct {
274 Id int64 `json:"id"` 306 Id int64 `json:"id"`
275 } 307 }
276 308
  309 +type TagOptionsRequest struct {
  310 + CompanyId int64 `path:",optional"` // 公司ID
  311 +}
  312 +
  313 +type TagOptionsResponse struct {
  314 + Options []TagOptions `json:"options"`
  315 +}
  316 +
  317 +type TagOptions struct {
  318 + Label string `json:"label"` // 分组名称
  319 + Options []TagOptionValue `json:"options"`
  320 +}
  321 +
  322 +type TagOptionValue struct {
  323 + Label string `json:"label"` // 名称
  324 + Value int64 `json:"value"` // 标签ID
  325 +}
  326 +
277 type MiniUserLoginRequest struct { 327 type MiniUserLoginRequest struct {
278 LoginType string `json:"loginType"` // 登录类型 wechat-login whchat-phone-login phone-password-login phone-smscode-login 328 LoginType string `json:"loginType"` // 登录类型 wechat-login whchat-phone-login phone-password-login phone-smscode-login
279 WechatAuthCode string `json:"wechatAuthcode,optional"` // 微信登录 授权码 329 WechatAuthCode string `json:"wechatAuthcode,optional"` // 微信登录 授权码
@@ -935,7 +985,6 @@ type SystemArticleUpdateRequest struct { @@ -935,7 +985,6 @@ type SystemArticleUpdateRequest struct {
935 Images []string `json:"images"` // 图片 985 Images []string `json:"images"` // 图片
936 WhoRead []int64 `json:"whoRead"` // 谁可以看 986 WhoRead []int64 `json:"whoRead"` // 谁可以看
937 WhoReview []int64 `json:"whoReview"` // 评论人 987 WhoReview []int64 `json:"whoReview"` // 评论人
938 - Location Location `json:"location"` // 坐标  
939 TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人] 988 TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人]
940 Tags []int64 `json:"tags"` // 标签 989 Tags []int64 `json:"tags"` // 标签
941 AccessToken string `header:"x-mmm-accesstoken"` // 授权token 990 AccessToken string `header:"x-mmm-accesstoken"` // 授权token
@@ -96,7 +96,6 @@ func (repository *ArticleSectionRepository) DeleteBy(ctx context.Context, conn t @@ -96,7 +96,6 @@ func (repository *ArticleSectionRepository) DeleteBy(ctx context.Context, conn t
96 m = &models.ArticleSection{} 96 m = &models.ArticleSection{}
97 ) 97 )
98 queryFunc := func() (interface{}, error) { 98 queryFunc := func() (interface{}, error) {
99 - tx = tx.Where("id = ?", m.Id)  
100 if v, ok := queryOptions["articleId"]; ok { 99 if v, ok := queryOptions["articleId"]; ok {
101 tx = tx.Where("article_id = ?", v) 100 tx = tx.Where("article_id = ?", v)
102 } 101 }
@@ -141,7 +140,7 @@ func (repository *ArticleSectionRepository) Find(ctx context.Context, conn trans @@ -141,7 +140,7 @@ func (repository *ArticleSectionRepository) Find(ctx context.Context, conn trans
141 total int64 140 total int64
142 ) 141 )
143 queryFunc := func() (interface{}, error) { 142 queryFunc := func() (interface{}, error) {
144 - tx = tx.Model(&ms).Order("id desc") 143 + tx = tx.Model(&ms).Order("sort_by")
145 144
146 if v, ok := queryOptions["articleId"]; ok { 145 if v, ok := queryOptions["articleId"]; ok {
147 tx = tx.Where("article_id = ?", v) 146 tx = tx.Where("article_id = ?", v)