作者 tangxuhui

更新

package domain
type CooperationInfo struct {
// 共创公司
CooperationCompany string `json:"cooperationCompany"`
// 共创公司到期时间
CooperationDeadline string `json:"cooperationDeadline"`
}
... ...
... ... @@ -4,10 +4,19 @@ package domain
type Users struct {
// 用户id
UserId string `json:"userId"`
UserBaseId int64 `json:"userBaseId"`
UserType int `json:"userType"`
UserCode string `json:"userCode"`
// 用户状态,1启用,2禁用
EnableStatus int32 `json:"enableStatus"`
//共创信息
CooperationInfo *CooperationInfo `json:"cooperationInfo,omitempty,"`
// 用户基础信息
UserInfo *UsersBase `json:"userInfo,omitempty"`
UserInfo *UsersBase `json:"userInfo,omitempty,"`
// 用户的组织
Org *Orgs `json:"org,omitempty"`
Org *Orgs `json:"org,omitempty,"`
// 用户的部门
Department *Department `json:"department,omitempty"`
Department *Department `json:"department,omitempty,"`
Company *CompanyInfo `json:"company"`
}
... ...
... ... @@ -4,8 +4,6 @@ package domain
type UsersBase struct {
// 手机号码
Phone string `json:"phone"`
// 用户状态,1启用,2禁用
EnableStatus int32 `json:"enableStatus"`
// 用户编号
UserCode string `json:"userCode"`
// 用户编号
... ... @@ -14,8 +12,4 @@ type UsersBase struct {
UserName string `json:"userName"`
// 邮箱
Email string `json:"email"`
// 共创公司
CooperationCompany string `json:"cooperationCompany"`
// 共创公司到期时间
CooperationDeadline string `json:"cooperationDeadline"`
}
... ...
package allied_creation_user
import (
"encoding/json"
"fmt"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
)
//RoleSearch 搜索角色列表
func (gateway HttplibAlliedCreationUser) RoleSearch(param ReqRoleSearch) (*DataRoleSearch, error) {
url := gateway.baseUrL + "/role/search"
method := "post"
req := gateway.CreateRequest(url, method)
//TODO traceID
log.Logger.Debug("向用户模块请求数据:搜索角色列表。", map[string]interface{}{
"api": method + ":" + url,
"param": param,
})
req, err := req.JSONBody(param)
if err != nil {
return nil, fmt.Errorf("搜索角色列表失败:%w", err)
}
byteResult, err := req.Bytes()
if err != nil {
return nil, fmt.Errorf("获取搜索角色列表失败:%w", err)
}
log.Logger.Debug("获取用户模块请求数据:搜索角色列表。", map[string]interface{}{
"result": string(byteResult),
})
var result service_gateway.GatewayResponse
err = json.Unmarshal(byteResult, &result)
if err != nil {
return nil, fmt.Errorf("解析搜索角色列表:%w", err)
}
var data DataRoleSearch
err = gateway.GetResponseData(result, &data)
return &data, err
}
//RoleGet 获取角色
func (gateway HttplibAlliedCreationUser) RoleGet(param ReqRoleGet) (*DataRoleGet, error) {
url := fmt.Sprintf("%s%s%d", gateway.baseUrL, "/role/", param.RoleId)
method := "get"
req := gateway.CreateRequest(url, method)
//TODO traceID
log.Logger.Debug("向用户模块请求数据:获取角色。", map[string]interface{}{
"api": method + ":" + url,
"param": param,
})
req, err := req.JSONBody(param)
if err != nil {
return nil, fmt.Errorf("请求获取角色失败:%w", err)
}
byteResult, err := req.Bytes()
if err != nil {
return nil, fmt.Errorf("获取获取角色失败:%w", err)
}
log.Logger.Debug("获取用户模块请求数据:获取角色。", map[string]interface{}{
"result": string(byteResult),
})
var result service_gateway.GatewayResponse
err = json.Unmarshal(byteResult, &result)
if err != nil {
return nil, fmt.Errorf("解析获取角色:%w", err)
}
var data DataRoleGet
err = gateway.GetResponseData(result, &data)
return &data, err
}
... ...
... ... @@ -2,6 +2,8 @@ package allied_creation_user
import "time"
//################用户模块##################
//搜索用户列表
type (
ReqUserSearch struct {
... ... @@ -31,8 +33,8 @@ type (
CompanyID int `json:"companyId"`
UserBaseID int `json:"userBaseId"`
UserType int `json:"userType"`
UserCode string `json:"userCode"`
UserName string `json:"userName"`
UserCode string `json:"userCode"`
OrganizationID int `json:"organizationId"`
DepartmentID int `json:"departmentId"`
UserOrg []struct {
... ... @@ -221,3 +223,28 @@ type (
DataUserAccessMenus struct {
}
)
//################角色模块##################
//搜索角色列表
type (
ReqRoleSearch struct {
// 查询偏离量
Offset int `json:"offset"`
// 查询限制
Limit int `json:"limit"`
}
DataRoleSearch struct {
}
)
//获取角色
type (
ReqRoleGet struct {
RoleId int64 `json:"roleId"`
}
DataRoleGet struct {
}
)
... ...