作者 tangxvhui
@@ -731,7 +731,7 @@ @@ -731,7 +731,7 @@
731 "200": { 731 "200": {
732 "description": "A successful response.", 732 "description": "A successful response.",
733 "schema": { 733 "schema": {
734 - "$ref": "#/definitions/MiniHomePageRespose" 734 + "$ref": "#/definitions/MiniHomePageResponse"
735 } 735 }
736 } 736 }
737 }, 737 },
@@ -741,7 +741,35 @@ @@ -741,7 +741,35 @@
741 ] 741 ]
742 } 742 }
743 }, 743 },
744 - "v1/mini/user/apply-join-company": { 744 + "v1/mini/show/search_article": {
  745 + "post": {
  746 + "summary": "小程序首页搜索文章",
  747 + "operationId": "MiniSearchArticlePage",
  748 + "responses": {
  749 + "200": {
  750 + "description": "A successful response.",
  751 + "schema": {
  752 + "$ref": "#/definitions/MiniSearchArticleResponse"
  753 + }
  754 + }
  755 + },
  756 + "parameters": [
  757 + {
  758 + "name": "body",
  759 + "in": "body",
  760 + "required": true,
  761 + "schema": {
  762 + "$ref": "#/definitions/MiniSearchArticleRequest"
  763 + }
  764 + }
  765 + ],
  766 + "requestBody": {},
  767 + "tags": [
  768 + "article"
  769 + ]
  770 + }
  771 + },
  772 + "v1/mini/user/apply_join_company": {
745 "post": { 773 "post": {
746 "summary": "用户申请加入公司", 774 "summary": "用户申请加入公司",
747 "operationId": "miniUserApplyJoinCompany", 775 "operationId": "miniUserApplyJoinCompany",
@@ -795,7 +823,7 @@ @@ -795,7 +823,7 @@
795 ] 823 ]
796 } 824 }
797 }, 825 },
798 - "v1/mini/user/audit-list": { 826 + "v1/mini/user/audit_list": {
799 "post": { 827 "post": {
800 "summary": "用户审核列表", 828 "summary": "用户审核列表",
801 "operationId": "miniUserAuditList", 829 "operationId": "miniUserAuditList",
@@ -823,16 +851,14 @@ @@ -823,16 +851,14 @@
823 ] 851 ]
824 } 852 }
825 }, 853 },
826 - "v1/mini/user/department-users": { 854 + "v1/mini/user/department_users": {
827 "post": { 855 "post": {
828 "summary": "部门用户列表", 856 "summary": "部门用户列表",
829 "operationId": "miniUserDepartmentUsers", 857 "operationId": "miniUserDepartmentUsers",
830 "responses": { 858 "responses": {
831 "200": { 859 "200": {
832 "description": "A successful response.", 860 "description": "A successful response.",
833 - "schema": {  
834 - "$ref": "#/definitions/MiniUserInfoResponse"  
835 - } 861 + "schema": {}
836 } 862 }
837 }, 863 },
838 "parameters": [ 864 "parameters": [
@@ -933,6 +959,60 @@ @@ -933,6 +959,60 @@
933 ] 959 ]
934 } 960 }
935 }, 961 },
  962 + "v1/mini/user/following/latest_unread_list": {
  963 + "post": {
  964 + "summary": "我关注的人-最新未读列表(未读标红)",
  965 + "operationId": "miniUserFollowingLatestUnreadList",
  966 + "responses": {
  967 + "200": {
  968 + "description": "A successful response.",
  969 + "schema": {
  970 + "$ref": "#/definitions/MiniUserFollowedSearchResponse"
  971 + }
  972 + }
  973 + },
  974 + "parameters": [
  975 + {
  976 + "name": "body",
  977 + "in": "body",
  978 + "required": true,
  979 + "schema": {
  980 + "$ref": "#/definitions/MiniUserFollowedSearchRequest"
  981 + }
  982 + }
  983 + ],
  984 + "requestBody": {},
  985 + "tags": [
  986 + "user"
  987 + ]
  988 + }
  989 + },
  990 + "v1/mini/user/following/mark_read": {
  991 + "post": {
  992 + "summary": "我关注的人-标记已读",
  993 + "operationId": "miniUserFollowingMarkRead",
  994 + "responses": {
  995 + "200": {
  996 + "description": "A successful response.",
  997 + "schema": {}
  998 + }
  999 + },
  1000 + "parameters": [
  1001 + {
  1002 + "name": "body",
  1003 + "in": "body",
  1004 + "required": true,
  1005 + "schema": {
  1006 + "$ref": "#/definitions/MiniUserFollowingMarkReadRequest"
  1007 + }
  1008 + }
  1009 + ],
  1010 + "requestBody": {},
  1011 + "tags": [
  1012 + "user"
  1013 + ]
  1014 + }
  1015 + },
