作者 yangfu

用户列表

@@ -751,6 +751,32 @@ @@ -751,6 +751,32 @@
751 ] 751 ]
752 } 752 }
753 }, 753 },
  754 + "v1/mini/user/at-users-list": {
  755 + "post": {
  756 + "summary": "@用户列表",
  757 + "operationId": "miniAtUsersList",
  758 + "responses": {
  759 + "200": {
  760 + "description": "A successful response.",
  761 + "schema": {}
  762 + }
  763 + },
  764 + "parameters": [
  765 + {
  766 + "name": "body",
  767 + "in": "body",
  768 + "required": true,
  769 + "schema": {
  770 + "$ref": "#/definitions/MiniAtUsersListRequest"
  771 + }
  772 + }
  773 + ],
  774 + "requestBody": {},
  775 + "tags": [
  776 + "user"
  777 + ]
  778 + }
  779 + },
754 "v1/mini/user/audit": { 780 "v1/mini/user/audit": {
755 "post": { 781 "post": {
756 "summary": "用户审核", 782 "summary": "用户审核",
@@ -812,9 +838,7 @@ @@ -812,9 +838,7 @@
812 "responses": { 838 "responses": {
813 "200": { 839 "200": {
814 "description": "A successful response.", 840 "description": "A successful response.",
815 - "schema": {  
816 - "$ref": "#/definitions/MiniUserInfoResponse"  
817 - } 841 + "schema": {}
818 } 842 }
819 }, 843 },
820 "parameters": [ 844 "parameters": [
@@ -1225,6 +1249,32 @@ @@ -1225,6 +1249,32 @@
1225 ] 1249 ]
1226 } 1250 }
1227 }, 1251 },
  1252 + "v1/system/article/history/{id}": {
  1253 + "get": {
  1254 + "summary": "管理后台帖子历史详情",
  1255 + "operationId": "SystemArticleGetHistory",
  1256 + "responses": {
  1257 + "200": {
  1258 + "description": "A successful response.",
  1259 + "schema": {
  1260 + "$ref": "#/definitions/SystemArticleGetHistoryResponse"
  1261 + }
  1262 + }
  1263 + },
  1264 + "parameters": [
  1265 + {
  1266 + "name": "id",
  1267 + "in": "path",
  1268 + "required": true,
  1269 + "type": "string"
  1270 + }
  1271 + ],
  1272 + "requestBody": {},
  1273 + "tags": [
  1274 + "article"
  1275 + ]
  1276 + }
  1277 + },
1228 "v1/system/article/search": { 1278 "v1/system/article/search": {
1229 "post": { 1279 "post": {
1230 "summary": "管理后台获取文章列表", 1280 "summary": "管理后台获取文章列表",
@@ -3773,6 +3823,17 @@ @@ -3773,6 +3823,17 @@
3773 "id" 3823 "id"
3774 ] 3824 ]
3775 }, 3825 },
  3826 + "MiniAtUsersListRequest": {
  3827 + "type": "object",
  3828 + "properties": {
  3829 + "articleId": {
  3830 + "type": "integer",
  3831 + "format": "int64",
  3832 + "description": " 按文章ID(返回文章可见的用户)"
  3833 + }
  3834 + },
  3835 + "title": "MiniAtUsersListRequest"
  3836 + },
