作者 tangxvhui

Merge branch 'dev' into test

正在显示 30 个修改的文件 包含 801 行增加166 行删除
  1 +# 说明
  2 +
  3 +### 测试环境
  4 +服务端域名 http://sumifcc-discuss-test.sumifcc.com/
  5 +
  6 +### 可设置环境变量
  7 +- DataSource
  8 + 数据库连接,样例
  9 + ``` code
  10 + host=数据库IP地址 user=用户名 password=密码 dbname=数据库名 port=31543 sslmode=disable TimeZone=Asia/Shanghai
  11 + ```
  12 +
@@ -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 {
@@ -47,7 +48,7 @@ type ( @@ -47,7 +48,7 @@ type (
47 Name string `json:"name"` // 标签名称 48 Name string `json:"name"` // 标签名称
48 Category string `json:"category"` // 标签分类 49 Category string `json:"category"` // 标签分类
49 Remark string `json:"remark,optional"` // 备注 50 Remark string `json:"remark,optional"` // 备注
50 - Other string `json:"other"` 51 + Other string `json:"other,optional"`
51 } 52 }
52 53
53 TagCreateResponse { 54 TagCreateResponse {
@@ -64,7 +65,7 @@ type ( @@ -64,7 +65,7 @@ type (
64 Name string `json:"name"` // 标签名称 65 Name string `json:"name"` // 标签名称
65 Category string `json:"category"` // 标签分类 66 Category string `json:"category"` // 标签分类
66 Remark string `json:"remark,optional"` // 备注 67 Remark string `json:"remark,optional"` // 备注
67 - Other string `json:"other"` 68 + Other string `json:"other,optional"`
68 } 69 }
69 70
70 TagEditResponse { 71 TagEditResponse {
@@ -248,7 +248,7 @@ type ( @@ -248,7 +248,7 @@ type (
248 MiniArticleDraftGetMeResponse { 248 MiniArticleDraftGetMeResponse {
249 Id int64 `json:"id"` // 249 Id int64 `json:"id"` //
250 Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式 250 Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式
251 - Section []string `json:"Section"` // 填写的内容 251 + Section []string `json:"section"` // 填写的内容
252 Title string `json:"title"` // 标题 252 Title string `json:"title"` // 标题
253 Images []string `json:"images"` // 图片 253 Images []string `json:"images"` // 图片
254 WhoRead []int64 `json:"whoRead"` // 谁可以看 254 WhoRead []int64 `json:"whoRead"` // 谁可以看
@@ -356,6 +356,7 @@ type ( @@ -356,6 +356,7 @@ type (
356 CountRead int `json:"countRead"` // 浏览数量 356 CountRead int `json:"countRead"` // 浏览数量
357 Show int `json:"show"` // 评论的展示状态(0显示、1不显示) 357 Show int `json:"show"` // 评论的展示状态(0显示、1不显示)
358 Tags []ArticleTagItem `json:"tags"` //标签 358 Tags []ArticleTagItem `json:"tags"` //标签
  359 + TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人]
359 } 360 }
360 ) 361 )
361 362
@@ -229,7 +229,7 @@ type ( @@ -229,7 +229,7 @@ type (
229 Page int `json:"page"` 229 Page int `json:"page"`
230 Size int `json:"size"` 230 Size int `json:"size"`
231 ArticleId int64 `json:"articleId"` // 文章ID 231 ArticleId int64 `json:"articleId"` // 文章ID
232 - TopId int64 `json:"topId"` // 文章顶层ID 232 + TopId int64 `json:"topId,optional"` // 文章顶层ID
233 AuthorId int64 `json:"authorId,optional"` // 用户 233 AuthorId int64 `json:"authorId,optional"` // 用户
234 Show int `json:"show,optional"` // 显示状态 234 Show int `json:"show,optional"` // 显示状态
235 BeginTime int64 `json:"beginTime,optional"` // 开始时间 235 BeginTime int64 `json:"beginTime,optional"` // 开始时间
@@ -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 {
@@ -71,9 +71,9 @@ type ( @@ -71,9 +71,9 @@ type (
71 Id int64 `json:"id"` 71 Id int64 `json:"id"`
72 CompanyId int64 `json:"companyId,omitempty"` // 公司ID 72 CompanyId int64 `json:"companyId,omitempty"` // 公司ID
73 CompanyName string `json:"companyName,omitempty"` // 公司名称 73 CompanyName string `json:"companyName,omitempty"` // 公司名称
74 - Name string `json:"name,omitempty"` // 名称  
75 - Avatar string `json:"avatar,omitempty"` // 头像  
76 - Position string `json:"position,omitempty"` // 职位 74 + Name string `json:"name"` // 名称
  75 + Avatar string `json:"avatar"` // 头像
  76 + Position string `json:"position"` // 职位
77 } 77 }
78 78
79 79
@@ -71,7 +71,7 @@ service Core { @@ -71,7 +71,7 @@ service Core {
71 post /mini/user/unfollow (FollowRequest) 71 post /mini/user/unfollow (FollowRequest)
72 @doc "我点赞的文章或评论" 72 @doc "我点赞的文章或评论"
73 @handler miniMyLike 73 @handler miniMyLike
74 - post /user/mylike (MiniMyLikeRequest)returns (MiniMyLikeResponse) 74 + post /mini/user/mylike (MiniMyLikeRequest)returns (MiniMyLikeResponse)
75 } 75 }
76 76
77 type( 77 type(
@@ -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
@@ -183,9 +183,10 @@ type( @@ -183,9 +183,10 @@ type(
183 } 183 }
184 Department struct { 184 Department struct {
185 Id int64 `json:"id,omitempty"` // 部门ID 185 Id int64 `json:"id,omitempty"` // 部门ID
186 - CompanyId int64 `json:"companyId,omitempty"` // 公司ID  
187 - ParentId int64 `json:"parentId,omitempty"` // 父级ID  
188 - Name string `json:"name,omitempty"` // 部门名称 186 + CompanyId int64 `json:"companyId"` // 公司ID
  187 + ParentId int64 `json:"parentId"` // 父级ID
  188 + Name string `json:"name"` // 部门名称
  189 + UserIds []int64 `json:"userIds"` // 部门下的用户
189 } 190 }
190 UserSearchRequest{ 191 UserSearchRequest{
191 Page int `json:"page,optional"` 192 Page int `json:"page,optional"`
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
  8 +# KeyFile: ./key/fjmaimaimai.com.key
7 Log: 9 Log:
8 #Mode: file 10 #Mode: file
9 Encoding: plain 11 Encoding: plain
@@ -113,38 +113,41 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { @@ -113,38 +113,41 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
113 ) 113 )
114 114
115 server.AddRoutes( 115 server.AddRoutes(
116 - []rest.Route{  
117 - {  
118 - Method: http.MethodPost,  
119 - Path: "/article_tag",  
120 - Handler: tags.CreateTagHandler(serverCtx),  
121 - },  
122 - {  
123 - Method: http.MethodPut,  
124 - Path: "/article_tag",  
125 - Handler: tags.EditTagHandler(serverCtx),  
126 - },  
127 - {  
128 - Method: http.MethodGet,  
129 - Path: "/article_tag/:id",  
130 - Handler: tags.GetTagHandler(serverCtx),  
131 - },  
132 - {  
133 - Method: http.MethodDelete,  
134 - Path: "/article_tag/:id",  
135 - Handler: tags.DeleteTagHandler(serverCtx),  
136 - },  
137 - {  
138 - Method: http.MethodPost,  
139 - Path: "/article_tag/search",  
140 - Handler: tags.SearchTagHandler(serverCtx),  
141 - },  
142 - {  
143 - Method: http.MethodGet,  
144 - Path: "/article_tag/options",  
145 - Handler: tags.OptionsHandler(serverCtx),  
146 - },  
147 - }, 116 + rest.WithMiddlewares(
  117 + []rest.Middleware{serverCtx.LoginStatusCheck},
  118 + []rest.Route{
  119 + {
  120 + Method: http.MethodPost,
  121 + Path: "/article_tag",
  122 + Handler: tags.CreateTagHandler(serverCtx),
  123 + },
  124 + {
  125 + Method: http.MethodPut,
  126 + Path: "/article_tag",
  127 + Handler: tags.EditTagHandler(serverCtx),
  128 + },
  129 + {
  130 + Method: http.MethodGet,
  131 + Path: "/article_tag/:id",
  132 + Handler: tags.GetTagHandler(serverCtx),
  133 + },
  134 + {
  135 + Method: http.MethodDelete,
  136 + Path: "/article_tag/:id",
  137 + Handler: tags.DeleteTagHandler(serverCtx),
  138 + },
  139 + {
  140 + Method: http.MethodPost,
  141 + Path: "/article_tag/search",
  142 + Handler: tags.SearchTagHandler(serverCtx),
  143 + },
  144 + {
  145 + Method: http.MethodGet,
  146 + Path: "/article_tag/options",
  147 + Handler: tags.OptionsHandler(serverCtx),
  148 + },
  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 )
@@ -239,7 +242,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { @@ -239,7 +242,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
239 }, 242 },
240 { 243 {
241 Method: http.MethodPost, 244 Method: http.MethodPost,
242 - Path: "/user/mylike", 245 + Path: "/mini/user/mylike",
243 Handler: user.MiniMyLikeHandler(serverCtx), 246 Handler: user.MiniMyLikeHandler(serverCtx),
244 }, 247 },
245 }, 248 },
@@ -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(
339 - []rest.Route{  
340 - {  
341 - Method: http.MethodPost,  
342 - Path: "/system/company/search",  
343 - Handler: company.SystemCompanySearchHandler(serverCtx),  
344 - },  
345 - }, 342 + rest.WithMiddlewares(
  343 + []rest.Middleware{serverCtx.LoginStatusCheck},
  344 + []rest.Route{
  345 + {
  346 + Method: http.MethodPost,
  347 + Path: "/system/company/search",
  348 + Handler: company.SystemCompanySearchHandler(serverCtx),
  349 + },
  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,43 +446,46 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { @@ -440,43 +446,46 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
440 ) 446 )
441 447
442 server.AddRoutes( 448 server.AddRoutes(
443 - []rest.Route{  
444 - {  
445 - Method: http.MethodGet,  
446 - Path: "/article/:id",  
447 - Handler: article.SystemGetArticleHandler(serverCtx),  
448 - },  
449 - {  
450 - Method: http.MethodPost,  
451 - Path: "/article/search",  
452 - Handler: article.SystemSearchArticleHandler(serverCtx),  
453 - },  
454 - {  
455 - Method: http.MethodPut,  
456 - Path: "/article",  
457 - Handler: article.SystemUpdateArticleHandler(serverCtx),  
458 - },  
459 - {  
460 - Method: http.MethodPost,  
461 - Path: "/article/history",  
462 - Handler: article.SystemHistoryArticleHandler(serverCtx),  
463 - },  
464 - {  
465 - Method: http.MethodGet,  
466 - Path: "/article/history/:id",  
467 - Handler: article.SystemArticleGetHistoryHandler(serverCtx),  
468 - },  
469 - {  
470 - Method: http.MethodPost,  
471 - Path: "/article/search/me",  
472 - Handler: article.SystemArticleSearchMeHandler(serverCtx),  
473 - },  
474 - {  
475 - Method: http.MethodPost,  
476 - Path: "/article/restore",  
477 - Handler: article.SystemArticleRestoreHandler(serverCtx),  
478 - },  
479 - }, 449 + rest.WithMiddlewares(
  450 + []rest.Middleware{serverCtx.LoginStatusCheck},
  451 + []rest.Route{
  452 + {
  453 + Method: http.MethodGet,
  454 + Path: "/article/:id",
  455 + Handler: article.SystemGetArticleHandler(serverCtx),
  456 + },
  457 + {
  458 + Method: http.MethodPost,
  459 + Path: "/article/search",
  460 + Handler: article.SystemSearchArticleHandler(serverCtx),
  461 + },
  462 + {
  463 + Method: http.MethodPut,
  464 + Path: "/article",
  465 + Handler: article.SystemUpdateArticleHandler(serverCtx),
  466 + },
  467 + {
  468 + Method: http.MethodPost,
  469 + Path: "/article/history",
  470 + Handler: article.SystemHistoryArticleHandler(serverCtx),
  471 + },
  472 + {
  473 + Method: http.MethodGet,
  474 + Path: "/article/history/:id",
  475 + Handler: article.SystemArticleGetHistoryHandler(serverCtx),
  476 + },
  477 + {
  478 + Method: http.MethodPost,
  479 + Path: "/article/search/me",
  480 + Handler: article.SystemArticleSearchMeHandler(serverCtx),
  481 + },
  482 + {
  483 + Method: http.MethodPost,
  484 + Path: "/article/restore",
  485 + Handler: article.SystemArticleRestoreHandler(serverCtx),
  486 + },
  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 )
@@ -51,6 +51,8 @@ func (l *MiniArticleMarkUserReadLogic) MiniArticleMarkUserRead(req *types.MiniAr @@ -51,6 +51,8 @@ func (l *MiniArticleMarkUserReadLogic) MiniArticleMarkUserRead(req *types.MiniAr
51 return nil, xerr.NewErrMsgErr("标记浏览记录失败", err) 51 return nil, xerr.NewErrMsgErr("标记浏览记录失败", err)
52 } 52 }
53 if len(markRecord) > 0 { 53 if len(markRecord) > 0 {
  54 + markRecord[0].Author = articleData.Author
  55 + markRecord[0].Title = articleData.Title
54 _, err = l.svcCtx.UserReadArticleRepository.Update(l.ctx, conn, markRecord[0]) 56 _, err = l.svcCtx.UserReadArticleRepository.Update(l.ctx, conn, markRecord[0])
55 if err != nil { 57 if err != nil {
56 return nil, xerr.NewErrMsgErr("标记浏览记录失败", err) 58 return nil, xerr.NewErrMsgErr("标记浏览记录失败", err)
@@ -170,11 +170,11 @@ func (l *MiniCreateArticleLogic) MiniCreateArticle(req *types.MiniArticleCreateR @@ -170,11 +170,11 @@ func (l *MiniCreateArticleLogic) MiniCreateArticle(req *types.MiniArticleCreateR
170 } 170 }
171 //设置内容概要 171 //设置内容概要
172 if len(sectionList) > 0 { 172 if len(sectionList) > 0 {
173 - // 截取内容 30个字 173 + // 截取内容 50个字
174 runeNumber := 0 //字数 174 runeNumber := 0 //字数
175 stringIndex := 0 //字符串长度 175 stringIndex := 0 //字符串长度
176 for i := range sectionList[0].Content { 176 for i := range sectionList[0].Content {
177 - if runeNumber > 30 { 177 + if runeNumber > 50 {
178 break 178 break
179 } 179 }
180 runeNumber += 1 180 runeNumber += 1
@@ -47,11 +47,12 @@ func (l *MiniSearchArticleDraftMeLogic) MiniSearchArticleDraftMe(req *types.Mini @@ -47,11 +47,12 @@ func (l *MiniSearchArticleDraftMeLogic) MiniSearchArticleDraftMe(req *types.Mini
47 images = append(images, val.Url) 47 images = append(images, val.Url)
48 } 48 }
49 resp.List[i] = types.MiniArticleDraftItem{ 49 resp.List[i] = types.MiniArticleDraftItem{
50 - Id: draftList[i].Id,  
51 - Template: draftList[i].Template,  
52 - Section: draftList[i].Content,  
53 - Title: draftList[i].Title,  
54 - Images: images, 50 + Id: draftList[i].Id,
  51 + Template: draftList[i].Template,
  52 + Section: draftList[i].Content,
  53 + Title: draftList[i].Title,
  54 + Images: images,
  55 + CreatedAt: draftList[i].CreatedAt,
55 } 56 }
56 } 57 }
57 return resp, nil 58 return resp, nil
@@ -65,6 +65,7 @@ func (l *SystemGetArticleLogic) SystemGetArticle(req *types.SystemArticleGetRequ @@ -65,6 +65,7 @@ func (l *SystemGetArticleLogic) SystemGetArticle(req *types.SystemArticleGetRequ
65 CountRead: article.CountRead, 65 CountRead: article.CountRead,
66 Show: int(article.Show), 66 Show: int(article.Show),
67 Tags: make([]types.ArticleTagItem, 0), 67 Tags: make([]types.ArticleTagItem, 0),
  68 + TargetUser: int(article.TargetUser),
68 } 69 }
69 //标签 70 //标签
70 if len(article.Tags) > 0 { 71 if len(article.Tags) > 0 {
@@ -4,6 +4,8 @@ import ( @@ -4,6 +4,8 @@ import (
4 "context" 4 "context"
5 "strconv" 5 "strconv"
6 6
  7 + "strings"
  8 +
7 "github.com/samber/lo" 9 "github.com/samber/lo"
8 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction" 10 "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" 11 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
@@ -11,7 +13,6 @@ import ( @@ -11,7 +13,6 @@ import (
11 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" 13 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
12 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/tool/oss" 14 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/tool/oss"
13 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" 15 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
14 - "strings"  
15 16
16 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" 17 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
17 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" 18 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
@@ -147,11 +148,11 @@ func (l *SystemUpdateArticleLogic) SystemUpdateArticle(req *types.SystemArticleU @@ -147,11 +148,11 @@ func (l *SystemUpdateArticleLogic) SystemUpdateArticle(req *types.SystemArticleU
147 }) 148 })
148 //设置内容概要 149 //设置内容概要
149 if len(req.Section) > 0 { 150 if len(req.Section) > 0 {
150 - // 截取内容 30个字 151 + // 截取内容 50个字
151 runeNumber := 0 //字数 152 runeNumber := 0 //字数
152 stringIndex := 0 //字符串长度 153 stringIndex := 0 //字符串长度
153 for i := range req.Section[0].Content { 154 for i := range req.Section[0].Content {
154 - if runeNumber > 30 { 155 + if runeNumber > 50 {
155 break 156 break
156 } 157 }
157 runeNumber += 1 158 runeNumber += 1
@@ -57,6 +57,7 @@ func (l *SystemAddLogic) SystemAdd(req *types.DepartmentAddRequest) (resp *types @@ -57,6 +57,7 @@ func (l *SystemAddLogic) SystemAdd(req *types.DepartmentAddRequest) (resp *types
57 if len(req.Ids) > 0 { 57 if len(req.Ids) > 0 {
58 _, users, err := l.svcCtx.UserRepository.Find(l.ctx, conn, domain.NewQueryOptions(). 58 _, users, err := l.svcCtx.UserRepository.Find(l.ctx, conn, domain.NewQueryOptions().
59 WithOffsetLimit(1, len(req.Ids)).WithFindOnly(). 59 WithOffsetLimit(1, len(req.Ids)).WithFindOnly().
  60 + WithKV("ids", req.Ids).
60 WithKV("companyId", userToken.CompanyId)) 61 WithKV("companyId", userToken.CompanyId))
61 if err != nil { 62 if err != nil {
62 return err 63 return err
@@ -4,6 +4,8 @@ import ( @@ -4,6 +4,8 @@ import (
4 "context" 4 "context"
5 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" 5 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
6 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" 6 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
7 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" 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"
@@ -24,17 +26,32 @@ func NewSystemGetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemG @@ -24,17 +26,32 @@ func NewSystemGetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemG
24 } 26 }
25 27
26 func (l *SystemGetLogic) SystemGet(req *types.DepartmentGetRequest) (resp *types.DepartmentGetResponse, err error) { 28 func (l *SystemGetLogic) SystemGet(req *types.DepartmentGetRequest) (resp *types.DepartmentGetResponse, err error) {
  29 + var userToken = contextdata.GetUserTokenFromCtx(l.ctx)
27 var conn = l.svcCtx.DefaultDBConn() 30 var conn = l.svcCtx.DefaultDBConn()
28 department, err := l.svcCtx.DepartmentRepository.FindOne(l.ctx, conn, req.Id) 31 department, err := l.svcCtx.DepartmentRepository.FindOne(l.ctx, conn, req.Id)
29 if err != nil { 32 if err != nil {
30 return nil, xerr.NewErrMsg("数据不存在") 33 return nil, xerr.NewErrMsg("数据不存在")
31 } 34 }
  35 +
  36 + // 部门下的用户
  37 + _, users, err := l.svcCtx.UserRepository.Find(l.ctx, conn, domain.NewQueryOptions().WithFindOnly().
  38 + WithKV("companyId", userToken.CompanyId).
  39 + WithKV("auditStatus", domain.UserAuditStatusPassed).
  40 + WithKV("departmentId", department.Id))
  41 + if err != nil {
  42 + return nil, err
  43 + }
  44 + ids := make([]int64, 0)
  45 + for i := range users {
  46 + ids = append(ids, users[i].Id)
  47 + }
32 resp = &types.DepartmentGetResponse{ 48 resp = &types.DepartmentGetResponse{
33 Department: types.Department{ 49 Department: types.Department{
34 Id: department.Id, 50 Id: department.Id,
35 CompanyId: department.CompanyId, 51 CompanyId: department.CompanyId,
36 ParentId: department.ParentId, 52 ParentId: department.ParentId,
37 Name: department.Name, 53 Name: department.Name,
  54 + UserIds: ids,
38 }, 55 },
39 } 56 }
40 return resp, nil 57 return resp, nil
@@ -43,10 +43,7 @@ func (l *CreateTagLogic) CreateTag(req *types.TagCreateRequest) (resp *types.Tag @@ -43,10 +43,7 @@ func (l *CreateTagLogic) CreateTag(req *types.TagCreateRequest) (resp *types.Tag
43 if cnt > 0 { 43 if cnt > 0 {
44 return nil, xerr.NewErrMsg(fmt.Sprintf("已存在标签 分类[%s]名称[%s]", req.Category, req.Name)) 44 return nil, xerr.NewErrMsg(fmt.Sprintf("已存在标签 分类[%s]名称[%s]", req.Category, req.Name))
45 } 45 }
46 - //获取图片的尺寸大小  
47 - fInfo, _ := oss.GetImageInfo(req.Image)  
48 - w, _ := strconv.Atoi(fInfo.ImageWidth.Value)  
49 - h, _ := strconv.Atoi(fInfo.ImageHeight.Value) 46 +
50 newTag := &domain.ArticleTag{ 47 newTag := &domain.ArticleTag{
51 Id: 0, 48 Id: 0,
52 CompanyId: req.CompanyId, 49 CompanyId: req.CompanyId,
@@ -54,17 +51,23 @@ func (l *CreateTagLogic) CreateTag(req *types.TagCreateRequest) (resp *types.Tag @@ -54,17 +51,23 @@ func (l *CreateTagLogic) CreateTag(req *types.TagCreateRequest) (resp *types.Tag
54 UpdatedAt: 0, 51 UpdatedAt: 0,
55 DeletedAt: 0, 52 DeletedAt: 0,
56 Version: 0, 53 Version: 0,
57 - Image: domain.Image{ 54 + Image: domain.Image{},
  55 + Name: req.Name,
  56 + Category: req.Category,
  57 + Remark: req.Remark,
  58 + Other: req.Other,
  59 + }
  60 + if len(req.Image) > 0 {
  61 + //获取图片的尺寸大小
  62 + fInfo, _ := oss.GetImageInfo(req.Image)
  63 + w, _ := strconv.Atoi(fInfo.ImageWidth.Value)
  64 + h, _ := strconv.Atoi(fInfo.ImageHeight.Value)
  65 + newTag.Image = domain.Image{
58 Url: req.Image, 66 Url: req.Image,
59 Width: w, 67 Width: w,
60 Height: h, 68 Height: h,
61 - },  
62 - Name: req.Name,  
63 - Category: req.Category,  
64 - Remark: req.Remark,  
65 - Other: req.Other, 69 + }
66 } 70 }
67 -  
68 newTag, err = l.svcCtx.ArticleTagRepository.Insert(l.ctx, conn, newTag) 71 newTag, err = l.svcCtx.ArticleTagRepository.Insert(l.ctx, conn, newTag)
69 if err != nil { 72 if err != nil {
70 return nil, xerr.NewErrMsgErr("添加标签失败", err) 73 return nil, xerr.NewErrMsgErr("添加标签失败", err)
@@ -54,16 +54,19 @@ func (l *EditTagLogic) EditTag(req *types.TagEditRequest) (resp *types.TagEditRe @@ -54,16 +54,19 @@ func (l *EditTagLogic) EditTag(req *types.TagEditRequest) (resp *types.TagEditRe
54 if oldTag.CompanyId != req.CompanyId { 54 if oldTag.CompanyId != req.CompanyId {
55 return nil, xerr.NewErrMsg("修改标签失败") 55 return nil, xerr.NewErrMsg("修改标签失败")
56 } 56 }
57 - //获取图片的尺寸大小  
58 - fInfo, _ := oss.GetImageInfo(req.Image)  
59 - w, _ := strconv.Atoi(fInfo.ImageWidth.Value)  
60 - h, _ := strconv.Atoi(fInfo.ImageHeight.Value)  
61 - oldTag.Category = req.Category  
62 - oldTag.Image = domain.Image{  
63 - Url: req.Image,  
64 - Width: w,  
65 - Height: h, 57 + oldTag.Image = domain.Image{}
  58 + if len(req.Image) > 0 {
  59 + // 获取图片的尺寸大小
  60 + fInfo, _ := oss.GetImageInfo(req.Image)
  61 + w, _ := strconv.Atoi(fInfo.ImageWidth.Value)
  62 + h, _ := strconv.Atoi(fInfo.ImageHeight.Value)
  63 + oldTag.Image = domain.Image{
  64 + Url: req.Image,
  65 + Width: w,
  66 + Height: h,
  67 + }
66 } 68 }
  69 + oldTag.Category = req.Category
67 oldTag.Name = req.Name 70 oldTag.Name = req.Name
68 oldTag.Remark = req.Remark 71 oldTag.Remark = req.Remark
69 oldTag.Other = req.Other 72 oldTag.Other = req.Other
@@ -28,10 +28,10 @@ func (l *SearchTagLogic) SearchTag(req *types.TagListRequest) (resp *types.TagLi @@ -28,10 +28,10 @@ func (l *SearchTagLogic) SearchTag(req *types.TagListRequest) (resp *types.TagLi
28 queryOptions := domain.NewQueryOptions().WithOffsetLimit(req.Page, req.Size) 28 queryOptions := domain.NewQueryOptions().WithOffsetLimit(req.Page, req.Size)
29 29
30 if len(req.Category) > 0 { 30 if len(req.Category) > 0 {
31 - queryOptions = queryOptions.MustWithKV("group", req.Category) 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+"%")
35 } 35 }
36 36
37 if len(req.Remark) > 0 { 37 if len(req.Remark) > 0 {
@@ -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 }
@@ -93,12 +93,70 @@ func (l *SystemUserInfoLogic) SystemUserInfo(req *types.SystemUserInfoRequest) ( @@ -93,12 +93,70 @@ func (l *SystemUserInfoLogic) SystemUserInfo(req *types.SystemUserInfoRequest) (
93 } 93 }
94 } 94 }
95 } 95 }
  96 + err = l.initSystemData(companyId)
  97 + if err != nil {
  98 + return nil, err
  99 + }
96 return 100 return
97 } 101 }
98 102
99 -// 后台登录时检查/设置公司的初始数据 103 +// 后台登录时检查/设置公司的初始数据
100 func (l *SystemUserInfoLogic) initSystemData(companyId int64) error { 104 func (l *SystemUserInfoLogic) initSystemData(companyId int64) error {
101 - // TODO 初始设置文章标签 105 + // 初始设置文章标签
  106 + queryOption := domain.NewQueryOptions().WithCountOnly()
  107 + conn := l.svcCtx.DefaultDBConn()
  108 + cnt, _, err := l.svcCtx.ArticleTagRepository.Find(l.ctx, conn, companyId, queryOption)
  109 + if err != nil {
  110 + return xerr.NewErrMsgErr("初始话公司数据失败", err)
  111 + }
  112 + if cnt == 0 {
  113 + articleTags := []*domain.ArticleTag{
  114 + {
  115 + Id: 0, CompanyId: companyId, Image: domain.Image{Url: "", Width: 0, Height: 0},
  116 + Name: "紧急重要", Category: "紧急重要", Remark: "优先解决", SortBy: 1,
  117 + },
  118 + {
  119 + Id: 0, CompanyId: companyId, Image: domain.Image{Url: "", Width: 0, Height: 0},
  120 + Name: "不紧急不重要", Category: "紧急重要", Remark: "给别人做", SortBy: 2,
  121 + },
  122 + {
  123 + Id: 0, CompanyId: companyId, Image: domain.Image{Url: "", Width: 0, Height: 0},
  124 + Name: "紧急不重要", Category: "紧急重要", Remark: "有空再做", SortBy: 3,
  125 + },
  126 + {
  127 + Id: 0, CompanyId: companyId, Image: domain.Image{Url: "", Width: 0, Height: 0},
  128 + Name: "不紧急重要", Category: "紧急重要", Remark: "制定计划去做", SortBy: 4,
  129 + },
  130 + {
  131 + Id: 0, CompanyId: companyId, Image: domain.Image{Url: "", Width: 0, Height: 0},
  132 + Name: "大机会高风险", Category: "机会风险", Remark: "谨慎考虑专项讨论", SortBy: 5,
  133 + },
  134 + {
  135 + Id: 0, CompanyId: companyId, Image: domain.Image{Url: "", Width: 0, Height: 0},
  136 + Name: "大机会中风险", Category: "机会风险", Remark: "加大关注值得尝试", SortBy: 6,
  137 + },
  138 + {
  139 + Id: 0, CompanyId: companyId, Image: domain.Image{Url: "", Width: 0, Height: 0},
  140 + Name: "大机会低风险", Category: "机会风险", Remark: "全员投入抓紧落实", SortBy: 7,
  141 + },
  142 + {
  143 + Id: 0, CompanyId: companyId, Image: domain.Image{Url: "", Width: 0, Height: 0},
  144 + Name: "中机会高风险", Category: "机会风险", Remark: "专人跟踪成立项目", SortBy: 8,
  145 + },
  146 + {
  147 + Id: 0, CompanyId: companyId, Image: domain.Image{Url: "", Width: 0, Height: 0},
  148 + Name: "中机会中风险", Category: "机会风险", Remark: "讨论落实", SortBy: 9,
  149 + },
  150 + {
  151 + Id: 0, CompanyId: companyId, Image: domain.Image{Url: "", Width: 0, Height: 0},
  152 + Name: "中机会低风险", Category: "机会风险", Remark: "解决问题多手准备", SortBy: 10,
  153 + },
  154 + }
  155 + err = l.svcCtx.ArticleTagRepository.CreateInBatches(l.ctx, conn, articleTags)
  156 + if err != nil {
  157 + return xerr.NewErrMsgErr("初始话公司数据失败", err)
  158 + }
  159 + }
102 160
103 return nil 161 return nil
104 } 162 }
@@ -140,7 +140,7 @@ type SystemArticleCommentSearchRequest struct { @@ -140,7 +140,7 @@ type SystemArticleCommentSearchRequest struct {
140 Page int `json:"page"` 140 Page int `json:"page"`
141 Size int `json:"size"` 141 Size int `json:"size"`
142 ArticleId int64 `json:"articleId"` // 文章ID 142 ArticleId int64 `json:"articleId"` // 文章ID
143 - TopId int64 `json:"topId"` // 文章顶层ID 143 + TopId int64 `json:"topId,optional"` // 文章顶层ID
144 AuthorId int64 `json:"authorId,optional"` // 用户 144 AuthorId int64 `json:"authorId,optional"` // 用户
145 Show int `json:"show,optional"` // 显示状态 145 Show int `json:"show,optional"` // 显示状态
146 BeginTime int64 `json:"beginTime,optional"` // 开始时间 146 BeginTime int64 `json:"beginTime,optional"` // 开始时间
@@ -296,9 +296,9 @@ type SimpleUser struct { @@ -296,9 +296,9 @@ type SimpleUser struct {
296 Id int64 `json:"id"` 296 Id int64 `json:"id"`
297 CompanyId int64 `json:"companyId,omitempty"` // 公司ID 297 CompanyId int64 `json:"companyId,omitempty"` // 公司ID
298 CompanyName string `json:"companyName,omitempty"` // 公司名称 298 CompanyName string `json:"companyName,omitempty"` // 公司名称
299 - Name string `json:"name,omitempty"` // 名称  
300 - Avatar string `json:"avatar,omitempty"` // 头像  
301 - Position string `json:"position,omitempty"` // 职位 299 + Name string `json:"name"` // 名称
  300 + Avatar string `json:"avatar"` // 头像
  301 + Position string `json:"position"` // 职位
302 } 302 }
303 303
304 type SimpleArticle struct { 304 type SimpleArticle struct {
@@ -316,7 +316,7 @@ type TagCreateRequest struct { @@ -316,7 +316,7 @@ type TagCreateRequest struct {
316 Name string `json:"name"` // 标签名称 316 Name string `json:"name"` // 标签名称
317 Category string `json:"category"` // 标签分类 317 Category string `json:"category"` // 标签分类
318 Remark string `json:"remark,optional"` // 备注 318 Remark string `json:"remark,optional"` // 备注
319 - Other string `json:"other"` 319 + Other string `json:"other,optional"`
320 } 320 }
321 321
322 type TagCreateResponse struct { 322 type TagCreateResponse struct {
@@ -330,7 +330,7 @@ type TagEditRequest struct { @@ -330,7 +330,7 @@ type TagEditRequest struct {
330 Name string `json:"name"` // 标签名称 330 Name string `json:"name"` // 标签名称
331 Category string `json:"category"` // 标签分类 331 Category string `json:"category"` // 标签分类
332 Remark string `json:"remark,optional"` // 备注 332 Remark string `json:"remark,optional"` // 备注
333 - Other string `json:"other"` 333 + Other string `json:"other,optional"`
334 } 334 }
335 335
336 type TagEditResponse struct { 336 type TagEditResponse struct {
@@ -464,8 +464,8 @@ type MiniUserNewsRequest struct { @@ -464,8 +464,8 @@ type MiniUserNewsRequest struct {
464 } 464 }
465 465
466 type MiniUserNewsResposne struct { 466 type MiniUserNewsResposne struct {
467 - List []UserNewsItem `json:"list"`  
468 - Total int64 `json:"total"` 467 + List []UserNewsItem `json:"list"`
  468 + LastArticleId int64 `json:"lastArticleId"` // 最后文章ID
469 } 469 }
470 470
471 type UserNewsItem struct { 471 type UserNewsItem struct {
@@ -519,10 +519,11 @@ type Account struct { @@ -519,10 +519,11 @@ type Account struct {
519 } 519 }
520 520
521 type Department struct { 521 type Department struct {
522 - Id int64 `json:"id,omitempty"` // 部门ID  
523 - CompanyId int64 `json:"companyId,omitempty"` // 公司ID  
524 - ParentId int64 `json:"parentId,omitempty"` // 父级ID  
525 - Name string `json:"name,omitempty"` // 部门名称 522 + Id int64 `json:"id,omitempty"` // 部门ID
  523 + CompanyId int64 `json:"companyId"` // 公司ID
  524 + ParentId int64 `json:"parentId"` // 父级ID
  525 + Name string `json:"name"` // 部门名称
  526 + UserIds []int64 `json:"userIds"` // 部门下的用户
526 } 527 }
527 528
528 type UserSearchRequest struct { 529 type UserSearchRequest struct {
@@ -949,7 +950,7 @@ type MiniArticleDraftGetMeRequest struct { @@ -949,7 +950,7 @@ type MiniArticleDraftGetMeRequest struct {
949 type MiniArticleDraftGetMeResponse struct { 950 type MiniArticleDraftGetMeResponse struct {
950 Id int64 `json:"id"` // 951 Id int64 `json:"id"` //
951 Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式 952 Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式
952 - Section []string `json:"Section"` // 填写的内容 953 + Section []string `json:"section"` // 填写的内容
953 Title string `json:"title"` // 标题 954 Title string `json:"title"` // 标题
954 Images []string `json:"images"` // 图片 955 Images []string `json:"images"` // 图片
955 WhoRead []int64 `json:"whoRead"` // 谁可以看 956 WhoRead []int64 `json:"whoRead"` // 谁可以看
@@ -1047,6 +1048,7 @@ type SystemArticleGetResponse struct { @@ -1047,6 +1048,7 @@ type SystemArticleGetResponse struct {
1047 CountRead int `json:"countRead"` // 浏览数量 1048 CountRead int `json:"countRead"` // 浏览数量
1048 Show int `json:"show"` // 评论的展示状态(0显示、1不显示) 1049 Show int `json:"show"` // 评论的展示状态(0显示、1不显示)
1049 Tags []ArticleTagItem `json:"tags"` //标签 1050 Tags []ArticleTagItem `json:"tags"` //标签
  1051 + TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人]
1050 } 1052 }
1051 1053
1052 type SystemArticleSearchRequest struct { 1054 type SystemArticleSearchRequest struct {
@@ -136,7 +136,9 @@ func (repository *ArticleRepository) Find(ctx context.Context, conn transaction. @@ -136,7 +136,9 @@ func (repository *ArticleRepository) Find(ctx context.Context, conn transaction.
136 if v, ok := queryOptions["endCreatedAt"]; ok { 136 if v, ok := queryOptions["endCreatedAt"]; ok {
137 tx = tx.Where("created_at < ?", v) 137 tx = tx.Where("created_at < ?", v)
138 } 138 }
139 - 139 + if v, ok := queryOptions["authorId"]; ok {
  140 + tx = tx.Where("author_id=?", v)
  141 + }
140 if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil { 142 if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil {
141 return dms, tx.Error 143 return dms, tx.Error
142 } 144 }
@@ -168,12 +170,14 @@ func (repository *ArticleRepository) FindAuthorsLatestArticle(ctx context.Contex @@ -168,12 +170,14 @@ func (repository *ArticleRepository) FindAuthorsLatestArticle(ctx context.Contex
168 ) 170 )
169 queryFunc := func() (interface{}, error) { 171 queryFunc := func() (interface{}, error) {
170 tx = tx.Model(&ms). 172 tx = tx.Model(&ms).
171 - Where("id < ?", lastId).  
172 Where("company_id=?", companyId). 173 Where("company_id=?", companyId).
173 Where("author_id in (?)", authors). 174 Where("author_id in (?)", authors).
174 - Where("target_user=0 or who_read @>'[?]'", whoRead).  
175 - Where("show = 1").  
176 - Order("id desc") 175 + Where(fmt.Sprintf("target_user=0 or who_read @>'[%d]'", whoRead)).
  176 + Where("show = 1")
  177 + if lastId > 0 {
  178 + tx.Where("id < ?", lastId)
  179 + }
  180 + tx.Order("id desc")
177 if limit > 0 { 181 if limit > 0 {
178 tx.Limit(limit) 182 tx.Limit(limit)
179 } 183 }
@@ -33,7 +33,28 @@ func (repository *ArticleTagRepository) Insert(ctx context.Context, conn transac @@ -33,7 +33,28 @@ func (repository *ArticleTagRepository) Insert(ctx context.Context, conn transac
33 33
34 } 34 }
35 35
36 -// func (repository *ArticleTagRepository) CreateInBatches 36 +func (repository *ArticleTagRepository) CreateInBatches(ctx context.Context, conn transaction.Conn, dm []*domain.ArticleTag) error {
  37 +
  38 + var (
  39 + ms = []*models.ArticleTag{}
  40 + tx = conn.DB()
  41 + )
  42 +
  43 + for _, val := range dm {
  44 + m, err := repository.DomainModelToModel(val)
  45 + if err != nil {
  46 + return err
  47 + }
  48 + ms = append(ms, m)
  49 + }
  50 + if tx = tx.CreateInBatches(ms, 100); tx.Error != nil {
  51 + return tx.Error
  52 + }
  53 + for i, val := range ms {
  54 + dm[i].Id = val.Id
  55 + }
  56 + return nil
  57 +}
37 58
38 func (repository *ArticleTagRepository) Update(ctx context.Context, conn transaction.Conn, dm *domain.ArticleTag) (*domain.ArticleTag, error) { 59 func (repository *ArticleTagRepository) Update(ctx context.Context, conn transaction.Conn, dm *domain.ArticleTag) (*domain.ArticleTag, error) {
39 var ( 60 var (
@@ -134,7 +155,9 @@ func (repository *ArticleTagRepository) Find(ctx context.Context, conn transacti @@ -134,7 +155,9 @@ func (repository *ArticleTagRepository) Find(ctx context.Context, conn transacti
134 if v, ok := queryOptions["ids"]; ok { 155 if v, ok := queryOptions["ids"]; ok {
135 tx = tx.Where("id in (?)", v) 156 tx = tx.Where("id in (?)", v)
136 } 157 }
137 - 158 + if v, ok := queryOptions["remark"]; ok {
  159 + tx = tx.Where("remark like ?", v)
  160 + }
138 if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil { 161 if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil {
139 return dms, tx.Error 162 return dms, tx.Error
140 } 163 }
@@ -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 //浏览数量变动
@@ -24,6 +24,7 @@ type ArticleTag struct { @@ -24,6 +24,7 @@ type ArticleTag struct {
24 } 24 }
25 type ArticleTagRepository interface { 25 type ArticleTagRepository interface {
26 Insert(ctx context.Context, conn transaction.Conn, dm *ArticleTag) (*ArticleTag, error) 26 Insert(ctx context.Context, conn transaction.Conn, dm *ArticleTag) (*ArticleTag, error)
  27 + CreateInBatches(ctx context.Context, conn transaction.Conn, dm []*ArticleTag) error
27 Update(ctx context.Context, conn transaction.Conn, dm *ArticleTag) (*ArticleTag, error) 28 Update(ctx context.Context, conn transaction.Conn, dm *ArticleTag) (*ArticleTag, error)
28 Delete(ctx context.Context, conn transaction.Conn, dm *ArticleTag) (*ArticleTag, error) 29 Delete(ctx context.Context, conn transaction.Conn, dm *ArticleTag) (*ArticleTag, error)
29 UpdateWithVersion(ctx context.Context, conn transaction.Conn, dm *ArticleTag) (*ArticleTag, error) 30 UpdateWithVersion(ctx context.Context, conn transaction.Conn, dm *ArticleTag) (*ArticleTag, error)
@@ -10,7 +10,7 @@ type Auth struct { @@ -10,7 +10,7 @@ type Auth struct {
10 } 10 }
11 type Config struct { 11 type Config struct {
12 DB struct { 12 DB struct {
13 - DataSource string 13 + DataSource string `json:",env=DataSource"`
14 } `json:",optional"` 14 } `json:",optional"`
15 Cache cache.CacheConf `json:",optional"` 15 Cache cache.CacheConf `json:",optional"`
16 DTM DTM `json:",optional"` 16 DTM DTM `json:",optional"`