作者 tangxvhui
正在显示 35 个修改的文件 包含 2909 行增加383 行删除
@@ -5,3 +5,4 @@ import "core/article_tag.api" @@ -5,3 +5,4 @@ import "core/article_tag.api"
5 import "core/user.api" 5 import "core/user.api"
6 import "core/company.api" 6 import "core/company.api"
7 import "core/article.api" 7 import "core/article.api"
  8 +import "core/role.api"
@@ -15,15 +15,15 @@ @@ -15,15 +15,15 @@
15 "application/json" 15 "application/json"
16 ], 16 ],
17 "paths": { 17 "paths": {
18 - "v1/mini/article_tag": {  
19 - "delete": {  
20 - "summary": "后台删除文章标签",  
21 - "operationId": "DeleteTag", 18 + "v1/mini/article": {
  19 + "post": {
  20 + "summary": "小程序创建发布内容",
  21 + "operationId": "MiniCreateArticle",
22 "responses": { 22 "responses": {
23 "200": { 23 "200": {
24 "description": "A successful response.", 24 "description": "A successful response.",
25 "schema": { 25 "schema": {
26 - "$ref": "#/definitions/TagDeleteResponse" 26 + "$ref": "#/definitions/MiniArticleCreateResponse"
27 } 27 }
28 } 28 }
29 }, 29 },
@@ -33,23 +33,25 @@ @@ -33,23 +33,25 @@
33 "in": "body", 33 "in": "body",
34 "required": true, 34 "required": true,
35 "schema": { 35 "schema": {
36 - "$ref": "#/definitions/TagDeleteRequest" 36 + "$ref": "#/definitions/MiniArticleCreateRequest"
37 } 37 }
38 } 38 }
39 ], 39 ],
40 "requestBody": {}, 40 "requestBody": {},
41 "tags": [ 41 "tags": [
42 - "tags" 42 + "article"
43 ] 43 ]
  44 + }
44 }, 45 },
  46 + "v1/mini/article/search/me": {
45 "post": { 47 "post": {
46 - "summary": "后台创建文章标签",  
47 - "operationId": "CreateTag", 48 + "summary": "小程序获取我发布的文章",
  49 + "operationId": "MiniArticleSearchMe",
48 "responses": { 50 "responses": {
49 "200": { 51 "200": {
50 "description": "A successful response.", 52 "description": "A successful response.",
51 "schema": { 53 "schema": {
52 - "$ref": "#/definitions/TagCreateResponse" 54 + "$ref": "#/definitions/MiniArticleSearchMeResponse"
53 } 55 }
54 } 56 }
55 }, 57 },
@@ -59,23 +61,25 @@ @@ -59,23 +61,25 @@
59 "in": "body", 61 "in": "body",
60 "required": true, 62 "required": true,
61 "schema": { 63 "schema": {
62 - "$ref": "#/definitions/TagCreateRequest" 64 + "$ref": "#/definitions/MiniArticleSearchMeRequest"
63 } 65 }
64 } 66 }
65 ], 67 ],
66 "requestBody": {}, 68 "requestBody": {},
67 "tags": [ 69 "tags": [
68 - "tags" 70 + "article"
69 ] 71 ]
  72 + }
70 }, 73 },
71 - "put": {  
72 - "summary": "后台编辑文章标签",  
73 - "operationId": "EditTag", 74 + "v1/mini/article/user_like/list": {
  75 + "post": {
  76 + "summary": "小程序获取文章的点赞人员列表",
  77 + "operationId": "MiniUserLikeArticle",
74 "responses": { 78 "responses": {
75 "200": { 79 "200": {
76 "description": "A successful response.", 80 "description": "A successful response.",
77 "schema": { 81 "schema": {
78 - "$ref": "#/definitions/TagEditResponse" 82 + "$ref": "#/definitions/MiniUserLikeArticleResponse"
79 } 83 }
80 } 84 }
81 }, 85 },
@@ -85,46 +89,67 @@ @@ -85,46 +89,67 @@
85 "in": "body", 89 "in": "body",
86 "required": true, 90 "required": true,
87 "schema": { 91 "schema": {
88 - "$ref": "#/definitions/TagEditRequest" 92 + "$ref": "#/definitions/MiniUserLikeArticleRequest"
89 } 93 }
90 } 94 }
91 ], 95 ],
92 "requestBody": {}, 96 "requestBody": {},
93 "tags": [ 97 "tags": [
94 - "tags" 98 + "article"
95 ] 99 ]
96 } 100 }
97 }, 101 },
98 - "v1/mini/article_tag/{id}": {  
99 - "get": {  
100 - "summary": "后台获取文章标签",  
101 - "operationId": "GetTag", 102 + "v1/mini/article/user_like/set": {
  103 + "post": {
  104 + "summary": "小程序人员操作点赞文章/评论",
  105 + "operationId": "MiniSetUserLike",
102 "responses": { 106 "responses": {
103 "200": { 107 "200": {
104 "description": "A successful response.", 108 "description": "A successful response.",
105 "schema": { 109 "schema": {
106 - "$ref": "#/definitions/TagGetResponse" 110 + "$ref": "#/definitions/MiniSetUserLikeResponse"
107 } 111 }
108 } 112 }
109 }, 113 },
110 "parameters": [ 114 "parameters": [
111 { 115 {
112 - "name": "id",  
113 - "in": "path", 116 + "name": "body",
  117 + "in": "body",
114 "required": true, 118 "required": true,
115 - "type": "string" 119 + "schema": {
  120 + "$ref": "#/definitions/MiniSetUserLikeRequset"
  121 + }
  122 + }
  123 + ],
  124 + "requestBody": {},
  125 + "tags": [
  126 + "article"
  127 + ]
  128 + }
  129 + },
  130 + "v1/mini/article/{id}": {
  131 + "get": {
  132 + "summary": "小程序获取文章内容详情",
  133 + "operationId": "MiniGetArticle",
  134 + "responses": {
  135 + "200": {
  136 + "description": "A successful response.",
  137 + "schema": {
  138 + "$ref": "#/definitions/MiniArticleGetResponse"
  139 + }
  140 + }
116 }, 141 },
  142 + "parameters": [
117 { 143 {
118 "name": "id", 144 "name": "id",
119 - "in": "query", 145 + "in": "path",
120 "required": true, 146 "required": true,
121 - "type": "integer",  
122 - "format": "int64" 147 + "type": "string"
123 } 148 }
124 ], 149 ],
125 "requestBody": {}, 150 "requestBody": {},
126 "tags": [ 151 "tags": [
127 - "tags" 152 + "article"
128 ] 153 ]
129 } 154 }
130 }, 155 },
@@ -374,7 +399,7 @@ @@ -374,7 +399,7 @@
374 "200": { 399 "200": {
375 "description": "A successful response.", 400 "description": "A successful response.",
376 "schema": { 401 "schema": {
377 - "$ref": "#/definitions/UserSearchResponse" 402 + "$ref": "#/definitions/MiniUserFollowedSearchResponse"
378 } 403 }
379 } 404 }
380 }, 405 },
@@ -384,7 +409,7 @@ @@ -384,7 +409,7 @@
384 "in": "body", 409 "in": "body",
385 "required": true, 410 "required": true,
386 "schema": { 411 "schema": {
387 - "$ref": "#/definitions/UserSearchRequest" 412 + "$ref": "#/definitions/MiniUserFollowedSearchRequest"
388 } 413 }
389 } 414 }
390 ], 415 ],
@@ -402,7 +427,7 @@ @@ -402,7 +427,7 @@
402 "200": { 427 "200": {
403 "description": "A successful response.", 428 "description": "A successful response.",
404 "schema": { 429 "schema": {
405 - "$ref": "#/definitions/UserSearchResponse" 430 + "$ref": "#/definitions/MiniUserFollowedSearchResponse"
406 } 431 }
407 } 432 }
408 }, 433 },
@@ -412,7 +437,7 @@ @@ -412,7 +437,7 @@
412 "in": "body", 437 "in": "body",
413 "required": true, 438 "required": true,
414 "schema": { 439 "schema": {
415 - "$ref": "#/definitions/UserSearchRequest" 440 + "$ref": "#/definitions/MiniUserFollowedSearchRequest"
416 } 441 }
417 } 442 }
418 ], 443 ],
@@ -478,6 +503,34 @@ @@ -478,6 +503,34 @@
478 ] 503 ]
479 } 504 }
480 }, 505 },
  506 + "v1/mini/user/switch-account": {
  507 + "post": {
  508 + "summary": "切换账号",
  509 + "operationId": "miniUserSwitchAccount",
  510 + "responses": {
  511 + "200": {
  512 + "description": "A successful response.",
  513 + "schema": {
  514 + "$ref": "#/definitions/MiniUserLoginResponse"
  515 + }
  516 + }
  517 + },
  518 + "parameters": [
  519 + {
  520 + "name": "body",
  521 + "in": "body",
  522 + "required": true,
  523 + "schema": {
  524 + "$ref": "#/definitions/MiniUserSwitchAccountRequest"
  525 + }
  526 + }
  527 + ],
  528 + "requestBody": {},
  529 + "tags": [
  530 + "user"
  531 + ]
  532 + }
  533 + },
481 "v1/mini/user/unfollow": { 534 "v1/mini/user/unfollow": {
482 "post": { 535 "post": {
483 "summary": "取消关注", 536 "summary": "取消关注",
@@ -504,6 +557,146 @@ @@ -504,6 +557,146 @@
504 ] 557 ]
505 } 558 }
506 }, 559 },
  560 + "v1/system/article_tag": {
  561 + "post": {
  562 + "summary": "后台创建文章标签",
  563 + "operationId": "CreateTag",
  564 + "responses": {
  565 + "200": {
  566 + "description": "A successful response.",
  567 + "schema": {
  568 + "$ref": "#/definitions/TagCreateResponse"
  569 + }
  570 + }
  571 + },
  572 + "parameters": [
  573 + {
  574 + "name": "body",
  575 + "in": "body",
  576 + "required": true,
  577 + "schema": {
  578 + "$ref": "#/definitions/TagCreateRequest"
  579 + }
  580 + }
  581 + ],
  582 + "requestBody": {},
  583 + "tags": [
  584 + "tags"
  585 + ]
  586 + },
  587 + "put": {
  588 + "summary": "后台编辑文章标签",
  589 + "operationId": "EditTag",
  590 + "responses": {
  591 + "200": {
  592 + "description": "A successful response.",
  593 + "schema": {
  594 + "$ref": "#/definitions/TagEditResponse"
  595 + }
  596 + }
  597 + },
  598 + "parameters": [
  599 + {
  600 + "name": "body",
  601 + "in": "body",
  602 + "required": true,
  603 + "schema": {
  604 + "$ref": "#/definitions/TagEditRequest"
  605 + }
  606 + }
  607 + ],
  608 + "requestBody": {},
  609 + "tags": [
  610 + "tags"
  611 + ]
  612 + }
  613 + },
  614 + "v1/system/article_tag/search": {
  615 + "post": {
  616 + "summary": "后台搜索标签",
  617 + "operationId": "SearchTag",
  618 + "responses": {
  619 + "200": {
  620 + "description": "A successful response.",
  621 + "schema": {
  622 + "$ref": "#/definitions/TagListResponse"
  623 + }
  624 + }
  625 + },
  626 + "parameters": [
  627 + {
  628 + "name": "body",
  629 + "in": "body",
  630 + "required": true,
  631 + "schema": {
  632 + "$ref": "#/definitions/TagListRequest"
  633 + }
  634 + }
  635 + ],
  636 + "requestBody": {},
  637 + "tags": [
  638 + "tags"
  639 + ]
  640 + }
  641 + },
  642 + "v1/system/article_tag/{id}": {
  643 + "get": {
  644 + "summary": "后台获取文章标签",
  645 + "operationId": "GetTag",
  646 + "responses": {
  647 + "200": {
  648 + "description": "A successful response.",
  649 + "schema": {
  650 + "$ref": "#/definitions/TagGetResponse"
  651 + }
  652 + }
  653 + },
  654 + "parameters": [
  655 + {
  656 + "name": "id",
  657 + "in": "path",
  658 + "required": true,
  659 + "type": "string"
  660 + }
  661 + ],
  662 + "requestBody": {},
  663 + "tags": [
  664 + "tags"
  665 + ]
  666 + },
  667 + "delete": {
  668 + "summary": "后台删除文章标签",
  669 + "operationId": "DeleteTag",
  670 + "responses": {
  671 + "200": {
  672 + "description": "A successful response.",
  673 + "schema": {
  674 + "$ref": "#/definitions/TagDeleteResponse"
  675 + }
  676 + }
  677 + },
  678 + "parameters": [
  679 + {
  680 + "name": "id",
  681 + "in": "path",
  682 + "required": true,
  683 + "type": "string"
  684 + },
  685 + {
  686 + "name": "body",
  687 + "in": "body",
  688 + "required": true,
  689 + "schema": {
  690 + "$ref": "#/definitions/TagDeleteRequest"
  691 + }
  692 + }
  693 + ],
  694 + "requestBody": {},
  695 + "tags": [
  696 + "tags"
  697 + ]
  698 + }
  699 + },
