|
|
@ -595,17 +595,19 @@ func (s *groupServer) TransferGroupOwner(_ context.Context, req *pbGroup.Transfe
|
|
|
|
log.NewInfo(req.OperationID, "TransferGroupOwner ", req.String())
|
|
|
|
log.NewInfo(req.OperationID, "TransferGroupOwner ", req.String())
|
|
|
|
|
|
|
|
|
|
|
|
if req.OldOwnerUserID == req.NewOwnerUserID {
|
|
|
|
if req.OldOwnerUserID == req.NewOwnerUserID {
|
|
|
|
log.NewError(req.OperationID, "same owner ", req.String())
|
|
|
|
log.NewError(req.OperationID, "same owner ", req.OldOwnerUserID, req.NewOwnerUserID)
|
|
|
|
return &pbGroup.TransferGroupOwnerResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrArgs.ErrCode, ErrMsg: constant.ErrArgs.ErrMsg}}, nil
|
|
|
|
return &pbGroup.TransferGroupOwnerResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrArgs.ErrCode, ErrMsg: constant.ErrArgs.ErrMsg}}, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
groupMemberInfo := imdb.GroupMember{GroupID: req.GroupID, UserID: req.OldOwnerUserID, RoleLevel: 0}
|
|
|
|
groupMemberInfo := imdb.GroupMember{GroupID: req.GroupID, UserID: req.OldOwnerUserID, RoleLevel: constant.GroupOrdinaryUsers}
|
|
|
|
err := imdb.UpdateGroupMemberInfo(groupMemberInfo)
|
|
|
|
err := imdb.UpdateGroupMemberInfo(groupMemberInfo)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
log.NewError(req.OperationID, "UpdateGroupMemberInfo failed ", groupMemberInfo)
|
|
|
|
return &pbGroup.TransferGroupOwnerResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil
|
|
|
|
return &pbGroup.TransferGroupOwnerResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
groupMemberInfo = imdb.GroupMember{GroupID: req.GroupID, UserID: req.NewOwnerUserID, RoleLevel: 1}
|
|
|
|
groupMemberInfo = imdb.GroupMember{GroupID: req.GroupID, UserID: req.NewOwnerUserID, RoleLevel: constant.GroupOwner}
|
|
|
|
err = imdb.UpdateGroupMemberInfo(groupMemberInfo)
|
|
|
|
err = imdb.UpdateGroupMemberInfo(groupMemberInfo)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
log.NewError(req.OperationID, "UpdateGroupMemberInfo failed ", groupMemberInfo)
|
|
|
|
return &pbGroup.TransferGroupOwnerResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil
|
|
|
|
return &pbGroup.TransferGroupOwnerResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
changedType := int32(1) << 4
|
|
|
|
changedType := int32(1) << 4
|
|
|
|