936 "v1/mini/user/info": { 1016 "v1/mini/user/info": {
937 "post": { 1017 "post": {
938 "summary": "用户信息", 1018 "summary": "用户信息",
@@ -989,7 +1069,63 @@ @@ -989,7 +1069,63 @@
989 ] 1069 ]
990 } 1070 }
991 }, 1071 },
992 - "v1/mini/user/switch-account": { 1072 + "v1/mini/user/news": {
  1073 + "post": {
  1074 + "summary": "用户快讯",
  1075 + "operationId": "miniUserNews",
  1076 + "responses": {
  1077 + "200": {
  1078 + "description": "A successful response.",
  1079 + "schema": {
  1080 + "$ref": "#/definitions/MiniUserNewsResposne"
  1081 + }
  1082 + }
  1083 + },
  1084 + "parameters": [
  1085 + {
  1086 + "name": "body",
  1087 + "in": "body",
  1088 + "required": true,
  1089 + "schema": {
  1090 + "$ref": "#/definitions/MiniUserNewsRequest"
  1091 + }
  1092 + }
  1093 + ],
  1094 + "requestBody": {},
  1095 + "tags": [
  1096 + "user"
  1097 + ]
  1098 + }
  1099 + },
  1100 + "v1/mini/user/statistics": {
  1101 + "post": {
  1102 + "summary": "用户统计",
  1103 + "operationId": "miniUserStatistics",
  1104 + "responses": {
  1105 + "200": {
  1106 + "description": "A successful response.",
  1107 + "schema": {
  1108 + "$ref": "#/definitions/UserStatisticsResponse"
  1109 + }
  1110 + }
  1111 + },
  1112 + "parameters": [
  1113 + {
  1114 + "name": "body",
  1115 + "in": "body",
  1116 + "required": true,
  1117 + "schema": {
  1118 + "$ref": "#/definitions/UserStatisticsRequest"
  1119 + }
  1120 + }
  1121 + ],
  1122 + "requestBody": {},
  1123 + "tags": [
  1124 + "user"
  1125 + ]
  1126 + }
  1127 + },
  1128 + "v1/mini/user/switch_account": {
993 "post": { 1129 "post": {
994 "summary": "切换账号", 1130 "summary": "切换账号",
995 "operationId": "miniUserSwitchAccount", 1131 "operationId": "miniUserSwitchAccount",
@@ -1043,6 +1179,32 @@ @@ -1043,6 +1179,32 @@
1043 ] 1179 ]
1044 } 1180 }
1045 }, 1181 },
  1182 + "v1/mini/user/user_list": {
  1183 + "post": {
  1184 + "summary": "用户列表",
  1185 + "operationId": "miniUsersList",
  1186 + "responses": {
  1187 + "200": {
  1188 + "description": "A successful response.",
  1189 + "schema": {}
  1190 + }
  1191 + },
  1192 + "parameters": [
  1193 + {
  1194 + "name": "body",
  1195 + "in": "body",
  1196 + "required": true,
  1197 + "schema": {
  1198 + "$ref": "#/definitions/MiniUsersListRequest"
  1199 + }
  1200 + }
  1201 + ],
  1202 + "requestBody": {},
  1203 + "tags": [
  1204 + "user"
  1205 + ]
  1206 + }
  1207 + },
1046 "v1/system/account": { 1208 "v1/system/account": {
1047 "post": { 1209 "post": {
1048 "summary": "系统新增账号", 1210 "summary": "系统新增账号",
@@ -1997,6 +2159,32 @@ @@ -1997,6 +2159,32 @@
1997 ] 2159 ]
1998 } 2160 }
1999 }, 2161 },
  2162 + "v1/system/user/user_list": {
  2163 + "post": {
  2164 + "summary": "用户列表",
  2165 + "operationId": "systemUsersList",
  2166 + "responses": {
  2167 + "200": {
  2168 + "description": "A successful response.",
  2169 + "schema": {}
  2170 + }
  2171 + },
  2172 + "parameters": [
  2173 + {
  2174 + "name": "body",
  2175 + "in": "body",
  2176 + "required": true,
  2177 + "schema": {
  2178 + "$ref": "#/definitions/MiniUsersListRequest"
  2179 + }
  2180 + }
  2181 + ],
  2182 + "requestBody": {},
  2183 + "tags": [
  2184 + "user"
  2185 + ]
  2186 + }
  2187 + },
