正在显示
5 个修改的文件
包含
121 行增加
和
11 行删除
pkg/domain/cooperation_info.go
0 → 100644
| @@ -3,11 +3,20 @@ package domain | @@ -3,11 +3,20 @@ package domain | ||
| 3 | // 用户基础信息 | 3 | // 用户基础信息 |
| 4 | type Users struct { | 4 | type Users struct { |
| 5 | // 用户id | 5 | // 用户id |
| 6 | - UserId string `json:"userId"` | 6 | + UserId string `json:"userId"` |
| 7 | + UserBaseId int64 `json:"userBaseId"` | ||
| 8 | + UserType int `json:"userType"` | ||
| 9 | + UserCode string `json:"userCode"` | ||
| 10 | + // 用户状态,1启用,2禁用 | ||
| 11 | + EnableStatus int32 `json:"enableStatus"` | ||
| 12 | + //共创信息 | ||
| 13 | + CooperationInfo *CooperationInfo `json:"cooperationInfo,omitempty,"` | ||
| 7 | // 用户基础信息 | 14 | // 用户基础信息 |
| 8 | - UserInfo *UsersBase `json:"userInfo,omitempty"` | 15 | + UserInfo *UsersBase `json:"userInfo,omitempty,"` |
| 9 | // 用户的组织 | 16 | // 用户的组织 |
| 10 | - Org *Orgs `json:"org,omitempty"` | 17 | + Org *Orgs `json:"org,omitempty,"` |
| 11 | // 用户的部门 | 18 | // 用户的部门 |
| 12 | - Department *Department `json:"department,omitempty"` | 19 | + Department *Department `json:"department,omitempty,"` |
| 20 | + | ||
| 21 | + Company *CompanyInfo `json:"company"` | ||
| 13 | } | 22 | } |
| @@ -4,8 +4,6 @@ package domain | @@ -4,8 +4,6 @@ package domain | ||
| 4 | type UsersBase struct { | 4 | type UsersBase struct { |
| 5 | // 手机号码 | 5 | // 手机号码 |
| 6 | Phone string `json:"phone"` | 6 | Phone string `json:"phone"` |
| 7 | - // 用户状态,1启用,2禁用 | ||
| 8 | - EnableStatus int32 `json:"enableStatus"` | ||
| 9 | // 用户编号 | 7 | // 用户编号 |
| 10 | UserCode string `json:"userCode"` | 8 | UserCode string `json:"userCode"` |
| 11 | // 用户编号 | 9 | // 用户编号 |
| @@ -14,8 +12,4 @@ type UsersBase struct { | @@ -14,8 +12,4 @@ type UsersBase struct { | ||
| 14 | UserName string `json:"userName"` | 12 | UserName string `json:"userName"` |
| 15 | // 邮箱 | 13 | // 邮箱 |
| 16 | Email string `json:"email"` | 14 | Email string `json:"email"` |
| 17 | - // 共创公司 | ||
| 18 | - CooperationCompany string `json:"cooperationCompany"` | ||
| 19 | - // 共创公司到期时间 | ||
| 20 | - CooperationDeadline string `json:"cooperationDeadline"` | ||
| 21 | } | 15 | } |
| 1 | package allied_creation_user | 1 | package allied_creation_user |
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "encoding/json" | ||
| 5 | + "fmt" | ||
| 6 | + | ||
| 7 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway" | ||
| 8 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log" | ||
| 9 | +) | ||
| 10 | + | ||
| 11 | +//RoleSearch 搜索角色列表 | ||
| 12 | +func (gateway HttplibAlliedCreationUser) RoleSearch(param ReqRoleSearch) (*DataRoleSearch, error) { | ||
| 13 | + url := gateway.baseUrL + "/role/search" | ||
| 14 | + method := "post" | ||
| 15 | + req := gateway.CreateRequest(url, method) | ||
| 16 | + //TODO traceID | ||
| 17 | + log.Logger.Debug("向用户模块请求数据:搜索角色列表。", map[string]interface{}{ | ||
| 18 | + "api": method + ":" + url, | ||
| 19 | + "param": param, | ||
| 20 | + }) | ||
| 21 | + req, err := req.JSONBody(param) | ||
| 22 | + if err != nil { | ||
| 23 | + return nil, fmt.Errorf("搜索角色列表失败:%w", err) | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + byteResult, err := req.Bytes() | ||
| 27 | + if err != nil { | ||
| 28 | + return nil, fmt.Errorf("获取搜索角色列表失败:%w", err) | ||
| 29 | + } | ||
| 30 | + log.Logger.Debug("获取用户模块请求数据:搜索角色列表。", map[string]interface{}{ | ||
| 31 | + "result": string(byteResult), | ||
| 32 | + }) | ||
| 33 | + var result service_gateway.GatewayResponse | ||
| 34 | + err = json.Unmarshal(byteResult, &result) | ||
| 35 | + if err != nil { | ||
| 36 | + return nil, fmt.Errorf("解析搜索角色列表:%w", err) | ||
| 37 | + } | ||
| 38 | + var data DataRoleSearch | ||
| 39 | + err = gateway.GetResponseData(result, &data) | ||
| 40 | + return &data, err | ||
| 41 | +} | ||
| 42 | + | ||
| 43 | +//RoleGet 获取角色 | ||
| 44 | +func (gateway HttplibAlliedCreationUser) RoleGet(param ReqRoleGet) (*DataRoleGet, error) { | ||
| 45 | + url := fmt.Sprintf("%s%s%d", gateway.baseUrL, "/role/", param.RoleId) | ||
| 46 | + method := "get" | ||
| 47 | + req := gateway.CreateRequest(url, method) | ||
| 48 | + //TODO traceID | ||
| 49 | + log.Logger.Debug("向用户模块请求数据:获取角色。", map[string]interface{}{ | ||
| 50 | + "api": method + ":" + url, | ||
| 51 | + "param": param, | ||
| 52 | + }) | ||
| 53 | + req, err := req.JSONBody(param) | ||
| 54 | + if err != nil { | ||
| 55 | + return nil, fmt.Errorf("请求获取角色失败:%w", err) | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + byteResult, err := req.Bytes() | ||
| 59 | + if err != nil { | ||
| 60 | + return nil, fmt.Errorf("获取获取角色失败:%w", err) | ||
| 61 | + } | ||
| 62 | + log.Logger.Debug("获取用户模块请求数据:获取角色。", map[string]interface{}{ | ||
| 63 | + "result": string(byteResult), | ||
| 64 | + }) | ||
| 65 | + var result service_gateway.GatewayResponse | ||
| 66 | + err = json.Unmarshal(byteResult, &result) | ||
| 67 | + if err != nil { | ||
| 68 | + return nil, fmt.Errorf("解析获取角色:%w", err) | ||
| 69 | + } | ||
| 70 | + var data DataRoleGet | ||
| 71 | + err = gateway.GetResponseData(result, &data) | ||
| 72 | + return &data, err | ||
| 73 | +} |
| @@ -2,6 +2,8 @@ package allied_creation_user | @@ -2,6 +2,8 @@ package allied_creation_user | ||
| 2 | 2 | ||
| 3 | import "time" | 3 | import "time" |
| 4 | 4 | ||
| 5 | +//################用户模块################## | ||
| 6 | + | ||
| 5 | //搜索用户列表 | 7 | //搜索用户列表 |
| 6 | type ( | 8 | type ( |
| 7 | ReqUserSearch struct { | 9 | ReqUserSearch struct { |
| @@ -31,8 +33,8 @@ type ( | @@ -31,8 +33,8 @@ type ( | ||
| 31 | CompanyID int `json:"companyId"` | 33 | CompanyID int `json:"companyId"` |
| 32 | UserBaseID int `json:"userBaseId"` | 34 | UserBaseID int `json:"userBaseId"` |
| 33 | UserType int `json:"userType"` | 35 | UserType int `json:"userType"` |
| 34 | - UserCode string `json:"userCode"` | ||
| 35 | UserName string `json:"userName"` | 36 | UserName string `json:"userName"` |
| 37 | + UserCode string `json:"userCode"` | ||
| 36 | OrganizationID int `json:"organizationId"` | 38 | OrganizationID int `json:"organizationId"` |
| 37 | DepartmentID int `json:"departmentId"` | 39 | DepartmentID int `json:"departmentId"` |
| 38 | UserOrg []struct { | 40 | UserOrg []struct { |
| @@ -221,3 +223,28 @@ type ( | @@ -221,3 +223,28 @@ type ( | ||
| 221 | DataUserAccessMenus struct { | 223 | DataUserAccessMenus struct { |
| 222 | } | 224 | } |
| 223 | ) | 225 | ) |
| 226 | + | ||
| 227 | +//################角色模块################## | ||
| 228 | + | ||
| 229 | +//搜索角色列表 | ||
| 230 | +type ( | ||
| 231 | + ReqRoleSearch struct { | ||
| 232 | + // 查询偏离量 | ||
| 233 | + Offset int `json:"offset"` | ||
| 234 | + // 查询限制 | ||
| 235 | + Limit int `json:"limit"` | ||
| 236 | + } | ||
| 237 | + | ||
| 238 | + DataRoleSearch struct { | ||
| 239 | + } | ||
| 240 | +) | ||
| 241 | + | ||
| 242 | +//获取角色 | ||
| 243 | +type ( | ||
| 244 | + ReqRoleGet struct { | ||
| 245 | + RoleId int64 `json:"roleId"` | ||
| 246 | + } | ||
| 247 | + | ||
| 248 | + DataRoleGet struct { | ||
| 249 | + } | ||
| 250 | +) |
-
请 注册 或 登录 后发表评论