507 "v1/system/comment": { 700 "v1/system/comment": {
508 "get": { 701 "get": {
509 "summary": "系统评论", 702 "summary": "系统评论",
@@ -549,64 +742,911 @@ @@ -549,64 +742,911 @@
549 "company" 742 "company"
550 ] 743 ]
551 } 744 }
552 - }  
553 - },  
554 - "definitions": {  
555 - "Comment": {  
556 - "type": "object",  
557 - "title": "Comment"  
558 - },  
559 - "CommentRequest": {  
560 - "type": "object",  
561 - "title": "CommentRequest"  
562 }, 745 },
563 - "CommentResposne": {  
564 - "type": "object",  
565 - "properties": {  
566 - "list": {  
567 - "type": "array",  
568 - "items": {  
569 - "$ref": "#/definitions/Comment" 746 + "v1/system/role": {
  747 + "post": {
  748 + "operationId": "systemSaveRole",
  749 + "responses": {
  750 + "200": {
  751 + "description": "A successful response.",
  752 + "schema": {
  753 + "$ref": "#/definitions/RoleSaveResponse"
570 } 754 }
571 } 755 }
572 }, 756 },
573 - "title": "CommentResposne",  
574 - "required": [  
575 - "list" 757 + "parameters": [
  758 + {
  759 + "name": "body",
  760 + "in": "body",
  761 + "required": true,
  762 + "schema": {
  763 + "$ref": "#/definitions/RoleSaveRequest"
  764 + }
  765 + }
  766 + ],
  767 + "requestBody": {},
  768 + "tags": [
  769 + "role"
576 ] 770 ]
  771 + }
577 }, 772 },
578 - "Company": {  
579 - "type": "object",  
580 - "properties": {  
581 - "id": {  
582 - "type": "integer", 773 + "v1/system/role/search": {
  774 + "post": {
  775 + "operationId": "systemSearchRole",
  776 + "responses": {
  777 + "200": {
  778 + "description": "A successful response.",
  779 + "schema": {
  780 + "$ref": "#/definitions/RoleSearchResponse"
  781 + }
  782 + }
  783 + },
  784 + "parameters": [
  785 + {
  786 + "name": "body",
  787 + "in": "body",
  788 + "required": true,
  789 + "schema": {
  790 + "$ref": "#/definitions/RoleSearchRequest"
  791 + }
  792 + }
  793 + ],
  794 + "requestBody": {},
  795 + "tags": [
  796 + "role"
  797 + ]
  798 + }
  799 + },
  800 + "v1/system/role/{id}": {
  801 + "delete": {
  802 + "operationId": "systemDeleteRole",
  803 + "responses": {
  804 + "200": {
  805 + "description": "A successful response.",
  806 + "schema": {
  807 + "$ref": "#/definitions/RoleDeleteResponse"
  808 + }
  809 + }
  810 + },
  811 + "parameters": [
  812 + {
  813 + "name": "id",
  814 + "in": "path",
  815 + "required": true,
  816 + "type": "string"
  817 + },
  818 + {
  819 + "name": "body",
  820 + "in": "body",
  821 + "required": true,
  822 + "schema": {
  823 + "$ref": "#/definitions/RoleDeleteRequest"
  824 + }
  825 + }
  826 + ],
  827 + "requestBody": {},
  828 + "tags": [
  829 + "role"
  830 + ]
  831 + },
  832 + "post": {
  833 + "operationId": "systemGetRole",
  834 + "responses": {
  835 + "200": {
  836 + "description": "A successful response.",
  837 + "schema": {
  838 + "$ref": "#/definitions/RoleGetResponse"
  839 + }
  840 + }
  841 + },
  842 + "parameters": [
  843 + {
  844 + "name": "id",
  845 + "in": "path",
  846 + "required": true,
  847 + "type": "string"
  848 + },
  849 + {
  850 + "name": "body",
  851 + "in": "body",
  852 + "required": true,
  853 + "schema": {
  854 + "$ref": "#/definitions/RoleGetRequest"
  855 + }
  856 + }
  857 + ],
  858 + "requestBody": {},
  859 + "tags": [
  860 + "role"
  861 + ]
  862 + },
  863 + "put": {
  864 + "operationId": "systemUpdateRole",
  865 + "responses": {
  866 + "200": {
  867 + "description": "A successful response.",
  868 + "schema": {
  869 + "$ref": "#/definitions/RoleUpdateResponse"
  870 + }
  871 + }
  872 + },
  873 + "parameters": [
  874 + {
  875 + "name": "id",
  876 + "in": "path",
  877 + "required": true,
  878 + "type": "string"
  879 + },
  880 + {
  881 + "name": "body",
  882 + "in": "body",
  883 + "required": true,
  884 + "schema": {
  885 + "$ref": "#/definitions/RoleUpdateRequest"
  886 + }
  887 + }
  888 + ],
  889 + "requestBody": {},
  890 + "tags": [
  891 + "role"
  892 + ]
  893 + }
  894 + }
  895 + },
  896 + "definitions": {
  897 + "Account": {
  898 + "type": "object",
  899 + "properties": {
  900 + "companyId": {
  901 + "type": "integer",
  902 + "format": "int64",
  903 + "description": " 公司ID"
  904 + },
  905 + "companyName": {
  906 + "type": "string",
  907 + "description": " 公司名称"
  908 + },
  909 + "logo": {
  910 + "type": "string",
  911 + "description": " 公司图标"
  912 + },
  913 + "userId": {
  914 + "type": "integer",
  915 + "format": "int64",
  916 + "description": " 用户ID"
  917 + },
  918 + "name": {
  919 + "type": "string",
  920 + "description": " 名称"
  921 + },
  922 + "position": {
  923 + "type": "string",
  924 + "description": " 职位"
  925 + }
  926 + },
  927 + "title": "Account",
  928 + "required": [
  929 + "companyId",
  930 + "companyName",
  931 + "logo",
  932 + "userId",
  933 + "name",
  934 + "position"
  935 + ]
  936 + },
  937 + "ArticleSearchMe": {
  938 + "type": "object",
  939 + "properties": {
  940 + "id": {
  941 + "type": "integer",
  942 + "format": "int64",
  943 + "description": "id"
  944 + },
  945 + "title": {
  946 + "type": "string",
  947 + "description": "标题"
  948 + },
  949 + "images": {
  950 + "type": "array",
  951 + "items": {
  952 + "type": "string"
  953 + },
  954 + "description": "图片"
  955 + },
  956 + "createdAt": {
  957 + "type": "integer",
  958 + "format": "int64",
  959 + "description": "文章的创建日期"
  960 + },
  961 + "countLove": {
  962 + "type": "integer",
  963 + "format": "int32",
  964 + "description": "点赞数量"
  965 + },
  966 + "CountComment": {
  967 + "type": "integer",
  968 + "format": "int32",
  969 + "description": "评论数量"
  970 + },
  971 + "show": {
  972 + "type": "integer",
  973 + "format": "int32",
  974 + "description": "是否隐藏 [0显示、1不显示]"
  975 + }
  976 + },
  977 + "title": "ArticleSearchMe",
  978 + "required": [
  979 + "id",
  980 + "title",
  981 + "images",
  982 + "createdAt",
  983 + "countLove",
  984 + "CountComment",
  985 + "show"
  986 + ]
  987 + },
  988 + "ArticleSection": {
  989 + "type": "object",
  990 + "properties": {
  991 + "id": {
  992 + "type": "integer",
  993 + "format": "int64",
  994 + "description": "段落id"
  995 + },
  996 + "content": {
  997 + "type": "string",
  998 + "description": " 文本内容"
  999 + },
  1000 + "sortBy": {
  1001 + "type": "integer",
  1002 + "format": "int32",
  1003 + "description": " 排序"
  1004 + },
  1005 + "totalComment": {
  1006 + "type": "integer",
  1007 + "format": "int32",
  1008 + "description": " 评论的数量"
  1009 + }
  1010 + },
  1011 + "title": "ArticleSection",
  1012 + "required": [
  1013 + "id",
  1014 + "content",
  1015 + "sortBy",
  1016 + "totalComment"
  1017 + ]
  1018 + },
  1019 + "Auth": {
  1020 + "type": "object",
  1021 + "properties": {
  1022 + "id": {
  1023 + "type": "integer",
  1024 + "format": "int64",
  1025 + "description": " ID"
  1026 + },
  1027 + "name": {
  1028 + "type": "string",
  1029 + "description": " 名称"
  1030 + },
  1031 + "code": {
  1032 + "type": "string",
  1033 + "description": " 编码"
  1034 + }
  1035 + },
  1036 + "title": "Auth",
  1037 + "required": [
  1038 + "id",
  1039 + "name",
  1040 + "code"
  1041 + ]
  1042 + },
  1043 + "Author": {
  1044 + "type": "object",
  1045 + "properties": {
  1046 + "id": {
  1047 + "type": "integer",
  1048 + "format": "int64",
  1049 + "description": " 人员id"
  1050 + },
  1051 + "name": {
  1052 + "type": "string",
  1053 + "description": " 人员的名字"
  1054 + },
  1055 + "avatar": {
  1056 + "type": "string",
  1057 + "description": " 人员头像URL"
  1058 + },
  1059 + "group": {
  1060 + "type": "string",
  1061 + "description": " 人员的分组"
  1062 + },
  1063 + "position": {
  1064 + "type": "string",
  1065 + "description": " 职位"
  1066 + },
  1067 + "company": {
  1068 + "type": "string",
  1069 + "description": " 公司"
  1070 + }
  1071 + },
  1072 + "title": "Author",
  1073 + "required": [
  1074 + "id",
  1075 + "name",
  1076 + "avatar",
  1077 + "group",
  1078 + "position",
  1079 + "company"
  1080 + ]
  1081 + },
  1082 + "Comment": {
  1083 + "type": "object",
  1084 + "title": "Comment"
  1085 + },
  1086 + "CommentRequest": {
  1087 + "type": "object",
  1088 + "title": "CommentRequest"
  1089 + },
  1090 + "CommentResposne": {
  1091 + "type": "object",
  1092 + "properties": {
  1093 + "list": {
  1094 + "type": "array",
  1095 + "items": {
  1096 + "$ref": "#/definitions/Comment"
  1097 + }
  1098 + }
  1099 + },
  1100 + "title": "CommentResposne",
  1101 + "required": [
  1102 + "list"
  1103 + ]
  1104 + },
  1105 + "Company": {
  1106 + "type": "object",
  1107 + "properties": {
  1108 + "id": {
  1109 + "type": "integer",
  1110 + "format": "int64",
  1111 + "description": " 唯一标识"
  1112 + },
  1113 + "name": {
  1114 + "type": "string",
  1115 + "description": " 名称"
  1116 + },
  1117 + "code": {
  1118 + "type": "string",
  1119 + "description": " 编码(搜索使用,4位字母数字)"
  1120 + },
  1121 + "logo": {
  1122 + "type": "string",
  1123 + "description": " 公司LOGO"
  1124 + }
  1125 + },
  1126 + "title": "Company",
  1127 + "required": [
  1128 + "id",
  1129 + "name",
  1130 + "code",
  1131 + "logo"
  1132 + ]
  1133 + },
  1134 + "CompanySearchRequest": {
  1135 + "type": "object",
  1136 + "properties": {
  1137 + "page": {
  1138 + "type": "integer",
  1139 + "format": "int32"
  1140 + },
  1141 + "size": {
  1142 + "type": "integer",
  1143 + "format": "int32"
  1144 + },
  1145 + "userId": {
  1146 + "type": "integer",
  1147 + "format": "int64",
  1148 + "description": " 按用户搜索"
  1149 + },
  1150 + "code": {
  1151 + "type": "string",
  1152 + "description": " 按编码搜索"
  1153 + }
  1154 + },
  1155 + "title": "CompanySearchRequest",
  1156 + "required": [
  1157 + "page",
  1158 + "size"
  1159 + ]
  1160 + },
  1161 + "CompanySearchResponse": {
  1162 + "type": "object",
  1163 + "properties": {
  1164 + "list": {
  1165 + "type": "array",
  1166 + "items": {
  1167 + "$ref": "#/definitions/Company"
  1168 + }
  1169 + },
  1170 + "total": {
  1171 + "type": "integer",
  1172 + "format": "int64"
  1173 + }
  1174 + },
  1175 + "title": "CompanySearchResponse",
  1176 + "required": [
  1177 + "list",
  1178 + "total"
  1179 + ]
  1180 + },
  1181 + "Department": {
  1182 + "type": "object",
  1183 + "properties": {
  1184 + "id": {
  1185 + "type": "integer",
  1186 + "format": "int64",
  1187 + "description": " 部门ID"
  1188 + },
  1189 + "companyId": {
  1190 + "type": "integer",
  1191 + "format": "int64",
  1192 + "description": " 公司ID"
  1193 + },
  1194 + "parentId": {
  1195 + "type": "integer",
  1196 + "format": "int64",
  1197 + "description": " 父级ID"
  1198 + },
  1199 + "name": {
  1200 + "type": "string",
  1201 + "description": " 部门名称"
  1202 + }
  1203 + },
  1204 + "title": "Department",
  1205 + "required": [
  1206 + "id",
  1207 + "companyId",
  1208 + "parentId",
  1209 + "name"
  1210 + ]
  1211 + },
  1212 + "FollowRequest": {
  1213 + "type": "object",
  1214 + "properties": {
  1215 + "userId": {
  1216 + "type": "integer",
  1217 + "format": "int64"
  1218 + }
  1219 + },
  1220 + "title": "FollowRequest",
  1221 + "required": [
  1222 + "userId"
  1223 + ]
  1224 + },
  1225 + "Location": {
  1226 + "type": "object",
  1227 + "properties": {
  1228 + "longitude": {
  1229 + "type": "number",
  1230 + "format": "double",
  1231 + "description": "经度"
  1232 + },
  1233 + "latitude": {
  1234 + "type": "number",
  1235 + "format": "double",
  1236 + "description": "纬度"
  1237 + },
  1238 + "descript": {
  1239 + "type": "string",
  1240 + "description": "地点描述"
  1241 + }
  1242 + },
  1243 + "title": "Location"
  1244 + },
  1245 + "MessageBusinessItem": {
  1246 + "type": "object",
  1247 + "properties": {
  1248 + "id": {
  1249 + "type": "integer",
  1250 + "format": "int64"
  1251 + },
  1252 + "type": {
  1253 + "type": "integer",
  1254 + "format": "int32",
  1255 + "description": " 分类 (1回复 2点赞 3被采纳)"
  1256 + },
  1257 + "optType": {
  1258 + "type": "integer",
  1259 + "format": "int32",
  1260 + "description": " 操作类型(1针对文章、1针对评论、2针对圆桌)"
  1261 + },
  1262 + "companyId": {
  1263 + "type": "integer",
  1264 + "format": "int64",
  1265 + "description": " 操作人公司ID"
  1266 + },
  1267 + "userId": {
  1268 + "type": "integer",
  1269 + "format": "int64",
  1270 + "description": " 操作人用户ID"
  1271 + },
  1272 + "recipientId": {
  1273 + "type": "integer",
  1274 + "format": "int64",
  1275 + "description": " 接收者ID"
  1276 + },
  1277 + "articleId": {
  1278 + "type": "integer",
  1279 + "format": "int64",
  1280 + "description": " 文章ID"
  1281 + },
  1282 + "commentId": {
  1283 + "type": "integer",
  1284 + "format": "int64",
  1285 + "description": " 评论ID"
  1286 + },
  1287 + "discussionId": {
  1288 + "type": "integer",
  1289 + "format": "int64",
  1290 + "description": " 圆桌ID"
  1291 + },
  1292 + "discussionOpinionId": {
  1293 + "type": "integer",
  1294 + "format": "int64",
  1295 + "description": " 观点ID"
  1296 + },
  1297 + "content": {
  1298 + "type": "string",
  1299 + "description": " 消息内容"
  1300 + },
  1301 + "createdAt": {
  1302 + "type": "integer",
  1303 + "format": "int64",
  1304 + "description": " 创建时间"
  1305 + },
  1306 + "user": {
  1307 + "$ref": "#/definitions/User",
  1308 + "description": " 操作人"
  1309 + },
  1310 + "article": {
  1311 + "$ref": "#/definitions/SimpleArticle",
  1312 + "description": " 文章"
  1313 + },
  1314 + "comment": {
  1315 + "$ref": "#/definitions/Comment",
  1316 + "description": " 评论(不一定是自己,可能是被人@到)"
  1317 + }
  1318 + },
  1319 + "title": "MessageBusinessItem",
  1320 + "required": [
  1321 + "id",
  1322 + "type",
  1323 + "optType",
  1324 + "companyId",
  1325 + "userId",
  1326 + "recipientId",
  1327 + "articleId",
  1328 + "commentId",
  1329 + "discussionId",
  1330 + "discussionOpinionId",
  1331 + "content",
  1332 + "createdAt",
  1333 + "user",
  1334 + "article",
  1335 + "comment"
  1336 + ]
  1337 + },
  1338 + "MessageBusinessRequest": {
  1339 + "type": "object",
  1340 + "properties": {
  1341 + "type": {
  1342 + "type": "integer",
  1343 + "format": "int32"
  1344 + },
  1345 + "page": {
  1346 + "type": "integer",
  1347 + "format": "int32"
  1348 + },
  1349 + "size": {
  1350 + "type": "integer",
  1351 + "format": "int32"
  1352 + }
  1353 + },
  1354 + "title": "MessageBusinessRequest",
  1355 + "required": [
  1356 + "type",
  1357 + "page",
  1358 + "size"
  1359 + ]
  1360 + },
  1361 + "MessageBusinessResponse": {
  1362 + "type": "object",
  1363 + "properties": {
  1364 + "list": {
  1365 + "type": "array",
  1366 + "items": {
  1367 + "$ref": "#/definitions/MessageBusinessItem"
  1368 + }
  1369 + },
  1370 + "total": {
  1371 + "type": "integer",
  1372 + "format": "int64"
  1373 + }
  1374 + },
  1375 + "title": "MessageBusinessResponse",
  1376 + "required": [
  1377 + "list",
  1378 + "total"
  1379 + ]
  1380 + },
  1381 + "MessageSystemItem": {
  1382 + "type": "object",
  1383 + "properties": {
  1384 + "id": {
  1385 + "type": "integer",
  1386 + "format": "int64",
  1387 + "description": " ID"
  1388 + },
  1389 + "type": {
  1390 + "type": "integer",
  1391 + "format": "int32",
  1392 + "description": " 系统分类"
  1393 + },
  1394 + "title": {
  1395 + "type": "string",
  1396 + "description": " 标题"
  1397 + },
  1398 + "content": {
  1399 + "type": "string",
  1400 + "description": " 内容"
  1401 + },
  1402 + "createdAt": {
  1403 + "type": "integer",
  1404 + "format": "int64",
  1405 + "description": " 创建时间"
  1406 + }
  1407 + },
  1408 + "title": "MessageSystemItem",
  1409 + "required": [
  1410 + "id",
  1411 + "type",
  1412 + "title",
  1413 + "content",
  1414 + "createdAt"
  1415 + ]
  1416 + },
  1417 + "MessageSystemRequest": {
  1418 + "type": "object",
  1419 + "properties": {
  1420 + "page": {
  1421 + "type": "integer",
  1422 + "format": "int32"
  1423 + },
  1424 + "size": {
  1425 + "type": "integer",
  1426 + "format": "int32"
  1427 + }
  1428 + },
  1429 + "title": "MessageSystemRequest",
  1430 + "required": [
  1431 + "page",
  1432 + "size"
  1433 + ]
  1434 + },
  1435 + "MessageSystemResponse": {
  1436 + "type": "object",
  1437 + "properties": {
  1438 + "list": {
  1439 + "type": "array",
  1440 + "items": {
  1441 + "$ref": "#/definitions/MessageSystemItem"
  1442 + }
  1443 + },
  1444 + "total": {
  1445 + "type": "integer",
  1446 + "format": "int64"
  1447 + }
  1448 + },
  1449 + "title": "MessageSystemResponse",
  1450 + "required": [
  1451 + "list",
  1452 + "total"
  1453 + ]
  1454 + },
  1455 + "MiniArticleCreateRequest": {
  1456 + "type": "object",
  1457 + "properties": {
  1458 + "title": {
  1459 + "type": "string",
  1460 + "description": "标题"
  1461 + },
  1462 + "section": {
  1463 + "type": "array",
  1464 + "items": {
  1465 + "type": "string"
  1466 + },
  1467 + "description": "文章的文本内容"
  1468 + },
  1469 + "authorId": {
  1470 + "type": "integer",
  1471 + "format": "int64",
  1472 + "description": "发布人id"
  1473 + },
  1474 + "images": {
  1475 + "type": "array",
  1476 + "items": {
  1477 + "type": "string"
  1478 + },
  1479 + "description": "图片"
  1480 + },
  1481 + "whoRead": {
  1482 + "type": "array",
  1483 + "items": {
  1484 + "type": "integer",
  1485 + "format": "int64"
  1486 + },
  1487 + "description": "谁可查看"
  1488 + },
  1489 + "whoReview": {
  1490 + "type": "array",
  1491 + "items": {
  1492 + "type": "integer",
  1493 + "format": "int64"
  1494 + },
  1495 + "description": "谁可评论"
  1496 + },
  1497 + "location": {
  1498 + "$ref": "#/definitions/Location",
  1499 + "description": "定位坐标"
  1500 + }
  1501 + },
  1502 + "title": "MiniArticleCreateRequest",
  1503 + "required": [
  1504 + "title",
  1505 + "section"
  1506 + ]
  1507 + },
  1508 + "MiniArticleCreateResponse": {
  1509 + "type": "object",
  1510 + "properties": {
  1511 + "id": {
  1512 + "type": "integer",
  1513 + "format": "int64"
  1514 + }
  1515 + },
  1516 + "title": "MiniArticleCreateResponse",
  1517 + "required": [
  1518 + "id"
  1519 + ]
  1520 + },
  1521 + "MiniArticleGetRequest": {
  1522 + "type": "object",
  1523 + "properties": {
  1524 + "id": {
  1525 + "type": "integer",
583 "format": "int64", 1526 "format": "int64",
584 - "description": " 唯一标识" 1527 + "description": "id"
585 }, 1528 },
586 - "name": {  
587 - "type": "string",  
588 - "description": " 名称" 1529 + "companyId": {
  1530 + "type": "integer",
  1531 + "format": "int64"
  1532 + }
589 }, 1533 },
590 - "code": {  
591 - "type": "string",  
592 - "description": " 编码(搜索使用,4位字母数字)" 1534 + "title": "MiniArticleGetRequest",
  1535 + "required": [
  1536 + "id",
  1537 + "-"
  1538 + ]
593 }, 1539 },
594 - "logo": { 1540 + "MiniArticleGetResponse": {
  1541 + "type": "object",
  1542 + "properties": {
  1543 + "id": {
  1544 + "type": "integer",
  1545 + "format": "int64",
  1546 + "description": "id"
  1547 + },
  1548 + "title": {
595 "type": "string", 1549 "type": "string",
596 - "description": " 公司LOGO" 1550 + "description": "标题"
  1551 + },
  1552 + "authorId": {
  1553 + "type": "integer",
  1554 + "format": "int64",
  1555 + "description": "发布人id"
  1556 + },
  1557 + "author": {
  1558 + "$ref": "#/definitions/Author",
  1559 + "description": "发布人"
  1560 + },
  1561 + "createdAt": {
  1562 + "type": "integer",
  1563 + "format": "int64",
  1564 + "description": "文章的发布时间"
  1565 + },
  1566 + "section": {
  1567 + "type": "array",
  1568 + "items": {
  1569 + "$ref": "#/definitions/ArticleSection"
  1570 + },
  1571 + "description": "文章的文本内容"
  1572 + },
  1573 + "images": {
  1574 + "type": "array",
  1575 + "items": {
  1576 + "type": "string"
  1577 + },
  1578 + "description": "图片"
  1579 + },
  1580 + "whoRead": {
  1581 + "type": "array",
  1582 + "items": {
  1583 + "type": "integer",
  1584 + "format": "int64"
  1585 + },
  1586 + "description": "谁可查看"
  1587 + },
  1588 + "whoReview": {
  1589 + "type": "array",
  1590 + "items": {
  1591 + "type": "integer",
  1592 + "format": "int64"
  1593 + },
  1594 + "description": "谁可评论"
  1595 + },
  1596 + "location": {
  1597 + "$ref": "#/definitions/Location",
  1598 + "description": "定位坐标"
  1599 + },
  1600 + "countLove": {
  1601 + "type": "integer",
  1602 + "format": "int32",
  1603 + "description": " 点赞数量"
  1604 + },
  1605 + "countComment": {
  1606 + "type": "integer",
  1607 + "format": "int32",
  1608 + "description": " 评论数量"
  1609 + },
  1610 + "countRead": {
  1611 + "type": "integer",
  1612 + "format": "int32",
  1613 + "description": " 浏览数量"
  1614 + },
  1615 + "show": {
  1616 + "type": "integer",
  1617 + "format": "int32",
  1618 + "description": " 评论的展示状态(0显示、1不显示)"
597 } 1619 }
598 }, 1620 },
599 - "title": "Company", 1621 + "title": "MiniArticleGetResponse",
600 "required": [ 1622 "required": [
601 "id", 1623 "id",
602 - "name",  
603 - "code",  
604 - "logo" 1624 + "title",
  1625 + "authorId",
  1626 + "author",
  1627 + "createdAt",
  1628 + "section",
  1629 + "images",
  1630 + "whoRead",
  1631 + "whoReview",
  1632 + "location",
  1633 + "countLove",
  1634 + "countComment",
  1635 + "countRead",
  1636 + "show"
605 ] 1637 ]
606 }, 1638 },
607 - "CompanySearchRequest": { 1639 + "MiniArticleSearchMeRequest": {
608 "type": "object", 1640 "type": "object",
609 "properties": { 1641 "properties": {
  1642 + "authorId": {
  1643 + "type": "integer",
  1644 + "format": "int64"
  1645 + },
  1646 + "companyId": {
  1647 + "type": "integer",
  1648 + "format": "int64"
  1649 + },
610 "page": { 1650 "page": {
611 "type": "integer", 1651 "type": "integer",
612 "format": "int32" 1652 "format": "int32"
@@ -614,462 +1654,571 @@ @@ -614,462 +1654,571 @@
614 "size": { 1654 "size": {
615 "type": "integer", 1655 "type": "integer",
616 "format": "int32" 1656 "format": "int32"
617 - },  
618 - "userId": {  
619 - "type": "integer",  
620 - "format": "int64",  
621 - "description": " 按用户搜索"  
622 - },  
623 - "code": {  
624 - "type": "string",  
625 - "description": " 按编码搜索"  
626 } 1657 }
627 }, 1658 },
628 - "title": "CompanySearchRequest", 1659 + "title": "MiniArticleSearchMeRequest",
629 "required": [ 1660 "required": [
  1661 + "-",
630 "page", 1662 "page",
631 "size" 1663 "size"
632 ] 1664 ]
633 }, 1665 },
634 - "CompanySearchResponse": { 1666 + "MiniArticleSearchMeResponse": {
635 "type": "object", 1667 "type": "object",
636 "properties": { 1668 "properties": {
  1669 + "total": {
  1670 + "type": "integer",
  1671 + "format": "int32"
  1672 + },
637 "list": { 1673 "list": {
638 "type": "array", 1674 "type": "array",
639 "items": { 1675 "items": {
640 - "$ref": "#/definitions/Company" 1676 + "$ref": "#/definitions/ArticleSearchMe"
641 } 1677 }
642 - },  
643 - "total": {  
644 - "type": "integer",  
645 - "format": "int64"  
646 } 1678 }
647 }, 1679 },
648 - "title": "CompanySearchResponse", 1680 + "title": "MiniArticleSearchMeResponse",
649 "required": [ 1681 "required": [
650 - "list",  
651 - "total" 1682 + "total",
  1683 + "list"
652 ] 1684 ]
653 }, 1685 },
654 - "Department": { 1686 + "MiniSetUserLikeRequset": {
655 "type": "object", 1687 "type": "object",
656 "properties": { 1688 "properties": {
657 - "id": { 1689 + "articleId": {
658 "type": "integer", 1690 "type": "integer",
659 "format": "int64", 1691 "format": "int64",
660 - "description": " 部门ID" 1692 + "description": "文章id"
661 }, 1693 },
662 - "companyId": { 1694 + "commentId": {
663 "type": "integer", 1695 "type": "integer",
664 "format": "int64", 1696 "format": "int64",
665 - "description": " 公司ID" 1697 + "description": "评论id"
666 }, 1698 },
667 - "parentId": { 1699 + "userId": {
668 "type": "integer", 1700 "type": "integer",
669 "format": "int64", 1701 "format": "int64",
670 - "description": " 父级ID" 1702 + "description": "操作人"
671 }, 1703 },
672 - "name": {  
673 - "type": "string",  
674 - "description": " 部门名称" 1704 + "flag": {
  1705 + "type": "integer",
  1706 + "format": "int32",
  1707 + "description": "点赞标志 1、点赞 2 、取消点赞"
675 } 1708 }
676 }, 1709 },
677 - "title": "Department", 1710 + "title": "MiniSetUserLikeRequset",
678 "required": [ 1711 "required": [
679 - "id",  
680 - "companyId",  
681 - "parentId",  
682 - "name" 1712 + "articleId",
  1713 + "commentId",
  1714 + "-",
  1715 + "flag"
683 ] 1716 ]
684 }, 1717 },
685 - "FollowRequest": { 1718 + "MiniSetUserLikeResponse": {
686 "type": "object", 1719 "type": "object",
687 "properties": { 1720 "properties": {
688 - "userId": { 1721 + "articleId": {
689 "type": "integer", 1722 "type": "integer",
690 - "format": "int64" 1723 + "format": "int64",
  1724 + "description": "文章id"
  1725 + },
  1726 + "commentId": {
  1727 + "type": "integer",
  1728 + "format": "int64",
  1729 + "description": "评论id"
  1730 + },
  1731 + "count": {
  1732 + "type": "integer",
  1733 + "format": "int32",
  1734 + "description": "现有的点赞数量"
691 } 1735 }
692 }, 1736 },
693 - "title": "FollowRequest", 1737 + "title": "MiniSetUserLikeResponse",
694 "required": [ 1738 "required": [
695 - "userId" 1739 + "articleId",
  1740 + "commentId",
  1741 + "count"
696 ] 1742 ]
697 }, 1743 },
698 - "MessageBusinessItem": { 1744 + "MiniUserApplyJoinCompanyRequest": {
699 "type": "object", 1745 "type": "object",
700 "properties": { 1746 "properties": {
701 - "id": {  
702 - "type": "integer",  
703 - "format": "int64" 1747 + "phone": {
  1748 + "type": "string"
704 }, 1749 },
705 - "type": { 1750 + "code": {
  1751 + "type": "string"
  1752 + }
  1753 + },
  1754 + "title": "MiniUserApplyJoinCompanyRequest",
  1755 + "required": [
  1756 + "phone",
  1757 + "code"
  1758 + ]
  1759 + },
  1760 + "MiniUserApplyJoinCompanyResponse": {
  1761 + "type": "object",
  1762 + "title": "MiniUserApplyJoinCompanyResponse"
  1763 + },
  1764 + "MiniUserAuditRequest": {
  1765 + "type": "object",
  1766 + "properties": {
  1767 + "userId": {
706 "type": "integer", 1768 "type": "integer",
707 - "format": "int32",  
708 - "description": " 分类 (1回复 2点赞 3被采纳)" 1769 + "format": "int64",
  1770 + "description": " 用户ID"
709 }, 1771 },
710 - "optType": { 1772 + "status": {
711 "type": "integer", 1773 "type": "integer",
712 "format": "int32", 1774 "format": "int32",
713 - "description": " 操作类型(1针对文章、1针对评论、2针对圆桌)" 1775 + "description": " 审核状态 1:审核通过 2:拒绝"
  1776 + }
714 }, 1777 },
715 - "companyId": { 1778 + "title": "MiniUserAuditRequest",
  1779 + "required": [
  1780 + "userId",
  1781 + "status"
  1782 + ]
  1783 + },
  1784 + "MiniUserDepartmentUsersRequest": {
  1785 + "type": "object",
  1786 + "title": "MiniUserDepartmentUsersRequest"
  1787 + },
  1788 + "MiniUserDepartmentUsersResponse": {
  1789 + "type": "object",
  1790 + "properties": {
  1791 + "departments": {
  1792 + "type": "array",
  1793 + "items": {
  1794 + "$ref": "#/definitions/Department"
  1795 + }
  1796 + },
  1797 + "users": {
  1798 + "type": "array",
  1799 + "items": {
  1800 + "$ref": "#/definitions/UserItem"
  1801 + }
  1802 + }
  1803 + },
  1804 + "title": "MiniUserDepartmentUsersResponse",
  1805 + "required": [
  1806 + "departments",
  1807 + "users"
  1808 + ]
  1809 + },
  1810 + "MiniUserFollowedSearchRequest": {
  1811 + "type": "object",
  1812 + "properties": {
  1813 + "page": {
716 "type": "integer", 1814 "type": "integer",
717 - "format": "int64",  
718 - "description": " 操作人公司ID" 1815 + "format": "int32"
719 }, 1816 },
720 - "userId": { 1817 + "size": {
721 "type": "integer", 1818 "type": "integer",
722 - "format": "int64",  
723 - "description": " 操作人用户ID" 1819 + "format": "int32"
  1820 + }
  1821 + },
  1822 + "title": "MiniUserFollowedSearchRequest"
  1823 + },
  1824 + "MiniUserFollowedSearchResponse": {
  1825 + "type": "object",
  1826 + "properties": {
  1827 + "users": {
  1828 + "type": "array",
  1829 + "items": {
  1830 + "$ref": "#/definitions/UserFollowItem"
  1831 + }
724 }, 1832 },
725 - "recipientId": { 1833 + "total": {
726 "type": "integer", 1834 "type": "integer",
727 - "format": "int64",  
728 - "description": " 接收者ID" 1835 + "format": "int64"
  1836 + }
729 }, 1837 },
730 - "articleId": {  
731 - "type": "integer",  
732 - "format": "int64",  
733 - "description": " 文章ID" 1838 + "title": "MiniUserFollowedSearchResponse",
  1839 + "required": [
  1840 + "users",
  1841 + "total"
  1842 + ]
734 }, 1843 },
735 - "commentId": {  
736 - "type": "integer",  
737 - "format": "int64",  
738 - "description": " 评论ID" 1844 + "MiniUserInfoRequest": {
  1845 + "type": "object",
  1846 + "title": "MiniUserInfoRequest"
739 }, 1847 },
740 - "discussionId": { 1848 + "MiniUserInfoResponse": {
  1849 + "type": "object",
  1850 + "properties": {
  1851 + "user": {
  1852 + "$ref": "#/definitions/UserItem",
  1853 + "description": " 用户信息"
  1854 + },
  1855 + "totalArticle": {
741 "type": "integer", 1856 "type": "integer",
742 "format": "int64", 1857 "format": "int64",
743 - "description": " 圆桌ID" 1858 + "description": " 累计信息发布"
744 }, 1859 },
745 - "discussionOpinionId": { 1860 + "totalLoved": {
746 "type": "integer", 1861 "type": "integer",
747 "format": "int64", 1862 "format": "int64",
748 - "description": " 观点ID"  
749 - },  
750 - "content": {  
751 - "type": "string",  
752 - "description": " 消息内容" 1863 + "description": " 累计收到的赞"
753 }, 1864 },
754 - "createdAt": { 1865 + "totalAccepted": {
755 "type": "integer", 1866 "type": "integer",
756 "format": "int64", 1867 "format": "int64",
757 - "description": " 创建时间"  
758 - },  
759 - "user": {  
760 - "$ref": "#/definitions/User",  
761 - "description": " 操作人" 1868 + "description": " 累计被采纳"
762 }, 1869 },
763 - "article": {  
764 - "$ref": "#/definitions/SimpleArticle",  
765 - "description": " 文章" 1870 + "accounts": {
  1871 + "type": "array",
  1872 + "items": {
  1873 + "$ref": "#/definitions/Account"
766 }, 1874 },
767 - "comment": {  
768 - "$ref": "#/definitions/Comment",  
769 - "description": " 评论(不一定是自己,可能是被人@到)" 1875 + "description": " 公司账号"
770 } 1876 }
771 }, 1877 },
772 - "title": "MessageBusinessItem", 1878 + "title": "MiniUserInfoResponse",
773 "required": [ 1879 "required": [
774 - "id",  
775 - "type",  
776 - "optType",  
777 - "companyId",  
778 - "userId",  
779 - "recipientId",  
780 - "articleId",  
781 - "commentId",  
782 - "discussionId",  
783 - "discussionOpinionId",  
784 - "content",  
785 - "createdAt",  
786 "user", 1880 "user",
787 - "article",  
788 - "comment" 1881 + "totalArticle",
  1882 + "totalLoved",
  1883 + "totalAccepted",
  1884 + "accounts"
789 ] 1885 ]
790 }, 1886 },
791 - "MessageBusinessRequest": { 1887 + "MiniUserLikeArticleRequest": {
792 "type": "object", 1888 "type": "object",
793 "properties": { 1889 "properties": {
794 - "type": { 1890 + "articleId": {
795 "type": "integer", 1891 "type": "integer",
796 - "format": "int32" 1892 + "format": "int64",
  1893 + "description": " 文章id"
  1894 + },
  1895 + "companyId": {
  1896 + "type": "integer",
  1897 + "format": "int64",
  1898 + "description": "公司id"
797 }, 1899 },
798 "page": { 1900 "page": {
799 "type": "integer", 1901 "type": "integer",
800 - "format": "int32" 1902 + "format": "int32",
  1903 + "description": "分页,第几页"
801 }, 1904 },
802 "size": { 1905 "size": {
803 "type": "integer", 1906 "type": "integer",
804 - "format": "int32" 1907 + "format": "int32",
  1908 + "description": "分页,每页几条"
805 } 1909 }
806 }, 1910 },
807 - "title": "MessageBusinessRequest", 1911 + "title": "MiniUserLikeArticleRequest",
808 "required": [ 1912 "required": [
809 - "type", 1913 + "articleId",
  1914 + "-",
810 "page", 1915 "page",
811 "size" 1916 "size"
812 ] 1917 ]
813 }, 1918 },
814 - "MessageBusinessResponse": { 1919 + "MiniUserLikeArticleResponse": {
815 "type": "object", 1920 "type": "object",
816 "properties": { 1921 "properties": {
  1922 + "total": {
  1923 + "type": "integer",
  1924 + "format": "int64",
  1925 + "description": "总数"
  1926 + },
817 "list": { 1927 "list": {
818 "type": "array", 1928 "type": "array",
819 "items": { 1929 "items": {
820 - "$ref": "#/definitions/MessageBusinessItem"  
821 - } 1930 + "$ref": "#/definitions/WhichUserLikeArticle"
822 }, 1931 },
823 - "total": {  
824 - "type": "integer",  
825 - "format": "int64" 1932 + "description": "列表"
826 } 1933 }
827 }, 1934 },
828 - "title": "MessageBusinessResponse", 1935 + "title": "MiniUserLikeArticleResponse",
829 "required": [ 1936 "required": [
830 - "list",  
831 - "total" 1937 + "total",
  1938 + "list"
832 ] 1939 ]
833 }, 1940 },
834 - "MessageSystemItem": { 1941 + "MiniUserLoginRequest": {
835 "type": "object", 1942 "type": "object",
836 "properties": { 1943 "properties": {
837 - "id": {  
838 - "type": "integer",  
839 - "format": "int64",  
840 - "description": " ID" 1944 + "loginType": {
  1945 + "type": "string",
  1946 + "description": " 登录类型 wechat-login whchat-phone-login phone-password-login phone-smscode-login"
841 }, 1947 },
842 - "type": {  
843 - "type": "integer",  
844 - "format": "int32",  
845 - "description": " 系统分类" 1948 + "wechatAuthcode": {
  1949 + "type": "string",
  1950 + "description": " 微信登录 授权码"
846 }, 1951 },
847 - "title": { 1952 + "wechatEncryptedData": {
848 "type": "string", 1953 "type": "string",
849 - "description": " 标题" 1954 + "description": " 微信登录 加密数据"
850 }, 1955 },
851 - "content": { 1956 + "wechatIV": {
852 "type": "string", 1957 "type": "string",
853 - "description": " 内容" 1958 + "description": " 微信登录 加密算法初始向量"
854 }, 1959 },
855 - "createdAt": {  
856 - "type": "integer",  
857 - "format": "int64",  
858 - "description": " 创建时间" 1960 + "phone": {
  1961 + "type": "string",
  1962 + "description": " 手机号"
  1963 + },
  1964 + "password": {
  1965 + "type": "string",
  1966 + "description": " 密码"
  1967 + },
  1968 + "smsCode": {
  1969 + "type": "string",
  1970 + "description": " 短信验证码"
859 } 1971 }
860 }, 1972 },
861 - "title": "MessageSystemItem", 1973 + "title": "MiniUserLoginRequest",
862 "required": [ 1974 "required": [
863 - "id",  
864 - "type",  
865 - "title",  
866 - "content",  
867 - "createdAt" 1975 + "loginType"
868 ] 1976 ]
869 }, 1977 },
870 - "MessageSystemRequest": { 1978 + "MiniUserLoginResponse": {
871 "type": "object", 1979 "type": "object",
872 "properties": { 1980 "properties": {
873 - "page": {  
874 - "type": "integer",  
875 - "format": "int32" 1981 + "token": {
  1982 + "type": "string",
  1983 + "description": " x-token"
876 }, 1984 },
877 - "size": {  
878 - "type": "integer",  
879 - "format": "int32" 1985 + "phone": {
  1986 + "type": "string",
  1987 + "description": " 手机号"
  1988 + },
  1989 + "message": {
  1990 + "type": "string",
  1991 + "description": " 失败消息(审核中,注册成功等待审核)"
  1992 + },
  1993 + "success": {
  1994 + "type": "boolean",
  1995 + "format": "boolean",
  1996 + "description": " 成功标识"
880 } 1997 }
881 }, 1998 },
882 - "title": "MessageSystemRequest", 1999 + "title": "MiniUserLoginResponse",
883 "required": [ 2000 "required": [
884 - "page",  
885 - "size" 2001 + "token",
  2002 + "phone",
  2003 + "message",
  2004 + "success"
886 ] 2005 ]
887 }, 2006 },
888 - "MessageSystemResponse": { 2007 + "MiniUserSwitchAccountRequest": {
889 "type": "object", 2008 "type": "object",
890 "properties": { 2009 "properties": {
891 - "list": {  
892 - "type": "array",  
893 - "items": {  
894 - "$ref": "#/definitions/MessageSystemItem" 2010 + "companyId": {
  2011 + "type": "integer",
  2012 + "format": "int64"
895 } 2013 }
896 }, 2014 },
897 - "total": { 2015 + "title": "MiniUserSwitchAccountRequest",
  2016 + "required": [
  2017 + "companyId"
  2018 + ]
  2019 + },
  2020 + "RoleDeleteRequest": {
  2021 + "type": "object",
  2022 + "properties": {
  2023 + "id": {
898 "type": "integer", 2024 "type": "integer",
899 "format": "int64" 2025 "format": "int64"
900 } 2026 }
901 }, 2027 },
902 - "title": "MessageSystemResponse", 2028 + "title": "RoleDeleteRequest",
903 "required": [ 2029 "required": [
904 - "list",  
905 - "total" 2030 + "id"
906 ] 2031 ]
907 }, 2032 },
908 - "MiniUserApplyJoinCompanyRequest": { 2033 + "RoleDeleteResponse": {
909 "type": "object", 2034 "type": "object",
910 - "properties": {  
911 - "phone": {  
912 - "type": "string" 2035 + "title": "RoleDeleteResponse"
913 }, 2036 },
914 - "code": {  
915 - "type": "string" 2037 + "RoleGetRequest": {
  2038 + "type": "object",
  2039 + "properties": {
  2040 + "id": {
  2041 + "type": "integer",
  2042 + "format": "int64"
916 } 2043 }
917 }, 2044 },
918 - "title": "MiniUserApplyJoinCompanyRequest", 2045 + "title": "RoleGetRequest",
919 "required": [ 2046 "required": [
920 - "phone",  
921 - "code" 2047 + "id"
922 ] 2048 ]
923 }, 2049 },
924 - "MiniUserApplyJoinCompanyResponse": { 2050 + "RoleGetResponse": {
925 "type": "object", 2051 "type": "object",
926 - "title": "MiniUserApplyJoinCompanyResponse" 2052 + "properties": {
  2053 + "role": {
  2054 + "$ref": "#/definitions/RoleItem"
927 }, 2055 },
928 - "MiniUserAuditRequest": { 2056 + "authList": {
  2057 + "type": "array",
  2058 + "items": {
  2059 + "$ref": "#/definitions/Auth"
  2060 + }
  2061 + }
  2062 + },
  2063 + "title": "RoleGetResponse",
  2064 + "required": [
  2065 + "role",
  2066 + "authList"
  2067 + ]
  2068 + },
  2069 + "RoleItem": {
929 "type": "object", 2070 "type": "object",
930 "properties": { 2071 "properties": {
931 - "userId": { 2072 + "id": {
932 "type": "integer", 2073 "type": "integer",
933 "format": "int64", 2074 "format": "int64",
934 - "description": " 用户ID" 2075 + "description": " 角色ID"
  2076 + },
  2077 + "companyId": {
  2078 + "type": "integer",
  2079 + "format": "int64",
  2080 + "description": " 公司ID"
  2081 + },
  2082 + "name": {
  2083 + "type": "string",
  2084 + "description": " 角色名称"
  2085 + },
  2086 + "authIds": {
  2087 + "type": "array",
  2088 + "items": {
  2089 + "type": "integer",
  2090 + "format": "int64"
  2091 + },
  2092 + "description": " 角色权限列表"
  2093 + },
  2094 + "authsDesc": {
  2095 + "type": "string",
  2096 + "description": " 权限列表描述"
  2097 + },
  2098 + "usersDesc": {
  2099 + "type": "string",
  2100 + "description": " 用户列表描述"
  2101 + },
  2102 + "remark": {
  2103 + "type": "string",
  2104 + "description": " 备注"
  2105 + },
  2106 + "users": {
  2107 + "type": "array",
  2108 + "items": {
  2109 + "$ref": "#/definitions/RoleUser"
935 }, 2110 },
936 - "status": { 2111 + "description": " 绑定的用户"
  2112 + },
  2113 + "updatedAt": {
937 "type": "integer", 2114 "type": "integer",
938 - "format": "int32",  
939 - "description": " 审核状态 1:审核通过 2:拒绝" 2115 + "format": "int64",
  2116 + "description": " 更新时间"
940 } 2117 }
941 }, 2118 },
942 - "title": "MiniUserAuditRequest", 2119 + "title": "RoleItem",
943 "required": [ 2120 "required": [
944 - "userId",  
945 - "status" 2121 + "name",
  2122 + "authIds",
  2123 + "authsDesc",
  2124 + "usersDesc",
  2125 + "remark",
  2126 + "updatedAt"
946 ] 2127 ]
947 }, 2128 },
948 - "MiniUserDepartmentUsersRequest": {  
949 - "type": "object",  
950 - "title": "MiniUserDepartmentUsersRequest"  
951 - },  
952 - "MiniUserDepartmentUsersResponse": { 2129 + "RoleSaveRequest": {
953 "type": "object", 2130 "type": "object",
954 "properties": { 2131 "properties": {
955 - "departments": {  
956 - "type": "array",  
957 - "items": {  
958 - "$ref": "#/definitions/Department"  
959 - }  
960 - },  
961 - "users": {  
962 - "type": "array",  
963 - "items": {  
964 - "$ref": "#/definitions/UserItem"  
965 - } 2132 + "role": {
  2133 + "$ref": "#/definitions/RoleItem"
966 } 2134 }
967 }, 2135 },
968 - "title": "MiniUserDepartmentUsersResponse", 2136 + "title": "RoleSaveRequest",
969 "required": [ 2137 "required": [
970 - "departments",  
971 - "users" 2138 + "role"
972 ] 2139 ]
973 }, 2140 },
974 - "MiniUserInfoRequest": { 2141 + "RoleSaveResponse": {
975 "type": "object", 2142 "type": "object",
976 - "title": "MiniUserInfoRequest" 2143 + "title": "RoleSaveResponse"
977 }, 2144 },
978 - "MiniUserInfoResponse": { 2145 + "RoleSearchRequest": {
979 "type": "object", 2146 "type": "object",
980 "properties": { 2147 "properties": {
981 - "user": {  
982 - "$ref": "#/definitions/UserItem",  
983 - "description": " 用户信息"  
984 - },  
985 - "totalArticle": { 2148 + "page": {
986 "type": "integer", 2149 "type": "integer",
987 - "format": "int64",  
988 - "description": " 累计信息发布" 2150 + "format": "int32"
989 }, 2151 },
990 - "totalLoved": { 2152 + "size": {
991 "type": "integer", 2153 "type": "integer",
992 - "format": "int64",  
993 - "description": " 累计收到的赞" 2154 + "format": "int32"
994 }, 2155 },
995 - "totalAccepted": {  
996 - "type": "integer",  
997 - "format": "int64",  
998 - "description": " 累计被采纳" 2156 + "style": {
  2157 + "type": "string",
  2158 + "description": " simple:只返回角色ID名称 full:所有字段都返回"
999 } 2159 }
1000 }, 2160 },
1001 - "title": "MiniUserInfoResponse", 2161 + "title": "RoleSearchRequest",
1002 "required": [ 2162 "required": [
1003 - "user",  
1004 - "totalArticle",  
1005 - "totalLoved",  
1006 - "totalAccepted" 2163 + "style"
1007 ] 2164 ]
1008 }, 2165 },
1009 - "MiniUserLoginRequest": { 2166 + "RoleSearchResponse": {
1010 "type": "object", 2167 "type": "object",
1011 "properties": { 2168 "properties": {
1012 - "loginType": {  
1013 - "type": "string",  
1014 - "description": " 登录类型 wechat-login whchat-phone-login phone-password-login phone-smscode-login"  
1015 - },  
1016 - "wechatAuthcode": {  
1017 - "type": "string",  
1018 - "description": " 微信登录 授权码"  
1019 - },  
1020 - "wechatEncryptedData": {  
1021 - "type": "string",  
1022 - "description": " 微信登录 加密数据" 2169 + "list": {
  2170 + "type": "array",
  2171 + "items": {
  2172 + "$ref": "#/definitions/RoleItem"
  2173 + }
1023 }, 2174 },
1024 - "wechatIV": {  
1025 - "type": "string",  
1026 - "description": " 微信登录 加密算法初始向量" 2175 + "total": {
  2176 + "type": "integer",
  2177 + "format": "int64"
  2178 + }
1027 }, 2179 },
1028 - "phone": {  
1029 - "type": "string",  
1030 - "description": " 手机号" 2180 + "title": "RoleSearchResponse",
  2181 + "required": [
  2182 + "list",
  2183 + "total"
  2184 + ]
1031 }, 2185 },
1032 - "password": {  
1033 - "type": "string",  
1034 - "description": " 密码" 2186 + "RoleUpdateRequest": {
  2187 + "type": "object",
  2188 + "properties": {
  2189 + "id": {
  2190 + "type": "integer",
  2191 + "format": "int64"
1035 }, 2192 },
1036 - "smsCode": {  
1037 - "type": "string",  
1038 - "description": " 短信验证码" 2193 + "role": {
  2194 + "$ref": "#/definitions/RoleItem"
1039 } 2195 }
1040 }, 2196 },
1041 - "title": "MiniUserLoginRequest", 2197 + "title": "RoleUpdateRequest",
1042 "required": [ 2198 "required": [
1043 - "loginType" 2199 + "id",
  2200 + "role"
1044 ] 2201 ]
1045 }, 2202 },
1046 - "MiniUserLoginResponse": { 2203 + "RoleUpdateResponse": {
1047 "type": "object", 2204 "type": "object",
1048 - "properties": {  
1049 - "token": {  
1050 - "type": "string",  
1051 - "description": " x-token"  
1052 - },  
1053 - "phone": {  
1054 - "type": "string",  
1055 - "description": " 手机号" 2205 + "title": "RoleUpdateResponse"
1056 }, 2206 },
1057 - "message": {  
1058 - "type": "string",  
1059 - "description": " 失败消息(审核中,注册成功等待审核)" 2207 + "RoleUser": {
  2208 + "type": "object",
  2209 + "properties": {
  2210 + "id": {
  2211 + "type": "integer",
  2212 + "format": "int64"
1060 }, 2213 },
1061 - "success": {  
1062 - "type": "boolean",  
1063 - "format": "boolean",  
1064 - "description": " 成功标识" 2214 + "name": {
  2215 + "type": "string"
1065 } 2216 }
1066 }, 2217 },
1067 - "title": "MiniUserLoginResponse", 2218 + "title": "RoleUser",
1068 "required": [ 2219 "required": [
1069 - "token",  
1070 - "phone",  
1071 - "message",  
1072 - "success" 2220 + "id",
  2221 + "name"
1073 ] 2222 ]
1074 }, 2223 },
1075 "SimpleArticle": { 2224 "SimpleArticle": {
@@ -1130,8 +2279,7 @@ @@ -1130,8 +2279,7 @@
1130 "companyId", 2279 "companyId",
1131 "image", 2280 "image",
1132 "name", 2281 "name",
1133 - "group",  
1134 - "remark" 2282 + "group"
1135 ] 2283 ]
1136 }, 2284 },
1137 "TagCreateResponse": { 2285 "TagCreateResponse": {
@@ -1153,11 +2301,16 @@ @@ -1153,11 +2301,16 @@
1153 "id": { 2301 "id": {
1154 "type": "integer", 2302 "type": "integer",
1155 "format": "int64" 2303 "format": "int64"
  2304 + },
  2305 + "companyId": {
  2306 + "type": "integer",
  2307 + "format": "int64"
1156 } 2308 }
1157 }, 2309 },
1158 "title": "TagDeleteRequest", 2310 "title": "TagDeleteRequest",
1159 "required": [ 2311 "required": [
1160 - "id" 2312 + "id",
  2313 + "-"
1161 ] 2314 ]
1162 }, 2315 },
1163 "TagDeleteResponse": { 2316 "TagDeleteResponse": {
@@ -1203,11 +2356,10 @@ @@ -1203,11 +2356,10 @@
1203 "title": "TagEditRequest", 2356 "title": "TagEditRequest",
1204 "required": [ 2357 "required": [
1205 "id", 2358 "id",
1206 - "companyId", 2359 + "-",
1207 "image", 2360 "image",
1208 "name", 2361 "name",
1209 - "group",  
1210 - "remark" 2362 + "group"
1211 ] 2363 ]
1212 }, 2364 },
1213 "TagEditResponse": { 2365 "TagEditResponse": {
@@ -1229,11 +2381,16 @@ @@ -1229,11 +2381,16 @@
1229 "id": { 2381 "id": {
1230 "type": "integer", 2382 "type": "integer",
1231 "format": "int64" 2383 "format": "int64"
  2384 + },
  2385 + "companyId": {
  2386 + "type": "integer",
  2387 + "format": "int64"
1232 } 2388 }
1233 }, 2389 },
1234 "title": "TagGetRequest", 2390 "title": "TagGetRequest",
1235 "required": [ 2391 "required": [
1236 - "id" 2392 + "id",
  2393 + "-"
1237 ] 2394 ]
1238 }, 2395 },
1239 "TagGetResponse": { 2396 "TagGetResponse": {
@@ -1315,12 +2472,26 @@ @@ -1315,12 +2472,26 @@
1315 "size": { 2472 "size": {
1316 "type": "integer", 2473 "type": "integer",
1317 "format": "int32" 2474 "format": "int32"
  2475 + },
  2476 + "companyId": {
  2477 + "type": "integer",
  2478 + "format": "int64"
  2479 + },
  2480 + "tagName": {
  2481 + "type": "string"
  2482 + },
  2483 + "group": {
  2484 + "type": "string"
  2485 + },
  2486 + "remark": {
  2487 + "type": "string"
1318 } 2488 }
1319 }, 2489 },
1320 "title": "TagListRequest", 2490 "title": "TagListRequest",
1321 "required": [ 2491 "required": [
1322 "page", 2492 "page",
1323 - "size" 2493 + "size",
  2494 + "-"
1324 ] 2495 ]
1325 }, 2496 },
1326 "TagListResponse": { 2497 "TagListResponse": {
@@ -1328,7 +2499,7 @@ @@ -1328,7 +2499,7 @@
1328 "properties": { 2499 "properties": {
1329 "total": { 2500 "total": {
1330 "type": "integer", 2501 "type": "integer",
1331 - "format": "int32" 2502 + "format": "int64"
1332 }, 2503 },
1333 "list": { 2504 "list": {
1334 "type": "array", 2505 "type": "array",
@@ -1382,7 +2553,7 @@ @@ -1382,7 +2553,7 @@
1382 "position" 2553 "position"
1383 ] 2554 ]
1384 }, 2555 },
1385 - "UserItem": { 2556 + "UserFollowItem": {
1386 "type": "object", 2557 "type": "object",
1387 "properties": { 2558 "properties": {
1388 "id": { 2559 "id": {
@@ -1390,23 +2561,60 @@ @@ -1390,23 +2561,60 @@
1390 "format": "int64", 2561 "format": "int64",
1391 "description": " 用户ID" 2562 "description": " 用户ID"
1392 }, 2563 },
1393 - "companyId": {  
1394 - "type": "integer",  
1395 - "format": "int64",  
1396 - "description": " 公司ID" 2564 + "name": {
  2565 + "type": "string",
  2566 + "description": " 名称"
  2567 + },
  2568 + "companyName": {
  2569 + "type": "string",
  2570 + "description": " 公司名称"
  2571 + },
  2572 + "avatar": {
  2573 + "type": "string",
  2574 + "description": " 头像"
  2575 + },
  2576 + "position": {
  2577 + "type": "string",
  2578 + "description": " 职位"
  2579 + },
  2580 + "followed": {
  2581 + "type": "boolean",
  2582 + "format": "boolean",
  2583 + "description": " 关注"
  2584 + },
  2585 + "mutualFollowed": {
  2586 + "type": "boolean",
  2587 + "format": "boolean",
  2588 + "description": " 互相关注标识"
  2589 + }
  2590 + },
  2591 + "title": "UserFollowItem",
  2592 + "required": [
  2593 + "id",
  2594 + "name",
  2595 + "companyName",
  2596 + "avatar",
  2597 + "position",
  2598 + "followed",
  2599 + "mutualFollowed"
  2600 + ]
1397 }, 2601 },
1398 - "departmentId": { 2602 + "UserItem": {
  2603 + "type": "object",
  2604 + "properties": {
  2605 + "id": {
1399 "type": "integer", 2606 "type": "integer",
1400 "format": "int64", 2607 "format": "int64",
1401 - "description": " 部门ID" 2608 + "description": " 用户ID"
1402 }, 2609 },
1403 - "roleId": {  
1404 - "type": "array",  
1405 - "items": { 2610 + "companyId": {
1406 "type": "integer", 2611 "type": "integer",
1407 - "format": "int64" 2612 + "format": "int64",
  2613 + "description": " 公司ID"
1408 }, 2614 },
1409 - "description": " 角色" 2615 + "companyName": {
  2616 + "type": "string",
  2617 + "description": " 公司名称"
1410 }, 2618 },
1411 "flag": { 2619 "flag": {
1412 "type": "integer", 2620 "type": "integer",
@@ -1435,8 +2643,7 @@ @@ -1435,8 +2643,7 @@
1435 "description": " 启用状态 1:启用 2:禁用" 2643 "description": " 启用状态 1:启用 2:禁用"
1436 }, 2644 },
1437 "auditStatus": { 2645 "auditStatus": {
1438 - "type": "integer",  
1439 - "format": "int32", 2646 + "$ref": "#/definitions/int",
1440 "description": " 审核状态 0:待审核 1:审核通过 2:拒绝" 2647 "description": " 审核状态 0:待审核 1:审核通过 2:拒绝"
1441 }, 2648 },
1442 "followers": { 2649 "followers": {
@@ -1454,14 +2661,25 @@ @@ -1454,14 +2661,25 @@
1454 "format": "int64" 2661 "format": "int64"
1455 }, 2662 },
1456 "description": " 我关注的人 (冗余)" 2663 "description": " 我关注的人 (冗余)"
  2664 + },
  2665 + "departments": {
  2666 + "type": "array",
  2667 + "items": {
  2668 + "type": "integer",
  2669 + "format": "int64"
  2670 + },
  2671 + "description": " 所属部门"
  2672 + },
  2673 + "accountFrom": {
  2674 + "type": "string",
  2675 + "description": " 账号来源 后台新增、扫码注册"
1457 } 2676 }
1458 }, 2677 },
1459 "title": "UserItem", 2678 "title": "UserItem",
1460 "required": [ 2679 "required": [
1461 "id", 2680 "id",
1462 "companyId", 2681 "companyId",
1463 - "departmentId",  
1464 - "roleId", 2682 + "companyName",
1465 "flag", 2683 "flag",
1466 "name", 2684 "name",
1467 "avatar", 2685 "avatar",
@@ -1470,7 +2688,9 @@ @@ -1470,7 +2688,9 @@
1470 "enable", 2688 "enable",
1471 "auditStatus", 2689 "auditStatus",
1472 "followers", 2690 "followers",
1473 - "following" 2691 + "following",
  2692 + "departments",
  2693 + "accountFrom"
1474 ] 2694 ]
1475 }, 2695 },
1476 "UserSearchRequest": { 2696 "UserSearchRequest": {
@@ -1510,6 +2730,42 @@ @@ -1510,6 +2730,42 @@
1510 "list", 2730 "list",
1511 "total" 2731 "total"
1512 ] 2732 ]
  2733 + },
  2734 + "WhichUserLikeArticle": {
  2735 + "type": "object",
  2736 + "properties": {
  2737 + "articleId": {
  2738 + "type": "integer",
  2739 + "format": "int64",
  2740 + "description": " 文章id"
  2741 + },
  2742 + "userId": {
  2743 + "type": "integer",
  2744 + "format": "int64",
  2745 + "description": " 人员id"
  2746 + },
  2747 + "name": {
  2748 + "type": "string",
  2749 + "description": " 人员名称"
  2750 + },
  2751 + "avatar": {
  2752 + "type": "string",
  2753 + "description": " 人员头像"
  2754 + },
  2755 + "createdAt": {
  2756 + "type": "integer",
  2757 + "format": "int64",
  2758 + "description": " 点赞记录的时间"
  2759 + }
  2760 + },
  2761 + "title": "WhichUserLikeArticle",
  2762 + "required": [
  2763 + "articleId",
  2764 + "userId",
  2765 + "name",
  2766 + "avatar",
  2767 + "createdAt"
  2768 + ]
1513 } 2769 }
1514 }, 2770 },
1515 "securityDefinitions": { 2771 "securityDefinitions": {
@@ -62,12 +62,12 @@ type ( @@ -62,12 +62,12 @@ type (
62 DiscussionOpinionId int64 `json:"discussionOpinionId"` // 观点ID 62 DiscussionOpinionId int64 `json:"discussionOpinionId"` // 观点ID
63 Content string `json:"content"` // 消息内容 63 Content string `json:"content"` // 消息内容
64 CreatedAt int64 `json:"createdAt"` // 创建时间 64 CreatedAt int64 `json:"createdAt"` // 创建时间
65 - User *User `json:"user"` // 操作人 65 + User *SimpleUser `json:"user"` // 操作人
66 Article *SimpleArticle `json:"article"` // 文章 66 Article *SimpleArticle `json:"article"` // 文章
67 - Comment *Comment `json:"comment"` // 评论(不一定是自己,可能是被人@到) 67 + Comment *SimpleComment `json:"comment"` // 评论(不一定是自己,可能是被人@到)
68 } 68 }
69 69
70 - User { 70 + SimpleUser {
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"` // 公司名称
@@ -82,6 +82,6 @@ type ( @@ -82,6 +82,6 @@ type (
82 Title string `json:"title"` // 文章标题 82 Title string `json:"title"` // 文章标题
83 CountLove int `json:"countLove"` // 点赞数量 83 CountLove int `json:"countLove"` // 点赞数量
84 CountComment int `json:"countComment"` // 评论数量 84 CountComment int `json:"countComment"` // 评论数量
  85 + Show int `json:"show"` // 文章的展示状态(0显示、1不显示)
85 } 86 }
86 ) 87 )
87 -  
  1 +syntax = "v1"
  2 +
  3 +info(
  4 + title: "天联鹰蜓"
  5 + desc: "天联鹰蜓"
  6 + author: "email"
  7 + email: "email"
  8 + version: "v1"
  9 +)
  10 +
  11 +@server(
  12 + prefix: v1
  13 + group: role
  14 + jwt: SystemAuth
  15 +)
  16 +service Core {
  17 + @handler systemGetRole
  18 + get /system/role/:id (RoleGetRequest) returns (RoleGetResponse)
  19 + @handler systemSaveRole
  20 + post /system/role (RoleSaveRequest) returns (RoleSaveResponse)
  21 + @handler systemDeleteRole
  22 + delete /system/role/:id (RoleDeleteRequest) returns (RoleDeleteResponse)
  23 + @handler systemUpdateRole
  24 + put /system/role/:id (RoleUpdateRequest) returns (RoleUpdateResponse)
  25 + @handler systemSearchRole
  26 + post /system/role/search (RoleSearchRequest) returns (RoleSearchResponse)
  27 +}
  28 +
  29 +type (
  30 + RoleGetRequest {
  31 + Id int64 `path:"id"`
  32 + }
  33 + RoleGetResponse struct{
  34 + Role RoleItem `json:"role"`
  35 + AuthList []Auth `json:"authList"`
  36 + }
  37 +
  38 + RoleSaveRequest struct{
  39 + Role RoleItem `json:"role"`
  40 + }
  41 + RoleSaveResponse struct{}
  42 +
  43 + RoleDeleteRequest struct{
  44 + Id int64 `path:"id"`
  45 + }
  46 + RoleDeleteResponse struct{}
  47 +
  48 + RoleUpdateRequest struct{
  49 + Id int64 `path:"id"`
  50 + Role RoleItem `json:"role"`
  51 + }
  52 + RoleUpdateResponse struct{}
  53 +
  54 + RoleSearchRequest struct{
  55 + Page int `json:"page,optional"`
  56 + Size int `json:"size,optional"`
  57 + Style string `json:"style,options=[simple,,full]"` // simple:只返回角色ID名称 full:所有字段都返回
  58 + }
  59 + RoleSearchResponse{
  60 + List []RoleItem `json:"list"`
  61 + Total int64 `json:"total"`
  62 + }
  63 + RoleItem struct{
  64 + Id int64 `json:"id,optional"` // 角色ID
  65 + CompanyId int64 `json:"companyId,optional,omitempty"` // 公司ID
  66 + Name string `json:"name"` // 角色名称
  67 + AuthIds []int64 `json:"authIds,optional,omitempty"` // 角色权限列表
  68 + AuthsDesc string `json:"authsDesc,optional,omitempty"` // 权限列表描述
  69 + UsersDesc string `json:"usersDesc,optional,omitempty"` // 用户列表描述
  70 + Remark string `json:"remark,optional,omitempty"` // 备注
  71 + Users []RoleUser `json:"users,optional,omitempty"` // 绑定的用户
  72 + UpdatedAt int64 `json:"updatedAt,optional,omitempty"` // 更新时间
  73 + }
  74 + RoleUser {
  75 + Id int64 `json:"id"`
  76 + Name string `json:"name"`
  77 + }
  78 + Auth {
  79 + Id int64 `json:"id"` // ID
  80 + Name string `json:"name"` // 名称
  81 + Code string `json:"code"` // 编码
  82 + }
  83 +)
@@ -27,6 +27,9 @@ service Core { @@ -27,6 +27,9 @@ service Core {
27 jwt: MiniAuth 27 jwt: MiniAuth
28 ) 28 )
29 service Core { 29 service Core {
  30 + @doc "切换账号"
  31 + @handler miniUserSwitchAccount
  32 + post /mini/user/switch-account (MiniUserSwitchAccountRequest) returns (MiniUserLoginResponse)
30 @doc "用户信息" 33 @doc "用户信息"
31 @handler miniUserInfo 34 @handler miniUserInfo
32 post /mini/user/info (MiniUserInfoRequest) returns (MiniUserInfoResponse) 35 post /mini/user/info (MiniUserInfoRequest) returns (MiniUserInfoResponse)
@@ -51,6 +54,9 @@ service Core { @@ -51,6 +54,9 @@ service Core {
51 @doc "取消关注" 54 @doc "取消关注"
52 @handler miniUserUnFollow 55 @handler miniUserUnFollow
53 post /mini/user/unfollow (FollowRequest) 56 post /mini/user/unfollow (FollowRequest)
  57 + @doc "我点赞的文章或评论"
  58 + @handler miniMyLike
  59 + post /user/mylike (MiniMyLikeRequest)returns (MiniMyLikeResponse)
54 } 60 }
55 61
56 type( 62 type(
@@ -69,6 +75,9 @@ type( @@ -69,6 +75,9 @@ type(
69 Message string `json:"message"` // 失败消息(审核中,注册成功等待审核) 75 Message string `json:"message"` // 失败消息(审核中,注册成功等待审核)
70 Success bool `json:"success"` // 成功标识 76 Success bool `json:"success"` // 成功标识
71 } 77 }
  78 + MiniUserSwitchAccountRequest{
  79 + CompanyId int64 `json:"companyId"`
  80 + }
72 81
73 MiniUserInfoRequest { 82 MiniUserInfoRequest {
74 //MyStatisticsFlag bool `json:"myStatisticsFlag"` // true:返回统计信息 false;统计信息不返回 83 //MyStatisticsFlag bool `json:"myStatisticsFlag"` // true:返回统计信息 false;统计信息不返回
@@ -78,6 +87,8 @@ type( @@ -78,6 +87,8 @@ type(
78 TotalArticle int64 `json:"totalArticle"` // 累计信息发布 87 TotalArticle int64 `json:"totalArticle"` // 累计信息发布
79 TotalLoved int64 `json:"totalLoved"` // 累计收到的赞 88 TotalLoved int64 `json:"totalLoved"` // 累计收到的赞
80 TotalAccepted int64 `json:"totalAccepted"` // 累计被采纳 89 TotalAccepted int64 `json:"totalAccepted"` // 累计被采纳
  90 + Accounts []Account `json:"accounts"` // 公司账号
  91 + Auths []Auth `json:"auths"` // 权限列表
81 } 92 }
82 MiniUserApplyJoinCompanyRequest{ 93 MiniUserApplyJoinCompanyRequest{
83 Phone string `json:"phone"` 94 Phone string `json:"phone"`
@@ -123,6 +134,14 @@ type( @@ -123,6 +134,14 @@ type(
123 Departments []int64 `json:"departments,omitempty"` // 所属部门 134 Departments []int64 `json:"departments,omitempty"` // 所属部门
124 AccountFrom string `json:"accountFrom,omitempty"` // 账号来源 后台新增、扫码注册 135 AccountFrom string `json:"accountFrom,omitempty"` // 账号来源 后台新增、扫码注册
125 } 136 }
  137 + Account {
  138 + CompanyId int64 `json:"companyId"` // 公司ID
  139 + CompanyName string `json:"companyName"` // 公司名称
  140 + Logo string `json:"logo"` // 公司图标
  141 + UserId int64 `json:"userId"` // 用户ID
  142 + Name string `json:"name"` // 名称
  143 + Position string `json:"position"`// 职位
  144 + }
126 Department struct { 145 Department struct {
127 Id int64 `json:"id,omitempty"` // 部门ID 146 Id int64 `json:"id,omitempty"` // 部门ID
128 CompanyId int64 `json:"companyId,omitempty"` // 公司ID 147 CompanyId int64 `json:"companyId,omitempty"` // 公司ID
@@ -153,6 +172,39 @@ type( @@ -153,6 +172,39 @@ type(
153 ) 172 )
154 173
155 174
  175 +
  176 +// 我点赞的文章或评论
  177 +type (
  178 + MiniMyLikeRequest{
  179 + Page int `json:"page"`
  180 + Size int `json:"size"`
  181 + }
  182 +
  183 + MiniMyLikeResponse {
  184 + List []MyLikeItem `json:"list"`
  185 + Total int64 `json:"total"`
  186 + }
  187 +
  188 + MyLikeItem {
  189 + UserId int64 `json:"userId"` // 发布人id
  190 + ArticleId int64 `json:"articleId"` // 文章id
  191 + CommentId int64 `json:"commentId"` // 评论id
  192 + CreatedAt int64 `json:"createdAt"` // 创建时间
  193 + User *SimpleUser `json:"user"` // 发布人
  194 + Article *SimpleArticle `json:"article"` // 文章
  195 + Comment *SimpleComment `json:"comment"` // 评论
  196 + }
  197 +
  198 + SimpleComment {
  199 + Id int64 `json:"id"`
  200 + Content string `json:"content"` // 评论内容
  201 + CountLove int `json:"countLove"` // 点赞数量
  202 + CountComment int `json:"countComment"` // 评论数量
  203 + Show int `json:"show"` // 评论的展示状态(0显示、1不显示)
  204 + }
  205 +)
  206 +
  207 +
156 // 后台接口 208 // 后台接口
157 //@server( 209 //@server(
158 // prefix: v1 210 // prefix: v1
  1 +package role
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  5 + "net/http"
  6 +
  7 + "github.com/zeromicro/go-zero/rest/httpx"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/role"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  11 +)
  12 +
  13 +func SystemDeleteRoleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  14 + return func(w http.ResponseWriter, r *http.Request) {
  15 + var req types.RoleDeleteRequest
  16 + if err := httpx.Parse(r, &req); err != nil {
  17 + httpx.ErrorCtx(r.Context(), w, err)
  18 + return
  19 + }
  20 +
  21 + l := role.NewSystemDeleteRoleLogic(r.Context(), svcCtx)
  22 + resp, err := l.SystemDeleteRole(&req)
  23 + result.HttpResult(r, w, resp, err)
  24 + }
  25 +}
  1 +package role
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  5 + "net/http"
  6 +
  7 + "github.com/zeromicro/go-zero/rest/httpx"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/role"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  11 +)
  12 +
  13 +func SystemGetRoleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  14 + return func(w http.ResponseWriter, r *http.Request) {
  15 + var req types.RoleGetRequest
  16 + if err := httpx.Parse(r, &req); err != nil {
  17 + httpx.ErrorCtx(r.Context(), w, err)
  18 + return
  19 + }
  20 +
  21 + l := role.NewSystemGetRoleLogic(r.Context(), svcCtx)
  22 + resp, err := l.SystemGetRole(&req)
  23 + result.HttpResult(r, w, resp, err)
  24 + }
  25 +}
  1 +package role
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  5 + "net/http"
  6 +
  7 + "github.com/zeromicro/go-zero/rest/httpx"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/role"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  11 +)
  12 +
  13 +func SystemSaveRoleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  14 + return func(w http.ResponseWriter, r *http.Request) {
  15 + var req types.RoleSaveRequest
  16 + if err := httpx.Parse(r, &req); err != nil {
  17 + httpx.ErrorCtx(r.Context(), w, err)
  18 + return
  19 + }
  20 +
  21 + l := role.NewSystemSaveRoleLogic(r.Context(), svcCtx)
  22 + resp, err := l.SystemSaveRole(&req)
  23 + result.HttpResult(r, w, resp, err)
  24 + }
  25 +}
  1 +package role
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  5 + "net/http"
  6 +
  7 + "github.com/zeromicro/go-zero/rest/httpx"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/role"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  11 +)
  12 +
  13 +func SystemSearchRoleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  14 + return func(w http.ResponseWriter, r *http.Request) {
  15 + var req types.RoleSearchRequest
  16 + if err := httpx.Parse(r, &req); err != nil {
  17 + httpx.ErrorCtx(r.Context(), w, err)
  18 + return
  19 + }
  20 +
  21 + l := role.NewSystemSearchRoleLogic(r.Context(), svcCtx)
  22 + resp, err := l.SystemSearchRole(&req)
  23 + result.HttpResult(r, w, resp, err)
  24 + }
  25 +}
  1 +package role
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  5 + "net/http"
  6 +
  7 + "github.com/zeromicro/go-zero/rest/httpx"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/role"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  11 +)
  12 +
  13 +func SystemUpdateRoleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  14 + return func(w http.ResponseWriter, r *http.Request) {
  15 + var req types.RoleUpdateRequest
  16 + if err := httpx.Parse(r, &req); err != nil {
  17 + httpx.ErrorCtx(r.Context(), w, err)
  18 + return
  19 + }
  20 +
  21 + l := role.NewSystemUpdateRoleLogic(r.Context(), svcCtx)
  22 + resp, err := l.SystemUpdateRole(&req)
  23 + result.HttpResult(r, w, resp, err)
  24 + }
  25 +}
@@ -8,6 +8,7 @@ import ( @@ -8,6 +8,7 @@ import (
8 comment "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/comment" 8 comment "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/comment"
9 company "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/company" 9 company "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/company"
10 message "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/message" 10 message "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/message"
  11 + role "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/role"
11 tags "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/tags" 12 tags "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/tags"
12 user "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/user" 13 user "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/user"
13 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" 14 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
@@ -109,6 +110,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { @@ -109,6 +110,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
109 []rest.Route{ 110 []rest.Route{
110 { 111 {
111 Method: http.MethodPost, 112 Method: http.MethodPost,
  113 + Path: "/mini/user/switch-account",
  114 + Handler: user.MiniUserSwitchAccountHandler(serverCtx),
  115 + },
  116 + {
  117 + Method: http.MethodPost,
112 Path: "/mini/user/info", 118 Path: "/mini/user/info",
113 Handler: user.MiniUserInfoHandler(serverCtx), 119 Handler: user.MiniUserInfoHandler(serverCtx),
114 }, 120 },
@@ -147,6 +153,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { @@ -147,6 +153,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
147 Path: "/mini/user/unfollow", 153 Path: "/mini/user/unfollow",
148 Handler: user.MiniUserUnFollowHandler(serverCtx), 154 Handler: user.MiniUserUnFollowHandler(serverCtx),
149 }, 155 },
  156 + {
  157 + Method: http.MethodPost,
  158 + Path: "/user/mylike",
  159 + Handler: user.MiniMyLikeHandler(serverCtx),
  160 + },
150 }, 161 },
151 rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret), 162 rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
152 rest.WithPrefix("/v1"), 163 rest.WithPrefix("/v1"),
@@ -228,4 +239,36 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { @@ -228,4 +239,36 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
228 rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret), 239 rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
229 rest.WithPrefix("/v1/system"), 240 rest.WithPrefix("/v1/system"),
230 ) 241 )
  242 +
  243 + server.AddRoutes(
  244 + []rest.Route{
  245 + {
  246 + Method: http.MethodGet,
  247 + Path: "/system/role/:id",
  248 + Handler: role.SystemGetRoleHandler(serverCtx),
  249 + },
  250 + {
  251 + Method: http.MethodPost,
  252 + Path: "/system/role",
  253 + Handler: role.SystemSaveRoleHandler(serverCtx),
  254 + },
  255 + {
  256 + Method: http.MethodDelete,
  257 + Path: "/system/role/:id",
  258 + Handler: role.SystemDeleteRoleHandler(serverCtx),
  259 + },
  260 + {
  261 + Method: http.MethodPut,
  262 + Path: "/system/role/:id",
  263 + Handler: role.SystemUpdateRoleHandler(serverCtx),
  264 + },
  265 + {
  266 + Method: http.MethodPost,
  267 + Path: "/system/role/search",
  268 + Handler: role.SystemSearchRoleHandler(serverCtx),
  269 + },
  270 + },
  271 + rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret),
  272 + rest.WithPrefix("/v1"),
  273 + )
231 } 274 }
  1 +package user
  2 +
  3 +import (
  4 + "github.com/zeromicro/go-zero/rest/httpx"
  5 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  6 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  7 + "net/http"
  8 +
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/user"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  11 +)
  12 +
  13 +func MiniMyLikeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  14 + return func(w http.ResponseWriter, r *http.Request) {
  15 + var req types.MiniMyLikeRequest
  16 + if err := httpx.Parse(r, &req); err != nil {
  17 + httpx.ErrorCtx(r.Context(), w, err)
  18 + return
  19 + }
  20 +
  21 + l := user.NewMiniMyLikeLogic(r.Context(), svcCtx)
  22 + resp, err := l.MiniMyLike(&req)
  23 + result.HttpResult(r, w, resp, err)
  24 + }
  25 +}
  1 +package user
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  5 + "net/http"
  6 +
  7 + "github.com/zeromicro/go-zero/rest/httpx"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/user"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  11 +)
  12 +
  13 +func MiniUserSwitchAccountHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  14 + return func(w http.ResponseWriter, r *http.Request) {
  15 + var req types.MiniUserSwitchAccountRequest
  16 + if err := httpx.Parse(r, &req); err != nil {
  17 + httpx.ErrorCtx(r.Context(), w, err)
  18 + return
  19 + }
  20 +
  21 + l := user.NewMiniUserSwitchAccountLogic(r.Context(), svcCtx)
  22 + resp, err := l.MiniUserSwitchAccount(&req)
  23 + result.HttpResult(r, w, resp, err)
  24 + }
  25 +}
@@ -169,7 +169,7 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageBusinessRequest) (res @@ -169,7 +169,7 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageBusinessRequest) (res
169 } 169 }
170 170
171 if v, ok := userIdMap[item.UserId]; ok { 171 if v, ok := userIdMap[item.UserId]; ok {
172 - to.User = &types.User{ 172 + to.User = &types.SimpleUser{
173 Id: v.Id, 173 Id: v.Id,
174 CompanyId: v.CompanyId, 174 CompanyId: v.CompanyId,
175 Position: v.Position, 175 Position: v.Position,
@@ -188,11 +188,12 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageBusinessRequest) (res @@ -188,11 +188,12 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageBusinessRequest) (res
188 Title: v.Title, 188 Title: v.Title,
189 CountLove: v.CountLove, 189 CountLove: v.CountLove,
190 CountComment: v.CountComment, 190 CountComment: v.CountComment,
  191 + Show: int(v.Show),
191 } 192 }
192 } 193 }
193 194
194 if _, ok := commentIdMap[item.CommentId]; ok { 195 if _, ok := commentIdMap[item.CommentId]; ok {
195 - to.Comment = &types.Comment{ 196 + to.Comment = &types.SimpleComment{
196 //Id: v.Id, 197 //Id: v.Id,
197 //Title: v.Title, 198 //Title: v.Title,
198 //CountLove: v.CountLove, 199 //CountLove: v.CountLove,
  1 +package role
  2 +
  3 +import (
  4 + "context"
  5 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction"
  6 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
  8 +
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  11 +
  12 + "github.com/zeromicro/go-zero/core/logx"
  13 +)
  14 +
  15 +type SystemDeleteRoleLogic struct {
  16 + logx.Logger
  17 + ctx context.Context
  18 + svcCtx *svc.ServiceContext
  19 +}
  20 +
  21 +func NewSystemDeleteRoleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemDeleteRoleLogic {
  22 + return &SystemDeleteRoleLogic{
  23 + Logger: logx.WithContext(ctx),
  24 + ctx: ctx,
  25 + svcCtx: svcCtx,
  26 + }
  27 +}
  28 +
  29 +func (l *SystemDeleteRoleLogic) SystemDeleteRole(req *types.RoleDeleteRequest) (resp *types.RoleDeleteResponse, err error) {
  30 + var (
  31 + conn = l.svcCtx.DefaultDBConn()
  32 + role *domain.Role
  33 + userRemoveRoleList []*domain.User
  34 + )
  35 + if role, err = l.svcCtx.RoleRepository.FindOne(l.ctx, conn, req.Id); err != nil {
  36 + return nil, xerr.NewErrMsgErr("角色不存在", err)
  37 + }
  38 + for _, item := range role.Users {
  39 + var user *domain.User
  40 + if user, err = l.svcCtx.UserRepository.FindOne(l.ctx, conn, item.Id); err != nil {
  41 + return nil, xerr.NewErrMsgErr("用户存在", err)
  42 + }
  43 + userRemoveRoleList = append(userRemoveRoleList, user)
  44 + }
  45 + if err = transaction.UseTrans(l.ctx, l.svcCtx.DB, func(ctx context.Context, conn transaction.Conn) error {
  46 + if role, err = l.svcCtx.RoleRepository.Delete(l.ctx, conn, role); err != nil {
  47 + return err
  48 + }
  49 + for _, user := range userRemoveRoleList {
  50 + user.RemoveRole(role.Id)
  51 + if user, err = l.svcCtx.UserRepository.UpdateWithVersion(ctx, conn, user); err != nil {
  52 + return err
  53 + }
  54 + }
  55 + return nil
  56 + }, true); err != nil {
  57 + return nil, xerr.NewErrMsgErr("删除角色失败", err)
  58 + }
  59 +
  60 + resp = &types.RoleDeleteResponse{}
  61 + return
  62 +}
  1 +package role
  2 +
  3 +import (
  4 + "context"
  5 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
  6 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
  7 +
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 +
  11 + "github.com/zeromicro/go-zero/core/logx"
  12 +)
  13 +
  14 +type SystemGetRoleLogic struct {
  15 + logx.Logger
  16 + ctx context.Context
  17 + svcCtx *svc.ServiceContext
  18 +}
  19 +
  20 +func NewSystemGetRoleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemGetRoleLogic {
  21 + return &SystemGetRoleLogic{
  22 + Logger: logx.WithContext(ctx),
  23 + ctx: ctx,
  24 + svcCtx: svcCtx,
  25 + }
  26 +}
  27 +
  28 +func (l *SystemGetRoleLogic) SystemGetRole(req *types.RoleGetRequest) (resp *types.RoleGetResponse, err error) {
  29 + var (
  30 + conn = l.svcCtx.DefaultDBConn()
  31 + role *domain.Role
  32 + )
  33 + if role, err = l.svcCtx.RoleRepository.FindOne(l.ctx, conn, req.Id); err != nil {
  34 + return nil, xerr.NewErrMsgErr("角色不存在", err)
  35 + }
  36 + resp = &types.RoleGetResponse{
  37 + Role: NewTypesRole(role),
  38 + }
  39 + for _, auth := range domain.Auths {
  40 + resp.AuthList = append(resp.AuthList, types.Auth{
  41 + Id: auth.Id,
  42 + Name: auth.Name,
  43 + Code: auth.Code,
  44 + })
  45 + }
  46 + return
  47 +}
  1 +package role
  2 +
  3 +import (
  4 + "context"
  5 + "fmt"
  6 + "github.com/samber/lo"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
  11 +
  12 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  13 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  14 +
  15 + "github.com/zeromicro/go-zero/core/logx"
  16 +)
  17 +
  18 +type SystemSaveRoleLogic struct {
  19 + logx.Logger
  20 + ctx context.Context
  21 + svcCtx *svc.ServiceContext
  22 +}
  23 +
  24 +func NewSystemSaveRoleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemSaveRoleLogic {
  25 + return &SystemSaveRoleLogic{
  26 + Logger: logx.WithContext(ctx),
  27 + ctx: ctx,
  28 + svcCtx: svcCtx,
  29 + }
  30 +}
  31 +
  32 +func (l *SystemSaveRoleLogic) SystemSaveRole(req *types.RoleSaveRequest) (resp *types.RoleSaveResponse, err error) {
  33 + var (
  34 + conn = l.svcCtx.DefaultDBConn()
  35 + userAddRoleList []*domain.User
  36 + )
  37 + role := NewDomainRole(l.ctx, req.Role)
  38 + for _, authId := range req.Role.AuthIds {
  39 + if auth := role.GetAuth(authId); auth == nil {
  40 + return nil, xerr.NewErrMsg(fmt.Sprintf("unknown auth %d ", authId))
  41 + }
  42 + }
  43 + for _, item := range req.Role.Users {
  44 + var user *domain.User
  45 + if user, err = l.svcCtx.UserRepository.FindOne(l.ctx, conn, item.Id); err != nil {
  46 + return nil, xerr.NewErrMsgErr("用户存在", err)
  47 + }
  48 + userAddRoleList = append(userAddRoleList, user)
  49 + }
  50 + if err = transaction.UseTrans(l.ctx, l.svcCtx.DB, func(ctx context.Context, conn transaction.Conn) error {
  51 + if role, err = l.svcCtx.RoleRepository.Insert(ctx, conn, role); err != nil {
  52 + return err
  53 + }
  54 + for _, user := range userAddRoleList {
  55 + user.AddRole(role.Id)
  56 + if user, err = l.svcCtx.UserRepository.UpdateWithVersion(ctx, conn, user); err != nil {
  57 + return err
  58 + }
  59 + }
  60 + return nil
  61 + }, true); err != nil {
  62 + return nil, xerr.NewErrMsgErr("添加角色失败", err)
  63 + }
  64 + resp = &types.RoleSaveResponse{}
  65 + return
  66 +}
  67 +
  68 +func NewDomainRole(ctx context.Context, item types.RoleItem) *domain.Role {
  69 + var (
  70 + role *domain.Role
  71 + users []domain.User = make([]domain.User, 0)
  72 + userToken = contextdata.GetUserTokenFromCtx(ctx)
  73 + )
  74 + lo.ForEach(item.Users, func(item types.RoleUser, index int) {
  75 + users = append(users, domain.User{
  76 + Id: item.Id,
  77 + Name: item.Name,
  78 + })
  79 + })
  80 + role = &domain.Role{
  81 + CompanyId: userToken.CompanyId,
  82 + Name: item.Name,
  83 + Auths: item.AuthIds,
  84 + Remark: item.Remark,
  85 + Users: users,
  86 + }
  87 + return role
  88 +}
  89 +
  90 +func NewTypesRole(item *domain.Role) types.RoleItem {
  91 + var (
  92 + role types.RoleItem
  93 + users []types.RoleUser = make([]types.RoleUser, 0)
  94 + )
  95 + lo.ForEach(item.Users, func(item domain.User, index int) {
  96 + users = append(users, types.RoleUser{
  97 + Id: item.Id,
  98 + Name: item.Name,
  99 + })
  100 + })
  101 + role = types.RoleItem{
  102 + Id: item.Id,
  103 + CompanyId: item.CompanyId,
  104 + Name: item.Name,
  105 + AuthIds: item.Auths,
  106 + Remark: item.Remark,
  107 + Users: users,
  108 + UpdatedAt: item.UpdatedAt,
  109 + }
  110 + return role
  111 +}
  1 +package role
  2 +
  3 +import (
  4 + "context"
  5 + "fmt"
  6 + "github.com/samber/lo"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
  10 + "strings"
  11 +
  12 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  13 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  14 +
  15 + "github.com/zeromicro/go-zero/core/logx"
  16 +)
  17 +
  18 +type SystemSearchRoleLogic struct {
  19 + logx.Logger
  20 + ctx context.Context
  21 + svcCtx *svc.ServiceContext
  22 +}
  23 +
  24 +func NewSystemSearchRoleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemSearchRoleLogic {
  25 + return &SystemSearchRoleLogic{
  26 + Logger: logx.WithContext(ctx),
  27 + ctx: ctx,
  28 + svcCtx: svcCtx,
  29 + }
  30 +}
  31 +
  32 +func (l *SystemSearchRoleLogic) SystemSearchRole(req *types.RoleSearchRequest) (resp *types.RoleSearchResponse, err error) {
  33 + var (
  34 + conn = l.svcCtx.DefaultDBConn()
  35 + userToken = contextdata.GetUserTokenFromCtx(l.ctx)
  36 + roles []*domain.Role
  37 + total int64
  38 + )
  39 + queryOptions := domain.IndexCompanyId(userToken.CompanyId)()
  40 + if req.Page != 0 && req.Size != 0 {
  41 + queryOptions.WithOffsetLimit(req.Page, req.Size)
  42 + }
  43 + total, roles, err = l.svcCtx.RoleRepository.Find(l.ctx, conn, queryOptions)
  44 + if err != nil {
  45 + return nil, xerr.NewErrMsgErr("搜索角色异常", err)
  46 + }
  47 + resp = &types.RoleSearchResponse{
  48 + Total: total,
  49 + List: make([]types.RoleItem, 0),
  50 + }
  51 + if req.Style == "simple" {
  52 + lo.ForEach(roles, func(item *domain.Role, index int) {
  53 + resp.List = append(resp.List, types.RoleItem{
  54 + Id: item.Id,
  55 + Name: item.Name,
  56 + })
  57 + })
  58 + return
  59 + }
  60 + lo.ForEach(roles, func(item *domain.Role, index int) {
  61 + role := NewTypesRole(item)
  62 + role.UsersDesc = usersDesc(item)
  63 + role.AuthsDesc = authsDesc(item)
  64 + resp.List = append(resp.List, role)
  65 + })
  66 + return
  67 +}
  68 +
  69 +func usersDesc(item *domain.Role) string {
  70 + users := lo.Slice(item.Users, 0, 3)
  71 + var (
  72 + nameList = make([]string, 0)
  73 + desc string = " "
  74 + )
  75 + lo.ForEach(users, func(item domain.User, index int) {
  76 + nameList = append(nameList, item.Name)
  77 + })
  78 + if len(users) == 0 {
  79 + return desc
  80 + }
  81 + desc = fmt.Sprintf("%s%s", strings.Join(nameList, "、"),
  82 + lo.Ternary(len(item.Users) > 3, fmt.Sprintf("...共%d人", len(item.Users)), ""),
  83 + )
  84 + return desc
  85 +}
  86 +
  87 +func authsDesc(role *domain.Role) string {
  88 + var (
  89 + nameList = make([]string, 0)
  90 + desc string = " "
  91 + )
  92 + lo.ForEach(role.Auths, func(item int64, index int) {
  93 + if auth := role.GetAuth(item); auth != nil {
  94 + nameList = append(nameList, auth.Name)
  95 + }
  96 + })
  97 + if len(nameList) == 0 {
  98 + return desc
  99 + }
  100 + desc = strings.Join(nameList, "、")
  101 + return desc
  102 +}
  1 +package role
  2 +
  3 +import (
  4 + "context"
  5 + "fmt"
  6 + "github.com/samber/lo"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
  10 +
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  12 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  13 +
  14 + "github.com/zeromicro/go-zero/core/logx"
  15 +)
  16 +
  17 +type SystemUpdateRoleLogic struct {
  18 + logx.Logger
  19 + ctx context.Context
  20 + svcCtx *svc.ServiceContext
  21 +}
  22 +
  23 +func NewSystemUpdateRoleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemUpdateRoleLogic {
  24 + return &SystemUpdateRoleLogic{
  25 + Logger: logx.WithContext(ctx),
  26 + ctx: ctx,
  27 + svcCtx: svcCtx,
  28 + }
  29 +}
  30 +
  31 +func (l *SystemUpdateRoleLogic) SystemUpdateRole(req *types.RoleUpdateRequest) (resp *types.RoleUpdateResponse, err error) {
  32 + var (
  33 + conn = l.svcCtx.DefaultDBConn()
  34 + role *domain.Role
  35 + beforeUserIds []int64
  36 + afterUserIds []int64
  37 +
  38 + userRemoveRoleList []*domain.User
  39 + userAddRoleList []*domain.User
  40 + )
  41 + if role, err = l.svcCtx.RoleRepository.FindOne(l.ctx, conn, req.Id); err != nil {
  42 + return nil, xerr.NewErrMsgErr("角色不存在", err)
  43 + }
  44 + for _, authId := range req.Role.AuthIds {
  45 + if auth := role.GetAuth(authId); auth == nil {
  46 + return nil, xerr.NewErrMsg(fmt.Sprintf("unknown auth %d ", authId))
  47 + }
  48 + }
  49 + lo.ForEach(role.Users, func(item domain.User, index int) {
  50 + beforeUserIds = append(beforeUserIds, item.Id)
  51 + })
  52 + tempRole := NewDomainRole(l.ctx, req.Role)
  53 + lo.ForEach(tempRole.Users, func(item domain.User, index int) {
  54 + afterUserIds = append(afterUserIds, item.Id)
  55 + })
  56 + removeList, addList := lo.Difference(beforeUserIds, afterUserIds)
  57 + for _, id := range removeList {
  58 + var user *domain.User
  59 + if user, err = l.svcCtx.UserRepository.FindOne(l.ctx, conn, id); err != nil {
  60 + return nil, xerr.NewErrMsgErr("更新角色失败", err)
  61 + }
  62 + userRemoveRoleList = append(userRemoveRoleList, user)
  63 + }
  64 + for _, id := range addList {
  65 + var user *domain.User
  66 + if user, err = l.svcCtx.UserRepository.FindOne(l.ctx, conn, id); err != nil {
  67 + return nil, xerr.NewErrMsgErr("更新角色失败", err)
  68 + }
  69 + userAddRoleList = append(userAddRoleList, user)
  70 + }
  71 + if err = transaction.UseTrans(l.ctx, l.svcCtx.DB, func(ctx context.Context, conn transaction.Conn) error {
  72 + role.Name = tempRole.Name
  73 + role.Auths = tempRole.Auths
  74 + role.Remark = tempRole.Remark
  75 + role.Users = tempRole.Users
  76 + if role, err = l.svcCtx.RoleRepository.UpdateWithVersion(ctx, conn, role); err != nil {
  77 + return err
  78 + }
  79 +
  80 + for _, user := range userRemoveRoleList {
  81 + user.RemoveRole(role.Id)
  82 + if user, err = l.svcCtx.UserRepository.UpdateWithVersion(ctx, conn, user); err != nil {
  83 + return err
  84 + }
  85 + }
  86 +
  87 + for _, user := range userAddRoleList {
  88 + user.AddRole(role.Id)
  89 + if user, err = l.svcCtx.UserRepository.UpdateWithVersion(ctx, conn, user); err != nil {
  90 + return err
  91 + }
  92 + }
  93 + return nil
  94 + }, true); err != nil {
  95 + return nil, xerr.NewErrMsgErr("更新角色失败", err)
  96 + }
  97 + resp = &types.RoleUpdateResponse{}
  98 + return
  99 +}
  1 +package user
  2 +
  3 +import (
  4 + "context"
  5 + "github.com/samber/lo"
  6 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  8 +
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  11 +
  12 + "github.com/zeromicro/go-zero/core/logx"
  13 +)
  14 +
  15 +type MiniMyLikeLogic struct {
  16 + logx.Logger
  17 + ctx context.Context
  18 + svcCtx *svc.ServiceContext
  19 +}
  20 +
  21 +func NewMiniMyLikeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniMyLikeLogic {
  22 + return &MiniMyLikeLogic{
  23 + Logger: logx.WithContext(ctx),
  24 + ctx: ctx,
  25 + svcCtx: svcCtx,
  26 + }
  27 +}
  28 +
  29 +func (l *MiniMyLikeLogic) MiniMyLike(req *types.MiniMyLikeRequest) (resp *types.MiniMyLikeResponse, err error) {
  30 + var userToken = contextdata.GetUserTokenFromCtx(l.ctx)
  31 + var conn = l.svcCtx.DefaultDBConn()
  32 +
  33 + total, list, err := l.svcCtx.UserLoveFlagRepository.Find(l.ctx, conn, domain.NewQueryOptions().
  34 + WithOffsetLimit(req.Page, req.Size).
  35 + WithKV("userId", userToken.UserId))
  36 + if err != nil {
  37 + return nil, err
  38 + }
  39 +
  40 + resp = &types.MiniMyLikeResponse{}
  41 + resp.Total = total
  42 + resp.List = make([]types.MyLikeItem, 0)
  43 + if total == 0 || len(list) == 0 {
  44 + return resp, nil
  45 + }
  46 +
  47 + var userMap = make(map[int64]*domain.User)
  48 + var articleMap = make(map[int64]*domain.Article)
  49 + var commentMap = make(map[int64]*domain.Comment)
  50 +
  51 + lo.ForEach(list, func(item *domain.UserLoveFlag, index int) {
  52 + var (
  53 + user *domain.User
  54 + article *domain.Article
  55 + comment *domain.Comment
  56 + )
  57 +
  58 + if item.CommentId != 0 { // 点赞评论
  59 + user, _ = domain.LazyLoad(userMap, l.ctx, conn, item.CommentAuthor, l.svcCtx.UserRepository.FindOne)
  60 + article, _ = domain.LazyLoad(articleMap, l.ctx, conn, item.ArticleId, l.svcCtx.ArticleRepository.FindOne)
  61 + comment, _ = domain.LazyLoad(commentMap, l.ctx, conn, item.CommentId, l.svcCtx.CommentRepository.FindOne)
  62 + } else {
  63 + user, _ = domain.LazyLoad(userMap, l.ctx, conn, item.ArticleAuthor, l.svcCtx.UserRepository.FindOne)
  64 + article, _ = domain.LazyLoad(articleMap, l.ctx, conn, item.ArticleId, l.svcCtx.ArticleRepository.FindOne)
  65 + }
  66 +
  67 + resp.List = append(resp.List, NewItemSimple(item, user, article, comment))
  68 + })
  69 +
  70 + return
  71 +}
  72 +
  73 +func NewItemSimple(love *domain.UserLoveFlag, user *domain.User, article *domain.Article, comment *domain.Comment) types.MyLikeItem {
  74 + item := types.MyLikeItem{
  75 + UserId: love.UserId,
  76 + ArticleId: love.ArticleId,
  77 + CommentId: love.CommentId,
  78 + CreatedAt: love.CreatedAt,
  79 + }
  80 +
  81 + if user != nil {
  82 + item.User = &types.SimpleUser{
  83 + Id: user.Id,
  84 + CompanyId: user.CompanyId,
  85 + Name: user.Name,
  86 + Avatar: user.Avatar,
  87 + Position: user.Position,
  88 + }
  89 + }
  90 +
  91 + if article != nil {
  92 + item.Article = &types.SimpleArticle{
  93 + Id: article.Id,
  94 + Title: article.Title,
  95 + CountLove: article.CountLove,
  96 + CountComment: article.CountComment,
  97 + Show: int(article.Show),
  98 + }
  99 + }
  100 +
  101 + if comment != nil {
  102 + item.Comment = &types.SimpleComment{
  103 + Id: comment.Id,
  104 + //Content: comment.Content,
  105 + //CountLove: comment.CountLove,
  106 + //CountComment: comment.CountComment,
  107 + }
  108 + }
  109 +
  110 + return item
  111 +}
@@ -2,9 +2,13 @@ package user @@ -2,9 +2,13 @@ package user
2 2
3 import ( 3 import (
4 "context" 4 "context"
5 - 5 + "github.com/samber/lo"
  6 + "github.com/zeromicro/go-zero/core/collection"
6 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" 7 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
7 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" 8 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
8 12
9 "github.com/zeromicro/go-zero/core/logx" 13 "github.com/zeromicro/go-zero/core/logx"
10 ) 14 )
@@ -23,8 +27,49 @@ func NewMiniUserDepartmentUsersLogic(ctx context.Context, svcCtx *svc.ServiceCon @@ -23,8 +27,49 @@ func NewMiniUserDepartmentUsersLogic(ctx context.Context, svcCtx *svc.ServiceCon
23 } 27 }
24 } 28 }
25 29
26 -func (l *MiniUserDepartmentUsersLogic) MiniUserDepartmentUsers(req *types.MiniUserDepartmentUsersRequest) (resp *types.MiniUserInfoResponse, err error) {  
27 - // todo: add your logic here and delete this line 30 +func (l *MiniUserDepartmentUsersLogic) MiniUserDepartmentUsers(req *types.MiniUserDepartmentUsersRequest) (resp interface{}, err error) {
  31 + var (
  32 + conn = l.svcCtx.DefaultDBConn()
  33 + userToken = contextdata.GetUserTokenFromCtx(l.ctx)
  34 + users []*domain.User
  35 + departments []*domain.Department
  36 + )
  37 + resp = map[string]interface{}{
  38 + "list": make([]DepartmentUser, 0),
  39 + }
  40 + _, departments, err = l.svcCtx.DepartmentRepository.Find(l.ctx, conn, domain.IndexCompanyId(userToken.CompanyId)().WithFindOnly())
  41 + if err != nil {
  42 + return nil, xerr.NewErrMsgErr("查找部门用户失败", err)
  43 + }
  44 + _, users, err = l.svcCtx.UserRepository.FindDepartmentUsers(l.ctx, conn, userToken.CompanyId, domain.NewQueryOptions().WithFindOnly())
  45 + if err != nil {
  46 + return nil, xerr.NewErrMsgErr("查找部门用户失败", err)
  47 + }
  48 + lo.ForEach(departments, func(item *domain.Department, index int) {
  49 + group := DepartmentUser{
  50 + Id: item.Id,
  51 + Name: item.Name,
  52 + Users: make([]*domain.User, 0),
  53 + }
  54 + groupUserSet := collection.NewSet()
  55 + for _, user := range users {
  56 + if len(user.Departments) == 0 {
  57 + continue
  58 + }
  59 + if lo.Contains(user.Departments, item.Id) && !groupUserSet.Contains(user.Id) {
  60 + group.Users = append(group.Users, &domain.User{
  61 + Id: user.Id,
  62 + Name: user.Name,
  63 + })
  64 + }
  65 + }
  66 + })
28 67
29 return 68 return
30 } 69 }
  70 +
  71 +type DepartmentUser struct {
  72 + Id int64 `json:"id"` // 分组ID
  73 + Name string `json:"name"` // 分组名称
  74 + Users []*domain.User `json:"users"` // 用户
  75 +}
@@ -2,6 +2,7 @@ package user @@ -2,6 +2,7 @@ package user
2 2
3 import ( 3 import (
4 "context" 4 "context"
  5 + "github.com/zeromicro/go-zero/core/collection"
5 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" 6 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
6 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" 7 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
7 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" 8 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
@@ -31,15 +32,65 @@ func (l *MiniUserInfoLogic) MiniUserInfo(req *types.MiniUserInfoRequest) (resp * @@ -31,15 +32,65 @@ func (l *MiniUserInfoLogic) MiniUserInfo(req *types.MiniUserInfoRequest) (resp *
31 userToken = contextdata.GetUserTokenFromCtx(l.ctx) 32 userToken = contextdata.GetUserTokenFromCtx(l.ctx)
32 user *domain.User 33 user *domain.User
33 conn = l.svcCtx.DefaultDBConn() 34 conn = l.svcCtx.DefaultDBConn()
  35 + accounts []*domain.User
  36 + companyMap = make(map[int64]*domain.Company)
  37 + roles []*domain.Role
34 ) 38 )
35 if user, err = l.svcCtx.UserRepository.FindOne(l.ctx, conn, userToken.UserId); err != nil { 39 if user, err = l.svcCtx.UserRepository.FindOne(l.ctx, conn, userToken.UserId); err != nil {
36 return nil, xerr.NewErrMsgErr("用户不存在", err) 40 return nil, xerr.NewErrMsgErr("用户不存在", err)
37 } 41 }
  42 + if _, roles, err = l.svcCtx.RoleRepository.Find(l.ctx, conn, domain.IndexCompanyId(user.CompanyId)().MustWithKV("ids", user.Roles)); err != nil {
  43 + return nil, xerr.NewErrMsgErr("角色不存在", err)
  44 + }
38 resp = &types.MiniUserInfoResponse{ 45 resp = &types.MiniUserInfoResponse{
39 User: &types.UserItem{ 46 User: &types.UserItem{
40 Id: user.Id, 47 Id: user.Id,
41 Name: user.Name, 48 Name: user.Name,
42 }, 49 },
  50 + Accounts: make([]types.Account, 0),
  51 + Auths: make([]types.Auth, 0),
  52 + }
  53 + _, accounts, err = l.svcCtx.UserRepository.Find(l.ctx, conn, domain.NewQueryOptions().MustWithKV("phone", user.Phone).MustWithKV("auditStatus", []int{domain.UserAuditStatusPassed}))
  54 + if err != nil {
  55 + return nil, xerr.NewErrMsgErr("用户不存在", err)
  56 + }
  57 + // 拥有的账号
  58 + for _, account := range accounts {
  59 + if account.Enable != domain.UserEnable {
  60 + continue
  61 + }
  62 + var (
  63 + companyName = ""
  64 + logo = ""
  65 + )
  66 + if company, _ := domain.LazyLoad(companyMap, l.ctx, conn, account.CompanyId, l.svcCtx.CompanyRepository.FindOne); company != nil {
  67 + companyName = company.Name
  68 + logo = company.Logo
  69 + }
  70 + resp.Accounts = append(resp.Accounts, types.Account{
  71 + CompanyId: account.CompanyId,
  72 + CompanyName: companyName,
  73 + Logo: logo,
  74 + UserId: account.Id,
  75 + Name: user.Name,
  76 + Position: user.Position,
  77 + })
  78 + }
  79 + // 拥有的权限
  80 + authSet := collection.NewSet()
  81 + for _, role := range roles {
  82 + for _, auth := range role.Auths {
  83 + if !authSet.Contains(auth) {
  84 + authSet.Add(auth)
  85 + if item := role.GetAuth(auth); item != nil {
  86 + resp.Auths = append(resp.Auths, types.Auth{
  87 + Id: item.Id,
  88 + Name: item.Name,
  89 + Code: item.Code,
  90 + })
  91 + }
  92 + }
  93 + }
43 } 94 }
44 return 95 return
45 } 96 }
  1 +package user
  2 +
  3 +import (
  4 + "context"
  5 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
  6 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/tool"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
  9 +
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  12 +
  13 + "github.com/zeromicro/go-zero/core/logx"
  14 +)
  15 +
  16 +type MiniUserSwitchAccountLogic struct {
  17 + logx.Logger
  18 + ctx context.Context
  19 + svcCtx *svc.ServiceContext
  20 +}
  21 +
  22 +func NewMiniUserSwitchAccountLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniUserSwitchAccountLogic {
  23 + return &MiniUserSwitchAccountLogic{
  24 + Logger: logx.WithContext(ctx),
  25 + ctx: ctx,
  26 + svcCtx: svcCtx,
  27 + }
  28 +}
  29 +
  30 +func (l *MiniUserSwitchAccountLogic) MiniUserSwitchAccount(req *types.MiniUserSwitchAccountRequest) (resp *types.MiniUserLoginResponse, err error) {
  31 + var (
  32 + conn = l.svcCtx.DefaultDBConn()
  33 + userToken = contextdata.GetUserTokenFromCtx(l.ctx)
  34 + token string
  35 + currentUser *domain.User
  36 + switchToUser *domain.User
  37 + )
  38 + if currentUser, err = l.svcCtx.UserRepository.FindOne(l.ctx, conn, userToken.UserId); err != nil {
  39 + return nil, xerr.NewErrMsgErr("当前账号异常", err)
  40 + }
  41 + if switchToUser, err = l.svcCtx.UserRepository.FindOneByCompanyIdAndPhone(l.ctx, conn, req.CompanyId, currentUser.Phone, []int{domain.UserAuditStatusPassed}); err != nil {
  42 + return nil, xerr.NewErrMsgErr("账号不可用", err)
  43 + }
  44 + if switchToUser.Enable != domain.UserEnable {
  45 + return nil, xerr.NewErrMsgErr("账号不可用", err)
  46 + }
  47 + var userJwtToken = tool.UserToken{}
  48 + if switchToUser != nil {
  49 + userJwtToken.UserId = switchToUser.Id
  50 + userJwtToken.CompanyId = switchToUser.CompanyId
  51 + userJwtToken.ClientType = "mini"
  52 + }
  53 + token, err = userJwtToken.GenerateToken(l.svcCtx.Config.MiniAuth.AccessSecret, l.svcCtx.Config.MiniAuth.AccessExpire)
  54 + if err != nil {
  55 + return nil, xerr.NewErrMsgErr("切换账号失败", err)
  56 + }
  57 + resp = &types.MiniUserLoginResponse{
  58 + Token: token,
  59 + Phone: "",
  60 + Success: true,
  61 + }
  62 + if switchToUser == nil {
  63 + resp.Success = false
  64 + }
  65 + return
  66 +}
@@ -53,12 +53,12 @@ type MessageBusinessItem struct { @@ -53,12 +53,12 @@ type MessageBusinessItem struct {
53 DiscussionOpinionId int64 `json:"discussionOpinionId"` // 观点ID 53 DiscussionOpinionId int64 `json:"discussionOpinionId"` // 观点ID
54 Content string `json:"content"` // 消息内容 54 Content string `json:"content"` // 消息内容
55 CreatedAt int64 `json:"createdAt"` // 创建时间 55 CreatedAt int64 `json:"createdAt"` // 创建时间
56 - User *User `json:"user"` // 操作人 56 + User *SimpleUser `json:"user"` // 操作人
57 Article *SimpleArticle `json:"article"` // 文章 57 Article *SimpleArticle `json:"article"` // 文章
58 - Comment *Comment `json:"comment"` // 评论(不一定是自己,可能是被人@到) 58 + Comment *SimpleComment `json:"comment"` // 评论(不一定是自己,可能是被人@到)
59 } 59 }
60 60
61 -type User struct { 61 +type SimpleUser struct {
62 Id int64 `json:"id"` 62 Id int64 `json:"id"`
63 CompanyId int64 `json:"companyId,omitempty"` // 公司ID 63 CompanyId int64 `json:"companyId,omitempty"` // 公司ID
64 CompanyName string `json:"companyName,omitempty"` // 公司名称 64 CompanyName string `json:"companyName,omitempty"` // 公司名称
@@ -72,6 +72,7 @@ type SimpleArticle struct { @@ -72,6 +72,7 @@ type SimpleArticle struct {
72 Title string `json:"title"` // 文章标题 72 Title string `json:"title"` // 文章标题
73 CountLove int `json:"countLove"` // 点赞数量 73 CountLove int `json:"countLove"` // 点赞数量
74 CountComment int `json:"countComment"` // 评论数量 74 CountComment int `json:"countComment"` // 评论数量
  75 + Show int `json:"show"` // 文章的展示状态(0显示、1不显示)
75 } 76 }
76 77
77 type TagCreateRequest struct { 78 type TagCreateRequest struct {
@@ -161,6 +162,10 @@ type MiniUserLoginResponse struct { @@ -161,6 +162,10 @@ type MiniUserLoginResponse struct {
161 Success bool `json:"success"` // 成功标识 162 Success bool `json:"success"` // 成功标识
162 } 163 }
163 164
  165 +type MiniUserSwitchAccountRequest struct {
  166 + CompanyId int64 `json:"companyId"`
  167 +}
  168 +
164 type MiniUserInfoRequest struct { 169 type MiniUserInfoRequest struct {
165 } 170 }
166 171
@@ -169,6 +174,8 @@ type MiniUserInfoResponse struct { @@ -169,6 +174,8 @@ type MiniUserInfoResponse struct {
169 TotalArticle int64 `json:"totalArticle"` // 累计信息发布 174 TotalArticle int64 `json:"totalArticle"` // 累计信息发布
170 TotalLoved int64 `json:"totalLoved"` // 累计收到的赞 175 TotalLoved int64 `json:"totalLoved"` // 累计收到的赞
171 TotalAccepted int64 `json:"totalAccepted"` // 累计被采纳 176 TotalAccepted int64 `json:"totalAccepted"` // 累计被采纳
  177 + Accounts []Account `json:"accounts"` // 公司账号
  178 + Auths []Auth `json:"auths"` // 权限列表
172 } 179 }
173 180
174 type MiniUserApplyJoinCompanyRequest struct { 181 type MiniUserApplyJoinCompanyRequest struct {
@@ -219,6 +226,15 @@ type UserItem struct { @@ -219,6 +226,15 @@ type UserItem struct {
219 AccountFrom string `json:"accountFrom,omitempty"` // 账号来源 后台新增、扫码注册 226 AccountFrom string `json:"accountFrom,omitempty"` // 账号来源 后台新增、扫码注册
220 } 227 }
221 228
  229 +type Account struct {
  230 + CompanyId int64 `json:"companyId"` // 公司ID
  231 + CompanyName string `json:"companyName"` // 公司名称
  232 + Logo string `json:"logo"` // 公司图标
  233 + UserId int64 `json:"userId"` // 用户ID
  234 + Name string `json:"name"` // 名称
  235 + Position string `json:"position"` // 职位
  236 +}
  237 +
222 type Department struct { 238 type Department struct {
223 Id int64 `json:"id,omitempty"` // 部门ID 239 Id int64 `json:"id,omitempty"` // 部门ID
224 CompanyId int64 `json:"companyId,omitempty"` // 公司ID 240 CompanyId int64 `json:"companyId,omitempty"` // 公司ID
@@ -251,6 +267,34 @@ type UserFollowItem struct { @@ -251,6 +267,34 @@ type UserFollowItem struct {
251 MutualFollowed bool `json:"mutualFollowed"` // 互相关注标识 267 MutualFollowed bool `json:"mutualFollowed"` // 互相关注标识
252 } 268 }
253 269
  270 +type MiniMyLikeRequest struct {
  271 + Page int `json:"page"`
  272 + Size int `json:"size"`
  273 +}
  274 +
  275 +type MiniMyLikeResponse struct {
  276 + List []MyLikeItem `json:"list"`
  277 + Total int64 `json:"total"`
  278 +}
  279 +
  280 +type MyLikeItem struct {
  281 + UserId int64 `json:"userId"` // 发布人id
  282 + ArticleId int64 `json:"articleId"` // 文章id
  283 + CommentId int64 `json:"commentId"` // 评论id
  284 + CreatedAt int64 `json:"createdAt"` // 创建时间
  285 + User *SimpleUser `json:"user"` // 发布人
  286 + Article *SimpleArticle `json:"article"` // 文章
  287 + Comment *SimpleComment `json:"comment"` // 评论
  288 +}
  289 +
  290 +type SimpleComment struct {
  291 + Id int64 `json:"id"`
  292 + Content string `json:"content"` // 评论内容
  293 + CountLove int `json:"countLove"` // 点赞数量
  294 + CountComment int `json:"countComment"` // 评论数量
  295 + Show int `json:"show"` // 评论的展示状态(0显示、1不显示)
  296 +}
  297 +
254 type CompanySearchRequest struct { 298 type CompanySearchRequest struct {
255 Page int `json:"page"` 299 Page int `json:"page"`
256 Size int `json:"size"` 300 Size int `json:"size"`
@@ -457,3 +501,68 @@ type SystemArticleSearch struct { @@ -457,3 +501,68 @@ type SystemArticleSearch struct {
457 Tags []string `json:"tags"` //标签 501 Tags []string `json:"tags"` //标签
458 TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] 502 TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人]
459 } 503 }
  504 +
  505 +type RoleGetRequest struct {
  506 + Id int64 `path:"id"`
  507 +}
  508 +
  509 +type RoleGetResponse struct {
  510 + Role RoleItem `json:"role"`
  511 + AuthList []Auth `json:"authList"`
  512 +}
  513 +
  514 +type RoleSaveRequest struct {
  515 + Role RoleItem `json:"role"`
  516 +}
  517 +
  518 +type RoleSaveResponse struct {
  519 +}
  520 +
  521 +type RoleDeleteRequest struct {
  522 + Id int64 `path:"id"`
  523 +}
  524 +
  525 +type RoleDeleteResponse struct {
  526 +}
  527 +
  528 +type RoleUpdateRequest struct {
  529 + Id int64 `path:"id"`
  530 + Role RoleItem `json:"role"`
  531 +}
  532 +
  533 +type RoleUpdateResponse struct {
  534 +}
  535 +
  536 +type RoleSearchRequest struct {
  537 + Page int `json:"page,optional"`
  538 + Size int `json:"size,optional"`
  539 + Style string `json:"style,options=[simple,,full]"` // simple:只返回角色ID名称 full:所有字段都返回
  540 +}
  541 +
  542 +type RoleSearchResponse struct {
  543 + List []RoleItem `json:"list"`
  544 + Total int64 `json:"total"`
  545 +}
  546 +
  547 +type RoleItem struct {
  548 + Id int64 `json:"id,optional"` // 角色ID
  549 + CompanyId int64 `json:"companyId,optional,omitempty"` // 公司ID
  550 + Name string `json:"name"` // 角色名称
  551 + AuthIds []int64 `json:"authIds,optional,omitempty"` // 角色权限列表
  552 + AuthsDesc string `json:"authsDesc,optional,omitempty"` // 权限列表描述
  553 + UsersDesc string `json:"usersDesc,optional,omitempty"` // 用户列表描述
  554 + Remark string `json:"remark,optional,omitempty"` // 备注
  555 + Users []RoleUser `json:"users,optional,omitempty"` // 绑定的用户
  556 + UpdatedAt int64 `json:"updatedAt,optional,omitempty"` // 更新时间
  557 +}
  558 +
  559 +type RoleUser struct {
  560 + Id int64 `json:"id"`
  561 + Name string `json:"name"`
  562 +}
  563 +
  564 +type Auth struct {
  565 + Id int64 `json:"id"` // ID
  566 + Name string `json:"name"` // 名称
  567 + Code string `json:"code"` // 编码
  568 +}
@@ -20,6 +20,7 @@ func Migrate(db *gorm.DB) { @@ -20,6 +20,7 @@ func Migrate(db *gorm.DB) {
20 &models.UserFollow{}, 20 &models.UserFollow{},
21 &models.MessageSystem{}, 21 &models.MessageSystem{},
22 &models.MessageBusiness{}, 22 &models.MessageBusiness{},
  23 + &models.Department{},
23 } 24 }
24 25
25 db.AutoMigrate(modelsList...) 26 db.AutoMigrate(modelsList...)
@@ -4,15 +4,20 @@ import ( @@ -4,15 +4,20 @@ import (
4 "fmt" 4 "fmt"
5 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" 5 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
6 "gorm.io/gorm" 6 "gorm.io/gorm"
  7 + "gorm.io/plugin/soft_delete"
7 ) 8 )
8 9
9 type Department struct { 10 type Department struct {
10 Id int64 // 唯一标识 11 Id int64 // 唯一标识
  12 + CompanyId int64 `json:"companyId,omitempty"` // 公司ID
  13 + ParentId int64 `json:"parentId,omitempty"` // 父级ID
  14 + Name string `json:"name,omitempty"` // 部门名称
11 15
12 CreatedAt int64 `json:"createdAt,omitempty"` 16 CreatedAt int64 `json:"createdAt,omitempty"`
13 UpdatedAt int64 `json:"updatedAt,omitempty"` 17 UpdatedAt int64 `json:"updatedAt,omitempty"`
14 DeletedAt int64 `json:"deletedAt,omitempty"` 18 DeletedAt int64 `json:"deletedAt,omitempty"`
15 Version int `json:"version,omitempty"` 19 Version int `json:"version,omitempty"`
  20 + IsDel soft_delete.DeletedAt `gorm:"softDelete:flag,DeletedAtField:DeletedAt"`
16 } 21 }
17 22
18 func (m *Department) TableName() string { 23 func (m *Department) TableName() string {
@@ -10,10 +10,11 @@ import ( @@ -10,10 +10,11 @@ import (
10 10
11 type Role struct { 11 type Role struct {
12 Id int64 // 唯一标识 12 Id int64 // 唯一标识
  13 + CompanyId int64
13 Name string `json:"name"` // 角色名称 14 Name string `json:"name"` // 角色名称
14 Auths []int64 `gorm:"type:jsonb;serializer:json"` // 角色权限列表 15 Auths []int64 `gorm:"type:jsonb;serializer:json"` // 角色权限列表
15 Remark string `json:"remark"` // 备注 16 Remark string `json:"remark"` // 备注
16 - Users []int64 `gorm:"type:jsonb;serializer:json"` // 绑定的用户 17 + Users []domain.User `gorm:"type:jsonb;serializer:json"` // 绑定的用户
17 18
18 CreatedAt int64 19 CreatedAt int64
19 UpdatedAt int64 20 UpdatedAt int64
@@ -120,6 +120,9 @@ func (repository *DepartmentRepository) Find(ctx context.Context, conn transacti @@ -120,6 +120,9 @@ func (repository *DepartmentRepository) Find(ctx context.Context, conn transacti
120 ) 120 )
121 queryFunc := func() (interface{}, error) { 121 queryFunc := func() (interface{}, error) {
122 tx = tx.Model(&ms).Order("id desc") 122 tx = tx.Model(&ms).Order("id desc")
  123 + if v, ok := queryOptions["companyId"]; ok {
  124 + tx.Where("company_id = ?", v)
  125 + }
123 if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil { 126 if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil {
124 return dms, tx.Error 127 return dms, tx.Error
125 } 128 }
@@ -120,7 +120,7 @@ func (repository *MessageBusinessRepository) Find(ctx context.Context, conn tran @@ -120,7 +120,7 @@ func (repository *MessageBusinessRepository) Find(ctx context.Context, conn tran
120 total int64 120 total int64
121 ) 121 )
122 queryFunc := func() (interface{}, error) { 122 queryFunc := func() (interface{}, error) {
123 - tx = tx.Model(&ms).Order("created_at desc") 123 + tx = tx.Model(&ms).Order("id desc")
124 if v, ok := queryOptions["companyId"]; ok { 124 if v, ok := queryOptions["companyId"]; ok {
125 tx.Where("company_id = ?", v) 125 tx.Where("company_id = ?", v)
126 } 126 }
@@ -120,7 +120,7 @@ func (repository *MessageSystemRepository) Find(ctx context.Context, conn transa @@ -120,7 +120,7 @@ func (repository *MessageSystemRepository) Find(ctx context.Context, conn transa
120 total int64 120 total int64
121 ) 121 )
122 queryFunc := func() (interface{}, error) { 122 queryFunc := func() (interface{}, error) {
123 - tx = tx.Model(&ms).Order("created_at desc") // 创建时间降序 123 + tx = tx.Model(&ms).Order("id desc")
124 if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil { 124 if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil {
125 return dms, tx.Error 125 return dms, tx.Error
126 } 126 }
@@ -120,12 +120,17 @@ func (repository *RoleRepository) Find(ctx context.Context, conn transaction.Con @@ -120,12 +120,17 @@ func (repository *RoleRepository) Find(ctx context.Context, conn transaction.Con
120 ) 120 )
121 queryFunc := func() (interface{}, error) { 121 queryFunc := func() (interface{}, error) {
122 tx = tx.Model(&ms).Order("id desc") 122 tx = tx.Model(&ms).Order("id desc")
  123 + if v, ok := queryOptions["companyId"]; ok {
  124 + tx.Where("company_id = ?", v)
  125 + }
  126 + if v, ok := queryOptions["ids"]; ok {
  127 + tx.Where("id in (?)", v)
  128 + }
123 if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil { 129 if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil {
124 return dms, tx.Error 130 return dms, tx.Error
125 } 131 }
126 return dms, nil 132 return dms, nil
127 } 133 }
128 -  
129 if _, err := repository.Query(queryFunc); err != nil { 134 if _, err := repository.Query(queryFunc); err != nil {
130 return 0, nil, err 135 return 0, nil, err
131 } 136 }
@@ -141,7 +141,7 @@ func (repository *UserRepository) Find(ctx context.Context, conn transaction.Con @@ -141,7 +141,7 @@ func (repository *UserRepository) Find(ctx context.Context, conn transaction.Con
141 total int64 141 total int64
142 ) 142 )
143 queryFunc := func() (interface{}, error) { 143 queryFunc := func() (interface{}, error) {
144 - tx = tx.Model(&ms).Order("id desc") 144 + tx = tx.Model(&ms).Order("id asc")
145 if v, ok := queryOptions["companyId"]; ok { 145 if v, ok := queryOptions["companyId"]; ok {
146 tx.Where("company_id = ?", v) 146 tx.Where("company_id = ?", v)
147 } 147 }
@@ -174,6 +174,39 @@ func (repository *UserRepository) Find(ctx context.Context, conn transaction.Con @@ -174,6 +174,39 @@ func (repository *UserRepository) Find(ctx context.Context, conn transaction.Con
174 return total, dms, nil 174 return total, dms, nil
175 } 175 }
176 176
  177 +func (repository *UserRepository) FindDepartmentUsers(ctx context.Context, conn transaction.Conn, companyId int64, queryOptions map[string]interface{}) (int64, []*domain.User, error) {
  178 + var (
  179 + tx = conn.DB()
  180 + ms []*models.User
  181 + dms = make([]*domain.User, 0)
  182 + total int64
  183 + )
  184 + queryFunc := func() (interface{}, error) {
  185 + tx = tx.Model(&ms).Order("id desc")
  186 + tx.Select("id", "name", "departments")
  187 + tx.Where("company_id = ?", companyId)
  188 + tx.Where("audit_status in (?)", domain.UserAuditStatusPassed)
  189 + tx.Where("enable = ?", domain.UserEnable)
  190 + if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil {
  191 + return dms, tx.Error
  192 + }
  193 + return dms, nil
  194 + }
  195 +
  196 + if _, err := repository.Query(queryFunc); err != nil {
  197 + return 0, nil, err
  198 + }
  199 +
  200 + for _, item := range ms {
  201 + if dm, err := repository.ModelToDomainModel(item); err != nil {
  202 + return 0, dms, err
  203 + } else {
  204 + dms = append(dms, dm)
  205 + }
  206 + }
  207 + return total, dms, nil
  208 +}
  209 +
177 func (repository *UserRepository) ModelToDomainModel(from *models.User) (*domain.User, error) { 210 func (repository *UserRepository) ModelToDomainModel(from *models.User) (*domain.User, error) {
178 to := &domain.User{} 211 to := &domain.User{}
179 err := copier.Copy(to, from) 212 err := copier.Copy(to, from)
@@ -76,3 +76,15 @@ func LazyLoad[K comparable, T any](source map[K]T, ctx context.Context, conn tra @@ -76,3 +76,15 @@ func LazyLoad[K comparable, T any](source map[K]T, ctx context.Context, conn tra
76 return v, nil 76 return v, nil
77 } 77 }
78 } 78 }
  79 +
  80 +/*************** 索引函数 ****************/
  81 +func IndexCompanyId(companyId int64) IndexQueryOptionFunc {
  82 + return func() QueryOptions {
  83 + return NewQueryOptions().WithKV("companyId", companyId)
  84 + }
  85 +}
  86 +func IndexUserId(userId int64) IndexQueryOptionFunc {
  87 + return func() QueryOptions {
  88 + return NewQueryOptions().WithKV("userId", userId)
  89 + }
  90 +}
@@ -7,10 +7,11 @@ import ( @@ -7,10 +7,11 @@ import (
7 7
8 type Role struct { 8 type Role struct {
9 Id int64 `json:"id"` // 角色ID 9 Id int64 `json:"id"` // 角色ID
  10 + CompanyId int64 `json:"companyId"` // 公司ID
10 Name string `json:"name"` // 角色名称 11 Name string `json:"name"` // 角色名称
11 Auths []int64 `json:"auths"` // 角色权限列表 12 Auths []int64 `json:"auths"` // 角色权限列表
12 Remark string `json:"remark"` // 备注 13 Remark string `json:"remark"` // 备注
13 - Users []int64 `json:"users"` // 绑定的用户 14 + Users []User `json:"users"` // 绑定的用户
14 15
15 CreatedAt int64 `json:"createdAt,omitempty"` 16 CreatedAt int64 `json:"createdAt,omitempty"`
16 UpdatedAt int64 `json:"updatedAt,omitempty"` 17 UpdatedAt int64 `json:"updatedAt,omitempty"`
@@ -33,3 +34,35 @@ func (m *Role) Identify() interface{} { @@ -33,3 +34,35 @@ func (m *Role) Identify() interface{} {
33 } 34 }
34 return m.Id 35 return m.Id
35 } 36 }
  37 +
  38 +func (m *Role) GetAuth(id int64) *Auth {
  39 + for _, auth := range Auths {
  40 + if auth.Id == id {
  41 + return &auth
  42 + }
  43 + }
  44 + return nil
  45 +}
  46 +
  47 +type Auth struct {
  48 + Id int64 `json:"id,omitempty"` // 菜单ID
  49 + ParentId int64 `json:"parentId"` // 父级ID
  50 + Name string `json:"name,omitempty"` // 菜单名称
  51 + Code string `json:"code,omitempty"` // 菜单编码
  52 +}
  53 +
  54 +var Auths = []Auth{
  55 + NewAuth(1001, "邀请注册", "MINI_INVITE-REGISTRATION", 0),
  56 + NewAuth(1002, "帖子定性", "SYSTEM_POST-JUDGMENT", 0),
  57 + //NewAuth(1003, "圆桌判定", "SYSTEM_STUDENT-MANAGE", 0),
  58 + //NewAuth(1004, "圆桌运营", "SYSTEM_FEEDBACK-MANAGE", 0),
  59 +}
  60 +
  61 +func NewAuth(id int64, name, code string, pid int64) Auth {
  62 + return Auth{
  63 + Id: id,
  64 + Name: name,
  65 + Code: code,
  66 + ParentId: pid,
  67 + }
  68 +}
@@ -37,6 +37,7 @@ type UserRepository interface { @@ -37,6 +37,7 @@ type UserRepository interface {
37 FindOne(ctx context.Context, conn transaction.Conn, id int64) (*User, error) 37 FindOne(ctx context.Context, conn transaction.Conn, id int64) (*User, error)
38 FindOneByCompanyIdAndPhone(ctx context.Context, conn transaction.Conn, companyId int64, phone string, status []int) (*User, error) 38 FindOneByCompanyIdAndPhone(ctx context.Context, conn transaction.Conn, companyId int64, phone string, status []int) (*User, error)
39 Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*User, error) 39 Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*User, error)
  40 + FindDepartmentUsers(ctx context.Context, conn transaction.Conn, companyId int64, queryOptions map[string]interface{}) (int64, []*User, error)
40 } 41 }
41 42
42 func (m *User) Identify() interface{} { 43 func (m *User) Identify() interface{} {
@@ -85,6 +86,7 @@ func (m *User) Audit(status int) error { @@ -85,6 +86,7 @@ func (m *User) Audit(status int) error {
85 return nil 86 return nil
86 } 87 }
87 88
  89 +// Follow 关注
88 func (m *User) Follow(targetUser *User) error { 90 func (m *User) Follow(targetUser *User) error {
89 if lo.Contains(m.Following, targetUser.Id) { 91 if lo.Contains(m.Following, targetUser.Id) {
90 return fmt.Errorf("已关注用户%v", targetUser.Name) 92 return fmt.Errorf("已关注用户%v", targetUser.Name)
@@ -96,12 +98,29 @@ func (m *User) Follow(targetUser *User) error { @@ -96,12 +98,29 @@ func (m *User) Follow(targetUser *User) error {
96 return nil 98 return nil
97 } 99 }
98 100
  101 +// Unfollow 取消关注
99 func (m *User) Unfollow(targetUser *User) error { 102 func (m *User) Unfollow(targetUser *User) error {
100 m.Following = lo.Without(m.Following, targetUser.Id) 103 m.Following = lo.Without(m.Following, targetUser.Id)
101 targetUser.Follower = lo.Without(targetUser.Follower, m.Id) 104 targetUser.Follower = lo.Without(targetUser.Follower, m.Id)
102 return nil 105 return nil
103 } 106 }
104 107
  108 +// AddRole 添加角色
  109 +func (m *User) AddRole(roleId int64) {
  110 + if lo.Contains(m.Roles, roleId) {
  111 + return
  112 + }
  113 + m.Roles = append(m.Roles, roleId)
  114 +}
  115 +
  116 +// RemoveRole 移除角色
  117 +func (m *User) RemoveRole(roleId int64) {
  118 + if !lo.Contains(m.Roles, roleId) {
  119 + return
  120 + }
  121 + m.Roles = lo.Without(m.Roles, roleId)
  122 +}
  123 +
105 type ( 124 type (
106 LoginCreator interface { 125 LoginCreator interface {
107 WechatLogin(r WechatLoginRequest) (*LoginInfo, error) 126 WechatLogin(r WechatLoginRequest) (*LoginInfo, error)