2000 "v1/system/user/{id}": { 2188 "v1/system/user/{id}": {
2001 "get": { 2189 "get": {
2002 "summary": "用户详情", 2190 "summary": "用户详情",
@@ -2375,7 +2563,7 @@ @@ -2375,7 +2563,7 @@
2375 "ArticleTagCount": { 2563 "ArticleTagCount": {
2376 "type": "object", 2564 "type": "object",
2377 "properties": { 2565 "properties": {
2378 - "tagGroup": { 2566 + "tagCategory": {
2379 "type": "string", 2567 "type": "string",
2380 "description": " 标签分组" 2568 "description": " 标签分组"
2381 }, 2569 },
@@ -2409,7 +2597,7 @@ @@ -2409,7 +2597,7 @@
2409 }, 2597 },
2410 "title": "ArticleTagCount", 2598 "title": "ArticleTagCount",
2411 "required": [ 2599 "required": [
2412 - "tagGroup", 2600 + "tagCategory",
2413 "tagId", 2601 "tagId",
2414 "tagImage", 2602 "tagImage",
2415 "tagName", 2603 "tagName",
@@ -2421,7 +2609,7 @@ @@ -2421,7 +2609,7 @@
2421 "ArticleTagGroup": { 2609 "ArticleTagGroup": {
2422 "type": "object", 2610 "type": "object",
2423 "properties": { 2611 "properties": {
2424 - "group": { 2612 + "category": {
2425 "type": "string" 2613 "type": "string"
2426 }, 2614 },
2427 "tags": { 2615 "tags": {
@@ -2433,7 +2621,7 @@ @@ -2433,7 +2621,7 @@
2433 }, 2621 },
2434 "title": "ArticleTagGroup", 2622 "title": "ArticleTagGroup",
2435 "required": [ 2623 "required": [
2436 - "group", 2624 + "category",
2437 "tags" 2625 "tags"
2438 ] 2626 ]
2439 }, 2627 },
@@ -2444,7 +2632,7 @@ @@ -2444,7 +2632,7 @@
2444 "type": "integer", 2632 "type": "integer",
2445 "format": "int64" 2633 "format": "int64"
2446 }, 2634 },
2447 - "group": { 2635 + "category": {
2448 "type": "string" 2636 "type": "string"
2449 }, 2637 },
2450 "name": { 2638 "name": {
@@ -2457,7 +2645,7 @@ @@ -2457,7 +2645,7 @@
2457 "title": "ArticleTagItem", 2645 "title": "ArticleTagItem",
2458 "required": [ 2646 "required": [
2459 "id", 2647 "id",
2460 - "group", 2648 + "category",
2461 "name", 2649 "name",
2462 "image" 2650 "image"
2463 ] 2651 ]
@@ -3698,7 +3886,7 @@ @@ -3698,7 +3886,7 @@
3698 "show": { 3886 "show": {
3699 "type": "integer", 3887 "type": "integer",
3700 "format": "int32", 3888 "format": "int32",
3701 - "description": " 评论的展示状态(0显示、1不显示)" 3889 + "description": " 评论的展示状态(1显示、2不显示)"
3702 }, 3890 },
3703 "edit": { 3891 "edit": {
3704 "type": "integer", 3892 "type": "integer",
@@ -3709,6 +3897,13 @@ @@ -3709,6 +3897,13 @@
3709 "type": "integer", 3897 "type": "integer",
3710 "format": "int32", 3898 "format": "int32",
3711 "description": " 当前人员对文章的点赞标识 (0 没有点赞 1有点赞)" 3899 "description": " 当前人员对文章的点赞标识 (0 没有点赞 1有点赞)"
  3900 + },
  3901 + "tags": {
  3902 + "type": "array",
  3903 + "items": {
  3904 + "type": "string"
  3905 + },
  3906 + "description": "文章的标签"
3712 } 3907 }
3713 }, 3908 },
3714 "title": "MiniArticleGetResponse", 3909 "title": "MiniArticleGetResponse",
@@ -3728,7 +3923,8 @@ @@ -3728,7 +3923,8 @@
3728 "countRead", 3923 "countRead",
3729 "show", 3924 "show",
3730 "edit", 3925 "edit",
3731 - "meLoveFlag" 3926 + "meLoveFlag",
  3927 + "tags"
3732 ] 3928 ]
3733 }, 3929 },
3734 "MiniArticleMarkItem": { 3930 "MiniArticleMarkItem": {
@@ -4157,9 +4353,15 @@ @@ -4157,9 +4353,15 @@
4157 }, 4353 },
4158 "title": "MiniHomePageRequest" 4354 "title": "MiniHomePageRequest"
4159 }, 4355 },
4160 - "MiniHomePageRespose": { 4356 + "MiniHomePageResponse": {
4161 "type": "object", 4357 "type": "object",
4162 "properties": { 4358 "properties": {
  4359 + "tagCategory": {
  4360 + "type": "array",
  4361 + "items": {
  4362 + "type": "string"
  4363 + }
  4364 + },
4163 "tags": { 4365 "tags": {
4164 "type": "array", 4366 "type": "array",
4165 "items": { 4367 "items": {
@@ -4167,8 +4369,9 @@ @@ -4167,8 +4369,9 @@
4167 } 4369 }
4168 } 4370 }
4169 }, 4371 },
4170 - "title": "MiniHomePageRespose", 4372 + "title": "MiniHomePageResponse",
4171 "required": [ 4373 "required": [
  4374 + "tagCategory",
4172 "tags" 4375 "tags"
4173 ] 4376 ]
4174 }, 4377 },
@@ -4265,6 +4468,115 @@ @@ -4265,6 +4468,115 @@
4265 "total" 4468 "total"
4266 ] 4469 ]
4267 }, 4470 },
  4471 + "MiniSearchArticleItem": {
  4472 + "type": "object",
  4473 + "properties": {
  4474 + "articleId": {
  4475 + "type": "integer",
  4476 + "format": "int64"
  4477 + },
  4478 + "title": {
  4479 + "type": "string"
  4480 + },
  4481 + "author": {
  4482 + "type": "string",
  4483 + "description": " 发布人"
  4484 + },
  4485 + "images": {
  4486 + "type": "array",
  4487 + "items": {
  4488 + "type": "string"
  4489 + }
  4490 + },
  4491 + "createdAt": {
  4492 + "type": "integer",
  4493 + "format": "int64"
  4494 + },
  4495 + "meReadFlag": {
  4496 + "type": "integer",
  4497 + "format": "int32",
  4498 + "description": "已读标识 [0:未读] [1:已读]"
  4499 + }
  4500 + },
  4501 + "title": "MiniSearchArticleItem",
  4502 + "required": [
  4503 + "articleId",
  4504 + "title",
  4505 + "author",
  4506 + "images",
  4507 + "createdAt",
  4508 + "meReadFlag"
  4509 + ]
  4510 + },
  4511 + "MiniSearchArticleRequest": {
  4512 + "type": "object",
  4513 + "properties": {
  4514 + "page": {
  4515 + "type": "integer",
  4516 + "format": "int32"
  4517 + },
  4518 + "size": {
  4519 + "type": "integer",
  4520 + "format": "int32"
  4521 + },
  4522 + "": {
  4523 + "type": "integer",
  4524 + "format": "int64"
  4525 + },
  4526 + "": {
  4527 + "type": "integer",
  4528 + "format": "int64"
  4529 + },
  4530 + "tagCategory": {
  4531 + "type": "string"
  4532 + },
  4533 + "tagId": {
  4534 + "type": "integer",
  4535 + "format": "int64"
  4536 + },
  4537 + "beginTime": {
  4538 + "type": "integer",
  4539 + "format": "int64"
  4540 + },
  4541 + "endTime": {
  4542 + "type": "integer",
  4543 + "format": "int64"
  4544 + },
  4545 + "searchWord": {
  4546 + "type": "string"
  4547 + }
  4548 + },
  4549 + "title": "MiniSearchArticleRequest",
  4550 + "required": [
  4551 + "page",
  4552 + "size",
  4553 + "tagCategory",
  4554 + "tagId",
  4555 + "beginTime",
  4556 + "endTime",
  4557 + "searchWord"
  4558 + ]
  4559 + },
  4560 + "MiniSearchArticleResponse": {
  4561 + "type": "object",
  4562 + "properties": {
  4563 + "total": {
  4564 + "type": "integer",
  4565 + "format": "int32"
  4566 + },
  4567 + "list": {
  4568 + "type": "array",
  4569 + "items": {
  4570 + "$ref": "#/definitions/MiniSearchArticleItem"
  4571 + }
  4572 + }
  4573 + },
  4574 + "title": "MiniSearchArticleResponse",
  4575 + "required": [
  4576 + "total",
  4577 + "list"
  4578 + ]
  4579 + },
