mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-05-19 19:05:15 +08:00
Merge branch 'errcode' of github.com:OpenIMSDK/Open-IM-Server into errcode
This commit is contained in:
commit
4688767c51
@ -147,15 +147,15 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR
|
|||||||
return nil, constant.ErrArgs.Wrap("no group owner")
|
return nil, constant.ErrArgs.Wrap("no group owner")
|
||||||
}
|
}
|
||||||
var userIDs []string
|
var userIDs []string
|
||||||
for _, ordinaryUserID := range req.InitMemberList {
|
for _, userID := range req.InitMemberList {
|
||||||
userIDs = append(userIDs, ordinaryUserID)
|
userIDs = append(userIDs, userID)
|
||||||
|
}
|
||||||
|
for _, userID := range req.AdminUserIDs {
|
||||||
|
userIDs = append(userIDs, userID)
|
||||||
}
|
}
|
||||||
userIDs = append(userIDs, req.OwnerUserID)
|
userIDs = append(userIDs, req.OwnerUserID)
|
||||||
for _, adminUserID := range req.AdminUserIDs {
|
|
||||||
userIDs = append(userIDs, adminUserID)
|
|
||||||
}
|
|
||||||
if utils.IsDuplicateID(userIDs) {
|
if utils.IsDuplicateID(userIDs) {
|
||||||
return nil, constant.ErrArgs.Wrap("group member is repeated")
|
return nil, constant.ErrArgs.Wrap("group member repeated")
|
||||||
}
|
}
|
||||||
users, err := getUsersInfo(ctx, userIDs)
|
users, err := getUsersInfo(ctx, userIDs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -165,68 +165,61 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR
|
|||||||
for i, user := range users {
|
for i, user := range users {
|
||||||
userMap[user.UserID] = users[i]
|
userMap[user.UserID] = users[i]
|
||||||
}
|
}
|
||||||
|
for _, userID := range userIDs {
|
||||||
|
if userMap[userID] == nil {
|
||||||
|
return nil, constant.ErrUserIDNotFound.Wrap(userID)
|
||||||
|
}
|
||||||
|
}
|
||||||
if err := callbackBeforeCreateGroup(ctx, req); err != nil {
|
if err := callbackBeforeCreateGroup(ctx, req); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
var groupInfo relation.Group
|
var group relation.Group
|
||||||
utils.CopyStructFields(&groupInfo, req.GroupInfo)
|
var groupMembers []*relation.GroupMember
|
||||||
|
utils.CopyStructFields(&group, req.GroupInfo)
|
||||||
groupInfo, err := (&cp.PBGroup{req.GroupInfo}).Convert()
|
group.GroupID = genGroupID(ctx, req.GroupInfo.GroupID)
|
||||||
groupInfo.GroupID = genGroupID(ctx, req.GroupInfo.GroupID)
|
if req.GroupInfo.GroupType == constant.SuperGroup {
|
||||||
if req.GroupInfo.GroupType != constant.SuperGroup {
|
if err := s.GroupInterface.CreateSuperGroup(ctx, group.GroupID, userIDs); err != nil {
|
||||||
var groupMembers []*relation.GroupMember
|
return nil, err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
opUserID := tools.OpUserID(ctx)
|
||||||
joinGroup := func(userID string, roleLevel int32) error {
|
joinGroup := func(userID string, roleLevel int32) error {
|
||||||
groupMember := &relation.GroupMember{GroupID: groupInfo.GroupID, RoleLevel: roleLevel, OperatorUserID: tools.OpUserID(ctx), JoinSource: constant.JoinByInvitation, InviterUserID: tools.OpUserID(ctx)}
|
|
||||||
user := userMap[userID]
|
user := userMap[userID]
|
||||||
|
groupMember := &relation.GroupMember{GroupID: group.GroupID, RoleLevel: roleLevel, OperatorUserID: opUserID, JoinSource: constant.JoinByInvitation, InviterUserID: opUserID}
|
||||||
utils.CopyStructFields(&groupMember, user)
|
utils.CopyStructFields(&groupMember, user)
|
||||||
if err := CallbackBeforeMemberJoinGroup(ctx, tools.OperationID(ctx), groupMember, groupInfo.Ex); err != nil {
|
if err := CallbackBeforeMemberJoinGroup(ctx, tools.OperationID(ctx), groupMember, group.Ex); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
groupMembers = append(groupMembers, groupMember)
|
groupMembers = append(groupMembers, groupMember)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := joinGroup(req.OwnerUserID, constant.GroupOwner); err != nil {
|
if err := joinGroup(req.OwnerUserID, constant.GroupOwner); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
for _, userID := range req.AdminUserIDs {
|
||||||
for _, info := range req.InitMemberList {
|
if err := joinGroup(userID, constant.GroupAdmin); err != nil {
|
||||||
if err := joinGroup(info, constant.GroupOrdinaryUsers); err != nil {
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for _, info := range req.AdminUserIDs {
|
for _, userID := range req.InitMemberList {
|
||||||
if err := joinGroup(info, constant.GroupAdmin); err != nil {
|
if err := joinGroup(userID, constant.GroupOrdinaryUsers); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err := (*relation.GroupMember)(nil).Create(ctx, groupMembers); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
if err := db.DB.CreateSuperGroup(groupId, userIDs, len(userIDs)); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if err := (*relation.Group)(nil).Create(ctx, []*relation.Group{&groupInfo}); err != nil {
|
if err := s.GroupInterface.CreateGroup(ctx, []*relation.Group{&group}, groupMembers); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
utils.CopyStructFields(resp.GroupInfo, groupInfo)
|
utils.CopyStructFields(resp.GroupInfo, group)
|
||||||
resp.GroupInfo.MemberCount = uint32(len(userIDs))
|
resp.GroupInfo.MemberCount = uint32(len(userIDs))
|
||||||
if req.GroupInfo.GroupType != constant.SuperGroup {
|
if req.GroupInfo.GroupType == constant.SuperGroup {
|
||||||
chat.GroupCreatedNotification(tools.OperationID(ctx), tools.OpUserID(ctx), groupId, userIDs)
|
|
||||||
} else {
|
|
||||||
for _, userID := range userIDs {
|
|
||||||
if err := rocksCache.DelJoinedSuperGroupIDListFromCache(ctx, userID); err != nil {
|
|
||||||
trace_log.SetCtxInfo(ctx, "DelJoinedSuperGroupIDListFromCache", err, "userID", userID)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
go func() {
|
go func() {
|
||||||
for _, v := range userIDs {
|
for _, userID := range userIDs {
|
||||||
chat.SuperGroupNotification(tools.OperationID(ctx), v, v)
|
chat.SuperGroupNotification(tools.OperationID(ctx), userID, userID)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
} else {
|
||||||
|
chat.GroupCreatedNotification(tools.OperationID(ctx), tools.OpUserID(ctx), group.GroupID, userIDs)
|
||||||
}
|
}
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
@ -4,9 +4,8 @@ import (
|
|||||||
chat "Open_IM/internal/rpc/msg"
|
chat "Open_IM/internal/rpc/msg"
|
||||||
"Open_IM/pkg/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"Open_IM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/db"
|
"Open_IM/pkg/common/db/controller"
|
||||||
imdb "Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
"Open_IM/pkg/common/db/relation"
|
||||||
rocksCache "Open_IM/pkg/common/db/rocks_cache"
|
|
||||||
"Open_IM/pkg/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
promePkg "Open_IM/pkg/common/prometheus"
|
promePkg "Open_IM/pkg/common/prometheus"
|
||||||
"Open_IM/pkg/common/token_verify"
|
"Open_IM/pkg/common/token_verify"
|
||||||
@ -24,6 +23,7 @@ import (
|
|||||||
|
|
||||||
grpcPrometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
|
grpcPrometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
|
||||||
|
|
||||||
|
utils2 "Open_IM/internal/utils"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
@ -33,16 +33,31 @@ type userServer struct {
|
|||||||
rpcRegisterName string
|
rpcRegisterName string
|
||||||
etcdSchema string
|
etcdSchema string
|
||||||
etcdAddr []string
|
etcdAddr []string
|
||||||
|
controller.UserInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewUserServer(port int) *userServer {
|
func NewUserServer(port int) *userServer {
|
||||||
log.NewPrivateLog(constant.LogFileName)
|
log.NewPrivateLog(constant.LogFileName)
|
||||||
return &userServer{
|
u := userServer{
|
||||||
rpcPort: port,
|
rpcPort: port,
|
||||||
rpcRegisterName: config.Config.RpcRegisterName.OpenImUserName,
|
rpcRegisterName: config.Config.RpcRegisterName.OpenImUserName,
|
||||||
etcdSchema: config.Config.Etcd.EtcdSchema,
|
etcdSchema: config.Config.Etcd.EtcdSchema,
|
||||||
etcdAddr: config.Config.Etcd.EtcdAddr,
|
etcdAddr: config.Config.Etcd.EtcdAddr,
|
||||||
}
|
}
|
||||||
|
//mysql init
|
||||||
|
var mysql relation.Mysql
|
||||||
|
var model relation.User
|
||||||
|
err := mysql.InitConn().AutoMigrateModel(&model)
|
||||||
|
if err != nil {
|
||||||
|
panic("db init err:" + err.Error())
|
||||||
|
}
|
||||||
|
if mysql.GormConn() != nil {
|
||||||
|
model.DB = mysql.GormConn()
|
||||||
|
} else {
|
||||||
|
panic("db init err:" + "conn is nil")
|
||||||
|
}
|
||||||
|
u.UserInterface = controller.NewUserController(model.DB)
|
||||||
|
return &u
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *userServer) Run() {
|
func (s *userServer) Run() {
|
||||||
@ -124,25 +139,19 @@ func syncPeerUserConversation(conversation *pbConversation.Conversation, operati
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *userServer) GetUserInfo(ctx context.Context, req *pbUser.GetUserInfoReq) (*pbUser.GetUserInfoResp, error) {
|
func (s *userServer) GetUserInfo(ctx context.Context, req *pbUser.GetUserInfoReq) (*pbUser.GetUserInfoResp, error) {
|
||||||
log.NewInfo(req.OperationID, "GetUserInfo args ", req.String())
|
resp := &pbUser.GetUserInfoResp{}
|
||||||
var userInfoList []*sdkws.UserInfo
|
users, err := s.Find(ctx, req.UserIDList)
|
||||||
if len(req.UserIDList) > 0 {
|
if err != nil {
|
||||||
for _, userID := range req.UserIDList {
|
return nil, err
|
||||||
var userInfo sdkws.UserInfo
|
|
||||||
user, err := rocksCache.GetUserInfoFromCache(userID)
|
|
||||||
if err != nil {
|
|
||||||
log.NewError(req.OperationID, "GetUserByUserID failed ", err.Error(), userID)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
utils.CopyStructFields(&userInfo, user)
|
|
||||||
userInfo.BirthStr = utils.TimeToString(user.Birth)
|
|
||||||
userInfoList = append(userInfoList, &userInfo)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return &pbUser.GetUserInfoResp{CommonResp: &pbUser.CommonResp{ErrCode: constant.ErrArgs.ErrCode, ErrMsg: constant.ErrArgs.ErrMsg}}, nil
|
|
||||||
}
|
}
|
||||||
log.NewInfo(req.OperationID, "GetUserInfo rpc return ", pbUser.GetUserInfoResp{CommonResp: &pbUser.CommonResp{}, UserInfoList: userInfoList})
|
for _, v := range users {
|
||||||
return &pbUser.GetUserInfoResp{CommonResp: &pbUser.CommonResp{}, UserInfoList: userInfoList}, nil
|
n, err := utils2.NewDBUser(v).Convert()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
resp.UserInfoList = append(resp.UserInfoList, n)
|
||||||
|
}
|
||||||
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *userServer) BatchSetConversations(ctx context.Context, req *pbUser.BatchSetConversationsReq) (*pbUser.BatchSetConversationsResp, error) {
|
func (s *userServer) BatchSetConversations(ctx context.Context, req *pbUser.BatchSetConversationsReq) (*pbUser.BatchSetConversationsResp, error) {
|
||||||
@ -395,41 +404,32 @@ func (s *userServer) AccountCheck(_ context.Context, req *pbUser.AccountCheckReq
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbUser.UpdateUserInfoReq) (*pbUser.UpdateUserInfoResp, error) {
|
func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbUser.UpdateUserInfoReq) (*pbUser.UpdateUserInfoResp, error) {
|
||||||
log.NewInfo(req.OperationID, "UpdateUserInfo args ", req.String())
|
resp := pbUser.UpdateUserInfoResp{}
|
||||||
if !token_verify.CheckAccess(req.OpUserID, req.UserInfo.UserID) {
|
err := token_verify.CheckAccessV3(ctx, req.UserInfo.UserID)
|
||||||
log.NewError(req.OperationID, "CheckAccess false ", req.OpUserID, req.UserInfo.UserID)
|
if err != nil {
|
||||||
return &pbUser.UpdateUserInfoResp{CommonResp: &pbUser.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}}, nil
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
oldNickname := ""
|
oldNickname := ""
|
||||||
if req.UserInfo.Nickname != "" {
|
if req.UserInfo.Nickname != "" {
|
||||||
u, err := imdb.GetUserByUserID(req.UserInfo.UserID)
|
u, err := s.Take(ctx, req.UserInfo.UserID)
|
||||||
if err == nil {
|
|
||||||
oldNickname = u.Nickname
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var user imdb.User
|
|
||||||
utils.CopyStructFields(&user, req.UserInfo)
|
|
||||||
|
|
||||||
if req.UserInfo.BirthStr != "" {
|
|
||||||
time, err := utils.TimeStringToTime(req.UserInfo.BirthStr)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.NewError(req.OperationID, "TimeStringToTime failed ", err.Error(), req.UserInfo.BirthStr)
|
return nil, err
|
||||||
return &pbUser.UpdateUserInfoResp{CommonResp: &pbUser.CommonResp{ErrCode: constant.ErrArgs.ErrCode, ErrMsg: "TimeStringToTime failed:" + err.Error()}}, nil
|
|
||||||
}
|
}
|
||||||
user.Birth = time
|
oldNickname = u.Nickname
|
||||||
}
|
}
|
||||||
|
|
||||||
err := imdb.UpdateUserInfo(user)
|
user, err := utils2.NewPBUser(req.UserInfo).Convert()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.NewError(req.OperationID, "UpdateUserInfo failed ", err.Error(), user)
|
return nil, err
|
||||||
return &pbUser.UpdateUserInfoResp{CommonResp: &pbUser.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil
|
|
||||||
}
|
}
|
||||||
etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.OperationID)
|
err = s.Update(ctx, []*relation.User{user})
|
||||||
if etcdConn == nil {
|
if err != nil {
|
||||||
errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil"
|
return nil, err
|
||||||
log.NewError(req.OperationID, errMsg)
|
}
|
||||||
return &pbUser.UpdateUserInfoResp{CommonResp: &pbUser.CommonResp{ErrCode: constant.ErrInternal.ErrCode, ErrMsg: errMsg}}, nil
|
etcdConn, err := getcdv3.GetConn(ctx, config.Config.RpcRegisterName.OpenImFriendName)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
client := pbFriend.NewFriendClient(etcdConn)
|
client := pbFriend.NewFriendClient(etcdConn)
|
||||||
@ -644,84 +644,3 @@ func (s *userServer) AddUser(ctx context.Context, req *pbUser.AddUserReq) (*pbUs
|
|||||||
}
|
}
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *userServer) BlockUser(ctx context.Context, req *pbUser.BlockUserReq) (*pbUser.BlockUserResp, error) {
|
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String())
|
|
||||||
resp := &pbUser.BlockUserResp{CommonResp: &pbUser.CommonResp{}}
|
|
||||||
err := imdb.BlockUser(req.UserID, req.EndDisableTime)
|
|
||||||
if err != nil {
|
|
||||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "BlockUser", err.Error(), req.UserID, req.EndDisableTime)
|
|
||||||
resp.CommonResp.ErrCode = constant.ErrDB.ErrCode
|
|
||||||
resp.CommonResp.ErrMsg = err.Error()
|
|
||||||
return resp, nil
|
|
||||||
}
|
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String())
|
|
||||||
return resp, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *userServer) UnBlockUser(ctx context.Context, req *pbUser.UnBlockUserReq) (*pbUser.UnBlockUserResp, error) {
|
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String())
|
|
||||||
resp := &pbUser.UnBlockUserResp{CommonResp: &pbUser.CommonResp{}}
|
|
||||||
err := imdb.UnBlockUser(req.UserID)
|
|
||||||
if err != nil {
|
|
||||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "unBlockUser", err.Error())
|
|
||||||
resp.CommonResp.ErrCode = constant.ErrDB.ErrCode
|
|
||||||
resp.CommonResp.ErrMsg = err.Error()
|
|
||||||
return resp, nil
|
|
||||||
}
|
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String())
|
|
||||||
return resp, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *userServer) GetBlockUsers(ctx context.Context, req *pbUser.GetBlockUsersReq) (resp *pbUser.GetBlockUsersResp, err error) {
|
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String())
|
|
||||||
resp = &pbUser.GetBlockUsersResp{CommonResp: &pbUser.CommonResp{}, Pagination: &sdkws.ResponsePagination{ShowNumber: req.Pagination.ShowNumber, CurrentPage: req.Pagination.PageNumber}}
|
|
||||||
var blockUsers []imdb.BlockUserInfo
|
|
||||||
if req.UserID != "" {
|
|
||||||
blockUser, err := imdb.GetBlockUserByID(req.UserID)
|
|
||||||
if err != nil {
|
|
||||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
|
||||||
return resp, nil
|
|
||||||
}
|
|
||||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), req.UserID)
|
|
||||||
resp.CommonResp.ErrCode = constant.ErrDB.ErrCode
|
|
||||||
resp.CommonResp.ErrMsg = err.Error()
|
|
||||||
return resp, nil
|
|
||||||
}
|
|
||||||
blockUsers = append(blockUsers, blockUser)
|
|
||||||
resp.UserNums = 1
|
|
||||||
} else {
|
|
||||||
blockUsers, err = imdb.GetBlockUsers(req.Pagination.ShowNumber, req.Pagination.PageNumber)
|
|
||||||
if err != nil {
|
|
||||||
log.Error(req.OperationID, utils.GetSelfFuncName(), "GetBlockUsers", err.Error(), req.Pagination.ShowNumber, req.Pagination.PageNumber)
|
|
||||||
resp.CommonResp.ErrCode = constant.ErrDB.ErrCode
|
|
||||||
resp.CommonResp.ErrMsg = err.Error()
|
|
||||||
return resp, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
nums, err := imdb.GetBlockUsersNumCount()
|
|
||||||
if err != nil {
|
|
||||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetBlockUsersNumCount failed", err.Error())
|
|
||||||
resp.CommonResp.ErrCode = constant.ErrDB.ErrCode
|
|
||||||
resp.CommonResp.ErrMsg = err.Error()
|
|
||||||
return resp, nil
|
|
||||||
}
|
|
||||||
resp.UserNums = nums
|
|
||||||
}
|
|
||||||
for _, v := range blockUsers {
|
|
||||||
resp.BlockUsers = append(resp.BlockUsers, &pbUser.BlockUser{
|
|
||||||
UserInfo: &sdkws.UserInfo{
|
|
||||||
FaceURL: v.User.FaceURL,
|
|
||||||
Nickname: v.User.Nickname,
|
|
||||||
UserID: v.User.UserID,
|
|
||||||
PhoneNumber: v.User.PhoneNumber,
|
|
||||||
Email: v.User.Email,
|
|
||||||
Gender: v.User.Gender,
|
|
||||||
},
|
|
||||||
BeginDisableTime: (v.BeginDisableTime).String(),
|
|
||||||
EndDisableTime: (v.EndDisableTime).String(),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
|
|
||||||
return resp, nil
|
|
||||||
}
|
|
||||||
|
@ -2,7 +2,7 @@ package controller
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/db/cache"
|
"Open_IM/pkg/common/db/cache"
|
||||||
"Open_IM/pkg/common/db/mysql"
|
"Open_IM/pkg/common/db/relation"
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
@ -2,7 +2,6 @@ package controller
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/db/cache"
|
"Open_IM/pkg/common/db/cache"
|
||||||
"Open_IM/pkg/common/db/mysql"
|
|
||||||
"Open_IM/pkg/common/db/relation"
|
"Open_IM/pkg/common/db/relation"
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
|
@ -2,7 +2,7 @@ package controller
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/db/cache"
|
"Open_IM/pkg/common/db/cache"
|
||||||
"Open_IM/pkg/common/db/mysql"
|
"Open_IM/pkg/common/db/relation"
|
||||||
"context"
|
"context"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -14,12 +14,12 @@ import (
|
|||||||
|
|
||||||
type GroupInterface interface {
|
type GroupInterface interface {
|
||||||
FindGroupsByID(ctx context.Context, groupIDs []string) (groups []*relation.Group, err error)
|
FindGroupsByID(ctx context.Context, groupIDs []string) (groups []*relation.Group, err error)
|
||||||
CreateGroup(ctx context.Context, groups []*relation.Group) error
|
CreateGroup(ctx context.Context, groups []*relation.Group, groupMember []*relation.GroupMember) error
|
||||||
DeleteGroupByIDs(ctx context.Context, groupIDs []string) error
|
DeleteGroupByIDs(ctx context.Context, groupIDs []string) error
|
||||||
TakeGroupByID(ctx context.Context, groupID string) (group *relation.Group, err error)
|
TakeGroupByID(ctx context.Context, groupID string) (group *relation.Group, err error)
|
||||||
|
|
||||||
//mongo
|
//mongo
|
||||||
CreateSuperGroup(ctx context.Context, groupID string, initMemberIDList []string, memberNumCount int) error
|
CreateSuperGroup(ctx context.Context, groupID string, initMemberIDList []string) error
|
||||||
GetSuperGroupByID(ctx context.Context, groupID string) (superGroup *unrelation.SuperGroup, err error)
|
GetSuperGroupByID(ctx context.Context, groupID string) (superGroup *unrelation.SuperGroup, err error)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,8 +36,8 @@ func (g *GroupController) FindGroupsByID(ctx context.Context, groupIDs []string)
|
|||||||
return g.database.FindGroupsByID(ctx, groupIDs)
|
return g.database.FindGroupsByID(ctx, groupIDs)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GroupController) CreateGroup(ctx context.Context, groups []*relation.Group) error {
|
func (g *GroupController) CreateGroup(ctx context.Context, groups []*relation.Group, groupMember []*relation.GroupMember) error {
|
||||||
return g.database.CreateGroup(ctx, groups)
|
return g.database.CreateGroup(ctx, groups, groupMember)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GroupController) DeleteGroupByIDs(ctx context.Context, groupIDs []string) error {
|
func (g *GroupController) DeleteGroupByIDs(ctx context.Context, groupIDs []string) error {
|
||||||
@ -52,17 +52,17 @@ func (g *GroupController) GetSuperGroupByID(ctx context.Context, groupID string)
|
|||||||
return g.database.GetSuperGroupByID(ctx, groupID)
|
return g.database.GetSuperGroupByID(ctx, groupID)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GroupController) CreateSuperGroup(ctx context.Context, groupID string, initMemberIDList []string, memberNumCount int) error {
|
func (g *GroupController) CreateSuperGroup(ctx context.Context, groupID string, initMemberIDList []string) error {
|
||||||
return g.database.CreateSuperGroup(ctx, groupID, initMemberIDList, memberNumCount)
|
return g.database.CreateSuperGroup(ctx, groupID, initMemberIDList)
|
||||||
}
|
}
|
||||||
|
|
||||||
type DataBase interface {
|
type DataBase interface {
|
||||||
FindGroupsByID(ctx context.Context, groupIDs []string) (groups []*relation.Group, err error)
|
FindGroupsByID(ctx context.Context, groupIDs []string) (groups []*relation.Group, err error)
|
||||||
CreateGroup(ctx context.Context, groups []*relation.Group) error
|
CreateGroup(ctx context.Context, groups []*relation.Group, groupMember []*relation.GroupMember) error
|
||||||
DeleteGroupByIDs(ctx context.Context, groupIDs []string) error
|
DeleteGroupByIDs(ctx context.Context, groupIDs []string) error
|
||||||
TakeGroupByID(ctx context.Context, groupID string) (group *relation.Group, err error)
|
TakeGroupByID(ctx context.Context, groupID string) (group *relation.Group, err error)
|
||||||
GetSuperGroupByID(ctx context.Context, groupID string) (superGroup *unrelation.SuperGroup, err error)
|
GetSuperGroupByID(ctx context.Context, groupID string) (superGroup *unrelation.SuperGroup, err error)
|
||||||
CreateSuperGroup(ctx context.Context, groupID string, initMemberIDList []string, memberNumCount int) error
|
CreateSuperGroup(ctx context.Context, groupID string, initMemberIDList []string) error
|
||||||
}
|
}
|
||||||
|
|
||||||
type GroupDataBase struct {
|
type GroupDataBase struct {
|
||||||
@ -100,8 +100,18 @@ func (g *GroupDataBase) FindGroupsByID(ctx context.Context, groupIDs []string) (
|
|||||||
return g.cache.GetGroupsInfo(ctx, groupIDs)
|
return g.cache.GetGroupsInfo(ctx, groupIDs)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GroupDataBase) CreateGroup(ctx context.Context, groups []*relation.Group) error {
|
func (g *GroupDataBase) CreateGroup(ctx context.Context, groups []*relation.Group, groupMember []*relation.GroupMember) error {
|
||||||
return g.groupDB.Create(ctx, groups)
|
return g.db.Transaction(func(tx *gorm.DB) error {
|
||||||
|
if err := g.groupDB.Create(ctx, groups, tx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if len(groupMember) > 0 {
|
||||||
|
if err := g.groupMemberDB.Create(ctx, groupMember, tx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GroupDataBase) DeleteGroupByIDs(ctx context.Context, groupIDs []string) error {
|
func (g *GroupDataBase) DeleteGroupByIDs(ctx context.Context, groupIDs []string) error {
|
||||||
@ -136,14 +146,14 @@ func (g *GroupDataBase) Update(ctx context.Context, groups []*relation.Group) er
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GroupDataBase) CreateSuperGroup(ctx context.Context, groupID string, initMemberIDList []string, memberNumCount int) error {
|
func (g *GroupDataBase) CreateSuperGroup(ctx context.Context, groupID string, initMemberIDList []string) error {
|
||||||
sess, err := g.mongoDB.MgoClient.StartSession()
|
sess, err := g.mongoDB.MgoClient.StartSession()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer sess.EndSession(ctx)
|
defer sess.EndSession(ctx)
|
||||||
sCtx := mongo.NewSessionContext(ctx, sess)
|
sCtx := mongo.NewSessionContext(ctx, sess)
|
||||||
if err = g.mongoDB.CreateSuperGroup(sCtx, groupID, initMemberIDList, memberNumCount); err != nil {
|
if err = g.mongoDB.CreateSuperGroup(sCtx, groupID, initMemberIDList); err != nil {
|
||||||
_ = sess.AbortTransaction(ctx)
|
_ = sess.AbortTransaction(ctx)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -158,15 +168,3 @@ func (g *GroupDataBase) CreateSuperGroup(ctx context.Context, groupID string, in
|
|||||||
func (g *GroupDataBase) GetSuperGroupByID(ctx context.Context, groupID string) (superGroup *unrelation.SuperGroup, err error) {
|
func (g *GroupDataBase) GetSuperGroupByID(ctx context.Context, groupID string) (superGroup *unrelation.SuperGroup, err error) {
|
||||||
return g.mongoDB.GetSuperGroup(ctx, groupID)
|
return g.mongoDB.GetSuperGroup(ctx, groupID)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GroupDataBase) CreateGroupAndMember(ctx context.Context, groups []*relation.Group, groupMember []*relation.GroupMember) error {
|
|
||||||
return g.db.Transaction(func(tx *gorm.DB) error {
|
|
||||||
if err := g.groupDB.Create(ctx, groups, tx); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if err := g.groupMemberDB.Create(ctx, groupMember, tx); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
@ -1,24 +1,69 @@
|
|||||||
package controller
|
package controller
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/db/mysql"
|
"Open_IM/pkg/common/db/relation"
|
||||||
"context"
|
"context"
|
||||||
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type UserModel struct {
|
type UserInterface interface {
|
||||||
db *relation.User
|
Find(ctx context.Context, userIDs []string) (users []*relation.User, err error)
|
||||||
|
Create(ctx context.Context, users []*relation.User) error
|
||||||
|
Take(ctx context.Context, userID string) (user *relation.User, err error)
|
||||||
|
Update(ctx context.Context, users []*relation.User) (err error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewGroupUser(ctx context.Context) *UserModel {
|
type UserController struct {
|
||||||
var userModel UserModel
|
database UserDatabaseInterface
|
||||||
userModel.db = relation.NewUserDB()
|
|
||||||
return &userModel
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *UserModel) Find(ctx context.Context, userIDs []string) (users []*relation.User, err error) {
|
func (u *UserController) Find(ctx context.Context, userIDs []string) (users []*relation.User, err error) {
|
||||||
return u.db.Find(ctx, userIDs)
|
return u.database.Find(ctx, userIDs)
|
||||||
|
}
|
||||||
|
func (u *UserController) Create(ctx context.Context, users []*relation.User) error {
|
||||||
|
return u.database.Create(ctx, users)
|
||||||
|
}
|
||||||
|
func (u *UserController) Take(ctx context.Context, userID string) (user *relation.User, err error) {
|
||||||
|
return u.database.Take(ctx, userID)
|
||||||
|
}
|
||||||
|
func (u *UserController) Update(ctx context.Context, users []*relation.User) (err error) {
|
||||||
|
return u.database.Update(ctx, users)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *UserModel) Create(ctx context.Context, users []*relation.User) error {
|
func NewUserController(db *gorm.DB) UserInterface {
|
||||||
return u.db.Create(ctx, users)
|
controller := &UserController{database: newUserDatabase(db)}
|
||||||
|
return controller
|
||||||
|
}
|
||||||
|
|
||||||
|
type UserDatabaseInterface interface {
|
||||||
|
Find(ctx context.Context, userIDs []string) (users []*relation.User, err error)
|
||||||
|
Create(ctx context.Context, users []*relation.User) error
|
||||||
|
Take(ctx context.Context, userID string) (user *relation.User, err error)
|
||||||
|
Update(ctx context.Context, users []*relation.User) (err error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type UserDatabase struct {
|
||||||
|
sqlDB *relation.User
|
||||||
|
}
|
||||||
|
|
||||||
|
func newUserDatabase(db *gorm.DB) UserDatabaseInterface {
|
||||||
|
sqlDB := relation.NewUserDB(db)
|
||||||
|
database := &UserDatabase{
|
||||||
|
sqlDB: sqlDB,
|
||||||
|
}
|
||||||
|
return database
|
||||||
|
}
|
||||||
|
|
||||||
|
func (u *UserDatabase) Find(ctx context.Context, userIDs []string) (users []*relation.User, err error) {
|
||||||
|
return u.sqlDB.Find(ctx, userIDs)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (u *UserDatabase) Create(ctx context.Context, users []*relation.User) error {
|
||||||
|
return u.sqlDB.Create(ctx, users)
|
||||||
|
}
|
||||||
|
func (u *UserDatabase) Take(ctx context.Context, userID string) (user *relation.User, err error) {
|
||||||
|
return u.sqlDB.Take(ctx, userID)
|
||||||
|
}
|
||||||
|
func (u *UserDatabase) Update(ctx context.Context, users []*relation.User) (err error) {
|
||||||
|
return u.sqlDB.Update(ctx, users)
|
||||||
}
|
}
|
||||||
|
@ -25,9 +25,9 @@ type User struct {
|
|||||||
DB *gorm.DB `gorm:"-" json:"-"`
|
DB *gorm.DB `gorm:"-" json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewUserDB() *User {
|
func NewUserDB(db *gorm.DB) *User {
|
||||||
var user User
|
var user User
|
||||||
user.DB = initMysqlDB(&user)
|
user.DB = db
|
||||||
return &user
|
return &user
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ func NewSuperGroupMgoDB(mgoClient *mongo.Client) *SuperGroupMgoDB {
|
|||||||
return &SuperGroupMgoDB{MgoDB: mgoDB, MgoClient: mgoClient, superGroupCollection: mgoDB.Collection(cSuperGroup), userToSuperGroupCollection: mgoDB.Collection(cUserToSuperGroup)}
|
return &SuperGroupMgoDB{MgoDB: mgoDB, MgoClient: mgoClient, superGroupCollection: mgoDB.Collection(cSuperGroup), userToSuperGroupCollection: mgoDB.Collection(cUserToSuperGroup)}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (db *SuperGroupMgoDB) CreateSuperGroup(sCtx mongo.SessionContext, groupID string, initMemberIDList []string, memberNumCount int) error {
|
func (db *SuperGroupMgoDB) CreateSuperGroup(sCtx mongo.SessionContext, groupID string, initMemberIDList []string) error {
|
||||||
superGroup := SuperGroup{
|
superGroup := SuperGroup{
|
||||||
GroupID: groupID,
|
GroupID: groupID,
|
||||||
MemberIDList: initMemberIDList,
|
MemberIDList: initMemberIDList,
|
||||||
|
@ -4,66 +4,48 @@ import "Open-IM-Server/pkg/proto/conversation/conversation.proto";
|
|||||||
option go_package = "Open_IM/pkg/proto/user;user";
|
option go_package = "Open_IM/pkg/proto/user;user";
|
||||||
package user;
|
package user;
|
||||||
|
|
||||||
message CommonResp{
|
|
||||||
int32 errCode = 1;
|
|
||||||
string errMsg = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
message GetAllUserIDReq{
|
message GetAllUserIDReq{
|
||||||
string opUserID = 1;
|
server_api_params.RequestPagination pagination = 1;
|
||||||
string operationID = 2;
|
|
||||||
}
|
}
|
||||||
message GetAllUserIDResp{
|
message GetAllUserIDResp{
|
||||||
CommonResp CommonResp = 1;
|
int32 total = 1;
|
||||||
repeated string UserIDList = 2;
|
repeated string UserIDList = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
message AccountCheckReq{
|
message AccountCheckReq{
|
||||||
repeated string CheckUserIDList = 1;
|
repeated string checkUserIDs = 1;
|
||||||
string OpUserID = 2;
|
|
||||||
string OperationID = 3;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
message AccountCheckResp{
|
message AccountCheckResp{
|
||||||
CommonResp commonResp = 1;
|
|
||||||
message SingleUserStatus {
|
message SingleUserStatus {
|
||||||
string userID = 1;
|
string userID = 1;
|
||||||
string accountStatus = 2;
|
string accountStatus = 2;
|
||||||
}
|
}
|
||||||
repeated SingleUserStatus ResultList = 2;
|
repeated SingleUserStatus results = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
message GetUserInfoReq{
|
message GetUsersInfoReq{
|
||||||
repeated string userIDList = 1;
|
repeated string userIDs = 1;
|
||||||
string OpUserID = 2;
|
|
||||||
string OperationID = 3;
|
|
||||||
}
|
}
|
||||||
message GetUserInfoResp{
|
message GetUsersInfoResp{
|
||||||
CommonResp commonResp = 1;
|
repeated server_api_params.UserInfo usersInfo = 1;
|
||||||
repeated server_api_params.UserInfo UserInfoList = 3;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
message UpdateUserInfoReq{
|
message UpdateUserInfoReq{
|
||||||
server_api_params.UserInfo UserInfo = 1;
|
server_api_params.UserInfo userInfo = 1;
|
||||||
string OpUserID = 2;
|
|
||||||
string operationID = 3;
|
|
||||||
}
|
}
|
||||||
message UpdateUserInfoResp{
|
message UpdateUserInfoResp{
|
||||||
CommonResp commonResp = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message SetGlobalRecvMessageOptReq{
|
message SetGlobalRecvMessageOptReq{
|
||||||
string userID = 1;
|
string userID = 1;
|
||||||
string operationID = 2;
|
|
||||||
int32 globalRecvMsgOpt = 3;
|
int32 globalRecvMsgOpt = 3;
|
||||||
}
|
}
|
||||||
message SetGlobalRecvMessageOptResp{
|
message SetGlobalRecvMessageOptResp{
|
||||||
CommonResp commonResp = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message SetConversationReq{
|
message SetConversationReq{
|
||||||
@ -73,7 +55,7 @@ message SetConversationReq{
|
|||||||
}
|
}
|
||||||
|
|
||||||
message SetConversationResp{
|
message SetConversationResp{
|
||||||
CommonResp commonResp = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message SetRecvMsgOptReq {
|
message SetRecvMsgOptReq {
|
||||||
@ -85,7 +67,7 @@ message SetRecvMsgOptReq {
|
|||||||
}
|
}
|
||||||
|
|
||||||
message SetRecvMsgOptResp {
|
message SetRecvMsgOptResp {
|
||||||
CommonResp commonResp = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message GetConversationReq{
|
message GetConversationReq{
|
||||||
@ -95,7 +77,6 @@ message GetConversationReq{
|
|||||||
}
|
}
|
||||||
|
|
||||||
message GetConversationResp{
|
message GetConversationResp{
|
||||||
CommonResp commonResp = 1;
|
|
||||||
conversation.Conversation Conversation = 2;
|
conversation.Conversation Conversation = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +87,6 @@ message GetConversationsReq{
|
|||||||
}
|
}
|
||||||
|
|
||||||
message GetConversationsResp{
|
message GetConversationsResp{
|
||||||
CommonResp commonResp = 1;
|
|
||||||
repeated conversation.Conversation Conversations = 2;
|
repeated conversation.Conversation Conversations = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,7 +96,6 @@ message GetAllConversationsReq{
|
|||||||
}
|
}
|
||||||
|
|
||||||
message GetAllConversationsResp{
|
message GetAllConversationsResp{
|
||||||
CommonResp commonResp = 1;
|
|
||||||
repeated conversation.Conversation Conversations = 2;
|
repeated conversation.Conversation Conversations = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,30 +107,21 @@ message BatchSetConversationsReq{
|
|||||||
}
|
}
|
||||||
|
|
||||||
message BatchSetConversationsResp{
|
message BatchSetConversationsResp{
|
||||||
CommonResp commonResp = 1;
|
|
||||||
repeated string Success = 2;
|
repeated string Success = 2;
|
||||||
repeated string Failed = 3;
|
repeated string Failed = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
message GetUsersReq {
|
message GetUsersReq {
|
||||||
string operationID = 1;
|
|
||||||
server_api_params.RequestPagination pagination = 2;
|
server_api_params.RequestPagination pagination = 2;
|
||||||
string userName = 3;
|
string userName = 3;
|
||||||
string userID = 4;
|
string userID = 4;
|
||||||
string content = 5;
|
string content = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
message CmsUser {
|
|
||||||
server_api_params.UserInfo user = 1;
|
|
||||||
bool isBlock = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message GetUsersResp{
|
message GetUsersResp{
|
||||||
CommonResp commonResp = 1;
|
int32 total = 1;
|
||||||
repeated CmsUser userList = 2;
|
repeated server_api_params.UserInfo users = 2;
|
||||||
server_api_params.ResponsePagination Pagination = 3;
|
|
||||||
int32 totalNums = 4;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message AddUserReq{
|
message AddUserReq{
|
||||||
@ -160,29 +130,6 @@ message AddUserReq{
|
|||||||
}
|
}
|
||||||
|
|
||||||
message AddUserResp{
|
message AddUserResp{
|
||||||
CommonResp CommonResp = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
message BlockUserReq{
|
|
||||||
string userID = 1;
|
|
||||||
string endDisableTime = 2;
|
|
||||||
string operationID = 3;
|
|
||||||
string opUserID = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
message BlockUserResp{
|
|
||||||
CommonResp CommonResp = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message UnBlockUserReq{
|
|
||||||
string userID = 1;
|
|
||||||
string operationID = 2;
|
|
||||||
string opUserID = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
message UnBlockUserResp{
|
|
||||||
CommonResp CommonResp = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message GetBlockUsersReq{
|
message GetBlockUsersReq{
|
||||||
@ -199,7 +146,6 @@ message BlockUser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
message GetBlockUsersResp{
|
message GetBlockUsersResp{
|
||||||
CommonResp CommonResp = 1;
|
|
||||||
repeated BlockUser BlockUsers = 2;
|
repeated BlockUser BlockUsers = 2;
|
||||||
server_api_params.ResponsePagination Pagination = 3;
|
server_api_params.ResponsePagination Pagination = 3;
|
||||||
int32 UserNums = 4;
|
int32 UserNums = 4;
|
||||||
@ -207,26 +153,15 @@ message GetBlockUsersResp{
|
|||||||
|
|
||||||
|
|
||||||
service user {
|
service user {
|
||||||
rpc GetUserInfo(GetUserInfoReq) returns(GetUserInfoResp);
|
//获取指定的用户信息 全字段
|
||||||
|
rpc GetUsersInfo(GetUsersInfoReq) returns(GetUsersInfoResp);
|
||||||
|
//更新用户信息
|
||||||
rpc UpdateUserInfo(UpdateUserInfoReq) returns(UpdateUserInfoResp);
|
rpc UpdateUserInfo(UpdateUserInfoReq) returns(UpdateUserInfoResp);
|
||||||
|
//设置用户消息接收选项
|
||||||
rpc SetGlobalRecvMessageOpt(SetGlobalRecvMessageOptReq) returns(SetGlobalRecvMessageOptResp);
|
rpc SetGlobalRecvMessageOpt(SetGlobalRecvMessageOptReq) returns(SetGlobalRecvMessageOptResp);
|
||||||
rpc GetAllUserID(GetAllUserIDReq)returns(GetAllUserIDResp);
|
//检查userID是否存在
|
||||||
|
|
||||||
rpc AccountCheck(AccountCheckReq)returns(AccountCheckResp);
|
rpc AccountCheck(AccountCheckReq)returns(AccountCheckResp);
|
||||||
rpc GetConversation(GetConversationReq)returns(GetConversationResp);
|
//翻页(或指定userID,昵称)拉取用户信息 全字段
|
||||||
rpc GetAllConversations(GetAllConversationsReq)returns(GetAllConversationsResp);
|
|
||||||
rpc GetConversations(GetConversationsReq)returns(GetConversationsResp);
|
|
||||||
rpc BatchSetConversations(BatchSetConversationsReq)returns(BatchSetConversationsResp);
|
|
||||||
rpc SetConversation(SetConversationReq)returns(SetConversationResp);
|
|
||||||
rpc SetRecvMsgOpt(SetRecvMsgOptReq)returns(SetRecvMsgOptResp);
|
|
||||||
|
|
||||||
|
|
||||||
rpc GetUsers(GetUsersReq) returns (GetUsersResp);
|
rpc GetUsers(GetUsersReq) returns (GetUsersResp);
|
||||||
|
|
||||||
rpc AddUser(AddUserReq) returns (AddUserResp);
|
|
||||||
|
|
||||||
rpc BlockUser(BlockUserReq) returns (BlockUserResp);
|
|
||||||
rpc UnBlockUser(UnBlockUserReq) returns (UnBlockUserResp);
|
|
||||||
rpc GetBlockUsers(GetBlockUsersReq) returns (GetBlockUsersResp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user