From 9ce50095b5bc4e2d42e00360fb0ebe6f84e9d1f4 Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Wed, 8 Mar 2023 17:29:03 +0800 Subject: [PATCH] cobra --- cmd/api/main.go | 2 +- internal/api/auth.go | 10 ++--- internal/api/conversation.go | 10 ++--- internal/api/friend.go | 11 ++--- internal/api/group.go | 11 ++--- internal/api/msg.go | 12 ++--- internal/api/route.go | 5 +-- internal/api/third.go | 11 ++--- internal/api/user.go | 10 ++--- pkg/apistruct/auth.go | 6 +-- pkg/apistruct/aws.go | 1 - pkg/apistruct/common.go | 6 --- pkg/apistruct/conversation.go | 10 ----- pkg/apistruct/cos.go | 1 - pkg/apistruct/friend.go | 30 ++++++------- pkg/apistruct/group.go | 50 ++++++++++----------- pkg/apistruct/manage.go | 9 +--- pkg/apistruct/msg.go | 8 ---- pkg/apistruct/oss.go | 1 - pkg/apistruct/third.go | 6 --- pkg/common/db/table/unrelation/msg.go | 4 +- pkg/common/db/unrelation/mongo.go | 2 +- pkg/discoveryregistry/discovery_register.go | 1 + 23 files changed, 89 insertions(+), 128 deletions(-) delete mode 100644 pkg/apistruct/common.go diff --git a/cmd/api/main.go b/cmd/api/main.go index 488ff8491..c3b8ad9ac 100644 --- a/cmd/api/main.go +++ b/cmd/api/main.go @@ -28,7 +28,7 @@ func run(port int) error { if port == 0 { port = config.Config.Api.GinPort[0] } - zk, err := openKeeper.NewClient(config.Config.Zookeeper.ZkAddr, "", 10, "", "") + zk, err := openKeeper.NewClient(config.Config.Zookeeper.ZkAddr, "", 10, config.Config.Zookeeper.UserName, config.Config.Zookeeper.Password) if err != nil { return err } diff --git a/internal/api/auth.go b/internal/api/auth.go index d72079b40..e997ba6aa 100644 --- a/internal/api/auth.go +++ b/internal/api/auth.go @@ -3,24 +3,24 @@ package api import ( "OpenIM/internal/api/a2r" "OpenIM/pkg/common/config" + "OpenIM/pkg/discoveryregistry" auth "OpenIM/pkg/proto/auth" "context" - "github.com/OpenIMSDK/openKeeper" "github.com/gin-gonic/gin" ) var _ context.Context // 解决goland编辑器bug -func NewAuth(zk *openKeeper.ZkClient) *Auth { - return &Auth{zk: zk} +func NewAuth(c discoveryregistry.SvcDiscoveryRegistry) *Auth { + return &Auth{c: c} } type Auth struct { - zk *openKeeper.ZkClient + c discoveryregistry.SvcDiscoveryRegistry } func (o *Auth) client() (auth.AuthClient, error) { - conn, err := o.zk.GetConn(config.Config.RpcRegisterName.OpenImAuthName) + conn, err := o.c.GetConn(config.Config.RpcRegisterName.OpenImAuthName) if err != nil { return nil, err } diff --git a/internal/api/conversation.go b/internal/api/conversation.go index 146e27d74..a1af558e4 100644 --- a/internal/api/conversation.go +++ b/internal/api/conversation.go @@ -3,24 +3,24 @@ package api import ( "OpenIM/internal/api/a2r" "OpenIM/pkg/common/config" + "OpenIM/pkg/discoveryregistry" "OpenIM/pkg/proto/conversation" "context" - "github.com/OpenIMSDK/openKeeper" "github.com/gin-gonic/gin" ) var _ context.Context // 解决goland编辑器bug -func NewConversation(zk *openKeeper.ZkClient) *Conversation { - return &Conversation{zk: zk} +func NewConversation(c discoveryregistry.SvcDiscoveryRegistry) *Conversation { + return &Conversation{c: c} } type Conversation struct { - zk *openKeeper.ZkClient + c discoveryregistry.SvcDiscoveryRegistry } func (o *Conversation) client() (conversation.ConversationClient, error) { - conn, err := o.zk.GetConn(config.Config.RpcRegisterName.OpenImConversationName) + conn, err := o.c.GetConn(config.Config.RpcRegisterName.OpenImConversationName) if err != nil { return nil, err } diff --git a/internal/api/friend.go b/internal/api/friend.go index ee2412b1c..ee8aabb35 100644 --- a/internal/api/friend.go +++ b/internal/api/friend.go @@ -3,24 +3,25 @@ package api import ( "OpenIM/internal/api/a2r" "OpenIM/pkg/common/config" + "OpenIM/pkg/discoveryregistry" "OpenIM/pkg/proto/friend" "context" - "github.com/OpenIMSDK/openKeeper" + "github.com/gin-gonic/gin" ) var _ context.Context // 解决goland编辑器bug -func NewFriend(zk *openKeeper.ZkClient) *Friend { - return &Friend{zk: zk} +func NewFriend(c discoveryregistry.SvcDiscoveryRegistry) *Friend { + return &Friend{c: c} } type Friend struct { - zk *openKeeper.ZkClient + c discoveryregistry.SvcDiscoveryRegistry } func (o *Friend) client() (friend.FriendClient, error) { - conn, err := o.zk.GetConn(config.Config.RpcRegisterName.OpenImFriendName) + conn, err := o.c.GetConn(config.Config.RpcRegisterName.OpenImFriendName) if err != nil { return nil, err } diff --git a/internal/api/group.go b/internal/api/group.go index bd4e9bf56..0318193e0 100644 --- a/internal/api/group.go +++ b/internal/api/group.go @@ -3,24 +3,25 @@ package api import ( "OpenIM/internal/api/a2r" "OpenIM/pkg/common/config" + "OpenIM/pkg/discoveryregistry" "OpenIM/pkg/proto/group" "context" - "github.com/OpenIMSDK/openKeeper" + "github.com/gin-gonic/gin" ) var _ context.Context // 解决goland编辑器bug -func NewGroup(zk *openKeeper.ZkClient) *Group { - return &Group{zk: zk} +func NewGroup(c discoveryregistry.SvcDiscoveryRegistry) *Group { + return &Group{c: c} } type Group struct { - zk *openKeeper.ZkClient + c discoveryregistry.SvcDiscoveryRegistry } func (o *Group) client() (group.GroupClient, error) { - conn, err := o.zk.GetConn(config.Config.RpcRegisterName.OpenImGroupName) + conn, err := o.c.GetConn(config.Config.RpcRegisterName.OpenImGroupName) if err != nil { return nil, err } diff --git a/internal/api/msg.go b/internal/api/msg.go index 3f04e766c..edaf7ecaa 100644 --- a/internal/api/msg.go +++ b/internal/api/msg.go @@ -7,13 +7,13 @@ import ( "OpenIM/pkg/common/config" "OpenIM/pkg/common/constant" "OpenIM/pkg/common/log" + "OpenIM/pkg/discoveryregistry" "OpenIM/pkg/errs" "OpenIM/pkg/proto/msg" "OpenIM/pkg/proto/sdkws" "OpenIM/pkg/utils" "context" "errors" - "github.com/OpenIMSDK/openKeeper" "github.com/gin-gonic/gin" "github.com/go-playground/validator/v10" "github.com/golang/protobuf/proto" @@ -22,12 +22,12 @@ import ( var _ context.Context // 解决goland编辑器bug -func NewMsg(zk *openKeeper.ZkClient) *Msg { - return &Msg{zk: zk, validate: validator.New()} +func NewMsg(c discoveryregistry.SvcDiscoveryRegistry) *Msg { + return &Msg{c: c, validate: validator.New()} } type Msg struct { - zk *openKeeper.ZkClient + c discoveryregistry.SvcDiscoveryRegistry validate *validator.Validate } @@ -107,7 +107,7 @@ func newUserSendMsgReq(params *apistruct.ManagementSendMsgReq) *msg.SendMsgReq { } func (o *Msg) client() (msg.MsgClient, error) { - conn, err := o.zk.GetConn(config.Config.RpcRegisterName.OpenImMsgName) + conn, err := o.c.GetConn(config.Config.RpcRegisterName.OpenImMsgName) if err != nil { return nil, err } @@ -214,7 +214,7 @@ func (o *Msg) ManagementSendMsg(c *gin.Context) { } log.NewInfo(params.OperationID, "Ws call success to ManagementSendMsgReq", params) pbData := newUserSendMsgReq(¶ms) - conn, err := o.zk.GetConn(config.Config.RpcRegisterName.OpenImMsgName) + conn, err := o.c.GetConn(config.Config.RpcRegisterName.OpenImMsgName) if err != nil { apiresp.GinError(c, errs.ErrInternalServer) return diff --git a/internal/api/route.go b/internal/api/route.go index 7aa006d59..d05564cc7 100644 --- a/internal/api/route.go +++ b/internal/api/route.go @@ -5,13 +5,13 @@ import ( "OpenIM/pkg/common/log" "OpenIM/pkg/common/mw" "OpenIM/pkg/common/prome" - "github.com/OpenIMSDK/openKeeper" + "OpenIM/pkg/discoveryregistry" "github.com/gin-gonic/gin" "io" "os" ) -func NewGinRouter(zk *openKeeper.ZkClient) *gin.Engine { +func NewGinRouter(zk discoveryregistry.SvcDiscoveryRegistry) *gin.Engine { gin.SetMode(gin.ReleaseMode) f, _ := os.Create("../logs/api.log") gin.DefaultWriter = io.MultiWriter(f) @@ -27,7 +27,6 @@ func NewGinRouter(zk *openKeeper.ZkClient) *gin.Engine { r.GET("/metrics", prome.PrometheusHandler()) } zk.AddOption(mw.GrpcClient()) // 默认RPC中间件 - userRouterGroup := r.Group("/user") { u := NewUser(zk) diff --git a/internal/api/third.go b/internal/api/third.go index 8d2c4d081..b020b4930 100644 --- a/internal/api/third.go +++ b/internal/api/third.go @@ -3,24 +3,25 @@ package api import ( "OpenIM/internal/api/a2r" "OpenIM/pkg/common/config" + "OpenIM/pkg/discoveryregistry" "OpenIM/pkg/proto/third" "context" - "github.com/OpenIMSDK/openKeeper" + "github.com/gin-gonic/gin" ) var _ context.Context // 解决goland编辑器bug -func NewThird(zk *openKeeper.ZkClient) *Third { - return &Third{zk: zk} +func NewThird(c discoveryregistry.SvcDiscoveryRegistry) *Third { + return &Third{c: c} } type Third struct { - zk *openKeeper.ZkClient + c discoveryregistry.SvcDiscoveryRegistry } func (o *Third) client() (third.ThirdClient, error) { - conn, err := o.zk.GetConn(config.Config.RpcRegisterName.OpenImThirdName) + conn, err := o.c.GetConn(config.Config.RpcRegisterName.OpenImThirdName) if err != nil { return nil, err } diff --git a/internal/api/user.go b/internal/api/user.go index 34634faf8..738b369b7 100644 --- a/internal/api/user.go +++ b/internal/api/user.go @@ -3,24 +3,24 @@ package api import ( "OpenIM/internal/api/a2r" "OpenIM/pkg/common/config" + "OpenIM/pkg/discoveryregistry" "OpenIM/pkg/proto/user" "context" - "github.com/OpenIMSDK/openKeeper" "github.com/gin-gonic/gin" ) var _ context.Context // 解决goland编辑器bug -func NewUser(zk *openKeeper.ZkClient) *User { - return &User{zk: zk} +func NewUser(client discoveryregistry.SvcDiscoveryRegistry) *User { + return &User{c: client} } type User struct { - zk *openKeeper.ZkClient + c discoveryregistry.SvcDiscoveryRegistry } func (o *User) client() (user.UserClient, error) { - conn, err := o.zk.GetConn(config.Config.RpcRegisterName.OpenImUserName) + conn, err := o.c.GetConn(config.Config.RpcRegisterName.OpenImUserName) if err != nil { return nil, err } diff --git a/pkg/apistruct/auth.go b/pkg/apistruct/auth.go index 2942519c3..664919876 100644 --- a/pkg/apistruct/auth.go +++ b/pkg/apistruct/auth.go @@ -13,7 +13,6 @@ type UserTokenInfo struct { ExpiredTime int64 `json:"expiredTime"` } type UserRegisterResp struct { - CommResp UserToken UserTokenInfo `json:"data"` } @@ -25,7 +24,6 @@ type UserTokenReq struct { } type UserTokenResp struct { - CommResp UserToken UserTokenInfo `json:"data"` } @@ -36,7 +34,6 @@ type ForceLogoutReq struct { } type ForceLogoutResp struct { - CommResp } type ParseTokenReq struct { @@ -44,7 +41,7 @@ type ParseTokenReq struct { } //type ParseTokenResp struct { -// CommResp +// // ExpireTime int64 `json:"expireTime" binding:"required"` //} @@ -53,7 +50,6 @@ type ExpireTime struct { } type ParseTokenResp struct { - CommResp Data map[string]interface{} `json:"data" swaggerignore:"true"` ExpireTime ExpireTime `json:"-"` } diff --git a/pkg/apistruct/aws.go b/pkg/apistruct/aws.go index f7f275d62..0ef2640c5 100644 --- a/pkg/apistruct/aws.go +++ b/pkg/apistruct/aws.go @@ -14,7 +14,6 @@ type AwsStorageCredentialRespData struct { } type AwsStorageCredentialResp struct { - CommResp CosData AwsStorageCredentialRespData Data map[string]interface{} `json:"data"` } diff --git a/pkg/apistruct/common.go b/pkg/apistruct/common.go deleted file mode 100644 index c5adee56a..000000000 --- a/pkg/apistruct/common.go +++ /dev/null @@ -1,6 +0,0 @@ -package apistruct - -type RequestPagination struct { - PageNumber int `json:"pageNumber" binding:"required"` - ShowNumber int `json:"showNumber" binding:"required"` -} diff --git a/pkg/apistruct/conversation.go b/pkg/apistruct/conversation.go index aeb5b329c..2abd566e5 100644 --- a/pkg/apistruct/conversation.go +++ b/pkg/apistruct/conversation.go @@ -9,7 +9,6 @@ type GetAllConversationMessageOptReq struct { FromUserID string `json:"fromUserID" binding:"required"` } type GetAllConversationMessageOptResp struct { - CommResp ConversationOptResultList []*OptResult `json:"data"` } type GetReceiveMessageOptReq struct { @@ -18,7 +17,6 @@ type GetReceiveMessageOptReq struct { FromUserID string `json:"fromUserID" binding:"required"` } type GetReceiveMessageOptResp struct { - CommResp ConversationOptResultList []*OptResult `json:"data"` } type SetReceiveMessageOptReq struct { @@ -28,7 +26,6 @@ type SetReceiveMessageOptReq struct { ConversationIDList []string `json:"conversationIDList" binding:"required"` } type SetReceiveMessageOptResp struct { - CommResp ConversationOptResultList []*OptResult `json:"data"` } @@ -58,7 +55,6 @@ type SetConversationReq struct { } type SetConversationResp struct { - CommResp } type ModifyConversationFieldReq struct { Conversation @@ -67,7 +63,6 @@ type ModifyConversationFieldReq struct { OperationID string `json:"operationID" binding:"required"` } type ModifyConversationFieldResp struct { - CommResp } type BatchSetConversationsReq struct { @@ -78,7 +73,6 @@ type BatchSetConversationsReq struct { } type BatchSetConversationsResp struct { - CommResp Data struct { Success []string `json:"success"` Failed []string `json:"failed"` @@ -92,7 +86,6 @@ type GetConversationReq struct { } type GetConversationResp struct { - CommResp Conversation Conversation `json:"data"` } @@ -102,7 +95,6 @@ type GetAllConversationsReq struct { } type GetAllConversationsResp struct { - CommResp Conversations []Conversation `json:"data"` } @@ -113,7 +105,6 @@ type GetConversationsReq struct { } type GetConversationsResp struct { - CommResp Conversations []Conversation `json:"data"` } @@ -126,5 +117,4 @@ type SetRecvMsgOptReq struct { } type SetRecvMsgOptResp struct { - CommResp } diff --git a/pkg/apistruct/cos.go b/pkg/apistruct/cos.go index 60162fa47..2695b6bbf 100644 --- a/pkg/apistruct/cos.go +++ b/pkg/apistruct/cos.go @@ -13,7 +13,6 @@ type TencentCloudStorageCredentialRespData struct { } type TencentCloudStorageCredentialResp struct { - CommResp CosData TencentCloudStorageCredentialRespData `json:"-"` Data map[string]interface{} `json:"data"` diff --git a/pkg/apistruct/friend.go b/pkg/apistruct/friend.go index 70f552b9b..4bfc39a91 100644 --- a/pkg/apistruct/friend.go +++ b/pkg/apistruct/friend.go @@ -10,7 +10,7 @@ package apistruct // ParamsCommFriend //} //type AddBlacklistResp struct { -// CommResp +// //} // //type ImportFriendReq struct { @@ -23,7 +23,7 @@ package apistruct // Result int32 `json:"result"` //} //type ImportFriendResp struct { -// CommResp +// // UserIDResultList []UserIDResult `json:"data"` //} // @@ -32,7 +32,7 @@ package apistruct // ReqMsg string `json:"reqMsg"` //} //type AddFriendResp struct { -// CommResp +// //} // //type AddFriendResponseReq struct { @@ -41,14 +41,14 @@ package apistruct // HandleMsg string `json:"handleMsg"` //} //type AddFriendResponseResp struct { -// CommResp +// //} // //type DeleteFriendReq struct { // ParamsCommFriend //} //type DeleteFriendResp struct { -// CommResp +// //} // //type GetBlackListReq struct { @@ -56,7 +56,7 @@ package apistruct // FromUserID string `json:"fromUserID" binding:"required"` //} //type GetBlackListResp struct { -// CommResp +// // BlackUserInfoList []*sdkws.PublicUserInfo `json:"-"` // Map []map[string]interface{} `json:"data" swaggerignore:"true"` //} @@ -73,14 +73,14 @@ package apistruct // Remark string `json:"remark"` //} //type SetFriendRemarkResp struct { -// CommResp +// //} // //type RemoveBlacklistReq struct { // ParamsCommFriend //} //type RemoveBlacklistResp struct { -// CommResp +// //} // //type IsFriendReq struct { @@ -90,7 +90,7 @@ package apistruct // Friend bool `json:"isFriend"` //} //type IsFriendResp struct { -// CommResp +// // Response Response `json:"data"` //} // @@ -98,7 +98,7 @@ package apistruct // ParamsCommFriend //} //type GetFriendsInfoResp struct { -// CommResp +// // FriendInfoList []*sdkws.FriendInfo `json:"-"` // Map []map[string]interface{} `json:"data" swaggerignore:"true"` //} @@ -108,7 +108,7 @@ package apistruct // FromUserID string `json:"fromUserID" binding:"required"` //} //type GetFriendListResp struct { -// CommResp +// // FriendInfoList []*sdkws.FriendInfo `json:"-"` // Map []map[string]interface{} `json:"data" swaggerignore:"true"` //} @@ -118,7 +118,7 @@ package apistruct // FromUserID string `json:"fromUserID" binding:"required"` //} //type GetFriendApplyListResp struct { -// CommResp +// // FriendRequestList []*sdkws.FriendRequest `json:"-"` // Map []map[string]interface{} `json:"data" swaggerignore:"true"` //} @@ -128,7 +128,7 @@ package apistruct // FromUserID string `json:"fromUserID" binding:"required"` //} //type GetSelfApplyListResp struct { -// CommResp +// // FriendRequestList []*sdkws.FriendRequest `json:"-"` // Map []map[string]interface{} `json:"data" swaggerignore:"true"` //} @@ -180,7 +180,7 @@ type ImportFriendReq struct { } type ImportFriendResp struct { - //CommResp + // } type AddFriendReq struct { @@ -189,7 +189,7 @@ type AddFriendReq struct { ReqMsg string `json:"reqMsg"` } type AddFriendResp struct { - //CommResp + // } type AddFriendResponseReq struct { diff --git a/pkg/apistruct/group.go b/pkg/apistruct/group.go index 27f9cd647..5009a5f64 100644 --- a/pkg/apistruct/group.go +++ b/pkg/apistruct/group.go @@ -4,13 +4,13 @@ import ( sdkws "OpenIM/pkg/proto/sdkws" ) -type CommResp struct { +type struct { ErrCode int32 `json:"errCode"` ErrMsg string `json:"errMsg"` } type CommDataResp struct { - CommResp + Data []map[string]interface{} `json:"data"` } @@ -21,7 +21,7 @@ type KickGroupMemberReq struct { OperationID string `json:"operationID" binding:"required"` } type KickGroupMemberResp struct { - CommResp + //UserIDResultList []*UserIDResult `json:"data"` } @@ -31,7 +31,7 @@ type GetGroupMembersInfoReq struct { OperationID string `json:"operationID" binding:"required"` } type GetGroupMembersInfoResp struct { - CommResp + MemberList []*sdkws.GroupMemberFullInfo `json:"-"` Data []map[string]interface{} `json:"data" swaggerignore:"true"` } @@ -43,7 +43,7 @@ type InviteUserToGroupReq struct { OperationID string `json:"operationID" binding:"required"` } type InviteUserToGroupResp struct { - CommResp + //UserIDResultList []*UserIDResult `json:"data"` } @@ -52,7 +52,7 @@ type GetJoinedGroupListReq struct { FromUserID string `json:"fromUserID" binding:"required"` } type GetJoinedGroupListResp struct { - CommResp + GroupInfoList []*sdkws.GroupInfo `json:"-"` Data []map[string]interface{} `json:"data" swaggerignore:"true"` } @@ -64,7 +64,7 @@ type GetGroupMemberListReq struct { OperationID string `json:"operationID"` } type GetGroupMemberListResp struct { - CommResp + NextSeq int32 `json:"nextSeq"` MemberList []*sdkws.GroupMemberFullInfo `json:"-"` Data []map[string]interface{} `json:"data" swaggerignore:"true"` @@ -77,7 +77,7 @@ type GetGroupAllMemberReq struct { Count int32 `json:"count"` } type GetGroupAllMemberResp struct { - CommResp + MemberList []*sdkws.GroupMemberFullInfo `json:"-"` Data []map[string]interface{} `json:"data" swaggerignore:"true"` } @@ -90,7 +90,7 @@ type GetGroupAllMemberResp struct { // Count int32 `json:"count" binding:"required"` //} //type GetGroupAllMemberListBySplitResp struct { -// CommResp +// // MemberList []*sdkws.GroupMemberFullInfo `json:"-"` // Map []map[string]interface{} `json:"data" swaggerignore:"true"` //} @@ -108,7 +108,7 @@ type CreateGroupReq struct { GroupID string `json:"groupID"` } type CreateGroupResp struct { - CommResp + GroupInfo sdkws.GroupInfo `json:"-"` Data map[string]interface{} `json:"data" swaggerignore:"true"` } @@ -118,7 +118,7 @@ type GetGroupApplicationListReq struct { FromUserID string `json:"fromUserID" binding:"required"` //作为管理员或群主收到的 进群申请 } type GetGroupApplicationListResp struct { - CommResp + GroupRequestList []*sdkws.GroupRequest `json:"-"` Data []map[string]interface{} `json:"data" swaggerignore:"true"` } @@ -137,7 +137,7 @@ type GetGroupInfoReq struct { OperationID string `json:"operationID" binding:"required"` } type GetGroupInfoResp struct { - CommResp + GroupInfoList []*sdkws.GroupInfo `json:"-"` Data []map[string]interface{} `json:"data" swaggerignore:"true"` } @@ -171,7 +171,7 @@ type ApplicationGroupResponseReq struct { HandleResult int32 `json:"handleResult" binding:"required,oneof=-1 1"` } type ApplicationGroupResponseResp struct { - CommResp + } type JoinGroupReq struct { @@ -183,7 +183,7 @@ type JoinGroupReq struct { } type JoinGroupResp struct { - CommResp + } type QuitGroupReq struct { @@ -191,7 +191,7 @@ type QuitGroupReq struct { OperationID string `json:"operationID" binding:"required"` } type QuitGroupResp struct { - CommResp + } type SetGroupInfoReq struct { @@ -208,7 +208,7 @@ type SetGroupInfoReq struct { } type SetGroupInfoResp struct { - CommResp + } type TransferGroupOwnerReq struct { @@ -218,7 +218,7 @@ type TransferGroupOwnerReq struct { OperationID string `json:"operationID" binding:"required"` } type TransferGroupOwnerResp struct { - CommResp + } type DismissGroupReq struct { @@ -226,7 +226,7 @@ type DismissGroupReq struct { OperationID string `json:"operationID" binding:"required"` } type DismissGroupResp struct { - CommResp + } type MuteGroupMemberReq struct { @@ -236,7 +236,7 @@ type MuteGroupMemberReq struct { MutedSeconds uint32 `json:"mutedSeconds" binding:"required"` } type MuteGroupMemberResp struct { - CommResp + } type CancelMuteGroupMemberReq struct { @@ -245,7 +245,7 @@ type CancelMuteGroupMemberReq struct { UserID string `json:"userID" binding:"required"` } type CancelMuteGroupMemberResp struct { - CommResp + } type MuteGroupReq struct { @@ -253,7 +253,7 @@ type MuteGroupReq struct { GroupID string `json:"groupID" binding:"required"` } type MuteGroupResp struct { - CommResp + } type CancelMuteGroupReq struct { @@ -261,7 +261,7 @@ type CancelMuteGroupReq struct { GroupID string `json:"groupID" binding:"required"` } type CancelMuteGroupResp struct { - CommResp + } type SetGroupMemberNicknameReq struct { @@ -272,7 +272,7 @@ type SetGroupMemberNicknameReq struct { } type SetGroupMemberNicknameResp struct { - CommResp + } type SetGroupMemberInfoReq struct { @@ -286,7 +286,7 @@ type SetGroupMemberInfoReq struct { } type SetGroupMemberInfoResp struct { - CommResp + } type GetGroupAbstractInfoReq struct { @@ -295,7 +295,7 @@ type GetGroupAbstractInfoReq struct { } type GetGroupAbstractInfoResp struct { - CommResp + GroupMemberNumber int32 `json:"groupMemberNumber"` GroupMemberListHash uint64 `json:"groupMemberListHash"` } diff --git a/pkg/apistruct/manage.go b/pkg/apistruct/manage.go index 018280bf9..4bf48d36e 100644 --- a/pkg/apistruct/manage.go +++ b/pkg/apistruct/manage.go @@ -9,14 +9,12 @@ type DeleteUsersReq struct { DeleteUserIDList []string `json:"deleteUserIDList" binding:"required"` } type DeleteUsersResp struct { - CommResp FailedUserIDList []string `json:"data"` } type GetAllUsersUidReq struct { OperationID string `json:"operationID" binding:"required"` } type GetAllUsersUidResp struct { - CommResp UserIDList []string `json:"data"` } type GetUsersOnlineStatusReq struct { @@ -24,7 +22,7 @@ type GetUsersOnlineStatusReq struct { UserIDList []string `json:"userIDList" binding:"required,lte=200"` } type GetUsersOnlineStatusResp struct { - CommResp + //SuccessResult []*msggateway.GetUsersOnlineStatusResp_SuccessResult `json:"data"` } type AccountCheckReq struct { @@ -32,7 +30,7 @@ type AccountCheckReq struct { CheckUserIDList []string `json:"checkUserIDList" binding:"required,lte=100"` } type AccountCheckResp struct { - CommResp + //ResultList []*pbUser.AccountCheckResp_SingleUserStatus `json:"data"` } @@ -69,7 +67,6 @@ type ManagementBatchSendMsgReq struct { } type ManagementBatchSendMsgResp struct { - CommResp Data struct { ResultList []*SingleReturnResult `json:"resultList"` FailedIDList []string @@ -87,7 +84,6 @@ type CheckMsgIsSendSuccessReq struct { } type CheckMsgIsSendSuccessResp struct { - CommResp Status int32 `json:"status"` } @@ -119,7 +115,6 @@ type CMSUser struct { } type GetUsersResp struct { - CommResp Data struct { UserList []*CMSUser `json:"userList"` TotalNum int32 `json:"totalNum"` diff --git a/pkg/apistruct/msg.go b/pkg/apistruct/msg.go index 0d5927350..4b9667413 100644 --- a/pkg/apistruct/msg.go +++ b/pkg/apistruct/msg.go @@ -12,7 +12,6 @@ type DelMsgReq struct { } type DelMsgResp struct { - CommResp } type CleanUpMsgReq struct { @@ -21,7 +20,6 @@ type CleanUpMsgReq struct { } type CleanUpMsgResp struct { - CommResp } type DelSuperGroupMsgReq struct { @@ -33,7 +31,6 @@ type DelSuperGroupMsgReq struct { } type DelSuperGroupMsgResp struct { - CommResp } type MsgDeleteNotificationElem struct { @@ -50,7 +47,6 @@ type SetMsgMinSeqReq struct { } type SetMsgMinSeqResp struct { - CommResp } type ModifyMessageReactionExtensionsReq struct { @@ -67,7 +63,6 @@ type ModifyMessageReactionExtensionsReq struct { } type ModifyMessageReactionExtensionsResp struct { - CommResp Data struct { ResultKeyValue []*msg.KeyValueResp `json:"result"` MsgFirstModifyTime int64 `json:"msgFirstModifyTime"` @@ -83,7 +78,6 @@ type ModifyMessageReactionExtensionsResp struct { //} type OperateMessageListReactionExtensionsResp struct { - CommResp Data struct { SuccessList []*msg.ExtendMsgResp `json:"successList"` FailedList []*msg.ExtendMsgResp `json:"failedList"` @@ -97,7 +91,6 @@ type SetMessageReactionExtensionsCallbackResp ModifyMessageReactionExtensionsRes //type GetMessageListReactionExtensionsReq OperateMessageListReactionExtensionsReq type GetMessageListReactionExtensionsResp struct { - CommResp Data []*msg.SingleMessageExtensionResult `json:"data"` } @@ -116,7 +109,6 @@ type DeleteMessageReactionExtensionsReq struct { } type DeleteMessageReactionExtensionsResp struct { - CommResp Data []*msg.KeyValueResp } diff --git a/pkg/apistruct/oss.go b/pkg/apistruct/oss.go index d1ecae757..55370d50c 100644 --- a/pkg/apistruct/oss.go +++ b/pkg/apistruct/oss.go @@ -16,7 +16,6 @@ type OSSCredentialRespData struct { } type OSSCredentialResp struct { - CommResp OssData OSSCredentialRespData `json:"-"` Data map[string]interface{} `json:"data"` } diff --git a/pkg/apistruct/third.go b/pkg/apistruct/third.go index 0be86b141..355700fee 100644 --- a/pkg/apistruct/third.go +++ b/pkg/apistruct/third.go @@ -29,7 +29,6 @@ type MinioUploadFile struct { } type MinioUploadFileResp struct { - CommResp Data struct { MinioUploadFile } `json:"data"` @@ -46,7 +45,6 @@ type UploadUpdateAppReq struct { } type UploadUpdateAppResp struct { - CommResp } type GetDownloadURLReq struct { @@ -56,7 +54,6 @@ type GetDownloadURLReq struct { } type GetDownloadURLResp struct { - CommResp Data struct { HasNewVersion bool `json:"hasNewVersion"` ForceUpdate bool `json:"forceUpdate"` @@ -73,7 +70,6 @@ type GetRTCInvitationInfoReq struct { } type GetRTCInvitationInfoResp struct { - CommResp Data struct { OpUserID string `json:"opUserID"` Invitation struct { @@ -110,7 +106,6 @@ type FcmUpdateTokenReq struct { } type FcmUpdateTokenResp struct { - CommResp } type SetAppBadgeReq struct { OperationID string `json:"operationID" binding:"required"` @@ -119,5 +114,4 @@ type SetAppBadgeReq struct { } type SetAppBadgeResp struct { - CommResp } diff --git a/pkg/common/db/table/unrelation/msg.go b/pkg/common/db/table/unrelation/msg.go index 270e69626..78aab60cc 100644 --- a/pkg/common/db/table/unrelation/msg.go +++ b/pkg/common/db/table/unrelation/msg.go @@ -10,7 +10,7 @@ import ( const ( singleGocMsgNum = 5000 - msg = "msg" + Msg = "msg" OldestList = 0 NewestList = -1 ) @@ -38,7 +38,7 @@ type MsgDocModelInterface interface { } func (MsgDocModel) TableName() string { - return msg + return Msg } func (MsgDocModel) GetSingleGocMsgNum() int64 { diff --git a/pkg/common/db/unrelation/mongo.go b/pkg/common/db/unrelation/mongo.go index 3543ade76..7b68021d8 100644 --- a/pkg/common/db/unrelation/mongo.go +++ b/pkg/common/db/unrelation/mongo.go @@ -61,7 +61,7 @@ func (m *Mongo) GetDatabase() *mongo.Database { } func (m *Mongo) CreateMsgIndex() error { - return m.createMongoIndex(unrelation.CChat, false, "uid") + return m.createMongoIndex(unrelation.Msg, false, "uid") } func (m *Mongo) CreateSuperGroupIndex() error { diff --git a/pkg/discoveryregistry/discovery_register.go b/pkg/discoveryregistry/discovery_register.go index 45d2ff2ea..78922f2a0 100644 --- a/pkg/discoveryregistry/discovery_register.go +++ b/pkg/discoveryregistry/discovery_register.go @@ -9,6 +9,7 @@ type SvcDiscoveryRegistry interface { UnRegister() error GetConns(serviceName string, opts ...grpc.DialOption) ([]*grpc.ClientConn, error) GetConn(serviceName string, opts ...grpc.DialOption) (*grpc.ClientConn, error) + AddOption(opts ...grpc.DialOption) RegisterConf2Registry(key string, conf []byte) error GetConfFromRegistry(key string) ([]byte, error)