4268 "MiniSetUserLikeRequset": { 4580 "MiniSetUserLikeRequset": {
4269 "type": "object", 4581 "type": "object",
4270 "properties": { 4582 "properties": {
@@ -4458,6 +4770,19 @@ @@ -4458,6 +4770,19 @@
4458 "total" 4770 "total"
4459 ] 4771 ]
4460 }, 4772 },
  4773 + "MiniUserFollowingMarkReadRequest": {
  4774 + "type": "object",
  4775 + "properties": {
  4776 + "userId": {
  4777 + "type": "integer",
  4778 + "format": "int64"
  4779 + }
  4780 + },
  4781 + "title": "MiniUserFollowingMarkReadRequest",
  4782 + "required": [
  4783 + "userId"
  4784 + ]
  4785 + },
4461 "MiniUserInfoRequest": { 4786 "MiniUserInfoRequest": {
4462 "type": "object", 4787 "type": "object",
4463 "title": "MiniUserInfoRequest" 4788 "title": "MiniUserInfoRequest"
@@ -4610,6 +4935,51 @@ @@ -4610,6 +4935,51 @@
4610 "success" 4935 "success"
4611 ] 4936 ]
4612 }, 4937 },
  4938 + "MiniUserNewsRequest": {
  4939 + "type": "object",
  4940 + "properties": {
  4941 + "authorId": {
  4942 + "type": "integer",
  4943 + "format": "int64",
  4944 + "description": " 特定作者ID"
  4945 + },
  4946 + "lastArticleId": {
  4947 + "type": "integer",
  4948 + "format": "int64",
  4949 + "description": " 最后文章ID"
  4950 + },
  4951 + "size": {
  4952 + "type": "integer",
  4953 + "format": "int32",
  4954 + "description": " 数量"
  4955 + }
  4956 + },
  4957 + "title": "MiniUserNewsRequest",
  4958 + "required": [
  4959 + "size"
  4960 + ]
  4961 + },
  4962 + "MiniUserNewsResposne": {
  4963 + "type": "object",
  4964 + "properties": {
  4965 + "list": {
  4966 + "type": "array",
  4967 + "items": {
  4968 + "$ref": "#/definitions/UserNewsItem"
  4969 + }
  4970 + },
  4971 + "lastArticleId": {
  4972 + "type": "integer",
  4973 + "format": "int64",
  4974 + "description": " 最后文章ID"
  4975 + }
  4976 + },
  4977 + "title": "MiniUserNewsResposne",
  4978 + "required": [
  4979 + "list",
  4980 + "lastArticleId"
  4981 + ]
  4982 + },
