mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
organization
This commit is contained in:
parent
97303eebe4
commit
164a15cfd0
@ -236,7 +236,7 @@ func (s *organizationServer) CreateDepartmentMember(ctx context.Context, req *rp
|
|||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *organizationServer) GetUserInDepartmentByUserID(userID string) (*open_im_sdk.UserInDepartment, error) {
|
func (s *organizationServer) GetUserInDepartmentByUserID(userID string, operationID string) (*open_im_sdk.UserInDepartment, error) {
|
||||||
err, organizationUser := imdb.GetOrganizationUser(userID)
|
err, organizationUser := imdb.GetOrganizationUser(userID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, utils.Wrap(err, "GetOrganizationUser failed")
|
return nil, utils.Wrap(err, "GetOrganizationUser failed")
|
||||||
@ -245,11 +245,13 @@ func (s *organizationServer) GetUserInDepartmentByUserID(userID string) (*open_i
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, utils.Wrap(err, "GetUserInDepartment failed")
|
return nil, utils.Wrap(err, "GetUserInDepartment failed")
|
||||||
}
|
}
|
||||||
|
log.Debug(operationID, "GetUserInDepartment ", departmentMemberList)
|
||||||
resp := &open_im_sdk.UserInDepartment{OrganizationUser: &open_im_sdk.OrganizationUser{}}
|
resp := &open_im_sdk.UserInDepartment{OrganizationUser: &open_im_sdk.OrganizationUser{}}
|
||||||
utils.CopyStructFields(resp.OrganizationUser, organizationUser)
|
utils.CopyStructFields(resp.OrganizationUser, organizationUser)
|
||||||
for _, v := range departmentMemberList {
|
for _, v := range departmentMemberList {
|
||||||
v1 := open_im_sdk.DepartmentMember{}
|
v1 := open_im_sdk.DepartmentMember{}
|
||||||
utils.CopyStructFields(&v1, v)
|
utils.CopyStructFields(&v1, v)
|
||||||
|
log.Debug(operationID, "DepartmentMember src ", v, "dst ", v1)
|
||||||
resp.DepartmentMemberList = append(resp.DepartmentMemberList, &v1)
|
resp.DepartmentMemberList = append(resp.DepartmentMemberList, &v1)
|
||||||
}
|
}
|
||||||
return resp, nil
|
return resp, nil
|
||||||
@ -257,7 +259,7 @@ func (s *organizationServer) GetUserInDepartmentByUserID(userID string) (*open_i
|
|||||||
|
|
||||||
func (s *organizationServer) GetUserInDepartment(ctx context.Context, req *rpc.GetUserInDepartmentReq) (*rpc.GetUserInDepartmentResp, error) {
|
func (s *organizationServer) GetUserInDepartment(ctx context.Context, req *rpc.GetUserInDepartmentReq) (*rpc.GetUserInDepartmentResp, error) {
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " rpc args ", req.String())
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " rpc args ", req.String())
|
||||||
r, err := s.GetUserInDepartmentByUserID(req.UserID)
|
r, err := s.GetUserInDepartmentByUserID(req.UserID, req.OperationID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errMsg := req.OperationID + " " + "GetUserInDepartmentByUserID failed " + err.Error()
|
errMsg := req.OperationID + " " + "GetUserInDepartmentByUserID failed " + err.Error()
|
||||||
log.Error(req.OperationID, errMsg, req.UserID)
|
log.Error(req.OperationID, errMsg, req.UserID)
|
||||||
@ -342,7 +344,7 @@ func (s *organizationServer) GetDepartmentMember(ctx context.Context, req *rpc.G
|
|||||||
|
|
||||||
resp := rpc.GetDepartmentMemberResp{}
|
resp := rpc.GetDepartmentMemberResp{}
|
||||||
for _, v := range departmentMemberUserIDList {
|
for _, v := range departmentMemberUserIDList {
|
||||||
r, err := s.GetUserInDepartmentByUserID(v)
|
r, err := s.GetUserInDepartmentByUserID(v, req.OperationID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.OperationID, "GetUserInDepartmentByUserID failed ", err.Error())
|
log.Error(req.OperationID, "GetUserInDepartmentByUserID failed ", err.Error())
|
||||||
continue
|
continue
|
||||||
|
Loading…
x
Reference in New Issue
Block a user