3776 "MiniCreateArticleCommentRequest": { 3837 "MiniCreateArticleCommentRequest": {
3777 "type": "object", 3838 "type": "object",
3778 "properties": { 3839 "properties": {
@@ -4276,21 +4337,6 @@ @@ -4276,21 +4337,6 @@
4276 "$ref": "#/definitions/UserItem", 4337 "$ref": "#/definitions/UserItem",
4277 "description": " 用户信息" 4338 "description": " 用户信息"
4278 }, 4339 },
4279 - "totalArticle": {  
4280 - "type": "integer",  
4281 - "format": "int64",  
4282 - "description": " 累计信息发布"  
4283 - },  
4284 - "totalLoved": {  
4285 - "type": "integer",  
4286 - "format": "int64",  
4287 - "description": " 累计收到的赞"  
4288 - },  
4289 - "totalAccepted": {  
4290 - "type": "integer",  
4291 - "format": "int64",  
4292 - "description": " 累计被采纳"  
4293 - },  
4294 "accounts": { 4340 "accounts": {
4295 "type": "array", 4341 "type": "array",
4296 "items": { 4342 "items": {
@@ -4309,9 +4355,6 @@ @@ -4309,9 +4355,6 @@
4309 "title": "MiniUserInfoResponse", 4355 "title": "MiniUserInfoResponse",
4310 "required": [ 4356 "required": [
4311 "user", 4357 "user",
4312 - "totalArticle",  
4313 - "totalLoved",  
4314 - "totalAccepted",  
4315 "accounts", 4358 "accounts",
4316 "auths" 4359 "auths"
4317 ] 4360 ]
@@ -4891,6 +4934,151 @@ @@ -4891,6 +4934,151 @@
4891 "total" 4934 "total"
4892 ] 4935 ]
4893 }, 4936 },
  4937 + "SystemArticleGetHistoryRequest": {
  4938 + "type": "object",
  4939 + "properties": {
  4940 + "id": {
  4941 + "type": "integer",
  4942 + "format": "int64",
  4943 + "description": "id"
  4944 + },
  4945 + "": {
  4946 + "type": "integer",
  4947 + "format": "int64"
  4948 + }
  4949 + },
  4950 + "title": "SystemArticleGetHistoryRequest",
  4951 + "required": [
  4952 + "id"
  4953 + ]
  4954 + },
  4955 + "SystemArticleGetHistoryResponse": {
  4956 + "type": "object",
  4957 + "properties": {
  4958 + "id": {
  4959 + "type": "integer",
  4960 + "format": "int64",
  4961 + "description": " id"
  4962 + },
  4963 + "articleId": {
  4964 + "type": "integer",
  4965 + "format": "int64",
  4966 + "description": " 文章ID"
  4967 + },
  4968 + "title": {
  4969 + "type": "string",
  4970 + "description": " 标题"
  4971 + },
  4972 + "authorId": {
  4973 + "type": "integer",
  4974 + "format": "int64",
  4975 + "description": " 发布人id"
  4976 + },
  4977 + "author": {
  4978 + "$ref": "#/definitions/ArticleAuthor",
  4979 + "description": " 发布人"
  4980 + },
  4981 + "createdAt": {
  4982 + "type": "integer",
  4983 + "format": "int64",
  4984 + "description": " 文章的发布时间"
  4985 + },
  4986 + "section": {
  4987 + "type": "array",
  4988 + "items": {
  4989 + "$ref": "#/definitions/ArticleSection"
  4990 + },
  4991 + "description": " 文章的文本内容"
  4992 + },
  4993 + "images": {
  4994 + "type": "array",
  4995 + "items": {
  4996 + "type": "string"
  4997 + },
  4998 + "description": " 图片"
  4999 + },
  5000 + "whoRead": {
  5001 + "type": "array",
  5002 + "items": {
  5003 + "type": "integer",
  5004 + "format": "int64"
  5005 + },
  5006 + "description": " 谁可查看"
  5007 + },
  5008 + "whoReadInfo": {
  5009 + "type": "array",
  5010 + "items": {
  5011 + "$ref": "#/definitions/UserShowName"
  5012 + },
  5013 + "description": " 谁可查看"
  5014 + },
  5015 + "whoReview": {
  5016 + "type": "array",
  5017 + "items": {
  5018 + "type": "integer",
  5019 + "format": "int64"
  5020 + },
  5021 + "description": " 谁可评论"
  5022 + },
  5023 + "whoReviewInfo": {
  5024 + "type": "array",
  5025 + "items": {
  5026 + "$ref": "#/definitions/UserShowName"
  5027 + },
  5028 + "description": " 谁可评论"
  5029 + },
  5030 + "location": {
  5031 + "$ref": "#/definitions/Location",
  5032 + "description": " 定位坐标"
  5033 + },
  5034 + "countLove": {
  5035 + "type": "integer",
  5036 + "format": "int32",
  5037 + "description": " 点赞数量"
  5038 + },
  5039 + "countComment": {
  5040 + "type": "integer",
  5041 + "format": "int32",
  5042 + "description": " 评论数量"
  5043 + },
  5044 + "countRead": {
  5045 + "type": "integer",
  5046 + "format": "int32",
  5047 + "description": " 浏览数量"
  5048 + },
  5049 + "show": {
  5050 + "type": "integer",
  5051 + "format": "int32",
  5052 + "description": " 评论的展示状态(0显示、1不显示)"
  5053 + },
  5054 + "targetUser": {
  5055 + "type": "integer",
  5056 + "format": "int32",
  5057 + "description": "分发方式 [0分发给所有人、1分发给指定的人]"
  5058 + }
  5059 + },
  5060 + "title": "SystemArticleGetHistoryResponse",
  5061 + "required": [
  5062 + "id",
  5063 + "articleId",
  5064 + "title",
  5065 + "authorId",
  5066 + "author",
  5067 + "createdAt",
  5068 + "section",
  5069 + "images",
  5070 + "whoRead",
  5071 + "whoReadInfo",
  5072 + "whoReview",
  5073 + "whoReviewInfo",
  5074 + "location",
  5075 + "countLove",
  5076 + "countComment",
  5077 + "countRead",
  5078 + "show",
  5079 + "targetUser"
  5080 + ]
  5081 + },
4894 "SystemArticleGetRequest": { 5082 "SystemArticleGetRequest": {
4895 "type": "object", 5083 "type": "object",
4896 "properties": { 5084 "properties": {
@@ -5002,6 +5190,13 @@ @@ -5002,6 +5190,13 @@
5002 "type": "integer", 5190 "type": "integer",
5003 "format": "int32", 5191 "format": "int32",
5004 "description": " 评论的展示状态(0显示、1不显示)" 5192 "description": " 评论的展示状态(0显示、1不显示)"
  5193 + },
  5194 + "tags": {
  5195 + "type": "array",
  5196 + "items": {
  5197 + "$ref": "#/definitions/ArticleTagItem"
  5198 + },
  5199 + "description": "标签"
5005 } 5200 }
5006 }, 5201 },
5007 "title": "SystemArticleGetResponse", 5202 "title": "SystemArticleGetResponse",
@@ -5021,7 +5216,8 @@ @@ -5021,7 +5216,8 @@
5021 "countLove", 5216 "countLove",
5022 "countComment", 5217 "countComment",
5023 "countRead", 5218 "countRead",
5024 - "show" 5219 + "show",
  5220 + "tags"
5025 ] 5221 ]
5026 }, 5222 },
5027 "SystemArticleHistory": { 5223 "SystemArticleHistory": {
@@ -5263,6 +5459,14 @@ @@ -5263,6 +5459,14 @@
5263 "format": "int64", 5459 "format": "int64",
5264 "description": "结束时间" 5460 "description": "结束时间"
5265 }, 5461 },
  5462 + "tags": {
  5463 + "type": "array",
  5464 + "items": {
  5465 + "type": "integer",
  5466 + "format": "int64"
  5467 + },
  5468 + "description": "标签"
  5469 + },