4613 "MiniUserSwitchAccountRequest": { 4983 "MiniUserSwitchAccountRequest": {
4614 "type": "object", 4984 "type": "object",
4615 "properties": { 4985 "properties": {
@@ -4623,6 +4993,22 @@ @@ -4623,6 +4993,22 @@
4623 "companyId" 4993 "companyId"
4624 ] 4994 ]
4625 }, 4995 },
  4996 + "MiniUsersListRequest": {
  4997 + "type": "object",
  4998 + "properties": {
  4999 + "articleId": {
  5000 + "type": "integer",
  5001 + "format": "int64",
  5002 + "description": " 按文章ID(返回文章可见的用户)"
  5003 + },
  5004 + "roleId": {
  5005 + "type": "integer",
  5006 + "format": "int64",
  5007 + "description": " 按角色角色关联的用户"
  5008 + }
  5009 + },
  5010 + "title": "MiniUsersListRequest"
  5011 + },
4626 "MyLikeItem": { 5012 "MyLikeItem": {
4627 "type": "object", 5013 "type": "object",
4628 "properties": { 5014 "properties": {
@@ -6738,6 +7124,11 @@ @@ -6738,6 +7124,11 @@
6738 "type": "boolean", 7124 "type": "boolean",
6739 "format": "boolean", 7125 "format": "boolean",
6740 "description": " 互相关注标识" 7126 "description": " 互相关注标识"
  7127 + },
  7128 + "readFlag": {
  7129 + "type": "boolean",
  7130 + "format": "boolean",
  7131 + "description": " 已读标识 true:已读 false:未读(小红点)"
6741 } 7132 }
6742 }, 7133 },
6743 "title": "UserFollowItem", 7134 "title": "UserFollowItem",
@@ -6748,7 +7139,8 @@ @@ -6748,7 +7139,8 @@
6748 "avatar", 7139 "avatar",
6749 "position", 7140 "position",
6750 "followed", 7141 "followed",
6751 - "mutualFollowed" 7142 + "mutualFollowed",
  7143 + "readFlag"
6752 ] 7144 ]
6753 }, 7145 },
6754 "UserItem": { 7146 "UserItem": {
@@ -6768,6 +7160,10 @@ @@ -6768,6 +7160,10 @@
6768 "type": "string", 7160 "type": "string",
6769 "description": " 公司名称" 7161 "description": " 公司名称"
6770 }, 7162 },
  7163 + "companyCode": {
  7164 + "type": "string",
  7165 + "description": " 公司编码(邀请码)"
  7166 + },
6771 "flag": { 7167 "flag": {
6772 "type": "integer", 7168 "type": "integer",
6773 "format": "int32", 7169 "format": "int32",
@@ -6832,6 +7228,7 @@ @@ -6832,6 +7228,7 @@
6832 "id", 7228 "id",
6833 "companyId", 7229 "companyId",
6834 "companyName", 7230 "companyName",
  7231 + "companyCode",
6835 "flag", 7232 "flag",
6836 "name", 7233 "name",
6837 "avatar", 7234 "avatar",
@@ -6845,6 +7242,47 @@ @@ -6845,6 +7242,47 @@
6845 "accountFrom" 7242 "accountFrom"
6846 ] 7243 ]
6847 }, 7244 },
  7245 + "UserNewsItem": {
  7246 + "type": "object",
  7247 + "properties": {
  7248 + "newsId": {
  7249 + "type": "integer",
  7250 + "format": "int64",
  7251 + "description": " 快讯ID"
  7252 + },
  7253 + "type": {
  7254 + "type": "string",
  7255 + "description": " 快讯类型 文章:Article 讨论:Discuss ..."
  7256 + },
  7257 + "title": {
  7258 + "type": "string",
  7259 + "description": " 标题"
  7260 + },
  7261 + "summary": {
  7262 + "type": "string",
  7263 + "description": " 快讯概要"
  7264 + },
  7265 + "time": {
  7266 + "type": "integer",
  7267 + "format": "int64",
  7268 + "description": " 时间"
  7269 + },
  7270 + "readFlag": {
  7271 + "type": "boolean",
  7272 + "format": "boolean",
  7273 + "description": " 已读标识 true:已读 false:未读"
  7274 + }
  7275 + },
  7276 + "title": "UserNewsItem",
  7277 + "required": [
  7278 + "newsId",
  7279 + "type",
  7280 + "title",
  7281 + "summary",
  7282 + "time",
  7283 + "readFlag"
  7284 + ]
  7285 + },