5266 "page": { 5470 "page": {
5267 "type": "integer", 5471 "type": "integer",
5268 "format": "int32", 5472 "format": "int32",
@@ -5358,6 +5562,14 @@ @@ -5358,6 +5562,14 @@
5358 "type": "integer", 5562 "type": "integer",
5359 "format": "int32", 5563 "format": "int32",
5360 "description": "分发方式 [0分发给所有人、1分发给指定的人]" 5564 "description": "分发方式 [0分发给所有人、1分发给指定的人]"
  5565 + },
  5566 + "tags": {
  5567 + "type": "array",
  5568 + "items": {
  5569 + "type": "integer",
  5570 + "format": "int64"
  5571 + },
  5572 + "description": " 标签"
5361 } 5573 }
5362 }, 5574 },
5363 "title": "SystemArticleUpdateRequest", 5575 "title": "SystemArticleUpdateRequest",
@@ -5370,7 +5582,8 @@ @@ -5370,7 +5582,8 @@
5370 "whoRead", 5582 "whoRead",
5371 "whoReview", 5583 "whoReview",
5372 "location", 5584 "location",
5373 - "targetUser" 5585 + "targetUser",
  5586 + "tags"
5374 ] 5587 ]
5375 }, 5588 },
5376 "SystemArticleUpdateResponse": { 5589 "SystemArticleUpdateResponse": {
@@ -5419,7 +5632,8 @@ @@ -5419,7 +5632,8 @@
5419 "tags": { 5632 "tags": {
5420 "type": "array", 5633 "type": "array",
5421 "items": { 5634 "items": {
5422 - "type": "string" 5635 + "type": "integer",
  5636 + "format": "int64"
5423 }, 5637 },
5424 "description": "标签" 5638 "description": "标签"
5425 }, 5639 },
@@ -33,6 +33,9 @@ service Core { @@ -33,6 +33,9 @@ service Core {
33 @doc "用户信息" 33 @doc "用户信息"
34 @handler miniUserInfo 34 @handler miniUserInfo
35 post /mini/user/info (MiniUserInfoRequest) returns (MiniUserInfoResponse) 35 post /mini/user/info (MiniUserInfoRequest) returns (MiniUserInfoResponse)
  36 + @doc "用户统计"
  37 + @handler miniUserStatistics
  38 + post /mini/user/statistics (UserStatisticsRequest) returns (UserStatisticsResponse)
36 @doc "用户审核列表" 39 @doc "用户审核列表"
37 @handler miniUserAuditList 40 @handler miniUserAuditList
38 post /mini/user/audit-list (UserSearchRequest)returns(UserSearchResponse) 41 post /mini/user/audit-list (UserSearchRequest)returns(UserSearchResponse)
@@ -41,7 +44,10 @@ service Core { @@ -41,7 +44,10 @@ service Core {
41 post /mini/user/audit (MiniUserAuditRequest) 44 post /mini/user/audit (MiniUserAuditRequest)
42 @doc "部门用户列表" 45 @doc "部门用户列表"
43 @handler miniUserDepartmentUsers 46 @handler miniUserDepartmentUsers
44 - post /mini/user/department-users (MiniUserDepartmentUsersRequest)returns (MiniUserInfoResponse) 47 + post /mini/user/department-users (MiniUserDepartmentUsersRequest)
  48 + @doc "用户列表"
  49 + @handler miniUsersList
  50 + post /mini/user/user-list (MiniUsersListRequest)
45 @doc "关注我的人" 51 @doc "关注我的人"
46 @handler miniUserFollower 52 @handler miniUserFollower
47 post /mini/user/follower (MiniUserFollowedSearchRequest)returns(MiniUserFollowedSearchResponse) 53 post /mini/user/follower (MiniUserFollowedSearchRequest)returns(MiniUserFollowedSearchResponse)
@@ -105,6 +111,10 @@ type( @@ -105,6 +111,10 @@ type(
105 Departments []*Department `json:"departments"` 111 Departments []*Department `json:"departments"`
106 Users []*UserItem `json:"users"` 112 Users []*UserItem `json:"users"`
107 } 113 }
  114 + MiniUsersListRequest{
  115 + ArticleId int64 `json:"articleId,optional"` // 按文章ID(返回文章可见的用户)
  116 + RoleId int64 `json:"roleId,optional"` // 按角色角色关联的用户
  117 + }
108 MiniUserFollowedSearchRequest{ 118 MiniUserFollowedSearchRequest{
109 Page int `json:"page,optional"` 119 Page int `json:"page,optional"`
110 Size int `json:"size,optional"` 120 Size int `json:"size,optional"`
@@ -117,6 +127,7 @@ type( @@ -117,6 +127,7 @@ type(
117 Id int64 `json:"id,omitempty"` // 用户ID 127 Id int64 `json:"id,omitempty"` // 用户ID
118 CompanyId int64 `json:"companyId,omitempty"` // 公司ID 128 CompanyId int64 `json:"companyId,omitempty"` // 公司ID
119 CompanyName string `json:"companyName,omitempty"` // 公司名称 129 CompanyName string `json:"companyName,omitempty"` // 公司名称
  130 + CompanyCode string `json:"companyCode,omitempty"` // 公司编码(邀请码)
120 //DepartmentId int64 `json:"departmentId,omitempty"` // 部门ID 131 //DepartmentId int64 `json:"departmentId,omitempty"` // 部门ID
121 //Roles []int64 `json:"roleId,omitempty"` // 角色 132 //Roles []int64 `json:"roleId,omitempty"` // 角色
122 Flag int `json:"flag,omitempty"` // 标识 1:管理员 2:普通用户 (有绑定角色是管理员) 133 Flag int `json:"flag,omitempty"` // 标识 1:管理员 2:普通用户 (有绑定角色是管理员)
@@ -216,6 +227,9 @@ service Core { @@ -216,6 +227,9 @@ service Core {
216 @doc "用户统计" 227 @doc "用户统计"
217 @handler systemUserStatistics 228 @handler systemUserStatistics
218 post /system/user/statistics (UserStatisticsRequest) returns (UserStatisticsResponse) 229 post /system/user/statistics (UserStatisticsRequest) returns (UserStatisticsResponse)
  230 + @doc "用户列表"
  231 + @handler systemUsersList
  232 + post /system/user/user-list (MiniUsersListRequest)
219 233
220 @doc "用户详情" 234 @doc "用户详情"
221 @handler systemUserGet 235 @handler systemUserGet
@@ -149,6 +149,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { @@ -149,6 +149,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
149 }, 149 },
150 { 150 {
151 Method: http.MethodPost, 151 Method: http.MethodPost,
  152 + Path: "/mini/user/statistics",
  153 + Handler: user.MiniUserStatisticsHandler(serverCtx),
  154 + },
  155 + {
  156 + Method: http.MethodPost,
152 Path: "/mini/user/audit-list", 157 Path: "/mini/user/audit-list",
153 Handler: user.MiniUserAuditListHandler(serverCtx), 158 Handler: user.MiniUserAuditListHandler(serverCtx),
154 }, 159 },
@@ -164,6 +169,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { @@ -164,6 +169,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
164 }, 169 },
165 { 170 {
166 Method: http.MethodPost, 171 Method: http.MethodPost,
  172 + Path: "/mini/user/user-list",
  173 + Handler: user.MiniUsersListHandler(serverCtx),
  174 + },
  175 + {
  176 + Method: http.MethodPost,
167 Path: "/mini/user/follower", 177 Path: "/mini/user/follower",
168 Handler: user.MiniUserFollowerHandler(serverCtx), 178 Handler: user.MiniUserFollowerHandler(serverCtx),
169 }, 179 },
@@ -207,6 +217,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { @@ -207,6 +217,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
207 Handler: user.SystemUserStatisticsHandler(serverCtx), 217 Handler: user.SystemUserStatisticsHandler(serverCtx),
208 }, 218 },
209 { 219 {
  220 + Method: http.MethodPost,
  221 + Path: "/system/user/user-list",
  222 + Handler: user.SystemUsersListHandler(serverCtx),
  223 + },
  224 + {
210 Method: http.MethodGet, 225 Method: http.MethodGet,
211 Path: "/system/user/:id", 226 Path: "/system/user/:id",
212 Handler: user.SystemUserGetHandler(serverCtx), 227 Handler: user.SystemUserGetHandler(serverCtx),
  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 MiniUserStatisticsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  14 + return func(w http.ResponseWriter, r *http.Request) {
  15 + var req types.UserStatisticsRequest
  16 + if err := httpx.Parse(r, &req); err != nil {
  17 + httpx.ErrorCtx(r.Context(), w, err)
  18 + return
  19 + }
  20 +
  21 + l := user.NewSystemUserStatisticsLogic(r.Context(), svcCtx)
  22 + resp, err := l.SystemUserStatistics(&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 MiniUsersListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  14 + return func(w http.ResponseWriter, r *http.Request) {
  15 + var req types.MiniUsersListRequest
  16 + if err := httpx.Parse(r, &req); err != nil {
  17 + httpx.ErrorCtx(r.Context(), w, err)
  18 + return
  19 + }
  20 +
  21 + l := user.NewMiniAtUsersListLogic(r.Context(), svcCtx)
  22 + resp, err := l.MiniAtUsersList(&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 SystemUsersListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  14 + return func(w http.ResponseWriter, r *http.Request) {
  15 + var req types.MiniUsersListRequest
  16 + if err := httpx.Parse(r, &req); err != nil {
  17 + httpx.ErrorCtx(r.Context(), w, err)
  18 + return
  19 + }
  20 +
  21 + l := user.NewMiniAtUsersListLogic(r.Context(), svcCtx)
  22 + resp, err := l.MiniAtUsersList(&req)
  23 + result.HttpResult(r, w, resp, err)
  24 + }
  25 +}
@@ -42,14 +42,21 @@ func (l *MiniUserInfoLogic) MiniUserInfo(req *types.MiniUserInfoRequest) (resp * @@ -42,14 +42,21 @@ func (l *MiniUserInfoLogic) MiniUserInfo(req *types.MiniUserInfoRequest) (resp *
42 if _, roles, err = l.svcCtx.RoleRepository.Find(l.ctx, conn, domain.IndexCompanyId(user.CompanyId)().MustWithKV("ids", user.Roles)); err != nil { 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) 43 return nil, xerr.NewErrMsgErr("角色不存在", err)
44 } 44 }
  45 +
45 resp = &types.MiniUserInfoResponse{ 46 resp = &types.MiniUserInfoResponse{
46 User: &types.UserItem{ 47 User: &types.UserItem{
47 - Id: user.Id,  
48 - Name: user.Name, 48 + Id: user.Id,
  49 + Name: user.Name,
  50 + Avatar: user.Avatar,
  51 + Position: user.Position,
49 }, 52 },
50 Accounts: make([]types.Account, 0), 53 Accounts: make([]types.Account, 0),
51 Auths: make([]types.Auth, 0), 54 Auths: make([]types.Auth, 0),
52 } 55 }
  56 + if company, _ := domain.LazyLoad(companyMap, l.ctx, conn, user.CompanyId, l.svcCtx.CompanyRepository.FindOne); company != nil {
  57 + resp.User.CompanyName = company.Name
  58 + resp.User.CompanyCode = company.Code
  59 + }
53 _, accounts, err = l.svcCtx.UserRepository.Find(l.ctx, conn, domain.NewQueryOptions().MustWithKV("phone", user.Phone).MustWithKV("auditStatus", []int{domain.UserAuditStatusPassed})) 60 _, accounts, err = l.svcCtx.UserRepository.Find(l.ctx, conn, domain.NewQueryOptions().MustWithKV("phone", user.Phone).MustWithKV("auditStatus", []int{domain.UserAuditStatusPassed}))
54 if err != nil { 61 if err != nil {
55 return nil, xerr.NewErrMsgErr("用户不存在", err) 62 return nil, xerr.NewErrMsgErr("用户不存在", err)
  1 +package user
  2 +
  3 +import (
  4 + "context"
  5 +
  6 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  8 +
  9 + "github.com/zeromicro/go-zero/core/logx"
  10 +)
  11 +
  12 +type MiniUserStatisticsLogic struct {
  13 + logx.Logger
  14 + ctx context.Context
  15 + svcCtx *svc.ServiceContext
  16 +}
  17 +
  18 +func NewMiniUserStatisticsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniUserStatisticsLogic {
  19 + return &MiniUserStatisticsLogic{
  20 + Logger: logx.WithContext(ctx),
  21 + ctx: ctx,
  22 + svcCtx: svcCtx,
  23 + }
  24 +}
  25 +
  26 +func (l *MiniUserStatisticsLogic) MiniUserStatistics(req *types.UserStatisticsRequest) (resp *types.UserStatisticsResponse, err error) {
  27 + // todo: add your logic here and delete this line
  28 +
  29 + return
  30 +}
  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 + "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 MiniAtUsersListLogic struct {
  17 + logx.Logger
  18 + ctx context.Context
  19 + svcCtx *svc.ServiceContext
  20 +}
  21 +
  22 +func NewMiniAtUsersListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniAtUsersListLogic {
  23 + return &MiniAtUsersListLogic{
  24 + Logger: logx.WithContext(ctx),
  25 + ctx: ctx,
  26 + svcCtx: svcCtx,
  27 + }
  28 +}
  29 +
  30 +func (l *MiniAtUsersListLogic) MiniAtUsersList(req *types.MiniUsersListRequest) (resp interface{}, err error) {
  31 + var (
  32 + conn = l.svcCtx.DefaultDBConn()
  33 + article *domain.Article
  34 + users []*domain.User
  35 + userToken = contextdata.GetUserTokenFromCtx(l.ctx)
  36 + onlyUsers []int64
  37 + )
  38 + if req.ArticleId != 0 {
  39 + if article, err = l.svcCtx.ArticleRepository.FindOne(l.ctx, conn, req.ArticleId); err != nil {
  40 + return nil, xerr.NewErrMsgErr("用户列表获取失败", err)
  41 + }
  42 + if article.TargetUser == domain.ArticleTargetLimit && len(article.WhoRead) > 0 {
  43 + onlyUsers = article.WhoRead
  44 + }
  45 + }
  46 + if _, users, err = l.svcCtx.UserRepository.FindDepartmentUsers(l.ctx, conn, userToken.CompanyId, domain.NewQueryOptions().WithFindOnly()); err != nil {
  47 + return nil, xerr.NewErrMsgErr("用户列表获取失败", err)
  48 + }
  49 + if len(onlyUsers) > 0 {
  50 + onlyUsersMap := lo.KeyBy(onlyUsers, func(item int64) int64 {
  51 + return item
  52 + })
  53 + users = lo.Filter(users, func(item *domain.User, index int) bool {
  54 + if _, ok := onlyUsersMap[item.Id]; ok {
  55 + return false
  56 + }
  57 + return true
  58 + })
  59 + }
  60 + var list = make([]*domain.User, 0)
  61 + lo.ForEach(users, func(item *domain.User, index int) {
  62 + list = append(list, &domain.User{
  63 + Id: item.Id,
  64 + Name: item.Name,
  65 + PinYinName: item.PinYinName,
  66 + })
  67 + })
  68 + return map[string]interface{}{
  69 + "list": list,
  70 + }, nil
  71 +}
  1 +package user
  2 +
  3 +import (
  4 + "context"
  5 +
  6 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  8 +
  9 + "github.com/zeromicro/go-zero/core/logx"
  10 +)
  11 +
  12 +type SystemUsersListLogic struct {
  13 + logx.Logger
  14 + ctx context.Context
  15 + svcCtx *svc.ServiceContext
  16 +}
  17 +
  18 +func NewSystemUsersListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemUsersListLogic {
  19 + return &SystemUsersListLogic{
  20 + Logger: logx.WithContext(ctx),
  21 + ctx: ctx,
  22 + svcCtx: svcCtx,
  23 + }
  24 +}
  25 +
  26 +func (l *SystemUsersListLogic) SystemUsersList(req *types.MiniUsersListRequest) error {
  27 + // todo: add your logic here and delete this line
  28 +
  29 + return nil
  30 +}
@@ -325,6 +325,11 @@ type MiniUserDepartmentUsersResponse struct { @@ -325,6 +325,11 @@ type MiniUserDepartmentUsersResponse struct {
325 Users []*UserItem `json:"users"` 325 Users []*UserItem `json:"users"`
326 } 326 }
327 327
  328 +type MiniUsersListRequest struct {
  329 + ArticleId int64 `json:"articleId,optional"` // 按文章ID(返回文章可见的用户)
  330 + RoleId int64 `json:"roleId,optional"` // 按角色角色关联的用户
  331 +}
  332 +
328 type MiniUserFollowedSearchRequest struct { 333 type MiniUserFollowedSearchRequest struct {
329 Page int `json:"page,optional"` 334 Page int `json:"page,optional"`
330 Size int `json:"size,optional"` 335 Size int `json:"size,optional"`
@@ -339,6 +344,7 @@ type UserItem struct { @@ -339,6 +344,7 @@ type UserItem struct {
339 Id int64 `json:"id,omitempty"` // 用户ID 344 Id int64 `json:"id,omitempty"` // 用户ID
340 CompanyId int64 `json:"companyId,omitempty"` // 公司ID 345 CompanyId int64 `json:"companyId,omitempty"` // 公司ID
341 CompanyName string `json:"companyName,omitempty"` // 公司名称 346 CompanyName string `json:"companyName,omitempty"` // 公司名称
  347 + CompanyCode string `json:"companyCode,omitempty"` // 公司编码(邀请码)
342 Flag int `json:"flag,omitempty"` // 标识 1:管理员 2:普通用户 (有绑定角色是管理员) 348 Flag int `json:"flag,omitempty"` // 标识 1:管理员 2:普通用户 (有绑定角色是管理员)
343 Name string `json:"name,omitempty"` // 名称 349 Name string `json:"name,omitempty"` // 名称
344 Avatar string `json:"avatar,omitempty"` // 头像 350 Avatar string `json:"avatar,omitempty"` // 头像