6848 "UserSearchRequest": { 7286 "UserSearchRequest": {
6849 "type": "object", 7287 "type": "object",
6850 "properties": { 7288 "properties": {
@@ -86,6 +86,7 @@ service Core { @@ -86,6 +86,7 @@ service Core {
86 @server( 86 @server(
87 prefix: v1/system 87 prefix: v1/system
88 group: article 88 group: article
  89 + middleware: LoginStatusCheck
89 jwt: SystemAuth 90 jwt: SystemAuth
90 ) 91 )
91 service Core { 92 service Core {
@@ -11,6 +11,7 @@ info( @@ -11,6 +11,7 @@ info(
11 @server( 11 @server(
12 prefix: v1/system 12 prefix: v1/system
13 group: tags 13 group: tags
  14 + middleware: LoginStatusCheck
14 jwt: SystemAuth 15 jwt: SystemAuth
15 ) 16 )
16 service Core { 17 service Core {
@@ -35,6 +35,7 @@ service Core { @@ -35,6 +35,7 @@ service Core {
35 @server( 35 @server(
36 prefix: v1 36 prefix: v1
37 group: company 37 group: company
  38 + middleware: LoginStatusCheck
38 jwt : SystemAuth 39 jwt : SystemAuth
39 ) 40 )
40 service Core { 41 service Core {
@@ -131,7 +131,7 @@ type( @@ -131,7 +131,7 @@ type(
131 } 131 }
132 MiniUserNewsResposne{ 132 MiniUserNewsResposne{
133 List []UserNewsItem `json:"list"` 133 List []UserNewsItem `json:"list"`
134 - Total int64 `json:"total"` 134 + LastArticleId int64 `json:"lastArticleId"`// 最后文章ID
135 } 135 }
136 UserNewsItem{ 136 UserNewsItem{
137 NewsId int64 `json:"newsId"` // 快讯ID 137 NewsId int64 `json:"newsId"` // 快讯ID
1 Name: discuss 1 Name: discuss
2 Host: 0.0.0.0 2 Host: 0.0.0.0
3 Port: 8081 3 Port: 8081
4 -Verbose: false 4 +Verbose: true
5 Migrate: false 5 Migrate: false
6 Timeout: 30000 6 Timeout: 30000
7 # CertFile: ./key/fjmaimaimai.com_bundle.crt 7 # CertFile: ./key/fjmaimaimai.com_bundle.crt
@@ -113,6 +113,8 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { @@ -113,6 +113,8 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
113 ) 113 )
114 114
115 server.AddRoutes( 115 server.AddRoutes(
  116 + rest.WithMiddlewares(
  117 + []rest.Middleware{serverCtx.LoginStatusCheck},
116 []rest.Route{ 118 []rest.Route{
117 { 119 {
118 Method: http.MethodPost, 120 Method: http.MethodPost,
@@ -144,7 +146,8 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { @@ -144,7 +146,8 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
144 Path: "/article_tag/options", 146 Path: "/article_tag/options",
145 Handler: tags.OptionsHandler(serverCtx), 147 Handler: tags.OptionsHandler(serverCtx),
146 }, 148 },
147 - }, 149 + }...,
  150 + ),
148 rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret), 151 rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret),
149 rest.WithPrefix("/v1/system"), 152 rest.WithPrefix("/v1/system"),
150 ) 153 )
@@ -336,13 +339,16 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { @@ -336,13 +339,16 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
336 ) 339 )
337 340
338 server.AddRoutes( 341 server.AddRoutes(
  342 + rest.WithMiddlewares(
  343 + []rest.Middleware{serverCtx.LoginStatusCheck},
339 []rest.Route{ 344 []rest.Route{
340 { 345 {
341 Method: http.MethodPost, 346 Method: http.MethodPost,
342 Path: "/system/company/search", 347 Path: "/system/company/search",
343 Handler: company.SystemCompanySearchHandler(serverCtx), 348 Handler: company.SystemCompanySearchHandler(serverCtx),
344 }, 349 },
345 - }, 350 + }...,
  351 + ),
346 rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret), 352 rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret),
347 rest.WithPrefix("/v1"), 353 rest.WithPrefix("/v1"),
348 ) 354 )
@@ -440,6 +446,8 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { @@ -440,6 +446,8 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
440 ) 446 )
441 447
442 server.AddRoutes( 448 server.AddRoutes(
  449 + rest.WithMiddlewares(
  450 + []rest.Middleware{serverCtx.LoginStatusCheck},
443 []rest.Route{ 451 []rest.Route{
444 { 452 {
445 Method: http.MethodGet, 453 Method: http.MethodGet,
@@ -476,7 +484,8 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { @@ -476,7 +484,8 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
476 Path: "/article/restore", 484 Path: "/article/restore",
477 Handler: article.SystemArticleRestoreHandler(serverCtx), 485 Handler: article.SystemArticleRestoreHandler(serverCtx),
478 }, 486 },
479 - }, 487 + }...,
  488 + ),
480 rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret), 489 rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret),
481 rest.WithPrefix("/v1/system"), 490 rest.WithPrefix("/v1/system"),
482 ) 491 )
@@ -49,6 +49,9 @@ func (l *MiniUserLoginLogic) MiniUserLogin(req *types.MiniUserLoginRequest) (res @@ -49,6 +49,9 @@ func (l *MiniUserLoginLogic) MiniUserLogin(req *types.MiniUserLoginRequest) (res
49 if err != nil { 49 if err != nil {
50 return 50 return
51 } 51 }
  52 + if loginInfo.User == nil {
  53 + return nil, xerr.NewErrMsgErr("用户不存在", err)
  54 + }
52 var userJwtToken = tool.UserToken{} 55 var userJwtToken = tool.UserToken{}
53 if loginInfo.User != nil { 56 if loginInfo.User != nil {
54 userJwtToken.UserId = loginInfo.User.Id 57 userJwtToken.UserId = loginInfo.User.Id
@@ -2,6 +2,10 @@ package user @@ -2,6 +2,10 @@ package user
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/contextdata"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
5 9
6 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" 10 "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" 11 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
@@ -24,7 +28,51 @@ func NewMiniUserNewsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Mini @@ -24,7 +28,51 @@ func NewMiniUserNewsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Mini
24 } 28 }
25 29
26 func (l *MiniUserNewsLogic) MiniUserNews(req *types.MiniUserNewsRequest) (resp *types.MiniUserNewsResposne, err error) { 30 func (l *MiniUserNewsLogic) MiniUserNews(req *types.MiniUserNewsRequest) (resp *types.MiniUserNewsResposne, err error) {
27 - // todo: add your logic here and delete this line  
28 - 31 + var (
  32 + conn = l.svcCtx.DefaultDBConn()
  33 + user *domain.User
  34 + userToken = contextdata.GetUserTokenFromCtx(l.ctx)
  35 + articles []*domain.Article
  36 + readedArticles = make([]*domain.UserReadArticle, 0)
  37 + )
  38 + if user, err = l.svcCtx.UserRepository.FindOne(l.ctx, conn, userToken.UserId); err != nil {
  39 + return nil, xerr.NewErrMsgErr("用户不存在", err)
  40 + }
  41 + var (
  42 + users = user.Following
  43 + )
  44 + if req.AuthorId > 0 {
  45 + users = []int64{req.AuthorId}
  46 + }
  47 + if _, articles, err = l.svcCtx.ArticleRepository.FindAuthorsLatestArticle(l.ctx, conn, user.CompanyId, users, user.Id, req.LastArticleId, req.Size); err != nil {
  48 + return nil, xerr.NewErrMsgErr("获取快讯异常", err)
  49 + }
  50 + resp = &types.MiniUserNewsResposne{
  51 + List: make([]types.UserNewsItem, 0),
  52 + }
  53 + articleIds := domain.Values(articles, func(item *domain.Article) int64 {
  54 + return item.Id
  55 + })
  56 + if len(articleIds) > 0 {
  57 + resp.LastArticleId = articleIds[len(articleIds)-1]
  58 + _, readedArticles, _ = l.svcCtx.UserReadArticleRepository.Find(l.ctx, conn, domain.IndexCompanyId(userToken.CompanyId)().WithKV("articleIds", articleIds))
  59 + }
  60 + readArticlesMap := lo.KeyBy(readedArticles, func(item *domain.UserReadArticle) int64 {
  61 + return item.ArticleId
  62 + })
  63 + lo.ForEach(articles, func(item *domain.Article, index int) {
  64 + newsItem := types.UserNewsItem{
  65 + NewsId: item.Id,
  66 + Type: "article",
  67 + Title: item.Title,
  68 + Summary: item.Summary,
  69 + Time: item.CreatedAt,
  70 + ReadFlag: false,
  71 + }
  72 + if _, ok := readArticlesMap[item.Id]; ok {
  73 + newsItem.ReadFlag = true
  74 + }
  75 + resp.List = append(resp.List, newsItem)
  76 + })
29 return 77 return
30 } 78 }
@@ -465,7 +465,7 @@ type MiniUserNewsRequest struct { @@ -465,7 +465,7 @@ type MiniUserNewsRequest struct {
465 465
466 type MiniUserNewsResposne struct { 466 type MiniUserNewsResposne struct {
467 List []UserNewsItem `json:"list"` 467 List []UserNewsItem `json:"list"`
468 - Total int64 `json:"total"` 468 + LastArticleId int64 `json:"lastArticleId"` // 最后文章ID
469 } 469 }
470 470
471 type UserNewsItem struct { 471 type UserNewsItem struct {
@@ -168,12 +168,14 @@ func (repository *ArticleRepository) FindAuthorsLatestArticle(ctx context.Contex @@ -168,12 +168,14 @@ func (repository *ArticleRepository) FindAuthorsLatestArticle(ctx context.Contex
168 ) 168 )
169 queryFunc := func() (interface{}, error) { 169 queryFunc := func() (interface{}, error) {
170 tx = tx.Model(&ms). 170 tx = tx.Model(&ms).
171 - Where("id < ?", lastId).  
172 Where("company_id=?", companyId). 171 Where("company_id=?", companyId).
173 Where("author_id in (?)", authors). 172 Where("author_id in (?)", authors).
174 - Where("target_user=0 or who_read @>'[?]'", whoRead).  
175 - Where("show = 1").  
176 - Order("id desc") 173 + Where(fmt.Sprintf("target_user=0 or who_read @>'[%d]'", whoRead)).
  174 + Where("show = 1")
  175 + if lastId > 0 {
  176 + tx.Where("id < ?", lastId)
  177 + }
  178 + tx.Order("id desc")
177 if limit > 0 { 179 if limit > 0 {
178 tx.Limit(limit) 180 tx.Limit(limit)
179 } 181 }
@@ -40,6 +40,7 @@ type ArticleRepository interface { @@ -40,6 +40,7 @@ type ArticleRepository interface {
40 Find(ctx context.Context, conn transaction.Conn, companyId int64, queryOptions map[string]interface{}) (int64, []*Article, error) 40 Find(ctx context.Context, conn transaction.Conn, companyId int64, queryOptions map[string]interface{}) (int64, []*Article, error)
41 FindAuthorsLatestFirstArticle(ctx context.Context, conn transaction.Conn, companyId int64, authors []int64, whoRead int64, limit int) (int64, []*Article, error) 41 FindAuthorsLatestFirstArticle(ctx context.Context, conn transaction.Conn, companyId int64, authors []int64, whoRead int64, limit int) (int64, []*Article, error)
42 FindAuthorsLatestFirstUnreadArticle(ctx context.Context, conn transaction.Conn, companyId int64, authors []int64, whoRead int64, limit int) (int64, []*Article, error) 42 FindAuthorsLatestFirstUnreadArticle(ctx context.Context, conn transaction.Conn, companyId int64, authors []int64, whoRead int64, limit int) (int64, []*Article, error)
  43 + FindAuthorsLatestArticle(ctx context.Context, conn transaction.Conn, companyId int64, authors []int64, whoRead int64, lastId int64, limit int) (int64, []*Article, error)
43 IncreaseCountLove(ctx context.Context, conn transaction.Conn, incr int, articleId int64) error //点赞数量变动 44 IncreaseCountLove(ctx context.Context, conn transaction.Conn, incr int, articleId int64) error //点赞数量变动
44 IncreaseCountComment(ctx context.Context, conn transaction.Conn, incr int, articleId int64) error //评论数量变动 45 IncreaseCountComment(ctx context.Context, conn transaction.Conn, incr int, articleId int64) error //评论数量变动
45 IncreaseCountRead(ctx context.Context, conn transaction.Conn, incr int, articleId int64) error //浏览数量变动 46 IncreaseCountRead(ctx context.Context, conn transaction.Conn, incr int, articleId int64) error //浏览数量变动