From 87ce1895e34ca0d83744e1b49eeb5a89862e6c31 Mon Sep 17 00:00:00 2001 From: skiffer-git <44203734@qq.com> Date: Fri, 13 Jan 2023 20:58:06 +0800 Subject: [PATCH 01/13] Error code standardization --- internal/rpc/group/g.go | 30 +- internal/rpc/group/group.go | 70 ++--- internal/utils/conversion.go | 224 ++++++++++++++ pkg/common/token_verify/jwt_token.go | 14 - pkg/proto/group/group.pb.go | 432 ++++++++++++--------------- pkg/proto/group/group.proto | 7 +- pkg/utils/strings.go | 4 + 7 files changed, 471 insertions(+), 310 deletions(-) create mode 100644 internal/utils/conversion.go diff --git a/internal/rpc/group/g.go b/internal/rpc/group/g.go index 4c6699584..55c0b838f 100644 --- a/internal/rpc/group/g.go +++ b/internal/rpc/group/g.go @@ -5,8 +5,11 @@ import ( imdb "Open_IM/pkg/common/db/mysql_model/im_mysql_model" "Open_IM/pkg/common/tools" pbGroup "Open_IM/pkg/proto/group" + sdk "Open_IM/pkg/proto/sdk_ws" "Open_IM/pkg/utils" "context" + "math/big" + "strconv" "time" ) @@ -19,16 +22,12 @@ func getDBGroupRequest(ctx context.Context, req *pbGroup.GroupApplicationRespons return dbGroupRequest } -func getDBGroupMember(ctx context.Context, req *pbGroup.GroupApplicationResponseReq) (dbGroupMember *imdb.GroupMember) { +func getDBGroupMember(ctx context.Context, groupID, userID string) (dbGroupMember *imdb.GroupMember, err error) { dbGroupMember = &imdb.GroupMember{} - utils.CopyStructFields(&dbGroupRequest, req) - dbGroupRequest.UserID = req.FromUserID - dbGroupRequest.HandleUserID = tools.OpUserID(ctx) - dbGroupRequest.HandledTime = time.Now() member := imdb.GroupMember{} - member.GroupID = req.GroupID - member.UserID = req.FromUserID + member.GroupID = groupID + member.UserID = userID member.RoleLevel = constant.GroupOrdinaryUsers member.OperatorUserID = tools.OpUserID(ctx) @@ -38,5 +37,20 @@ func getDBGroupMember(ctx context.Context, req *pbGroup.GroupApplicationResponse member.InviterUserID = request.InviterUserID member.MuteEndTime = time.Unix(int64(time.Now().Second()), 0) - return dbGroupRequest + return dbGroupMember, nil +} + +func getUsersInfo(ctx context.Context, userIDs []string) ([]*sdk.UserInfo, error) { + return nil, nil +} + +func genGroupID(ctx context.Context, groupID string) string { + if groupID != "" { + return groupID + } + groupID = utils.Md5(tools.OperationID(ctx) + strconv.FormatInt(time.Now().UnixNano(), 10)) + bi := big.NewInt(0) + bi.SetString(groupID[0:8], 16) + groupID = bi.String() + return groupID } diff --git a/internal/rpc/group/group.go b/internal/rpc/group/group.go index 93698225d..0109743f4 100644 --- a/internal/rpc/group/group.go +++ b/internal/rpc/group/group.go @@ -24,7 +24,6 @@ import ( "Open_IM/pkg/utils" "context" "errors" - "math/big" "net" "strconv" "strings" @@ -121,48 +120,36 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR if err := token_verify.CheckAccessV3(ctx, req.OwnerUserID); err != nil { return nil, err } - var groupOwnerNum int + if req.OwnerUserID == "" { + return nil, constant.ErrArgs.Wrap("no group owner") + } var userIDs []string - for _, info := range req.InitMemberList { - if info.RoleLevel == constant.GroupOwner { - groupOwnerNum++ - } - userIDs = append(userIDs, info.UserID) + for _, ordinaryUserID := range req.InitMemberList { + userIDs = append(userIDs, ordinaryUserID) } - if req.OwnerUserID != "" { - groupOwnerNum++ - userIDs = append(userIDs, req.OwnerUserID) + userIDs = append(userIDs, req.OwnerUserID) + for _, adminUserID := range req.AdminUserIDs { + userIDs = append(userIDs, adminUserID) } - if groupOwnerNum != 1 { - return nil, constant.ErrArgs.Wrap("groupOwnerNum != 1") - } - if utils.IsRepeatStringSlice(userIDs) { + if utils.IsRepeatID(userIDs) { return nil, constant.ErrArgs.Wrap("group member is repeated") } - users, err := rocksCache.GetUserInfoFromCacheBatch(ctx, userIDs) + + users, err := getUsersInfo(ctx, userIDs) if err != nil { return nil, err } - if len(users) != len(userIDs) { - return nil, constant.ErrDatabase.Wrap("len(users from cache) != len(userIDs)") - } - userMap := make(map[string]*imdb.User) + + userMap := make(map[string]*open_im_sdk.UserInfo) for i, user := range users { userMap[user.UserID] = users[i] } - if err := s.DelGroupAndUserCache(ctx, "", userIDs); err != nil { - return nil, err - } + if err := callbackBeforeCreateGroup(ctx, req); err != nil { return nil, err } - groupId := req.GroupInfo.GroupID - if groupId == "" { - groupId = utils.Md5(tools.OperationID(ctx) + strconv.FormatInt(time.Now().UnixNano(), 10)) - bi := big.NewInt(0) - bi.SetString(groupId[0:8], 16) - groupId = bi.String() - } + groupId := genGroupID(ctx, req.GroupInfo.GroupID) + groupInfo := imdb.Group{} utils.CopyStructFields(&groupInfo, req.GroupInfo) groupInfo.CreatorUserID = tools.OpUserID(ctx) @@ -171,7 +158,9 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR if groupInfo.NotificationUpdateTime.Unix() < 0 { groupInfo.NotificationUpdateTime = utils.UnixSecondToTime(0) } + if req.GroupInfo.GroupType != constant.SuperGroup { + var groupMembers []*imdb.GroupMember joinGroup := func(userID string, roleLevel int32) error { groupMember := &imdb.GroupMember{GroupID: groupId, RoleLevel: roleLevel, OperatorUserID: tools.OpUserID(ctx), JoinSource: constant.JoinByInvitation, InviterUserID: tools.OpUserID(ctx)} @@ -193,9 +182,11 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR return nil, err } } + if err := (*imdb.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 @@ -673,30 +664,15 @@ func (s *groupServer) GroupApplicationResponse(ctx context.Context, req *pbGroup return nil, err } if req.HandleResult == constant.GroupResponseAgree { - user, err := imdb.GetUserByUserID(req.FromUserID) + member, err := getDBGroupMember(ctx, req.GroupID, req.FromUserID) if err != nil { return nil, err } - request, err := (&imdb.GroupRequest{}).Take(ctx, req.GroupID, req.FromUserID) + err = CallbackBeforeMemberJoinGroup(ctx, tools.OperationID(ctx), member, groupInfo.Ex) if err != nil { return nil, err } - member := imdb.GroupMember{} - member.GroupID = req.GroupID - member.UserID = req.FromUserID - member.RoleLevel = constant.GroupOrdinaryUsers - member.OperatorUserID = tools.OpUserID(ctx) - member.FaceURL = user.FaceURL - member.Nickname = user.Nickname - member.JoinSource = request.JoinSource - member.InviterUserID = request.InviterUserID - member.MuteEndTime = time.Unix(int64(time.Now().Second()), 0) - err = CallbackBeforeMemberJoinGroup(ctx, tools.OperationID(ctx), &member, groupInfo.Ex) - if err != nil { - return nil, err - } - - err = (&imdb.GroupMember{}).Create(ctx, []*imdb.GroupMember{&member}) + err = (&imdb.GroupMember{}).Create(ctx, []*imdb.GroupMember{member}) if err != nil { return nil, err } diff --git a/internal/utils/conversion.go b/internal/utils/conversion.go new file mode 100644 index 000000000..9ba43c73f --- /dev/null +++ b/internal/utils/conversion.go @@ -0,0 +1,224 @@ +package utils + +import ( + imdb "Open_IM/pkg/common/db/mysql_model/im_mysql_model" + sdk "Open_IM/pkg/proto/sdk_ws" + utils2 "Open_IM/pkg/utils" + utils "github.com/OpenIMSDK/open_utils" + "time" +) + +func getUsersInfo(userIDs []string) ([]*sdk.UserInfo, error) { + return nil, nil +} + +func getGroupOwnerInfo(groupID string) (*sdk.GroupMemberFullInfo, error) { + return nil, nil +} +func getNumberOfGroupMember(groupID string) (int32, error) { + return 0, nil +} + +type DBFriend struct { + *imdb.Friend +} + +type PBFriend struct { + *sdk.FriendInfo +} + +func (db *DBFriend) convert() (*sdk.FriendInfo, error) { + pbFriend := &sdk.FriendInfo{FriendUser: &sdk.UserInfo{}} + utils.CopyStructFields(pbFriend, db) + user, err := getUsersInfo([]string{db.FriendUserID}) + if err != nil { + return nil, err + } + utils2.CopyStructFields(pbFriend.FriendUser, user[0]) + pbFriend.CreateTime = uint32(db.CreateTime.Unix()) + + pbFriend.FriendUser.CreateTime = uint32(db.CreateTime.Unix()) + return pbFriend, nil +} + +func (pb *PBFriend) convert() (*imdb.Friend, error) { + dbFriend := &imdb.Friend{} + utils2.CopyStructFields(dbFriend, pb) + dbFriend.FriendUserID = pb.FriendUser.UserID + dbFriend.CreateTime = utils2.UnixSecondToTime(int64(pb.CreateTime)) + return dbFriend, nil +} + +type DBFriendRequest struct { + *imdb.FriendRequest +} + +type PBFriendRequest struct { + *sdk.FriendRequest +} + +func (pb *PBFriendRequest) convert() (*imdb.FriendRequest, error) { + dbFriendRequest := &imdb.FriendRequest{} + utils.CopyStructFields(dbFriendRequest, pb) + dbFriendRequest.CreateTime = utils.UnixSecondToTime(int64(pb.CreateTime)) + dbFriendRequest.HandleTime = utils.UnixSecondToTime(int64(pb.HandleTime)) + return dbFriendRequest, nil +} +func (db *DBFriendRequest) convert() (*sdk.FriendRequest, error) { + pbFriendRequest := &sdk.FriendRequest{} + utils.CopyStructFields(pbFriendRequest, db) + user, err := getUsersInfo([]string{db.FromUserID}) + if err != nil { + return nil, err + } + pbFriendRequest.FromNickname = user[0].Nickname + pbFriendRequest.FromFaceURL = user[0].FaceURL + pbFriendRequest.FromGender = user[0].Gender + user, err = getUsersInfo([]string{db.ToUserID}) + if err != nil { + return nil, err + } + pbFriendRequest.ToNickname = user[0].Nickname + pbFriendRequest.ToFaceURL = user[0].FaceURL + pbFriendRequest.ToGender = user[0].Gender + pbFriendRequest.CreateTime = uint32(db.CreateTime.Unix()) + pbFriendRequest.HandleTime = uint32(db.HandleTime.Unix()) + return pbFriendRequest, nil +} + +type DBBlack struct { + *imdb.Black +} + +type PBBlack struct { + *sdk.BlackInfo +} + +func (pb *PBBlack) convert() (*imdb.Black, error) { + dbBlack := &imdb.Black{} + dbBlack.BlockUserID = pb.BlackUserInfo.UserID + dbBlack.CreateTime = utils.UnixSecondToTime(int64(pb.CreateTime)) + return dbBlack, nil +} +func (db *DBBlack) convert() (*sdk.BlackInfo, error) { + pbBlack := &sdk.BlackInfo{} + utils.CopyStructFields(pbBlack, db) + pbBlack.CreateTime = uint32(db.CreateTime.Unix()) + user, err := getUsersInfo([]string{db.BlockUserID}) + if err != nil { + return nil, err + } + utils.CopyStructFields(pbBlack.BlackUserInfo, user) + return pbBlack, nil +} + +type DBGroup struct { + *imdb.Group +} + +type PBGroup struct { + *sdk.GroupInfo +} + +func (pb *PBGroup) convert() (*imdb.Group, error) { + dst := &imdb.Group{} + utils.CopyStructFields(dst, pb) + return dst, nil +} +func (db *DBGroup) convert() (*sdk.GroupInfo, error) { + dst := &sdk.GroupInfo{} + utils.CopyStructFields(dst, db) + user, err := getGroupOwnerInfo(db.GroupID) + if err != nil { + return nil, err + } + dst.OwnerUserID = user.UserID + + memberCount, err := getNumberOfGroupMember(db.GroupID) + if err != nil { + return nil, err + } + dst.MemberCount = uint32(memberCount) + dst.CreateTime = uint32(db.CreateTime.Unix()) + dst.NotificationUpdateTime = uint32(db.NotificationUpdateTime.Unix()) + if db.NotificationUpdateTime.Unix() < 0 { + dst.NotificationUpdateTime = 0 + } + return dst, nil +} + +type DBGroupMember struct { + *imdb.GroupMember +} + +type PBGroupMember struct { + *sdk.GroupMemberFullInfo +} + +func (pb *PBGroupMember) convert() (*imdb.GroupMember, error) { + dst := &imdb.GroupMember{} + utils.CopyStructFields(dst, pb) + dst.JoinTime = utils.UnixSecondToTime(int64(pb.JoinTime)) + dst.MuteEndTime = utils.UnixSecondToTime(int64(pb.MuteEndTime)) + return dst, nil +} +func (db *DBGroupMember) convert() (*sdk.GroupMemberFullInfo, error) { + dst := &sdk.GroupMemberFullInfo{} + utils.CopyStructFields(dst, db) + + user, err := getUsersInfo([]string{db.UserID}) + if err != nil { + return nil, err + } + dst.AppMangerLevel = user[0].AppMangerLevel + + dst.JoinTime = int32(db.JoinTime.Unix()) + if db.JoinTime.Unix() < 0 { + dst.JoinTime = 0 + } + dst.MuteEndTime = uint32(db.MuteEndTime.Unix()) + if dst.MuteEndTime < uint32(time.Now().Unix()) { + dst.MuteEndTime = 0 + } + return dst, nil +} + +type DBGroupRequest struct { + *imdb.GroupRequest +} + +type PBGroupRequest struct { + *sdk.GroupRequest +} + +func (pb *PBGroupRequest) convert() (*imdb.GroupRequest, error) { + dst := &imdb.GroupRequest{} + utils.CopyStructFields(dst, pb) + dst.ReqTime = utils.UnixSecondToTime(int64(pb.ReqTime)) + dst.HandledTime = utils.UnixSecondToTime(int64(pb.HandleTime)) + return dst, nil +} +func (db *DBGroupRequest) convert() (*sdk.GroupRequest, error) { + dst := &sdk.GroupRequest{} + utils.CopyStructFields(dst, db) + dst.ReqTime = uint32(db.ReqTime.Unix()) + dst.HandleTime = uint32(db.HandledTime.Unix()) + return dst, nil +} + +func UserOpenIMCopyDB(dst *imdb.User, src *open_im_sdk.UserInfo) { + utils.CopyStructFields(dst, src) + dst.Birth, _ = utils.TimeStringToTime(src.BirthStr) + dst.CreateTime = utils.UnixSecondToTime(int64(src.CreateTime)) +} + +func UserDBCopyOpenIM(dst *open_im_sdk.UserInfo, src *imdb.User) { + utils.CopyStructFields(dst, src) + dst.CreateTime = uint32(src.CreateTime.Unix()) + //dst.Birth = uint32(src.Birth.Unix()) + dst.BirthStr = utils2.TimeToString(src.Birth) +} + +func UserDBCopyOpenIMPublicUser(dst *open_im_sdk.PublicUserInfo, src *imdb.User) { + utils.CopyStructFields(dst, src) +} diff --git a/pkg/common/token_verify/jwt_token.go b/pkg/common/token_verify/jwt_token.go index 438a972ca..e5daef0e4 100644 --- a/pkg/common/token_verify/jwt_token.go +++ b/pkg/common/token_verify/jwt_token.go @@ -9,7 +9,6 @@ import ( "Open_IM/pkg/common/trace_log" "Open_IM/pkg/utils" "context" - "github.com/OpenIMSDK/open_utils" "time" go_redis "github.com/go-redis/redis/v8" @@ -160,19 +159,6 @@ func CheckAccess(ctx context.Context, OpUserID string, OwnerUserID string) bool return false } -func CheckAccessV2(ctx context.Context, OpUserID string, OwnerUserID string) (err error) { - defer func() { - trace_log.SetCtxInfo(ctx, utils.GetFuncName(1), err, "OpUserID", OpUserID, "OwnerUserID", OwnerUserID) - }() - if utils.IsContain(OpUserID, config.Config.Manager.AppManagerUid) { - return nil - } - if OpUserID == OwnerUserID { - return nil - } - return utils.Wrap(constant.ErrIdentity, open_utils.GetSelfFuncName()) -} - func CheckAccessV3(ctx context.Context, OwnerUserID string) (err error) { opUserID := tools.OpUserID(ctx) defer func() { diff --git a/pkg/proto/group/group.pb.go b/pkg/proto/group/group.pb.go index db483d834..450f19f14 100644 --- a/pkg/proto/group/group.pb.go +++ b/pkg/proto/group/group.pb.go @@ -25,66 +25,21 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package -type GroupAddMemberInfo struct { - UserID string `protobuf:"bytes,1,opt,name=userID" json:"userID,omitempty"` - RoleLevel int32 `protobuf:"varint,2,opt,name=roleLevel" json:"roleLevel,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GroupAddMemberInfo) Reset() { *m = GroupAddMemberInfo{} } -func (m *GroupAddMemberInfo) String() string { return proto.CompactTextString(m) } -func (*GroupAddMemberInfo) ProtoMessage() {} -func (*GroupAddMemberInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{0} -} -func (m *GroupAddMemberInfo) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GroupAddMemberInfo.Unmarshal(m, b) -} -func (m *GroupAddMemberInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GroupAddMemberInfo.Marshal(b, m, deterministic) -} -func (dst *GroupAddMemberInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_GroupAddMemberInfo.Merge(dst, src) -} -func (m *GroupAddMemberInfo) XXX_Size() int { - return xxx_messageInfo_GroupAddMemberInfo.Size(m) -} -func (m *GroupAddMemberInfo) XXX_DiscardUnknown() { - xxx_messageInfo_GroupAddMemberInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_GroupAddMemberInfo proto.InternalMessageInfo - -func (m *GroupAddMemberInfo) GetUserID() string { - if m != nil { - return m.UserID - } - return "" -} - -func (m *GroupAddMemberInfo) GetRoleLevel() int32 { - if m != nil { - return m.RoleLevel - } - return 0 -} - type CreateGroupReq struct { - InitMemberList []*GroupAddMemberInfo `protobuf:"bytes,1,rep,name=initMemberList" json:"initMemberList,omitempty"` - GroupInfo *sdk_ws.GroupInfo `protobuf:"bytes,2,opt,name=groupInfo" json:"groupInfo,omitempty"` - OwnerUserID string `protobuf:"bytes,5,opt,name=ownerUserID" json:"ownerUserID,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + InitMemberList []string `protobuf:"bytes,1,rep,name=initMemberList" json:"initMemberList,omitempty"` + GroupInfo *sdk_ws.GroupInfo `protobuf:"bytes,2,opt,name=groupInfo" json:"groupInfo,omitempty"` + AdminUserIDs []string `protobuf:"bytes,3,rep,name=adminUserIDs" json:"adminUserIDs,omitempty"` + OwnerUserID string `protobuf:"bytes,5,opt,name=ownerUserID" json:"ownerUserID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *CreateGroupReq) Reset() { *m = CreateGroupReq{} } func (m *CreateGroupReq) String() string { return proto.CompactTextString(m) } func (*CreateGroupReq) ProtoMessage() {} func (*CreateGroupReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{1} + return fileDescriptor_group_4fa7763fd681832d, []int{0} } func (m *CreateGroupReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreateGroupReq.Unmarshal(m, b) @@ -104,7 +59,7 @@ func (m *CreateGroupReq) XXX_DiscardUnknown() { var xxx_messageInfo_CreateGroupReq proto.InternalMessageInfo -func (m *CreateGroupReq) GetInitMemberList() []*GroupAddMemberInfo { +func (m *CreateGroupReq) GetInitMemberList() []string { if m != nil { return m.InitMemberList } @@ -118,6 +73,13 @@ func (m *CreateGroupReq) GetGroupInfo() *sdk_ws.GroupInfo { return nil } +func (m *CreateGroupReq) GetAdminUserIDs() []string { + if m != nil { + return m.AdminUserIDs + } + return nil +} + func (m *CreateGroupReq) GetOwnerUserID() string { if m != nil { return m.OwnerUserID @@ -136,7 +98,7 @@ func (m *CreateGroupResp) Reset() { *m = CreateGroupResp{} } func (m *CreateGroupResp) String() string { return proto.CompactTextString(m) } func (*CreateGroupResp) ProtoMessage() {} func (*CreateGroupResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{2} + return fileDescriptor_group_4fa7763fd681832d, []int{1} } func (m *CreateGroupResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreateGroupResp.Unmarshal(m, b) @@ -174,7 +136,7 @@ func (m *GetGroupsInfoReq) Reset() { *m = GetGroupsInfoReq{} } func (m *GetGroupsInfoReq) String() string { return proto.CompactTextString(m) } func (*GetGroupsInfoReq) ProtoMessage() {} func (*GetGroupsInfoReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{3} + return fileDescriptor_group_4fa7763fd681832d, []int{2} } func (m *GetGroupsInfoReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupsInfoReq.Unmarshal(m, b) @@ -212,7 +174,7 @@ func (m *GetGroupsInfoResp) Reset() { *m = GetGroupsInfoResp{} } func (m *GetGroupsInfoResp) String() string { return proto.CompactTextString(m) } func (*GetGroupsInfoResp) ProtoMessage() {} func (*GetGroupsInfoResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{4} + return fileDescriptor_group_4fa7763fd681832d, []int{3} } func (m *GetGroupsInfoResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupsInfoResp.Unmarshal(m, b) @@ -250,7 +212,7 @@ func (m *SetGroupInfoReq) Reset() { *m = SetGroupInfoReq{} } func (m *SetGroupInfoReq) String() string { return proto.CompactTextString(m) } func (*SetGroupInfoReq) ProtoMessage() {} func (*SetGroupInfoReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{5} + return fileDescriptor_group_4fa7763fd681832d, []int{4} } func (m *SetGroupInfoReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetGroupInfoReq.Unmarshal(m, b) @@ -287,7 +249,7 @@ func (m *SetGroupInfoResp) Reset() { *m = SetGroupInfoResp{} } func (m *SetGroupInfoResp) String() string { return proto.CompactTextString(m) } func (*SetGroupInfoResp) ProtoMessage() {} func (*SetGroupInfoResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{6} + return fileDescriptor_group_4fa7763fd681832d, []int{5} } func (m *SetGroupInfoResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetGroupInfoResp.Unmarshal(m, b) @@ -319,7 +281,7 @@ func (m *GetGroupApplicationListReq) Reset() { *m = GetGroupApplicationL func (m *GetGroupApplicationListReq) String() string { return proto.CompactTextString(m) } func (*GetGroupApplicationListReq) ProtoMessage() {} func (*GetGroupApplicationListReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{7} + return fileDescriptor_group_4fa7763fd681832d, []int{6} } func (m *GetGroupApplicationListReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupApplicationListReq.Unmarshal(m, b) @@ -365,7 +327,7 @@ func (m *GetGroupApplicationListResp) Reset() { *m = GetGroupApplication func (m *GetGroupApplicationListResp) String() string { return proto.CompactTextString(m) } func (*GetGroupApplicationListResp) ProtoMessage() {} func (*GetGroupApplicationListResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{8} + return fileDescriptor_group_4fa7763fd681832d, []int{7} } func (m *GetGroupApplicationListResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupApplicationListResp.Unmarshal(m, b) @@ -411,7 +373,7 @@ func (m *GetUserReqApplicationListReq) Reset() { *m = GetUserReqApplicat func (m *GetUserReqApplicationListReq) String() string { return proto.CompactTextString(m) } func (*GetUserReqApplicationListReq) ProtoMessage() {} func (*GetUserReqApplicationListReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{9} + return fileDescriptor_group_4fa7763fd681832d, []int{8} } func (m *GetUserReqApplicationListReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetUserReqApplicationListReq.Unmarshal(m, b) @@ -457,7 +419,7 @@ func (m *GetUserReqApplicationListResp) Reset() { *m = GetUserReqApplica func (m *GetUserReqApplicationListResp) String() string { return proto.CompactTextString(m) } func (*GetUserReqApplicationListResp) ProtoMessage() {} func (*GetUserReqApplicationListResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{10} + return fileDescriptor_group_4fa7763fd681832d, []int{9} } func (m *GetUserReqApplicationListResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetUserReqApplicationListResp.Unmarshal(m, b) @@ -504,7 +466,7 @@ func (m *TransferGroupOwnerReq) Reset() { *m = TransferGroupOwnerReq{} } func (m *TransferGroupOwnerReq) String() string { return proto.CompactTextString(m) } func (*TransferGroupOwnerReq) ProtoMessage() {} func (*TransferGroupOwnerReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{11} + return fileDescriptor_group_4fa7763fd681832d, []int{10} } func (m *TransferGroupOwnerReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_TransferGroupOwnerReq.Unmarshal(m, b) @@ -555,7 +517,7 @@ func (m *TransferGroupOwnerResp) Reset() { *m = TransferGroupOwnerResp{} func (m *TransferGroupOwnerResp) String() string { return proto.CompactTextString(m) } func (*TransferGroupOwnerResp) ProtoMessage() {} func (*TransferGroupOwnerResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{12} + return fileDescriptor_group_4fa7763fd681832d, []int{11} } func (m *TransferGroupOwnerResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_TransferGroupOwnerResp.Unmarshal(m, b) @@ -589,7 +551,7 @@ func (m *JoinGroupReq) Reset() { *m = JoinGroupReq{} } func (m *JoinGroupReq) String() string { return proto.CompactTextString(m) } func (*JoinGroupReq) ProtoMessage() {} func (*JoinGroupReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{13} + return fileDescriptor_group_4fa7763fd681832d, []int{12} } func (m *JoinGroupReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_JoinGroupReq.Unmarshal(m, b) @@ -647,7 +609,7 @@ func (m *JoinGroupResp) Reset() { *m = JoinGroupResp{} } func (m *JoinGroupResp) String() string { return proto.CompactTextString(m) } func (*JoinGroupResp) ProtoMessage() {} func (*JoinGroupResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{14} + return fileDescriptor_group_4fa7763fd681832d, []int{13} } func (m *JoinGroupResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_JoinGroupResp.Unmarshal(m, b) @@ -681,7 +643,7 @@ func (m *GroupApplicationResponseReq) Reset() { *m = GroupApplicationRes func (m *GroupApplicationResponseReq) String() string { return proto.CompactTextString(m) } func (*GroupApplicationResponseReq) ProtoMessage() {} func (*GroupApplicationResponseReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{15} + return fileDescriptor_group_4fa7763fd681832d, []int{14} } func (m *GroupApplicationResponseReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupApplicationResponseReq.Unmarshal(m, b) @@ -739,7 +701,7 @@ func (m *GroupApplicationResponseResp) Reset() { *m = GroupApplicationRe func (m *GroupApplicationResponseResp) String() string { return proto.CompactTextString(m) } func (*GroupApplicationResponseResp) ProtoMessage() {} func (*GroupApplicationResponseResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{16} + return fileDescriptor_group_4fa7763fd681832d, []int{15} } func (m *GroupApplicationResponseResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupApplicationResponseResp.Unmarshal(m, b) @@ -770,7 +732,7 @@ func (m *QuitGroupReq) Reset() { *m = QuitGroupReq{} } func (m *QuitGroupReq) String() string { return proto.CompactTextString(m) } func (*QuitGroupReq) ProtoMessage() {} func (*QuitGroupReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{17} + return fileDescriptor_group_4fa7763fd681832d, []int{16} } func (m *QuitGroupReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_QuitGroupReq.Unmarshal(m, b) @@ -807,7 +769,7 @@ func (m *QuitGroupResp) Reset() { *m = QuitGroupResp{} } func (m *QuitGroupResp) String() string { return proto.CompactTextString(m) } func (*QuitGroupResp) ProtoMessage() {} func (*QuitGroupResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{18} + return fileDescriptor_group_4fa7763fd681832d, []int{17} } func (m *QuitGroupResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_QuitGroupResp.Unmarshal(m, b) @@ -840,7 +802,7 @@ func (m *GetGroupMemberListReq) Reset() { *m = GetGroupMemberListReq{} } func (m *GetGroupMemberListReq) String() string { return proto.CompactTextString(m) } func (*GetGroupMemberListReq) ProtoMessage() {} func (*GetGroupMemberListReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{19} + return fileDescriptor_group_4fa7763fd681832d, []int{18} } func (m *GetGroupMemberListReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupMemberListReq.Unmarshal(m, b) @@ -893,7 +855,7 @@ func (m *GetGroupMemberListResp) Reset() { *m = GetGroupMemberListResp{} func (m *GetGroupMemberListResp) String() string { return proto.CompactTextString(m) } func (*GetGroupMemberListResp) ProtoMessage() {} func (*GetGroupMemberListResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{20} + return fileDescriptor_group_4fa7763fd681832d, []int{19} } func (m *GetGroupMemberListResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupMemberListResp.Unmarshal(m, b) @@ -939,7 +901,7 @@ func (m *GetGroupMembersInfoReq) Reset() { *m = GetGroupMembersInfoReq{} func (m *GetGroupMembersInfoReq) String() string { return proto.CompactTextString(m) } func (*GetGroupMembersInfoReq) ProtoMessage() {} func (*GetGroupMembersInfoReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{21} + return fileDescriptor_group_4fa7763fd681832d, []int{20} } func (m *GetGroupMembersInfoReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupMembersInfoReq.Unmarshal(m, b) @@ -984,7 +946,7 @@ func (m *GetGroupMembersInfoResp) Reset() { *m = GetGroupMembersInfoResp func (m *GetGroupMembersInfoResp) String() string { return proto.CompactTextString(m) } func (*GetGroupMembersInfoResp) ProtoMessage() {} func (*GetGroupMembersInfoResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{22} + return fileDescriptor_group_4fa7763fd681832d, []int{21} } func (m *GetGroupMembersInfoResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupMembersInfoResp.Unmarshal(m, b) @@ -1024,7 +986,7 @@ func (m *KickGroupMemberReq) Reset() { *m = KickGroupMemberReq{} } func (m *KickGroupMemberReq) String() string { return proto.CompactTextString(m) } func (*KickGroupMemberReq) ProtoMessage() {} func (*KickGroupMemberReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{23} + return fileDescriptor_group_4fa7763fd681832d, []int{22} } func (m *KickGroupMemberReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_KickGroupMemberReq.Unmarshal(m, b) @@ -1077,7 +1039,7 @@ func (m *Id2Result) Reset() { *m = Id2Result{} } func (m *Id2Result) String() string { return proto.CompactTextString(m) } func (*Id2Result) ProtoMessage() {} func (*Id2Result) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{24} + return fileDescriptor_group_4fa7763fd681832d, []int{23} } func (m *Id2Result) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Id2Result.Unmarshal(m, b) @@ -1122,7 +1084,7 @@ func (m *KickGroupMemberResp) Reset() { *m = KickGroupMemberResp{} } func (m *KickGroupMemberResp) String() string { return proto.CompactTextString(m) } func (*KickGroupMemberResp) ProtoMessage() {} func (*KickGroupMemberResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{25} + return fileDescriptor_group_4fa7763fd681832d, []int{24} } func (m *KickGroupMemberResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_KickGroupMemberResp.Unmarshal(m, b) @@ -1161,7 +1123,7 @@ func (m *GetJoinedGroupListReq) Reset() { *m = GetJoinedGroupListReq{} } func (m *GetJoinedGroupListReq) String() string { return proto.CompactTextString(m) } func (*GetJoinedGroupListReq) ProtoMessage() {} func (*GetJoinedGroupListReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{26} + return fileDescriptor_group_4fa7763fd681832d, []int{25} } func (m *GetJoinedGroupListReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetJoinedGroupListReq.Unmarshal(m, b) @@ -1207,7 +1169,7 @@ func (m *GetJoinedGroupListResp) Reset() { *m = GetJoinedGroupListResp{} func (m *GetJoinedGroupListResp) String() string { return proto.CompactTextString(m) } func (*GetJoinedGroupListResp) ProtoMessage() {} func (*GetJoinedGroupListResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{27} + return fileDescriptor_group_4fa7763fd681832d, []int{26} } func (m *GetJoinedGroupListResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetJoinedGroupListResp.Unmarshal(m, b) @@ -1254,7 +1216,7 @@ func (m *InviteUserToGroupReq) Reset() { *m = InviteUserToGroupReq{} } func (m *InviteUserToGroupReq) String() string { return proto.CompactTextString(m) } func (*InviteUserToGroupReq) ProtoMessage() {} func (*InviteUserToGroupReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{28} + return fileDescriptor_group_4fa7763fd681832d, []int{27} } func (m *InviteUserToGroupReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_InviteUserToGroupReq.Unmarshal(m, b) @@ -1306,7 +1268,7 @@ func (m *InviteUserToGroupResp) Reset() { *m = InviteUserToGroupResp{} } func (m *InviteUserToGroupResp) String() string { return proto.CompactTextString(m) } func (*InviteUserToGroupResp) ProtoMessage() {} func (*InviteUserToGroupResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{29} + return fileDescriptor_group_4fa7763fd681832d, []int{28} } func (m *InviteUserToGroupResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_InviteUserToGroupResp.Unmarshal(m, b) @@ -1346,7 +1308,7 @@ func (m *GetGroupAllMemberReq) Reset() { *m = GetGroupAllMemberReq{} } func (m *GetGroupAllMemberReq) String() string { return proto.CompactTextString(m) } func (*GetGroupAllMemberReq) ProtoMessage() {} func (*GetGroupAllMemberReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{30} + return fileDescriptor_group_4fa7763fd681832d, []int{29} } func (m *GetGroupAllMemberReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupAllMemberReq.Unmarshal(m, b) @@ -1398,7 +1360,7 @@ func (m *GetGroupAllMemberResp) Reset() { *m = GetGroupAllMemberResp{} } func (m *GetGroupAllMemberResp) String() string { return proto.CompactTextString(m) } func (*GetGroupAllMemberResp) ProtoMessage() {} func (*GetGroupAllMemberResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{31} + return fileDescriptor_group_4fa7763fd681832d, []int{30} } func (m *GetGroupAllMemberResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupAllMemberResp.Unmarshal(m, b) @@ -1438,7 +1400,7 @@ func (m *CMSGroup) Reset() { *m = CMSGroup{} } func (m *CMSGroup) String() string { return proto.CompactTextString(m) } func (*CMSGroup) ProtoMessage() {} func (*CMSGroup) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{32} + return fileDescriptor_group_4fa7763fd681832d, []int{31} } func (m *CMSGroup) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CMSGroup.Unmarshal(m, b) @@ -1492,7 +1454,7 @@ func (m *GetGroupsReq) Reset() { *m = GetGroupsReq{} } func (m *GetGroupsReq) String() string { return proto.CompactTextString(m) } func (*GetGroupsReq) ProtoMessage() {} func (*GetGroupsReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{33} + return fileDescriptor_group_4fa7763fd681832d, []int{32} } func (m *GetGroupsReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupsReq.Unmarshal(m, b) @@ -1545,7 +1507,7 @@ func (m *GetGroupsResp) Reset() { *m = GetGroupsResp{} } func (m *GetGroupsResp) String() string { return proto.CompactTextString(m) } func (*GetGroupsResp) ProtoMessage() {} func (*GetGroupsResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{34} + return fileDescriptor_group_4fa7763fd681832d, []int{33} } func (m *GetGroupsResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupsResp.Unmarshal(m, b) @@ -1590,7 +1552,7 @@ func (m *GetGroupMemberReq) Reset() { *m = GetGroupMemberReq{} } func (m *GetGroupMemberReq) String() string { return proto.CompactTextString(m) } func (*GetGroupMemberReq) ProtoMessage() {} func (*GetGroupMemberReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{35} + return fileDescriptor_group_4fa7763fd681832d, []int{34} } func (m *GetGroupMemberReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupMemberReq.Unmarshal(m, b) @@ -1630,7 +1592,7 @@ func (m *GetGroupMembersCMSReq) Reset() { *m = GetGroupMembersCMSReq{} } func (m *GetGroupMembersCMSReq) String() string { return proto.CompactTextString(m) } func (*GetGroupMembersCMSReq) ProtoMessage() {} func (*GetGroupMembersCMSReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{36} + return fileDescriptor_group_4fa7763fd681832d, []int{35} } func (m *GetGroupMembersCMSReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupMembersCMSReq.Unmarshal(m, b) @@ -1684,7 +1646,7 @@ func (m *GetGroupMembersCMSResp) Reset() { *m = GetGroupMembersCMSResp{} func (m *GetGroupMembersCMSResp) String() string { return proto.CompactTextString(m) } func (*GetGroupMembersCMSResp) ProtoMessage() {} func (*GetGroupMembersCMSResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{37} + return fileDescriptor_group_4fa7763fd681832d, []int{36} } func (m *GetGroupMembersCMSResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupMembersCMSResp.Unmarshal(m, b) @@ -1736,7 +1698,7 @@ func (m *DismissGroupReq) Reset() { *m = DismissGroupReq{} } func (m *DismissGroupReq) String() string { return proto.CompactTextString(m) } func (*DismissGroupReq) ProtoMessage() {} func (*DismissGroupReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{38} + return fileDescriptor_group_4fa7763fd681832d, []int{37} } func (m *DismissGroupReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DismissGroupReq.Unmarshal(m, b) @@ -1773,7 +1735,7 @@ func (m *DismissGroupResp) Reset() { *m = DismissGroupResp{} } func (m *DismissGroupResp) String() string { return proto.CompactTextString(m) } func (*DismissGroupResp) ProtoMessage() {} func (*DismissGroupResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{39} + return fileDescriptor_group_4fa7763fd681832d, []int{38} } func (m *DismissGroupResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DismissGroupResp.Unmarshal(m, b) @@ -1806,7 +1768,7 @@ func (m *MuteGroupMemberReq) Reset() { *m = MuteGroupMemberReq{} } func (m *MuteGroupMemberReq) String() string { return proto.CompactTextString(m) } func (*MuteGroupMemberReq) ProtoMessage() {} func (*MuteGroupMemberReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{40} + return fileDescriptor_group_4fa7763fd681832d, []int{39} } func (m *MuteGroupMemberReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MuteGroupMemberReq.Unmarshal(m, b) @@ -1857,7 +1819,7 @@ func (m *MuteGroupMemberResp) Reset() { *m = MuteGroupMemberResp{} } func (m *MuteGroupMemberResp) String() string { return proto.CompactTextString(m) } func (*MuteGroupMemberResp) ProtoMessage() {} func (*MuteGroupMemberResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{41} + return fileDescriptor_group_4fa7763fd681832d, []int{40} } func (m *MuteGroupMemberResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MuteGroupMemberResp.Unmarshal(m, b) @@ -1889,7 +1851,7 @@ func (m *CancelMuteGroupMemberReq) Reset() { *m = CancelMuteGroupMemberR func (m *CancelMuteGroupMemberReq) String() string { return proto.CompactTextString(m) } func (*CancelMuteGroupMemberReq) ProtoMessage() {} func (*CancelMuteGroupMemberReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{42} + return fileDescriptor_group_4fa7763fd681832d, []int{41} } func (m *CancelMuteGroupMemberReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CancelMuteGroupMemberReq.Unmarshal(m, b) @@ -1933,7 +1895,7 @@ func (m *CancelMuteGroupMemberResp) Reset() { *m = CancelMuteGroupMember func (m *CancelMuteGroupMemberResp) String() string { return proto.CompactTextString(m) } func (*CancelMuteGroupMemberResp) ProtoMessage() {} func (*CancelMuteGroupMemberResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{43} + return fileDescriptor_group_4fa7763fd681832d, []int{42} } func (m *CancelMuteGroupMemberResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CancelMuteGroupMemberResp.Unmarshal(m, b) @@ -1964,7 +1926,7 @@ func (m *MuteGroupReq) Reset() { *m = MuteGroupReq{} } func (m *MuteGroupReq) String() string { return proto.CompactTextString(m) } func (*MuteGroupReq) ProtoMessage() {} func (*MuteGroupReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{44} + return fileDescriptor_group_4fa7763fd681832d, []int{43} } func (m *MuteGroupReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MuteGroupReq.Unmarshal(m, b) @@ -2001,7 +1963,7 @@ func (m *MuteGroupResp) Reset() { *m = MuteGroupResp{} } func (m *MuteGroupResp) String() string { return proto.CompactTextString(m) } func (*MuteGroupResp) ProtoMessage() {} func (*MuteGroupResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{45} + return fileDescriptor_group_4fa7763fd681832d, []int{44} } func (m *MuteGroupResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MuteGroupResp.Unmarshal(m, b) @@ -2032,7 +1994,7 @@ func (m *CancelMuteGroupReq) Reset() { *m = CancelMuteGroupReq{} } func (m *CancelMuteGroupReq) String() string { return proto.CompactTextString(m) } func (*CancelMuteGroupReq) ProtoMessage() {} func (*CancelMuteGroupReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{46} + return fileDescriptor_group_4fa7763fd681832d, []int{45} } func (m *CancelMuteGroupReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CancelMuteGroupReq.Unmarshal(m, b) @@ -2069,7 +2031,7 @@ func (m *CancelMuteGroupResp) Reset() { *m = CancelMuteGroupResp{} } func (m *CancelMuteGroupResp) String() string { return proto.CompactTextString(m) } func (*CancelMuteGroupResp) ProtoMessage() {} func (*CancelMuteGroupResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{47} + return fileDescriptor_group_4fa7763fd681832d, []int{46} } func (m *CancelMuteGroupResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CancelMuteGroupResp.Unmarshal(m, b) @@ -2102,7 +2064,7 @@ func (m *SetGroupMemberNicknameReq) Reset() { *m = SetGroupMemberNicknam func (m *SetGroupMemberNicknameReq) String() string { return proto.CompactTextString(m) } func (*SetGroupMemberNicknameReq) ProtoMessage() {} func (*SetGroupMemberNicknameReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{48} + return fileDescriptor_group_4fa7763fd681832d, []int{47} } func (m *SetGroupMemberNicknameReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetGroupMemberNicknameReq.Unmarshal(m, b) @@ -2153,7 +2115,7 @@ func (m *SetGroupMemberNicknameResp) Reset() { *m = SetGroupMemberNickna func (m *SetGroupMemberNicknameResp) String() string { return proto.CompactTextString(m) } func (*SetGroupMemberNicknameResp) ProtoMessage() {} func (*SetGroupMemberNicknameResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{49} + return fileDescriptor_group_4fa7763fd681832d, []int{48} } func (m *SetGroupMemberNicknameResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetGroupMemberNicknameResp.Unmarshal(m, b) @@ -2185,7 +2147,7 @@ func (m *GetJoinedSuperGroupListReq) Reset() { *m = GetJoinedSuperGroupL func (m *GetJoinedSuperGroupListReq) String() string { return proto.CompactTextString(m) } func (*GetJoinedSuperGroupListReq) ProtoMessage() {} func (*GetJoinedSuperGroupListReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{50} + return fileDescriptor_group_4fa7763fd681832d, []int{49} } func (m *GetJoinedSuperGroupListReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetJoinedSuperGroupListReq.Unmarshal(m, b) @@ -2231,7 +2193,7 @@ func (m *GetJoinedSuperGroupListResp) Reset() { *m = GetJoinedSuperGroup func (m *GetJoinedSuperGroupListResp) String() string { return proto.CompactTextString(m) } func (*GetJoinedSuperGroupListResp) ProtoMessage() {} func (*GetJoinedSuperGroupListResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{51} + return fileDescriptor_group_4fa7763fd681832d, []int{50} } func (m *GetJoinedSuperGroupListResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetJoinedSuperGroupListResp.Unmarshal(m, b) @@ -2276,7 +2238,7 @@ func (m *GetSuperGroupsInfoReq) Reset() { *m = GetSuperGroupsInfoReq{} } func (m *GetSuperGroupsInfoReq) String() string { return proto.CompactTextString(m) } func (*GetSuperGroupsInfoReq) ProtoMessage() {} func (*GetSuperGroupsInfoReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{52} + return fileDescriptor_group_4fa7763fd681832d, []int{51} } func (m *GetSuperGroupsInfoReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetSuperGroupsInfoReq.Unmarshal(m, b) @@ -2314,7 +2276,7 @@ func (m *GetSuperGroupsInfoResp) Reset() { *m = GetSuperGroupsInfoResp{} func (m *GetSuperGroupsInfoResp) String() string { return proto.CompactTextString(m) } func (*GetSuperGroupsInfoResp) ProtoMessage() {} func (*GetSuperGroupsInfoResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{53} + return fileDescriptor_group_4fa7763fd681832d, []int{52} } func (m *GetSuperGroupsInfoResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetSuperGroupsInfoResp.Unmarshal(m, b) @@ -2357,7 +2319,7 @@ func (m *SetGroupMemberInfoReq) Reset() { *m = SetGroupMemberInfoReq{} } func (m *SetGroupMemberInfoReq) String() string { return proto.CompactTextString(m) } func (*SetGroupMemberInfoReq) ProtoMessage() {} func (*SetGroupMemberInfoReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{54} + return fileDescriptor_group_4fa7763fd681832d, []int{53} } func (m *SetGroupMemberInfoReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetGroupMemberInfoReq.Unmarshal(m, b) @@ -2429,7 +2391,7 @@ func (m *SetGroupMemberInfoResp) Reset() { *m = SetGroupMemberInfoResp{} func (m *SetGroupMemberInfoResp) String() string { return proto.CompactTextString(m) } func (*SetGroupMemberInfoResp) ProtoMessage() {} func (*SetGroupMemberInfoResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{55} + return fileDescriptor_group_4fa7763fd681832d, []int{54} } func (m *SetGroupMemberInfoResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetGroupMemberInfoResp.Unmarshal(m, b) @@ -2460,7 +2422,7 @@ func (m *GetGroupAbstractInfoReq) Reset() { *m = GetGroupAbstractInfoReq func (m *GetGroupAbstractInfoReq) String() string { return proto.CompactTextString(m) } func (*GetGroupAbstractInfoReq) ProtoMessage() {} func (*GetGroupAbstractInfoReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{56} + return fileDescriptor_group_4fa7763fd681832d, []int{55} } func (m *GetGroupAbstractInfoReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupAbstractInfoReq.Unmarshal(m, b) @@ -2500,7 +2462,7 @@ func (m *GroupAbstractInfo) Reset() { *m = GroupAbstractInfo{} } func (m *GroupAbstractInfo) String() string { return proto.CompactTextString(m) } func (*GroupAbstractInfo) ProtoMessage() {} func (*GroupAbstractInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{57} + return fileDescriptor_group_4fa7763fd681832d, []int{56} } func (m *GroupAbstractInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupAbstractInfo.Unmarshal(m, b) @@ -2552,7 +2514,7 @@ func (m *GetGroupAbstractInfoResp) Reset() { *m = GetGroupAbstractInfoRe func (m *GetGroupAbstractInfoResp) String() string { return proto.CompactTextString(m) } func (*GetGroupAbstractInfoResp) ProtoMessage() {} func (*GetGroupAbstractInfoResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_908b1d0f9beeddfc, []int{58} + return fileDescriptor_group_4fa7763fd681832d, []int{57} } func (m *GetGroupAbstractInfoResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupAbstractInfoResp.Unmarshal(m, b) @@ -2580,7 +2542,6 @@ func (m *GetGroupAbstractInfoResp) GetGroupAbstractInfos() []*GroupAbstractInfo } func init() { - proto.RegisterType((*GroupAddMemberInfo)(nil), "group.GroupAddMemberInfo") proto.RegisterType((*CreateGroupReq)(nil), "group.CreateGroupReq") proto.RegisterType((*CreateGroupResp)(nil), "group.CreateGroupResp") proto.RegisterType((*GetGroupsInfoReq)(nil), "group.GetGroupsInfoReq") @@ -3586,129 +3547,128 @@ var _Group_serviceDesc = grpc.ServiceDesc{ Metadata: "group/group.proto", } -func init() { proto.RegisterFile("group/group.proto", fileDescriptor_group_908b1d0f9beeddfc) } +func init() { proto.RegisterFile("group/group.proto", fileDescriptor_group_4fa7763fd681832d) } -var fileDescriptor_group_908b1d0f9beeddfc = []byte{ - // 1925 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x59, 0x5f, 0x73, 0x1b, 0x49, - 0x11, 0xaf, 0x95, 0x23, 0xc7, 0x6e, 0xdb, 0xb1, 0x33, 0x8e, 0x1c, 0x65, 0xa3, 0x24, 0xbe, 0xb9, - 0x70, 0xb8, 0x20, 0xb1, 0x29, 0x1f, 0x5c, 0x71, 0x1c, 0x55, 0x47, 0x2e, 0x21, 0x39, 0xdf, 0x59, - 0x36, 0x59, 0xe5, 0xb8, 0xaa, 0x2b, 0xc0, 0xac, 0xa5, 0xd1, 0xde, 0xc6, 0xd2, 0xee, 0x78, 0x67, - 0xd7, 0xb9, 0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, - 0x85, 0xdc, 0x79, 0xd1, 0x07, 0x2b, 0x39, 0xbd, 0x87, 0x56, 0x72, 0xa5, 0x76, 0x99, 0x67, 0x9a, - 0x3e, 0x40, 0x44, 0xb7, 0x8b, 0x63, 0x57, 0x86, 0x91, 0x6e, 0xdb, 0xbe, 0xc0, 0x28, 0xfa, 0x18, - 0x56, 0x99, 0x36, 0xca, 0x43, 0xc5, 0xd9, 0x2a, 0x03, 0x44, 0xf7, 0xb6, 0x95, 0xce, 0x28, 0xfa, - 0x35, 0xdc, 0x0e, 0xec, 0x13, 0x37, 0xf4, 0x4e, 0x45, 0xab, 0x39, 0x0d, 0x73, 0xf1, 0x2c, 0x16, - 0x46, 0xd1, 0x10, 0xee, 0x04, 0x75, 0x23, 0x2d, 0xf4, 0xee, 0x64, 0x83, 0xda, 0x99, 0x9b, 0xfb, - 0x70, 0x36, 0x13, 0xa3, 0xe8, 0x25, 0xa0, 0xd4, 0x18, 0x19, 0xa1, 0x8e, 0x94, 0xb5, 0x0e, 0xb4, - 0xdc, 0x7b, 0x53, 0x56, 0x19, 0x45, 0x7d, 0x68, 0x07, 0x35, 0xb3, 0x12, 0x84, 0x4b, 0x31, 0x6a, - 0x9d, 0xf4, 0xb8, 0xef, 0xce, 0xe4, 0x11, 0x76, 0x07, 0xc6, 0x8c, 0x42, 0xd9, 0x6d, 0x9d, 0xa7, - 0x28, 0xbb, 0x6b, 0x86, 0x1b, 0xaf, 0x60, 0x33, 0x30, 0x47, 0x05, 0xc8, 0x2e, 0xa5, 0xa2, 0xec, - 0xfe, 0xb4, 0x65, 0x9e, 0xb1, 0xeb, 0x67, 0xe5, 0x66, 0x1b, 0x15, 0xff, 0x08, 0x98, 0x53, 0x03, - 0xd7, 0xad, 0x5b, 0x52, 0x47, 0xae, 0x34, 0xba, 0xfa, 0x91, 0xcd, 0x16, 0x5c, 0x3f, 0xb2, 0xad, - 0x43, 0x3e, 0x2a, 0xba, 0x50, 0xad, 0xaf, 0x44, 0x77, 0x8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 0x4f, 0x1e, 0x7c, 0x75, 0xef, 0x98, 0x92, 0xe8, 0xe4, 0xa0, 0xab, 0xfd, 0x83, 0xca, 0x65, 0x3e, - 0xe2, 0xbf, 0xa7, 0x8b, 0x9c, 0xf4, 0xfe, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xd4, 0x50, 0xb3, - 0x74, 0xb4, 0x1d, 0x00, 0x00, +var fileDescriptor_group_4fa7763fd681832d = []byte{ + // 1907 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x59, 0x5f, 0x73, 0xdb, 0xc6, + 0x11, 0x1f, 0x50, 0xa6, 0x2c, 0xad, 0xa5, 0x50, 0x3e, 0x99, 0x32, 0x0d, 0xcb, 0xb6, 0x72, 0x71, + 0x53, 0x4d, 0x6b, 0x53, 0x1d, 0xa5, 0xcd, 0x34, 0x4d, 0x67, 0xd2, 0xc4, 0xae, 0x1d, 0x35, 0xa2, + 0x54, 0x83, 0x4e, 0x33, 0x93, 0x69, 0xab, 0x42, 0xe4, 0x11, 0x81, 0x45, 0x02, 0x27, 0x1c, 0x20, + 0x67, 0x3a, 0xed, 0x4c, 0xdb, 0x87, 0x3e, 0xf5, 0xcf, 0x43, 0x1f, 0xfb, 0xd6, 0xe9, 0xa7, 0xe8, + 0x5b, 0xbf, 0x59, 0x07, 0x77, 0x87, 0xe3, 0x01, 0x77, 0x20, 0x25, 0x97, 0x79, 0xe1, 0x0c, 0xf6, + 0x76, 0xef, 0xf6, 0xf6, 0xdf, 0xfd, 0x76, 0x09, 0x37, 0x83, 0x24, 0xce, 0xe8, 0x1e, 0xff, 0xed, + 0xd2, 0x24, 0x4e, 0x63, 0xd4, 0xe4, 0x1f, 0xee, 0xee, 0x31, 0x25, 0xd1, 0xe3, 0x83, 0xde, 0xe3, + 0x3e, 0x49, 0x2e, 0x48, 0xb2, 0x47, 0xcf, 0x82, 0x3d, 0xce, 0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x16, 0x2f, 0x61, 0xcf, 0xfc, 0x76, 0x95, 0x4d, 0xd5, 0xed, 0x4c, 0x68, 0xab, 0x6e, 0x67, + 0x41, 0xb1, 0x79, 0x2d, 0xac, 0x01, 0x70, 0x7a, 0x2d, 0xac, 0x01, 0x97, 0x7a, 0x2d, 0xac, 0xc5, + 0x80, 0x22, 0x3a, 0x2a, 0xb0, 0x4b, 0x8f, 0x0e, 0x13, 0xcc, 0xe9, 0xd1, 0x61, 0xc3, 0x6b, 0xbf, + 0xaa, 0x82, 0x88, 0x02, 0x0f, 0xa3, 0x9d, 0x4a, 0xcd, 0x37, 0x90, 0xb9, 0xfb, 0xf6, 0x1c, 0x0e, + 0xa1, 0xb1, 0x89, 0x51, 0x94, 0xc6, 0x56, 0x90, 0xa7, 0x34, 0xb6, 0x83, 0x1b, 0xf4, 0x85, 0x36, + 0xb1, 0xd1, 0x71, 0x4a, 0xb5, 0xfe, 0x54, 0x90, 0x8f, 0xfb, 0x60, 0xe6, 0x3a, 0xa3, 0x9f, 0x3c, + 0xf8, 0xf2, 0xde, 0x31, 0x25, 0xd1, 0xc9, 0x41, 0x4f, 0xfb, 0xfb, 0x93, 0xcb, 0x7c, 0xc8, 0x7f, + 0x4f, 0x97, 0x39, 0xe9, 0xbd, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0x06, 0xa5, 0xc5, 0x9c, 0x71, + 0x1d, 0x00, 0x00, } diff --git a/pkg/proto/group/group.proto b/pkg/proto/group/group.proto index 486bb69df..390af86ae 100644 --- a/pkg/proto/group/group.proto +++ b/pkg/proto/group/group.proto @@ -5,14 +5,11 @@ option go_package = "Open_IM/pkg/proto/group;group"; package group; -message GroupAddMemberInfo{ - string userID = 1; - int32 roleLevel = 2; -} message CreateGroupReq{ - repeated GroupAddMemberInfo initMemberList = 1; + repeated string initMemberList = 1; server_api_params.GroupInfo groupInfo = 2; + repeated string adminUserIDs = 3; string ownerUserID = 5; //owner } message CreateGroupResp{ diff --git a/pkg/utils/strings.go b/pkg/utils/strings.go index ef744730f..35bf3c541 100644 --- a/pkg/utils/strings.go +++ b/pkg/utils/strings.go @@ -132,3 +132,7 @@ func IsRepeatStringSlice(arr []string) bool { } return false } + +func IsRepeatID(args ...interface{}) bool { + return false +} From 033d1e09191b91bb48e5460ecb5802056c62d1ec Mon Sep 17 00:00:00 2001 From: skiffer-git <44203734@qq.com> Date: Fri, 13 Jan 2023 20:58:59 +0800 Subject: [PATCH 02/13] Error code standardization --- internal/utils/{conversion.go => convert.go} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename internal/utils/{conversion.go => convert.go} (100%) diff --git a/internal/utils/conversion.go b/internal/utils/convert.go similarity index 100% rename from internal/utils/conversion.go rename to internal/utils/convert.go From 62a67905af21b3ab4a2059ea16d42dffeb4195a2 Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Mon, 16 Jan 2023 15:53:40 +0800 Subject: [PATCH 03/13] 1 --- internal/rpc/friend/friend.go | 512 +++++------------- internal/rpc/friend/other.go | 4 + .../im_mysql_model/friend_model_k.go | 27 +- .../im_mysql_model/friend_request_model.go | 20 +- 4 files changed, 177 insertions(+), 386 deletions(-) diff --git a/internal/rpc/friend/friend.go b/internal/rpc/friend/friend.go index ebe24b7f1..c392f7fec 100644 --- a/internal/rpc/friend/friend.go +++ b/internal/rpc/friend/friend.go @@ -11,6 +11,7 @@ import ( promePkg "Open_IM/pkg/common/prometheus" "Open_IM/pkg/common/token_verify" "Open_IM/pkg/common/tools" + "Open_IM/pkg/common/trace_log" cp "Open_IM/pkg/common/utils" "Open_IM/pkg/getcdv3" pbCache "Open_IM/pkg/proto/cache" @@ -18,6 +19,8 @@ import ( sdkws "Open_IM/pkg/proto/sdk_ws" "Open_IM/pkg/utils" "context" + "errors" + "gorm.io/gorm" "net" "strconv" "strings" @@ -45,7 +48,7 @@ func NewFriendServer(port int) *friendServer { rpcRegisterName: config.Config.RpcRegisterName.OpenImFriendName, etcdSchema: config.Config.Etcd.EtcdSchema, etcdAddr: config.Config.Etcd.EtcdAddr, - friendModel: imdb.NewFriend(nil), + friendModel: imdb.NewFriend(nil), // TODO friendRequestModel: imdb.NewFriendRequest(nil), blackModel: imdb.NewBlack(nil), } @@ -119,7 +122,7 @@ func (s *friendServer) AddBlacklist(ctx context.Context, req *pbFriend.AddBlackl if err != nil { return nil, err } - _, err = pbCache.NewCacheClient(etcdConn).DelBlackIDListFromCache(ctx, &pbCache.DelBlackIDListFromCacheReq{UserID: req.CommID.FromUserID, OperationID: req.CommID.OperationID}) + _, err = pbCache.NewCacheClient(etcdConn).DelBlackIDListFromCache(ctx, &pbCache.DelBlackIDListFromCacheReq{UserID: req.CommID.FromUserID}) if err != nil { return nil, err } @@ -179,199 +182,113 @@ func (s *friendServer) AddFriend(ctx context.Context, req *pbFriend.AddFriendReq func (s *friendServer) ImportFriend(ctx context.Context, req *pbFriend.ImportFriendReq) (*pbFriend.ImportFriendResp, error) { resp := &pbFriend.ImportFriendResp{} - //var c sdkws.CommonResp if !utils.IsContain(tools.OpUserID(ctx), config.Config.Manager.AppManagerUid) { - //log.NewError(req.OperationID, "not authorized", req.OpUserID, config.Config.Manager.AppManagerUid) - //c.ErrCode = constant.ErrNoPermission.ErrCode - //c.ErrMsg = constant.ErrNoPermission.ErrMsg - //for _, userID := range req.FriendUserIDList { - // resp.UserIDResultList = append(resp.UserIDResultList, &pbFriend.UserIDResult{UserID: userID, Result: -1}) - //} return nil, constant.ErrNoPermission.Wrap() } if _, err := GetUserInfo(ctx, req.FromUserID); err != nil { - //log.NewError(req.OperationID, "GetUserByUserID failed ", err.Error(), req.FromUserID) - //c.ErrCode = constant.ErrDB.ErrCode - //c.ErrMsg = "this user not exists,cant not add friend" - //for _, userID := range req.FriendUserIDList { - // resp.UserIDResultList = append(resp.UserIDResultList, &pbFriend.UserIDResult{UserID: userID, Result: -1}) - //} - //resp.CommonResp = &c return nil, err } - for _, userID := range req.FriendUserIDList { - if _, fErr := GetUserInfo(ctx, userID); fErr != nil { - resp.UserIDResultList = append(resp.UserIDResultList, &pbFriend.UserIDResult{UserID: userID, Result: -1}) - } else { - if _, err := imdb.GetFriendRelationshipFromFriend(req.FromUserID, userID); err != nil { - //Establish two single friendship - toInsertFollow := imdb.Friend{OwnerUserID: req.FromUserID, FriendUserID: userID} - err1 := imdb.InsertToFriend(&toInsertFollow) - if err1 != nil { - log.NewError(req.OperationID, "InsertToFriend failed ", err1.Error(), toInsertFollow) - resp.UserIDResultList = append(resp.UserIDResultList, &pbFriend.UserIDResult{UserID: userID, Result: -1}) - continue - } - toInsertFollow = imdb.Friend{OwnerUserID: userID, FriendUserID: req.FromUserID} - err2 := imdb.InsertToFriend(&toInsertFollow) - if err2 != nil { - log.NewError(req.OperationID, "InsertToFriend failed ", err2.Error(), toInsertFollow) - resp.UserIDResultList = append(resp.UserIDResultList, &pbFriend.UserIDResult{UserID: userID, Result: -1}) - continue - } - resp.UserIDResultList = append(resp.UserIDResultList, &pbFriend.UserIDResult{UserID: userID, Result: 0}) - log.NewDebug(req.OperationID, "UserIDResultList ", resp.UserIDResultList) - chat.FriendAddedNotification(req.OperationID, req.OpUserID, req.FromUserID, userID) + if _, err := GetUserInfo(ctx, userID); err != nil { + return nil, err + } + fs, err := s.friendModel.FindUserState(ctx, req.FromUserID, userID) + if err != nil { + return nil, err + } + var friends []*imdb.Friend + switch len(fs) { + case 1: + if fs[0].OwnerUserID == req.FromUserID { + friends = append(friends, &imdb.Friend{OwnerUserID: userID, FriendUserID: req.FromUserID}) } else { - log.NewWarn(req.OperationID, "GetFriendRelationshipFromFriend ok", req.FromUserID, userID) - resp.UserIDResultList = append(resp.UserIDResultList, &pbFriend.UserIDResult{UserID: userID, Result: 0}) + friends = append(friends, &imdb.Friend{OwnerUserID: req.FromUserID, FriendUserID: userID}) } + case 0: + friends = append(friends, &imdb.Friend{OwnerUserID: userID, FriendUserID: req.FromUserID}, &imdb.Friend{OwnerUserID: req.FromUserID, FriendUserID: userID}) + default: + continue + } + if err := s.friendModel.Create(ctx, friends); err != nil { + return nil, err } } - - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationID, config.Config.Etcd.UserName, config.Config.Etcd.Password) - if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" - log.NewError(req.OperationID, errMsg) - resp.CommonResp.ErrMsg = errMsg - resp.CommonResp.ErrCode = 500 - return &resp, nil + etcdConn, err := getcdv3.GetConn(ctx, config.Config.RpcRegisterName.OpenImCacheName) + if err != nil { + return nil, err } cacheClient := pbCache.NewCacheClient(etcdConn) - cacheResp, err := cacheClient.DelFriendIDListFromCache(context.Background(), &pbCache.DelFriendIDListFromCacheReq{UserID: req.FromUserID, OperationID: req.OperationID}) - if err != nil { - log.NewError(req.OperationID, "DelBlackIDListFromCache rpc call failed ", err.Error()) - resp.CommonResp.ErrCode = 500 - resp.CommonResp.ErrMsg = err.Error() - return &resp, nil - } - if cacheResp.CommonResp.ErrCode != 0 { - log.NewError(req.OperationID, "DelBlackIDListFromCache rpc logic call failed ", cacheResp.String()) - resp.CommonResp.ErrCode = 500 - resp.CommonResp.ErrMsg = cacheResp.CommonResp.ErrMsg - return &resp, nil + if _, err := cacheClient.DelFriendIDListFromCache(ctx, &pbCache.DelFriendIDListFromCacheReq{UserID: req.FromUserID}); err != nil { + return nil, err } if err := rocksCache.DelAllFriendsInfoFromCache(ctx, req.FromUserID); err != nil { - log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), req.FromUserID) + trace_log.SetCtxInfo(ctx, "DelAllFriendsInfoFromCache", err, "userID", req.FromUserID) } - for _, userID := range req.FriendUserIDList { - cacheResp, err := cacheClient.DelFriendIDListFromCache(context.Background(), &pbCache.DelFriendIDListFromCacheReq{UserID: userID, OperationID: req.OperationID}) - if err != nil { - log.NewError(req.OperationID, "DelBlackIDListFromCache rpc call failed ", err.Error()) - } - if cacheResp != nil && cacheResp.CommonResp != nil { - if cacheResp.CommonResp.ErrCode != 0 { - log.NewError(req.OperationID, "DelBlackIDListFromCache rpc logic call failed ", cacheResp.String()) - resp.CommonResp.ErrCode = 500 - resp.CommonResp.ErrMsg = cacheResp.CommonResp.ErrMsg - return &resp, nil - } + if _, err = cacheClient.DelFriendIDListFromCache(ctx, &pbCache.DelFriendIDListFromCacheReq{UserID: userID}); err != nil { + return nil, err } if err := rocksCache.DelAllFriendsInfoFromCache(ctx, userID); err != nil { - log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), userID) + trace_log.SetCtxInfo(ctx, "DelAllFriendsInfoFromCache", err, "userID", userID) } } - - resp.CommonResp.ErrCode = 0 - log.NewInfo(req.OperationID, "ImportFriend rpc ok ", resp.String()) - return &resp, nil + return resp, nil } // process Friend application func (s *friendServer) AddFriendResponse(ctx context.Context, req *pbFriend.AddFriendResponseReq) (*pbFriend.AddFriendResponseResp, error) { - log.NewInfo(req.CommID.OperationID, "AddFriendResponse args ", req.String()) - if !token_verify.CheckAccess(ctx, req.CommID.OpUserID, req.CommID.FromUserID) { - log.NewError(req.CommID.OperationID, "CheckAccess false ", req.CommID.OpUserID, req.CommID.FromUserID) - return &pbFriend.AddFriendResponseResp{CommonResp: &sdkws.CommonResp{ErrCode: constant.ErrNoPermission.ErrCode, ErrMsg: constant.ErrNoPermission.ErrMsg}}, nil + resp := &pbFriend.AddFriendResponseResp{} + if err := token_verify.CheckAccessV3(ctx, req.CommID.FromUserID); err != nil { + return nil, err } - - //Check there application before agreeing or refuse to a friend's application - //req.CommID.FromUserID process req.CommID.ToUserID - friendRequest, err := imdb.GetFriendApplicationByBothUserID(req.CommID.ToUserID, req.CommID.FromUserID) + friendRequest, err := s.friendRequestModel.Take(ctx, req.CommID.ToUserID, req.CommID.FromUserID) if err != nil { - log.NewError(req.CommID.OperationID, "GetFriendApplicationByBothUserID failed ", err.Error(), req.CommID.ToUserID, req.CommID.FromUserID) - return &pbFriend.AddFriendResponseResp{CommonResp: &sdkws.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil + return nil, err } friendRequest.HandleResult = req.HandleResult friendRequest.HandleTime = time.Now() - //friendRequest.HandleTime.Unix() friendRequest.HandleMsg = req.HandleMsg friendRequest.HandlerUserID = req.CommID.OpUserID err = imdb.UpdateFriendApplication(friendRequest) if err != nil { - log.NewError(req.CommID.OperationID, "UpdateFriendApplication failed ", err.Error(), friendRequest) - return &pbFriend.AddFriendResponseResp{CommonResp: &sdkws.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil + return nil, err } //Change the status of the friend request form if req.HandleResult == constant.FriendFlag { - var isInsert int + var isInsert bool //Establish friendship after find friend relationship not exists - _, err := imdb.GetFriendRelationshipFromFriend(req.CommID.FromUserID, req.CommID.ToUserID) - if err == nil { - log.NewWarn(req.CommID.OperationID, "GetFriendRelationshipFromFriend exist", req.CommID.FromUserID, req.CommID.ToUserID) - } else { - //Establish two single friendship - toInsertFollow := imdb.Friend{OwnerUserID: req.CommID.FromUserID, FriendUserID: req.CommID.ToUserID, OperatorUserID: req.CommID.OpUserID} - err = imdb.InsertToFriend(&toInsertFollow) - if err != nil { - log.NewError(req.CommID.OperationID, "InsertToFriend failed ", err.Error(), toInsertFollow) - return &pbFriend.AddFriendResponseResp{CommonResp: &sdkws.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil + _, err := s.friendModel.Take(ctx, req.CommID.FromUserID, req.CommID.ToUserID) + if errors.Is(err, gorm.ErrRecordNotFound) { + if err := s.friendModel.Create(ctx, []*imdb.Friend{{OwnerUserID: req.CommID.FromUserID, FriendUserID: req.CommID.ToUserID, OperatorUserID: req.CommID.OpUserID}}); err != nil { + return nil, err } - isInsert = 1 + isInsert = true + } else if err != nil { + return nil, err } - _, err = imdb.GetFriendRelationshipFromFriend(req.CommID.ToUserID, req.CommID.FromUserID) - if err == nil { - log.NewWarn(req.CommID.OperationID, "GetFriendRelationshipFromFriend exist", req.CommID.ToUserID, req.CommID.FromUserID) - } else { - toInsertFollow := imdb.Friend{OwnerUserID: req.CommID.ToUserID, FriendUserID: req.CommID.FromUserID, OperatorUserID: req.CommID.OpUserID} - err = imdb.InsertToFriend(&toInsertFollow) - if err != nil { - log.NewError(req.CommID.OperationID, "InsertToFriend failed ", err.Error(), toInsertFollow) - return &pbFriend.AddFriendResponseResp{CommonResp: &sdkws.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil - } - isInsert = 1 - } // cache rpc - if isInsert == 1 { - delFriendIDListFromCacheReq := &pbCache.DelFriendIDListFromCacheReq{OperationID: req.CommID.OperationID} - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.CommID.OperationID, config.Config.Etcd.UserName, config.Config.Etcd.Password) - if etcdConn == nil { - errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" - log.NewError(req.CommID.OperationID, errMsg) - return &pbFriend.AddFriendResponseResp{CommonResp: &sdkws.CommonResp{ErrCode: constant.ErrInternalServer.ErrCode, ErrMsg: errMsg}}, nil + if isInsert { + etcdConn, err := getcdv3.GetConn(ctx, config.Config.RpcRegisterName.OpenImCacheName) + if err != nil { + return nil, err } client := pbCache.NewCacheClient(etcdConn) - delFriendIDListFromCacheReq.UserID = req.CommID.ToUserID - respPb, err := client.DelFriendIDListFromCache(context.Background(), delFriendIDListFromCacheReq) - if err != nil { - log.NewError(req.CommID.OperationID, utils.GetSelfFuncName(), "DelFriendIDListFromCache failed", err.Error()) - return &pbFriend.AddFriendResponseResp{CommonResp: &sdkws.CommonResp{ErrCode: constant.ErrServer.ErrCode, ErrMsg: constant.ErrServer.ErrMsg}}, nil + + if _, err := client.DelFriendIDListFromCache(context.Background(), &pbCache.DelFriendIDListFromCacheReq{UserID: req.CommID.ToUserID}); err != nil { + return nil, err } - if respPb.CommonResp.ErrCode != 0 { - log.NewError(req.CommID.OperationID, utils.GetSelfFuncName(), "DelFriendIDListFromCache failed", respPb.CommonResp.String()) - return &pbFriend.AddFriendResponseResp{CommonResp: &sdkws.CommonResp{ErrCode: respPb.CommonResp.ErrCode, ErrMsg: respPb.CommonResp.ErrMsg}}, nil - } - delFriendIDListFromCacheReq.UserID = req.CommID.FromUserID - respPb, err = client.DelFriendIDListFromCache(context.Background(), delFriendIDListFromCacheReq) - if err != nil { - log.NewError(req.CommID.OperationID, utils.GetSelfFuncName(), "DelFriendIDListFromCache failed", err.Error()) - return &pbFriend.AddFriendResponseResp{CommonResp: &sdkws.CommonResp{ErrCode: constant.ErrServer.ErrCode, ErrMsg: constant.ErrServer.ErrMsg}}, nil - } - if respPb.CommonResp.ErrCode != 0 { - log.NewError(req.CommID.OperationID, utils.GetSelfFuncName(), "DelFriendIDListFromCache failed", respPb.CommonResp.String()) - return &pbFriend.AddFriendResponseResp{CommonResp: &sdkws.CommonResp{ErrCode: respPb.CommonResp.ErrCode, ErrMsg: respPb.CommonResp.ErrMsg}}, nil + if _, err := client.DelFriendIDListFromCache(context.Background(), &pbCache.DelFriendIDListFromCacheReq{UserID: req.CommID.FromUserID}); err != nil { + return nil, err } if err := rocksCache.DelAllFriendsInfoFromCache(ctx, req.CommID.ToUserID); err != nil { - log.NewError(req.CommID.OperationID, utils.GetSelfFuncName(), err.Error(), req.CommID.ToUserID) + trace_log.SetCtxInfo(ctx, "DelAllFriendsInfoFromCache", err, "userID", req.CommID.ToUserID) } if err := rocksCache.DelAllFriendsInfoFromCache(ctx, req.CommID.FromUserID); err != nil { - log.NewError(req.CommID.OperationID, utils.GetSelfFuncName(), err.Error(), req.CommID.FromUserID) + trace_log.SetCtxInfo(ctx, "DelAllFriendsInfoFromCache", err, "userID", req.CommID.FromUserID) } - chat.FriendAddedNotification(req.CommID.OperationID, req.CommID.OpUserID, req.CommID.FromUserID, req.CommID.ToUserID) + chat.FriendAddedNotification(tools.OperationID(ctx), tools.OpUserID(ctx), req.CommID.FromUserID, req.CommID.ToUserID) } } @@ -380,329 +297,174 @@ func (s *friendServer) AddFriendResponse(ctx context.Context, req *pbFriend.AddF } else if req.HandleResult == constant.FriendResponseRefuse { chat.FriendApplicationRejectedNotification(req) } else { - log.Error(req.CommID.OperationID, "HandleResult failed ", req.HandleResult) + trace_log.SetCtxInfo(ctx, utils.GetSelfFuncName(), nil, "handleResult", req.HandleResult) } - - log.NewInfo(req.CommID.OperationID, "rpc AddFriendResponse ok") - return &pbFriend.AddFriendResponseResp{CommonResp: &sdkws.CommonResp{}}, nil + return resp, nil } func (s *friendServer) DeleteFriend(ctx context.Context, req *pbFriend.DeleteFriendReq) (*pbFriend.DeleteFriendResp, error) { - log.NewInfo(req.CommID.OperationID, "DeleteFriend args ", req.String()) - //Parse token, to find current user information - if !token_verify.CheckAccess(ctx, req.CommID.OpUserID, req.CommID.FromUserID) { - log.NewError(req.CommID.OperationID, "CheckAccess false ", req.CommID.OpUserID, req.CommID.FromUserID) - return &pbFriend.DeleteFriendResp{CommonResp: &sdkws.CommonResp{ErrCode: constant.ErrNoPermission.ErrCode, ErrMsg: constant.ErrNoPermission.ErrMsg}}, nil + resp := &pbFriend.DeleteFriendResp{} + if err := token_verify.CheckAccessV3(ctx, req.CommID.FromUserID); err != nil { + return nil, err } - err := imdb.DeleteSingleFriendInfo(req.CommID.FromUserID, req.CommID.ToUserID) + if err := s.friendModel.Delete(ctx, req.CommID.FromUserID, req.CommID.ToUserID); err != nil { + return nil, err + } + etcdConn, err := getcdv3.GetConn(ctx, config.Config.RpcRegisterName.OpenImCacheName) if err != nil { - log.NewError(req.CommID.OperationID, "DeleteSingleFriendInfo failed", err.Error(), req.CommID.FromUserID, req.CommID.ToUserID) - return &pbFriend.DeleteFriendResp{CommonResp: &sdkws.CommonResp{ErrCode: constant.ErrNoPermission.ErrCode, ErrMsg: constant.ErrNoPermission.ErrMsg}}, nil + return nil, err } - log.NewInfo(req.CommID.OperationID, "DeleteFriend rpc ok") - - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.CommID.OperationID, config.Config.Etcd.UserName, config.Config.Etcd.Password) - if etcdConn == nil { - errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" - log.NewError(req.CommID.OperationID, errMsg) - return &pbFriend.DeleteFriendResp{CommonResp: &sdkws.CommonResp{ErrCode: constant.ErrInternalServer.ErrCode, ErrMsg: errMsg}}, nil - } - client := pbCache.NewCacheClient(etcdConn) - respPb, err := client.DelFriendIDListFromCache(context.Background(), &pbCache.DelFriendIDListFromCacheReq{OperationID: req.CommID.OperationID, UserID: req.CommID.FromUserID}) + _, err = pbCache.NewCacheClient(etcdConn).DelFriendIDListFromCache(context.Background(), &pbCache.DelFriendIDListFromCacheReq{UserID: req.CommID.FromUserID}) if err != nil { - log.NewError(req.CommID.OperationID, utils.GetSelfFuncName(), "DelFriendIDListFromCache rpc failed", err.Error()) - return &pbFriend.DeleteFriendResp{CommonResp: &sdkws.CommonResp{ErrCode: constant.ErrServer.ErrCode, ErrMsg: constant.ErrServer.ErrMsg}}, nil - } - if respPb.CommonResp.ErrCode != 0 { - log.NewError(req.CommID.OperationID, utils.GetSelfFuncName(), "DelFriendIDListFromCache failed", respPb.CommonResp.String()) - return &pbFriend.DeleteFriendResp{CommonResp: &sdkws.CommonResp{ErrCode: respPb.CommonResp.ErrCode, ErrMsg: respPb.CommonResp.ErrMsg}}, nil + return nil, err } if err := rocksCache.DelAllFriendsInfoFromCache(ctx, req.CommID.FromUserID); err != nil { - log.NewError(req.CommID.OperationID, utils.GetSelfFuncName(), err.Error(), req.CommID.FromUserID) + trace_log.SetCtxInfo(ctx, "DelAllFriendsInfoFromCache", err, "DelAllFriendsInfoFromCache", req.CommID.FromUserID) } if err := rocksCache.DelAllFriendsInfoFromCache(ctx, req.CommID.ToUserID); err != nil { - log.NewError(req.CommID.OperationID, utils.GetSelfFuncName(), err.Error(), req.CommID.FromUserID) + trace_log.SetCtxInfo(ctx, "DelAllFriendsInfoFromCache", err, "DelAllFriendsInfoFromCache", req.CommID.ToUserID) } chat.FriendDeletedNotification(req) - return &pbFriend.DeleteFriendResp{CommonResp: &sdkws.CommonResp{}}, nil + return resp, nil } func (s *friendServer) GetBlacklist(ctx context.Context, req *pbFriend.GetBlacklistReq) (*pbFriend.GetBlacklistResp, error) { - log.NewInfo(req.CommID.OperationID, "GetBlacklist args ", req.String()) - - if !token_verify.CheckAccess(ctx, req.CommID.OpUserID, req.CommID.FromUserID) { - log.NewError(req.CommID.OperationID, "CheckAccess false ", req.CommID.OpUserID, req.CommID.FromUserID) - return &pbFriend.GetBlacklistResp{CommonResp: &sdkws.CommonResp{ErrCode: constant.ErrNoPermission.ErrCode, ErrMsg: constant.ErrNoPermission.ErrMsg}}, nil + resp := &pbFriend.GetBlacklistResp{} + if err := token_verify.CheckAccessV3(ctx, req.CommID.FromUserID); err != nil { + return nil, err } - blackIDList, err := rocksCache.GetBlackListFromCache(ctx, req.CommID.FromUserID) if err != nil { - log.NewError(req.CommID.OperationID, "GetBlackListByUID failed ", err.Error(), req.CommID.FromUserID) - return &pbFriend.GetBlacklistResp{CommonResp: &sdkws.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil + return nil, err } - - var ( - userInfoList []*sdkws.PublicUserInfo - ) for _, userID := range blackIDList { user, err := rocksCache.GetUserInfoFromCache(ctx, userID) if err != nil { - log.NewError(req.CommID.OperationID, "GetUserByUserID failed ", err.Error(), userID) + trace_log.SetCtxInfo(ctx, "GetUserInfoFromCache", err, "userID", userID) continue } var blackUserInfo sdkws.PublicUserInfo utils.CopyStructFields(&blackUserInfo, user) - userInfoList = append(userInfoList, &blackUserInfo) + resp.BlackUserInfoList = append(resp.BlackUserInfoList, &blackUserInfo) } - log.NewInfo(req.CommID.OperationID, "rpc GetBlacklist ok ", pbFriend.GetBlacklistResp{BlackUserInfoList: userInfoList}) - return &pbFriend.GetBlacklistResp{BlackUserInfoList: userInfoList}, nil + return resp, nil } func (s *friendServer) SetFriendRemark(ctx context.Context, req *pbFriend.SetFriendRemarkReq) (*pbFriend.SetFriendRemarkResp, error) { - log.NewInfo(req.CommID.OperationID, "SetFriendComment args ", req.String()) - //Parse token, to find current user information - if !token_verify.CheckAccess(ctx, req.CommID.OpUserID, req.CommID.FromUserID) { - log.NewError(req.CommID.OperationID, "CheckAccess false ", req.CommID.OpUserID, req.CommID.FromUserID) - return &pbFriend.SetFriendRemarkResp{CommonResp: &sdkws.CommonResp{ErrCode: constant.ErrNoPermission.ErrCode, ErrMsg: constant.ErrNoPermission.ErrMsg}}, nil + resp := &pbFriend.SetFriendRemarkResp{} + if err := token_verify.CheckAccessV3(ctx, req.CommID.FromUserID); err != nil { + return nil, err } - - err := imdb.UpdateFriendComment(req.CommID.FromUserID, req.CommID.ToUserID, req.Remark) - if err != nil { - log.NewError(req.CommID.OperationID, "UpdateFriendComment failed ", req.CommID.FromUserID, req.CommID.ToUserID, req.Remark, err.Error()) - return &pbFriend.SetFriendRemarkResp{CommonResp: &sdkws.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil + if err := s.friendModel.UpdateRemark(ctx, req.CommID.FromUserID, req.CommID.ToUserID, req.Remark); err != nil { + return nil, err } - log.NewInfo(req.CommID.OperationID, "rpc SetFriendComment ok") - err = rocksCache.DelAllFriendsInfoFromCache(ctx, req.CommID.FromUserID) - if err != nil { - log.NewError(req.CommID.OperationID, "DelAllFriendInfoFromCache failed ", req.CommID.FromUserID, err.Error()) - return &pbFriend.SetFriendRemarkResp{CommonResp: &sdkws.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil + if err := rocksCache.DelAllFriendsInfoFromCache(ctx, req.CommID.FromUserID); err != nil { + return nil, err } - chat.FriendRemarkSetNotification(req.CommID.OperationID, req.CommID.OpUserID, req.CommID.FromUserID, req.CommID.ToUserID) - return &pbFriend.SetFriendRemarkResp{CommonResp: &sdkws.CommonResp{}}, nil + chat.FriendRemarkSetNotification(tools.OperationID(ctx), tools.OpUserID(ctx), req.CommID.FromUserID, req.CommID.ToUserID) + return resp, nil } func (s *friendServer) RemoveBlacklist(ctx context.Context, req *pbFriend.RemoveBlacklistReq) (*pbFriend.RemoveBlacklistResp, error) { - log.NewInfo(req.CommID.OperationID, "RemoveBlacklist args ", req.String()) + resp := &pbFriend.RemoveBlacklistResp{} //Parse token, to find current user information - if !token_verify.CheckAccess(ctx, req.CommID.OpUserID, req.CommID.FromUserID) { - log.NewError(req.CommID.OperationID, "CheckAccess false ", req.CommID.OpUserID, req.CommID.FromUserID) - return &pbFriend.RemoveBlacklistResp{CommonResp: &sdkws.CommonResp{ErrCode: constant.ErrNoPermission.ErrCode, ErrMsg: constant.ErrNoPermission.ErrMsg}}, nil + if err := token_verify.CheckAccessV3(ctx, req.CommID.FromUserID); err != nil { + return nil, err } - err := imdb.RemoveBlackList(req.CommID.FromUserID, req.CommID.ToUserID) + if err := s.blackModel.Delete(ctx, []*imdb.Black{{OwnerUserID: req.CommID.FromUserID, BlockUserID: req.CommID.ToUserID}}); err != nil { + return nil, err + } + etcdConn, err := getcdv3.GetConn(ctx, config.Config.RpcRegisterName.OpenImCacheName) if err != nil { - log.NewError(req.CommID.OperationID, "RemoveBlackList failed", err.Error(), req.CommID.FromUserID, req.CommID.ToUserID) - return &pbFriend.RemoveBlacklistResp{CommonResp: &sdkws.CommonResp{ErrCode: constant.ErrNoPermission.ErrCode, ErrMsg: constant.ErrNoPermission.ErrMsg}}, nil - + return nil, err } - log.NewInfo(req.CommID.OperationID, "rpc RemoveBlacklist ok ") - - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.CommID.OperationID, config.Config.Etcd.UserName, config.Config.Etcd.Password) - if etcdConn == nil { - errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" - log.NewError(req.CommID.OperationID, errMsg) - return &pbFriend.RemoveBlacklistResp{CommonResp: &sdkws.CommonResp{ErrCode: constant.ErrInternalServer.ErrCode, ErrMsg: errMsg}}, nil - } - - cacheClient := pbCache.NewCacheClient(etcdConn) - cacheResp, err := cacheClient.DelBlackIDListFromCache(context.Background(), &pbCache.DelBlackIDListFromCacheReq{UserID: req.CommID.FromUserID, OperationID: req.CommID.OperationID}) + _, err = pbCache.NewCacheClient(etcdConn).DelBlackIDListFromCache(context.Background(), &pbCache.DelBlackIDListFromCacheReq{UserID: req.CommID.FromUserID}) if err != nil { - log.NewError(req.CommID.OperationID, "DelBlackIDListFromCache rpc call failed ", err.Error()) - return &pbFriend.RemoveBlacklistResp{CommonResp: &sdkws.CommonResp{ErrCode: 500, ErrMsg: "ReduceBlackUserFromCache rpc call failed"}}, nil - } - if cacheResp.CommonResp.ErrCode != 0 { - log.NewError(req.CommID.OperationID, "DelBlackIDListFromCache rpc logic call failed ", cacheResp.CommonResp.String()) - return &pbFriend.RemoveBlacklistResp{CommonResp: &sdkws.CommonResp{ErrCode: cacheResp.CommonResp.ErrCode, ErrMsg: cacheResp.CommonResp.ErrMsg}}, nil + return nil, err } chat.BlackDeletedNotification(req) - return &pbFriend.RemoveBlacklistResp{CommonResp: &sdkws.CommonResp{}}, nil + return resp, nil } func (s *friendServer) IsInBlackList(ctx context.Context, req *pbFriend.IsInBlackListReq) (*pbFriend.IsInBlackListResp, error) { - log.NewInfo("IsInBlackList args ", req.String()) - if !token_verify.CheckAccess(ctx, req.CommID.OpUserID, req.CommID.FromUserID) { - log.NewError(req.CommID.OperationID, "CheckAccess false ", req.CommID.OpUserID, req.CommID.FromUserID) - return &pbFriend.IsInBlackListResp{CommonResp: &sdkws.CommonResp{ErrCode: constant.ErrNoPermission.ErrCode, ErrMsg: constant.ErrNoPermission.ErrMsg}}, nil + resp := &pbFriend.IsInBlackListResp{} + if err := token_verify.CheckAccessV3(ctx, req.CommID.FromUserID); err != nil { + return nil, err } blackIDList, err := rocksCache.GetBlackListFromCache(ctx, req.CommID.FromUserID) if err != nil { - log.NewError(req.CommID.OperationID, utils.GetSelfFuncName(), err.Error(), req.CommID.FromUserID) - return &pbFriend.IsInBlackListResp{CommonResp: &sdkws.CommonResp{ErrMsg: err.Error(), ErrCode: constant.ErrDB.ErrCode}}, nil + return nil, err } - var isInBlacklist bool - if utils.IsContain(req.CommID.ToUserID, blackIDList) { - isInBlacklist = true - } - log.NewInfo(req.CommID.OperationID, "IsInBlackList rpc ok ", pbFriend.IsInBlackListResp{Response: isInBlacklist}) - return &pbFriend.IsInBlackListResp{Response: isInBlacklist}, nil + resp.Response = utils.IsContain(req.CommID.ToUserID, blackIDList) + return resp, nil } func (s *friendServer) IsFriend(ctx context.Context, req *pbFriend.IsFriendReq) (*pbFriend.IsFriendResp, error) { - log.NewInfo(req.CommID.OperationID, req.String()) - if !token_verify.CheckAccess(ctx, req.CommID.OpUserID, req.CommID.FromUserID) { - log.NewError(req.CommID.OperationID, "CheckAccess false ", req.CommID.OpUserID, req.CommID.FromUserID) - return &pbFriend.IsFriendResp{CommonResp: &sdkws.CommonResp{ErrCode: constant.ErrNoPermission.ErrCode, ErrMsg: constant.ErrNoPermission.ErrMsg}}, nil + resp := &pbFriend.IsFriendResp{} + if err := token_verify.CheckAccessV3(ctx, req.CommID.FromUserID); err != nil { + return nil, err } friendIDList, err := rocksCache.GetFriendIDListFromCache(ctx, req.CommID.FromUserID) if err != nil { - log.NewError(req.CommID.OperationID, utils.GetSelfFuncName(), err.Error(), req.CommID.FromUserID) - return &pbFriend.IsFriendResp{CommonResp: &sdkws.CommonResp{ErrMsg: err.Error(), ErrCode: constant.ErrDB.ErrCode}}, nil + return nil, err } - var isFriend bool - if utils.IsContain(req.CommID.ToUserID, friendIDList) { - isFriend = true - } - log.NewInfo(req.CommID.OperationID, pbFriend.IsFriendResp{Response: isFriend}) - return &pbFriend.IsFriendResp{Response: isFriend}, nil + resp.Response = utils.IsContain(req.CommID.ToUserID, friendIDList) + return resp, nil } func (s *friendServer) GetFriendList(ctx context.Context, req *pbFriend.GetFriendListReq) (*pbFriend.GetFriendListResp, error) { - log.NewInfo("GetFriendList args ", req.String()) - if !token_verify.CheckAccess(ctx, req.CommID.OpUserID, req.CommID.FromUserID) { - log.NewError(req.CommID.OperationID, "CheckAccess false ", req.CommID.OpUserID, req.CommID.FromUserID) - return &pbFriend.GetFriendListResp{CommonResp: &sdkws.CommonResp{ErrCode: constant.ErrNoPermission.ErrCode, ErrMsg: constant.ErrNoPermission.ErrMsg}}, nil + resp := &pbFriend.GetFriendListResp{} + if err := token_verify.CheckAccessV3(ctx, req.CommID.FromUserID); err != nil { + return nil, err } friendList, err := rocksCache.GetAllFriendsInfoFromCache(ctx, req.CommID.FromUserID) if err != nil { - log.NewError(req.CommID.OperationID, utils.GetSelfFuncName(), "GetFriendIDListFromCache failed", err.Error(), req.CommID.FromUserID) - return &pbFriend.GetFriendListResp{CommonResp: &sdkws.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil + return nil, err } - var userInfoList []*sdkws.FriendInfo for _, friendUser := range friendList { friendUserInfo := sdkws.FriendInfo{FriendUser: &sdkws.UserInfo{}} cp.FriendDBCopyOpenIM(&friendUserInfo, friendUser) - log.NewDebug(req.CommID.OperationID, "friends : ", friendUser, "openim friends: ", friendUserInfo) userInfoList = append(userInfoList, &friendUserInfo) } - log.NewInfo(req.CommID.OperationID, "rpc GetFriendList ok", pbFriend.GetFriendListResp{FriendInfoList: userInfoList}) - return &pbFriend.GetFriendListResp{FriendInfoList: userInfoList}, nil + return resp, nil } // received func (s *friendServer) GetFriendApplyList(ctx context.Context, req *pbFriend.GetFriendApplyListReq) (*pbFriend.GetFriendApplyListResp, error) { - log.NewInfo(req.CommID.OperationID, "GetFriendApplyList args ", req.String()) + resp := &pbFriend.GetFriendApplyListResp{} //Parse token, to find current user information - if !token_verify.CheckAccess(ctx, req.CommID.OpUserID, req.CommID.FromUserID) { - log.NewError(req.CommID.OperationID, "CheckAccess false ", req.CommID.OpUserID, req.CommID.FromUserID) - return &pbFriend.GetFriendApplyListResp{CommonResp: &sdkws.CommonResp{ErrCode: constant.ErrNoPermission.ErrCode, ErrMsg: constant.ErrNoPermission.ErrMsg}}, nil + if err := token_verify.CheckAccessV3(ctx, req.CommID.FromUserID); err != nil { + return nil, err } // Find the current user friend applications received - ApplyUsersInfo, err := imdb.GetReceivedFriendsApplicationListByUserID(req.CommID.FromUserID) + applyUsersInfo, err := s.friendRequestModel.FindToUserID(ctx, req.CommID.FromUserID) if err != nil { - log.NewError(req.CommID.OperationID, "GetReceivedFriendsApplicationListByUserID ", err.Error(), req.CommID.FromUserID) - return &pbFriend.GetFriendApplyListResp{CommonResp: &sdkws.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil + return nil, err } - - var appleUserList []*sdkws.FriendRequest - for _, applyUserInfo := range ApplyUsersInfo { + for _, applyUserInfo := range applyUsersInfo { var userInfo sdkws.FriendRequest - cp.FriendRequestDBCopyOpenIM(&userInfo, &applyUserInfo) - // utils.CopyStructFields(&userInfo, applyUserInfo) - // u, err := imdb.GetUserByUserID(userInfo.FromUserID) - // if err != nil { - // log.Error(req.CommID.OperationID, "GetUserByUserID", userInfo.FromUserID) - // continue - // } - // userInfo.FromNickname = u.Nickname - // userInfo.FromFaceURL = u.FaceURL - // userInfo.FromGender = u.Gender - // - // u, err = imdb.GetUserByUserID(userInfo.ToUserID) - // if err != nil { - // log.Error(req.CommID.OperationID, "GetUserByUserID", userInfo.ToUserID) - // continue - // } - // userInfo.ToNickname = u.Nickname - // userInfo.ToFaceURL = u.FaceURL - // userInfo.ToGender = u.Gender - appleUserList = append(appleUserList, &userInfo) + cp.FriendRequestDBCopyOpenIM(&userInfo, applyUserInfo) + resp.FriendRequestList = append(resp.FriendRequestList, &userInfo) } - - log.NewInfo(req.CommID.OperationID, "rpc GetFriendApplyList ok", pbFriend.GetFriendApplyListResp{FriendRequestList: appleUserList}) - return &pbFriend.GetFriendApplyListResp{FriendRequestList: appleUserList}, nil + return resp, nil } func (s *friendServer) GetSelfApplyList(ctx context.Context, req *pbFriend.GetSelfApplyListReq) (*pbFriend.GetSelfApplyListResp, error) { - log.NewInfo(req.CommID.OperationID, "GetSelfApplyList args ", req.String()) - + resp := &pbFriend.GetSelfApplyListResp{} //Parse token, to find current user information - if !token_verify.CheckAccess(ctx, req.CommID.OpUserID, req.CommID.FromUserID) { - log.NewError(req.CommID.OperationID, "CheckAccess false ", req.CommID.OpUserID, req.CommID.FromUserID) - return &pbFriend.GetSelfApplyListResp{CommonResp: &sdkws.CommonResp{ErrCode: constant.ErrNoPermission.ErrCode, ErrMsg: constant.ErrNoPermission.ErrMsg}}, nil - + if err := token_verify.CheckAccessV3(ctx, req.CommID.FromUserID); err != nil { + return nil, err } // Find the self add other userinfo - usersInfo, err := imdb.GetSendFriendApplicationListByUserID(req.CommID.FromUserID) + usersInfo, err := s.friendRequestModel.FindFromUserID(ctx, req.CommID.FromUserID) if err != nil { - log.NewError(req.CommID.OperationID, "GetSendFriendApplicationListByUserID failed ", err.Error(), req.CommID.FromUserID) - return &pbFriend.GetSelfApplyListResp{CommonResp: &sdkws.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil + return nil, err } - var selfApplyOtherUserList []*sdkws.FriendRequest for _, selfApplyOtherUserInfo := range usersInfo { var userInfo sdkws.FriendRequest // pbFriend.ApplyUserInfo - cp.FriendRequestDBCopyOpenIM(&userInfo, &selfApplyOtherUserInfo) - //u, err := imdb.GetUserByUserID(userInfo.FromUserID) - //if err != nil { - // log.Error(req.CommID.OperationID, "GetUserByUserID", userInfo.FromUserID) - // continue - //} - //userInfo.FromNickname = u.Nickname - //userInfo.FromFaceURL = u.FaceURL - //userInfo.FromGender = u.Gender - // - //u, err = imdb.GetUserByUserID(userInfo.ToUserID) - //if err != nil { - // log.Error(req.CommID.OperationID, "GetUserByUserID", userInfo.ToUserID) - // continue - //} - //userInfo.ToNickname = u.Nickname - //userInfo.ToFaceURL = u.FaceURL - //userInfo.ToGender = u.Gender - - selfApplyOtherUserList = append(selfApplyOtherUserList, &userInfo) + cp.FriendRequestDBCopyOpenIM(&userInfo, selfApplyOtherUserInfo) + resp.FriendRequestList = append(resp.FriendRequestList, &userInfo) } - log.NewInfo(req.CommID.OperationID, "rpc GetSelfApplyList ok", pbFriend.GetSelfApplyListResp{FriendRequestList: selfApplyOtherUserList}) - return &pbFriend.GetSelfApplyListResp{FriendRequestList: selfApplyOtherUserList}, nil + return resp, nil } - -//// -//func (s *friendServer) GetFriendsInfo(ctx context.Context, req *pbFriend.GetFriendsInfoReq) (*pbFriend.GetFriendInfoResp, error) { -// return nil, nil -//// log.NewInfo(req.CommID.OperationID, "GetFriendsInfo args ", req.String()) -//// var ( -//// isInBlackList int32 -//// // isFriend int32 -//// comment string -//// ) -//// -//// friendShip, err := imdb.FindFriendRelationshipFromFriend(req.CommID.FromUserID, req.CommID.ToUserID) -//// if err != nil { -//// log.NewError(req.CommID.OperationID, "FindFriendRelationshipFromFriend failed ", err.Error()) -//// return &pbFriend.GetFriendInfoResp{ErrCode: constant.ErrSearchUserInfo.ErrCode, ErrMsg: constant.ErrSearchUserInfo.ErrMsg}, nil -//// // isFriend = constant.FriendFlag -//// } -//// comment = friendShip.Remark -//// -//// friendUserInfo, err := imdb.FindUserByUID(req.CommID.ToUserID) -//// if err != nil { -//// log.NewError(req.CommID.OperationID, "FindUserByUID failed ", err.Error()) -//// return &pbFriend.GetFriendInfoResp{ErrCode: constant.ErrSearchUserInfo.ErrCode, ErrMsg: constant.ErrSearchUserInfo.ErrMsg}, nil -//// } -//// -//// err = imdb.FindRelationshipFromBlackList(req.CommID.FromUserID, req.CommID.ToUserID) -//// if err == nil { -//// isInBlackList = constant.BlackListFlag -//// } -//// -//// resp := pbFriend.GetFriendInfoResp{ErrCode: 0, ErrMsg: "",} -//// -//// utils.CopyStructFields(resp.FriendInfoList, friendUserInfo) -//// resp.Data.IsBlack = isInBlackList -//// resp.Data.OwnerUserID = req.CommID.FromUserID -//// resp.Data.Remark = comment -//// resp.Data.CreateTime = friendUserInfo.CreateTime -//// -//// log.NewInfo(req.CommID.OperationID, "GetFriendsInfo ok ", resp) -//// return &resp, nil -//// -//} diff --git a/internal/rpc/friend/other.go b/internal/rpc/friend/other.go index 592f9eada..3beebfada 100644 --- a/internal/rpc/friend/other.go +++ b/internal/rpc/friend/other.go @@ -8,3 +8,7 @@ import ( func GetUserInfo(ctx context.Context, userID string) (interface{}, error) { return nil, errors.New("TODO:GetUserInfo") } + +func GetUserInfoBatch(ctx context.Context, userIDs []string) (interface{}, error) { + return nil, errors.New("TODO:GetUserInfo") +} diff --git a/pkg/common/db/mysql_model/im_mysql_model/friend_model_k.go b/pkg/common/db/mysql_model/im_mysql_model/friend_model_k.go index 9f2105079..cdb317db9 100644 --- a/pkg/common/db/mysql_model/im_mysql_model/friend_model_k.go +++ b/pkg/common/db/mysql_model/im_mysql_model/friend_model_k.go @@ -27,15 +27,14 @@ func (f *Friend) Create(ctx context.Context, friends []*Friend) (err error) { defer func() { trace_log.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "friends", friends) }() - err = utils.Wrap(f.db.Create(&friends).Error, "") - return err + return utils.Wrap(f.db.Create(&friends).Error, "") } -func (f *Friend) Delete(ctx context.Context, ownerUserID string, friendUserIDs []string) (err error) { +func (f *Friend) Delete(ctx context.Context, ownerUserID string, friendUserIDs string) (err error) { defer func() { trace_log.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "ownerUserID", ownerUserID, "friendUserIDs", friendUserIDs) }() - err = utils.Wrap(f.db.Where("owner_user_id = ? and friend_user_id in (?)", ownerUserID, friendUserIDs).Delete(&Friend{}).Error, "") + err = utils.Wrap(f.db.Where("owner_user_id = ? and friend_user_id = ?", ownerUserID, friendUserIDs).Delete(&Friend{}).Error, "") return err } @@ -53,17 +52,29 @@ func (f *Friend) Update(ctx context.Context, friends []*Friend) (err error) { return utils.Wrap(f.db.Updates(&friends).Error, "") } +func (f *Friend) UpdateRemark(ctx context.Context, ownerUserID, friendUserID, remark string) (err error) { + defer func() { + trace_log.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "ownerUserID", ownerUserID, "friendUserID", friendUserID, "remark", remark) + }() + return utils.Wrap(f.db.Model(f).Where("owner_user_id = ? and friend_user_id = ?", ownerUserID, friendUserID).Update("remark", remark).Error, "") +} + func (f *Friend) Find(ctx context.Context, ownerUserID string) (friends []*Friend, err error) { defer func() { trace_log.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "ownerUserID", ownerUserID, "friends", friends) }() - err = utils.Wrap(f.db.Where("owner_user_id = ?", ownerUserID).Find(&friends).Error, "") - return friends, err + return friends, utils.Wrap(f.db.Where("owner_user_id = ?", ownerUserID).Find(&friends).Error, "") } func (f *Friend) Take(ctx context.Context, ownerUserID, friendUserID string) (friend *Friend, err error) { friend = &Friend{} defer trace_log.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "ownerUserID", ownerUserID, "friendUserID", friendUserID, "group", *friend) - err = utils.Wrap(f.db.Where("owner_user_id = ? and friend_user_id", ownerUserID, friendUserID).Take(friend).Error, "") - return friend, err + return friend, utils.Wrap(f.db.Where("owner_user_id = ? and friend_user_id", ownerUserID, friendUserID).Take(friend).Error, "") +} + +func (f *Friend) FindUserState(ctx context.Context, userID1, userID2 string) (friends []*Friend, err error) { + defer func() { + trace_log.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "userID1", userID1, "userID2", userID2) + }() + return friends, utils.Wrap(f.db.Where("(owner_user_id = ? and friend_user_id = ?) or (owner_user_id = ? and friend_user_id = ?)", userID1, userID2, userID2, userID1).Find(&friends).Error, "") } diff --git a/pkg/common/db/mysql_model/im_mysql_model/friend_request_model.go b/pkg/common/db/mysql_model/im_mysql_model/friend_request_model.go index ce0563c29..fe2d9f33c 100644 --- a/pkg/common/db/mysql_model/im_mysql_model/friend_request_model.go +++ b/pkg/common/db/mysql_model/im_mysql_model/friend_request_model.go @@ -65,13 +65,27 @@ func (f *FriendRequest) Find(ctx context.Context, ownerUserID string) (friends [ return friends, err } -func (f *FriendRequest) Take(ctx context.Context, ownerUserID, friendUserID string) (friend *FriendRequest, err error) { +func (f *FriendRequest) Take(ctx context.Context, fromUserID, toUserID string) (friend *FriendRequest, err error) { friend = &FriendRequest{} - defer trace_log.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "ownerUserID", ownerUserID, "friendUserID", friendUserID, "group", *friend) - err = utils.Wrap(f.db.Where("owner_user_id = ? and friend_user_id", ownerUserID, friendUserID).Take(friend).Error, "") + defer trace_log.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "fromUserID", fromUserID, "toUserID", toUserID, "friend", friend) + err = utils.Wrap(f.db.Where("from_user_id = ? and to_user_id", fromUserID, toUserID).Take(friend).Error, "") return friend, err } +func (f *FriendRequest) FindToUserID(ctx context.Context, toUserID string) (friends []*FriendRequest, err error) { + defer func() { + trace_log.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "toUserID", toUserID, "friends", friends) + }() + return friends, utils.Wrap(f.db.Where("to_user_id = ?", toUserID).Find(&friends).Error, "") +} + +func (f *FriendRequest) FindFromUserID(ctx context.Context, fromUserID string) (friends []*FriendRequest, err error) { + defer func() { + trace_log.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "fromUserID", fromUserID, "friends", friends) + }() + return friends, utils.Wrap(f.db.Where("from_user_id = ?", fromUserID).Find(&friends).Error, "") +} + // who apply to add me func GetReceivedFriendsApplicationListByUserID(ToUserID string) ([]FriendRequest, error) { var usersInfo []FriendRequest From 8a6435ddf686c8014302c9a8c95736bc44e1d31a Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Mon, 16 Jan 2023 15:59:30 +0800 Subject: [PATCH 04/13] 1 --- pkg/proto/friend/friend.proto | 101 +++++++++++++++------------------- 1 file changed, 44 insertions(+), 57 deletions(-) diff --git a/pkg/proto/friend/friend.proto b/pkg/proto/friend/friend.proto index e42ca2665..10e54b956 100644 --- a/pkg/proto/friend/friend.proto +++ b/pkg/proto/friend/friend.proto @@ -3,26 +3,19 @@ import "Open-IM-Server/pkg/proto/sdk_ws/ws.proto"; option go_package = "Open_IM/pkg/proto/friend;friend"; package friend; -message CommID{ - string OpUserID = 1; - string OperationID = 2; - string ToUserID = 4; - string FromUserID = 5; -} - - message GetFriendsInfoReq{ - CommID CommID = 1; + string ToUserID = 1; + string FromUserID = 2; } message GetFriendInfoResp{ - server_api_params.CommonResp commonResp = 1; - repeated server_api_params.FriendInfo FriendInfoList = 2; + repeated server_api_params.FriendInfo FriendInfoList = 1; } message AddFriendReq{ - CommID CommID = 1; - string ReqMsg = 2; + string ToUserID = 1; + string FromUserID = 2; + string ReqMsg = 3; } message AddFriendResp{ server_api_params.CommonResp commonResp = 1; @@ -31,115 +24,112 @@ message AddFriendResp{ message ImportFriendReq{ repeated string FriendUserIDList = 1; - string OperationID = 2; - string FromUserID = 3; - string OpUserID = 4; -} -message UserIDResult{ - string UserID = 1; - int32 Result = 2; + string FromUserID = 2; } + message ImportFriendResp{ - server_api_params.CommonResp commonResp = 1; - repeated UserIDResult UserIDResultList = 2; } message GetFriendApplyListReq{ - CommID CommID = 1; + string ToUserID = 1; + string FromUserID = 2; } message GetFriendApplyListResp{ - server_api_params.CommonResp commonResp = 1; - repeated server_api_params.FriendRequest FriendRequestList = 2; + repeated server_api_params.FriendRequest FriendRequestList = 1; } message GetFriendListReq{ - CommID CommID = 1; + string ToUserID = 1; + string FromUserID = 2; } message GetFriendListResp{ - server_api_params.CommonResp commonResp = 1; - repeated server_api_params.FriendInfo FriendInfoList = 2; + repeated server_api_params.FriendInfo FriendInfoList = 1; } message AddBlacklistReq{ - CommID CommID = 1; + string ToUserID = 1; + string FromUserID = 2; } message AddBlacklistResp{ - server_api_params.CommonResp commonResp = 1; + } message RemoveBlacklistReq{ - CommID CommID = 1; + string ToUserID = 1; + string FromUserID = 2; } message RemoveBlacklistResp{ - server_api_params.CommonResp commonResp = 1; + } message GetBlacklistReq{ - CommID CommID = 1; + string ToUserID = 1; + string FromUserID = 2; } message GetBlacklistResp{ - server_api_params.CommonResp commonResp = 1; - repeated server_api_params.PublicUserInfo BlackUserInfoList = 2; + repeated server_api_params.PublicUserInfo BlackUserInfoList = 1; } message IsFriendReq{ - CommID CommID = 1; + string ToUserID = 1; + string FromUserID = 2; } message IsFriendResp{ - server_api_params.CommonResp commonResp = 1; - bool Response = 2; + bool Response = 1; } message IsInBlackListReq{ - CommID CommID = 1; + string ToUserID = 1; + string FromUserID = 2; } message IsInBlackListResp{ - server_api_params.CommonResp commonResp = 1; - bool Response = 2; + bool Response = 1; } message DeleteFriendReq{ - CommID CommID = 1; + string ToUserID = 1; + string FromUserID = 2; } message DeleteFriendResp{ - server_api_params.CommonResp commonResp = 1; + } //process message AddFriendResponseReq{ - CommID CommID = 1; - int32 handleResult = 2; - string handleMsg = 3; + string ToUserID = 1; + string FromUserID = 2; + int32 handleResult = 3; + string handleMsg = 4; } message AddFriendResponseResp{ - server_api_params.CommonResp commonResp = 1; + } message SetFriendRemarkReq{ - CommID CommID = 1; - string Remark = 2; + string ToUserID = 1; + string FromUserID = 2; + string Remark = 3; } message SetFriendRemarkResp{ - server_api_params.CommonResp commonResp = 1; + } message GetSelfApplyListReq{ - CommID CommID = 1; + string ToUserID = 1; + string FromUserID = 2; } message GetSelfApplyListResp{ - server_api_params.CommonResp commonResp = 1; - repeated server_api_params.FriendRequest FriendRequestList = 2; + repeated server_api_params.FriendRequest FriendRequestList = 1; } service friend{ - // rpc getFriendsInfo(GetFriendsInfoReq) returns(GetFriendInfoResp); rpc addFriend(AddFriendReq) returns(AddFriendResp); rpc getFriendApplyList(GetFriendApplyListReq) returns(GetFriendApplyListResp); rpc getSelfApplyList(GetSelfApplyListReq) returns(GetSelfApplyListResp); @@ -153,7 +143,4 @@ service friend{ rpc addFriendResponse(AddFriendResponseReq) returns(AddFriendResponseResp); rpc setFriendRemark(SetFriendRemarkReq) returns(SetFriendRemarkResp); rpc importFriend(ImportFriendReq) returns(ImportFriendResp); - - // rpc CheckFriendFromCache(IsFriendReq) returns(IsFriendResp); - // rpc CheckBlockFromCache(IsInBlackListReq) returns(IsFriendResp); } \ No newline at end of file From 99bcc50eb8a95feeee6d5a8bc3d1af5374197bf5 Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Mon, 16 Jan 2023 16:02:56 +0800 Subject: [PATCH 05/13] 1 --- pkg/proto/friend/friend.pb.go | 685 ++++++++++++++-------------------- 1 file changed, 270 insertions(+), 415 deletions(-) diff --git a/pkg/proto/friend/friend.pb.go b/pkg/proto/friend/friend.pb.go index 7223677b4..c68eb3194 100644 --- a/pkg/proto/friend/friend.pb.go +++ b/pkg/proto/friend/friend.pb.go @@ -24,70 +24,9 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package -type CommID struct { - OpUserID string `protobuf:"bytes,1,opt,name=OpUserID" json:"OpUserID,omitempty"` - OperationID string `protobuf:"bytes,2,opt,name=OperationID" json:"OperationID,omitempty"` - ToUserID string `protobuf:"bytes,4,opt,name=ToUserID" json:"ToUserID,omitempty"` - FromUserID string `protobuf:"bytes,5,opt,name=FromUserID" json:"FromUserID,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CommID) Reset() { *m = CommID{} } -func (m *CommID) String() string { return proto.CompactTextString(m) } -func (*CommID) ProtoMessage() {} -func (*CommID) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_30fdefc06aa43365, []int{0} -} -func (m *CommID) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CommID.Unmarshal(m, b) -} -func (m *CommID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CommID.Marshal(b, m, deterministic) -} -func (dst *CommID) XXX_Merge(src proto.Message) { - xxx_messageInfo_CommID.Merge(dst, src) -} -func (m *CommID) XXX_Size() int { - return xxx_messageInfo_CommID.Size(m) -} -func (m *CommID) XXX_DiscardUnknown() { - xxx_messageInfo_CommID.DiscardUnknown(m) -} - -var xxx_messageInfo_CommID proto.InternalMessageInfo - -func (m *CommID) GetOpUserID() string { - if m != nil { - return m.OpUserID - } - return "" -} - -func (m *CommID) GetOperationID() string { - if m != nil { - return m.OperationID - } - return "" -} - -func (m *CommID) GetToUserID() string { - if m != nil { - return m.ToUserID - } - return "" -} - -func (m *CommID) GetFromUserID() string { - if m != nil { - return m.FromUserID - } - return "" -} - type GetFriendsInfoReq struct { - CommID *CommID `protobuf:"bytes,1,opt,name=CommID" json:"CommID,omitempty"` + ToUserID string `protobuf:"bytes,1,opt,name=ToUserID" json:"ToUserID,omitempty"` + FromUserID string `protobuf:"bytes,2,opt,name=FromUserID" json:"FromUserID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -97,7 +36,7 @@ func (m *GetFriendsInfoReq) Reset() { *m = GetFriendsInfoReq{} } func (m *GetFriendsInfoReq) String() string { return proto.CompactTextString(m) } func (*GetFriendsInfoReq) ProtoMessage() {} func (*GetFriendsInfoReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_30fdefc06aa43365, []int{1} + return fileDescriptor_friend_268d4d8b889bd130, []int{0} } func (m *GetFriendsInfoReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetFriendsInfoReq.Unmarshal(m, b) @@ -117,16 +56,22 @@ func (m *GetFriendsInfoReq) XXX_DiscardUnknown() { var xxx_messageInfo_GetFriendsInfoReq proto.InternalMessageInfo -func (m *GetFriendsInfoReq) GetCommID() *CommID { +func (m *GetFriendsInfoReq) GetToUserID() string { if m != nil { - return m.CommID + return m.ToUserID } - return nil + return "" +} + +func (m *GetFriendsInfoReq) GetFromUserID() string { + if m != nil { + return m.FromUserID + } + return "" } type GetFriendInfoResp struct { - CommonResp *sdk_ws.CommonResp `protobuf:"bytes,1,opt,name=commonResp" json:"commonResp,omitempty"` - FriendInfoList []*sdk_ws.FriendInfo `protobuf:"bytes,2,rep,name=FriendInfoList" json:"FriendInfoList,omitempty"` + FriendInfoList []*sdk_ws.FriendInfo `protobuf:"bytes,1,rep,name=FriendInfoList" json:"FriendInfoList,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -136,7 +81,7 @@ func (m *GetFriendInfoResp) Reset() { *m = GetFriendInfoResp{} } func (m *GetFriendInfoResp) String() string { return proto.CompactTextString(m) } func (*GetFriendInfoResp) ProtoMessage() {} func (*GetFriendInfoResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_30fdefc06aa43365, []int{2} + return fileDescriptor_friend_268d4d8b889bd130, []int{1} } func (m *GetFriendInfoResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetFriendInfoResp.Unmarshal(m, b) @@ -156,13 +101,6 @@ func (m *GetFriendInfoResp) XXX_DiscardUnknown() { var xxx_messageInfo_GetFriendInfoResp proto.InternalMessageInfo -func (m *GetFriendInfoResp) GetCommonResp() *sdk_ws.CommonResp { - if m != nil { - return m.CommonResp - } - return nil -} - func (m *GetFriendInfoResp) GetFriendInfoList() []*sdk_ws.FriendInfo { if m != nil { return m.FriendInfoList @@ -171,8 +109,9 @@ func (m *GetFriendInfoResp) GetFriendInfoList() []*sdk_ws.FriendInfo { } type AddFriendReq struct { - CommID *CommID `protobuf:"bytes,1,opt,name=CommID" json:"CommID,omitempty"` - ReqMsg string `protobuf:"bytes,2,opt,name=ReqMsg" json:"ReqMsg,omitempty"` + ToUserID string `protobuf:"bytes,1,opt,name=ToUserID" json:"ToUserID,omitempty"` + FromUserID string `protobuf:"bytes,2,opt,name=FromUserID" json:"FromUserID,omitempty"` + ReqMsg string `protobuf:"bytes,3,opt,name=ReqMsg" json:"ReqMsg,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -182,7 +121,7 @@ func (m *AddFriendReq) Reset() { *m = AddFriendReq{} } func (m *AddFriendReq) String() string { return proto.CompactTextString(m) } func (*AddFriendReq) ProtoMessage() {} func (*AddFriendReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_30fdefc06aa43365, []int{3} + return fileDescriptor_friend_268d4d8b889bd130, []int{2} } func (m *AddFriendReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AddFriendReq.Unmarshal(m, b) @@ -202,11 +141,18 @@ func (m *AddFriendReq) XXX_DiscardUnknown() { var xxx_messageInfo_AddFriendReq proto.InternalMessageInfo -func (m *AddFriendReq) GetCommID() *CommID { +func (m *AddFriendReq) GetToUserID() string { if m != nil { - return m.CommID + return m.ToUserID } - return nil + return "" +} + +func (m *AddFriendReq) GetFromUserID() string { + if m != nil { + return m.FromUserID + } + return "" } func (m *AddFriendReq) GetReqMsg() string { @@ -227,7 +173,7 @@ func (m *AddFriendResp) Reset() { *m = AddFriendResp{} } func (m *AddFriendResp) String() string { return proto.CompactTextString(m) } func (*AddFriendResp) ProtoMessage() {} func (*AddFriendResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_30fdefc06aa43365, []int{4} + return fileDescriptor_friend_268d4d8b889bd130, []int{3} } func (m *AddFriendResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AddFriendResp.Unmarshal(m, b) @@ -256,9 +202,7 @@ func (m *AddFriendResp) GetCommonResp() *sdk_ws.CommonResp { type ImportFriendReq struct { FriendUserIDList []string `protobuf:"bytes,1,rep,name=FriendUserIDList" json:"FriendUserIDList,omitempty"` - OperationID string `protobuf:"bytes,2,opt,name=OperationID" json:"OperationID,omitempty"` - FromUserID string `protobuf:"bytes,3,opt,name=FromUserID" json:"FromUserID,omitempty"` - OpUserID string `protobuf:"bytes,4,opt,name=OpUserID" json:"OpUserID,omitempty"` + FromUserID string `protobuf:"bytes,2,opt,name=FromUserID" json:"FromUserID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -268,7 +212,7 @@ func (m *ImportFriendReq) Reset() { *m = ImportFriendReq{} } func (m *ImportFriendReq) String() string { return proto.CompactTextString(m) } func (*ImportFriendReq) ProtoMessage() {} func (*ImportFriendReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_30fdefc06aa43365, []int{5} + return fileDescriptor_friend_268d4d8b889bd130, []int{4} } func (m *ImportFriendReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ImportFriendReq.Unmarshal(m, b) @@ -295,13 +239,6 @@ func (m *ImportFriendReq) GetFriendUserIDList() []string { return nil } -func (m *ImportFriendReq) GetOperationID() string { - if m != nil { - return m.OperationID - } - return "" -} - func (m *ImportFriendReq) GetFromUserID() string { if m != nil { return m.FromUserID @@ -309,72 +246,17 @@ func (m *ImportFriendReq) GetFromUserID() string { return "" } -func (m *ImportFriendReq) GetOpUserID() string { - if m != nil { - return m.OpUserID - } - return "" -} - -type UserIDResult struct { - UserID string `protobuf:"bytes,1,opt,name=UserID" json:"UserID,omitempty"` - Result int32 `protobuf:"varint,2,opt,name=Result" json:"Result,omitempty"` +type ImportFriendResp struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } -func (m *UserIDResult) Reset() { *m = UserIDResult{} } -func (m *UserIDResult) String() string { return proto.CompactTextString(m) } -func (*UserIDResult) ProtoMessage() {} -func (*UserIDResult) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_30fdefc06aa43365, []int{6} -} -func (m *UserIDResult) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UserIDResult.Unmarshal(m, b) -} -func (m *UserIDResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UserIDResult.Marshal(b, m, deterministic) -} -func (dst *UserIDResult) XXX_Merge(src proto.Message) { - xxx_messageInfo_UserIDResult.Merge(dst, src) -} -func (m *UserIDResult) XXX_Size() int { - return xxx_messageInfo_UserIDResult.Size(m) -} -func (m *UserIDResult) XXX_DiscardUnknown() { - xxx_messageInfo_UserIDResult.DiscardUnknown(m) -} - -var xxx_messageInfo_UserIDResult proto.InternalMessageInfo - -func (m *UserIDResult) GetUserID() string { - if m != nil { - return m.UserID - } - return "" -} - -func (m *UserIDResult) GetResult() int32 { - if m != nil { - return m.Result - } - return 0 -} - -type ImportFriendResp struct { - CommonResp *sdk_ws.CommonResp `protobuf:"bytes,1,opt,name=commonResp" json:"commonResp,omitempty"` - UserIDResultList []*UserIDResult `protobuf:"bytes,2,rep,name=UserIDResultList" json:"UserIDResultList,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - func (m *ImportFriendResp) Reset() { *m = ImportFriendResp{} } func (m *ImportFriendResp) String() string { return proto.CompactTextString(m) } func (*ImportFriendResp) ProtoMessage() {} func (*ImportFriendResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_30fdefc06aa43365, []int{7} + return fileDescriptor_friend_268d4d8b889bd130, []int{5} } func (m *ImportFriendResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ImportFriendResp.Unmarshal(m, b) @@ -394,22 +276,9 @@ func (m *ImportFriendResp) XXX_DiscardUnknown() { var xxx_messageInfo_ImportFriendResp proto.InternalMessageInfo -func (m *ImportFriendResp) GetCommonResp() *sdk_ws.CommonResp { - if m != nil { - return m.CommonResp - } - return nil -} - -func (m *ImportFriendResp) GetUserIDResultList() []*UserIDResult { - if m != nil { - return m.UserIDResultList - } - return nil -} - type GetFriendApplyListReq struct { - CommID *CommID `protobuf:"bytes,1,opt,name=CommID" json:"CommID,omitempty"` + ToUserID string `protobuf:"bytes,1,opt,name=ToUserID" json:"ToUserID,omitempty"` + FromUserID string `protobuf:"bytes,2,opt,name=FromUserID" json:"FromUserID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -419,7 +288,7 @@ func (m *GetFriendApplyListReq) Reset() { *m = GetFriendApplyListReq{} } func (m *GetFriendApplyListReq) String() string { return proto.CompactTextString(m) } func (*GetFriendApplyListReq) ProtoMessage() {} func (*GetFriendApplyListReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_30fdefc06aa43365, []int{8} + return fileDescriptor_friend_268d4d8b889bd130, []int{6} } func (m *GetFriendApplyListReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetFriendApplyListReq.Unmarshal(m, b) @@ -439,16 +308,22 @@ func (m *GetFriendApplyListReq) XXX_DiscardUnknown() { var xxx_messageInfo_GetFriendApplyListReq proto.InternalMessageInfo -func (m *GetFriendApplyListReq) GetCommID() *CommID { +func (m *GetFriendApplyListReq) GetToUserID() string { if m != nil { - return m.CommID + return m.ToUserID } - return nil + return "" +} + +func (m *GetFriendApplyListReq) GetFromUserID() string { + if m != nil { + return m.FromUserID + } + return "" } type GetFriendApplyListResp struct { - CommonResp *sdk_ws.CommonResp `protobuf:"bytes,1,opt,name=commonResp" json:"commonResp,omitempty"` - FriendRequestList []*sdk_ws.FriendRequest `protobuf:"bytes,2,rep,name=FriendRequestList" json:"FriendRequestList,omitempty"` + FriendRequestList []*sdk_ws.FriendRequest `protobuf:"bytes,1,rep,name=FriendRequestList" json:"FriendRequestList,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -458,7 +333,7 @@ func (m *GetFriendApplyListResp) Reset() { *m = GetFriendApplyListResp{} func (m *GetFriendApplyListResp) String() string { return proto.CompactTextString(m) } func (*GetFriendApplyListResp) ProtoMessage() {} func (*GetFriendApplyListResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_30fdefc06aa43365, []int{9} + return fileDescriptor_friend_268d4d8b889bd130, []int{7} } func (m *GetFriendApplyListResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetFriendApplyListResp.Unmarshal(m, b) @@ -478,13 +353,6 @@ func (m *GetFriendApplyListResp) XXX_DiscardUnknown() { var xxx_messageInfo_GetFriendApplyListResp proto.InternalMessageInfo -func (m *GetFriendApplyListResp) GetCommonResp() *sdk_ws.CommonResp { - if m != nil { - return m.CommonResp - } - return nil -} - func (m *GetFriendApplyListResp) GetFriendRequestList() []*sdk_ws.FriendRequest { if m != nil { return m.FriendRequestList @@ -493,7 +361,8 @@ func (m *GetFriendApplyListResp) GetFriendRequestList() []*sdk_ws.FriendRequest } type GetFriendListReq struct { - CommID *CommID `protobuf:"bytes,1,opt,name=CommID" json:"CommID,omitempty"` + ToUserID string `protobuf:"bytes,1,opt,name=ToUserID" json:"ToUserID,omitempty"` + FromUserID string `protobuf:"bytes,2,opt,name=FromUserID" json:"FromUserID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -503,7 +372,7 @@ func (m *GetFriendListReq) Reset() { *m = GetFriendListReq{} } func (m *GetFriendListReq) String() string { return proto.CompactTextString(m) } func (*GetFriendListReq) ProtoMessage() {} func (*GetFriendListReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_30fdefc06aa43365, []int{10} + return fileDescriptor_friend_268d4d8b889bd130, []int{8} } func (m *GetFriendListReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetFriendListReq.Unmarshal(m, b) @@ -523,16 +392,22 @@ func (m *GetFriendListReq) XXX_DiscardUnknown() { var xxx_messageInfo_GetFriendListReq proto.InternalMessageInfo -func (m *GetFriendListReq) GetCommID() *CommID { +func (m *GetFriendListReq) GetToUserID() string { if m != nil { - return m.CommID + return m.ToUserID } - return nil + return "" +} + +func (m *GetFriendListReq) GetFromUserID() string { + if m != nil { + return m.FromUserID + } + return "" } type GetFriendListResp struct { - CommonResp *sdk_ws.CommonResp `protobuf:"bytes,1,opt,name=commonResp" json:"commonResp,omitempty"` - FriendInfoList []*sdk_ws.FriendInfo `protobuf:"bytes,2,rep,name=FriendInfoList" json:"FriendInfoList,omitempty"` + FriendInfoList []*sdk_ws.FriendInfo `protobuf:"bytes,1,rep,name=FriendInfoList" json:"FriendInfoList,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -542,7 +417,7 @@ func (m *GetFriendListResp) Reset() { *m = GetFriendListResp{} } func (m *GetFriendListResp) String() string { return proto.CompactTextString(m) } func (*GetFriendListResp) ProtoMessage() {} func (*GetFriendListResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_30fdefc06aa43365, []int{11} + return fileDescriptor_friend_268d4d8b889bd130, []int{9} } func (m *GetFriendListResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetFriendListResp.Unmarshal(m, b) @@ -562,13 +437,6 @@ func (m *GetFriendListResp) XXX_DiscardUnknown() { var xxx_messageInfo_GetFriendListResp proto.InternalMessageInfo -func (m *GetFriendListResp) GetCommonResp() *sdk_ws.CommonResp { - if m != nil { - return m.CommonResp - } - return nil -} - func (m *GetFriendListResp) GetFriendInfoList() []*sdk_ws.FriendInfo { if m != nil { return m.FriendInfoList @@ -577,7 +445,8 @@ func (m *GetFriendListResp) GetFriendInfoList() []*sdk_ws.FriendInfo { } type AddBlacklistReq struct { - CommID *CommID `protobuf:"bytes,1,opt,name=CommID" json:"CommID,omitempty"` + ToUserID string `protobuf:"bytes,1,opt,name=ToUserID" json:"ToUserID,omitempty"` + FromUserID string `protobuf:"bytes,2,opt,name=FromUserID" json:"FromUserID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -587,7 +456,7 @@ func (m *AddBlacklistReq) Reset() { *m = AddBlacklistReq{} } func (m *AddBlacklistReq) String() string { return proto.CompactTextString(m) } func (*AddBlacklistReq) ProtoMessage() {} func (*AddBlacklistReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_30fdefc06aa43365, []int{12} + return fileDescriptor_friend_268d4d8b889bd130, []int{10} } func (m *AddBlacklistReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AddBlacklistReq.Unmarshal(m, b) @@ -607,25 +476,31 @@ func (m *AddBlacklistReq) XXX_DiscardUnknown() { var xxx_messageInfo_AddBlacklistReq proto.InternalMessageInfo -func (m *AddBlacklistReq) GetCommID() *CommID { +func (m *AddBlacklistReq) GetToUserID() string { if m != nil { - return m.CommID + return m.ToUserID } - return nil + return "" +} + +func (m *AddBlacklistReq) GetFromUserID() string { + if m != nil { + return m.FromUserID + } + return "" } type AddBlacklistResp struct { - CommonResp *sdk_ws.CommonResp `protobuf:"bytes,1,opt,name=commonResp" json:"commonResp,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *AddBlacklistResp) Reset() { *m = AddBlacklistResp{} } func (m *AddBlacklistResp) String() string { return proto.CompactTextString(m) } func (*AddBlacklistResp) ProtoMessage() {} func (*AddBlacklistResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_30fdefc06aa43365, []int{13} + return fileDescriptor_friend_268d4d8b889bd130, []int{11} } func (m *AddBlacklistResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AddBlacklistResp.Unmarshal(m, b) @@ -645,15 +520,9 @@ func (m *AddBlacklistResp) XXX_DiscardUnknown() { var xxx_messageInfo_AddBlacklistResp proto.InternalMessageInfo -func (m *AddBlacklistResp) GetCommonResp() *sdk_ws.CommonResp { - if m != nil { - return m.CommonResp - } - return nil -} - type RemoveBlacklistReq struct { - CommID *CommID `protobuf:"bytes,1,opt,name=CommID" json:"CommID,omitempty"` + ToUserID string `protobuf:"bytes,1,opt,name=ToUserID" json:"ToUserID,omitempty"` + FromUserID string `protobuf:"bytes,2,opt,name=FromUserID" json:"FromUserID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -663,7 +532,7 @@ func (m *RemoveBlacklistReq) Reset() { *m = RemoveBlacklistReq{} } func (m *RemoveBlacklistReq) String() string { return proto.CompactTextString(m) } func (*RemoveBlacklistReq) ProtoMessage() {} func (*RemoveBlacklistReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_30fdefc06aa43365, []int{14} + return fileDescriptor_friend_268d4d8b889bd130, []int{12} } func (m *RemoveBlacklistReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RemoveBlacklistReq.Unmarshal(m, b) @@ -683,25 +552,31 @@ func (m *RemoveBlacklistReq) XXX_DiscardUnknown() { var xxx_messageInfo_RemoveBlacklistReq proto.InternalMessageInfo -func (m *RemoveBlacklistReq) GetCommID() *CommID { +func (m *RemoveBlacklistReq) GetToUserID() string { if m != nil { - return m.CommID + return m.ToUserID } - return nil + return "" +} + +func (m *RemoveBlacklistReq) GetFromUserID() string { + if m != nil { + return m.FromUserID + } + return "" } type RemoveBlacklistResp struct { - CommonResp *sdk_ws.CommonResp `protobuf:"bytes,1,opt,name=commonResp" json:"commonResp,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *RemoveBlacklistResp) Reset() { *m = RemoveBlacklistResp{} } func (m *RemoveBlacklistResp) String() string { return proto.CompactTextString(m) } func (*RemoveBlacklistResp) ProtoMessage() {} func (*RemoveBlacklistResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_30fdefc06aa43365, []int{15} + return fileDescriptor_friend_268d4d8b889bd130, []int{13} } func (m *RemoveBlacklistResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RemoveBlacklistResp.Unmarshal(m, b) @@ -721,15 +596,9 @@ func (m *RemoveBlacklistResp) XXX_DiscardUnknown() { var xxx_messageInfo_RemoveBlacklistResp proto.InternalMessageInfo -func (m *RemoveBlacklistResp) GetCommonResp() *sdk_ws.CommonResp { - if m != nil { - return m.CommonResp - } - return nil -} - type GetBlacklistReq struct { - CommID *CommID `protobuf:"bytes,1,opt,name=CommID" json:"CommID,omitempty"` + ToUserID string `protobuf:"bytes,1,opt,name=ToUserID" json:"ToUserID,omitempty"` + FromUserID string `protobuf:"bytes,2,opt,name=FromUserID" json:"FromUserID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -739,7 +608,7 @@ func (m *GetBlacklistReq) Reset() { *m = GetBlacklistReq{} } func (m *GetBlacklistReq) String() string { return proto.CompactTextString(m) } func (*GetBlacklistReq) ProtoMessage() {} func (*GetBlacklistReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_30fdefc06aa43365, []int{16} + return fileDescriptor_friend_268d4d8b889bd130, []int{14} } func (m *GetBlacklistReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetBlacklistReq.Unmarshal(m, b) @@ -759,16 +628,22 @@ func (m *GetBlacklistReq) XXX_DiscardUnknown() { var xxx_messageInfo_GetBlacklistReq proto.InternalMessageInfo -func (m *GetBlacklistReq) GetCommID() *CommID { +func (m *GetBlacklistReq) GetToUserID() string { if m != nil { - return m.CommID + return m.ToUserID } - return nil + return "" +} + +func (m *GetBlacklistReq) GetFromUserID() string { + if m != nil { + return m.FromUserID + } + return "" } type GetBlacklistResp struct { - CommonResp *sdk_ws.CommonResp `protobuf:"bytes,1,opt,name=commonResp" json:"commonResp,omitempty"` - BlackUserInfoList []*sdk_ws.PublicUserInfo `protobuf:"bytes,2,rep,name=BlackUserInfoList" json:"BlackUserInfoList,omitempty"` + BlackUserInfoList []*sdk_ws.PublicUserInfo `protobuf:"bytes,1,rep,name=BlackUserInfoList" json:"BlackUserInfoList,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -778,7 +653,7 @@ func (m *GetBlacklistResp) Reset() { *m = GetBlacklistResp{} } func (m *GetBlacklistResp) String() string { return proto.CompactTextString(m) } func (*GetBlacklistResp) ProtoMessage() {} func (*GetBlacklistResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_30fdefc06aa43365, []int{17} + return fileDescriptor_friend_268d4d8b889bd130, []int{15} } func (m *GetBlacklistResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetBlacklistResp.Unmarshal(m, b) @@ -798,13 +673,6 @@ func (m *GetBlacklistResp) XXX_DiscardUnknown() { var xxx_messageInfo_GetBlacklistResp proto.InternalMessageInfo -func (m *GetBlacklistResp) GetCommonResp() *sdk_ws.CommonResp { - if m != nil { - return m.CommonResp - } - return nil -} - func (m *GetBlacklistResp) GetBlackUserInfoList() []*sdk_ws.PublicUserInfo { if m != nil { return m.BlackUserInfoList @@ -813,7 +681,8 @@ func (m *GetBlacklistResp) GetBlackUserInfoList() []*sdk_ws.PublicUserInfo { } type IsFriendReq struct { - CommID *CommID `protobuf:"bytes,1,opt,name=CommID" json:"CommID,omitempty"` + ToUserID string `protobuf:"bytes,1,opt,name=ToUserID" json:"ToUserID,omitempty"` + FromUserID string `protobuf:"bytes,2,opt,name=FromUserID" json:"FromUserID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -823,7 +692,7 @@ func (m *IsFriendReq) Reset() { *m = IsFriendReq{} } func (m *IsFriendReq) String() string { return proto.CompactTextString(m) } func (*IsFriendReq) ProtoMessage() {} func (*IsFriendReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_30fdefc06aa43365, []int{18} + return fileDescriptor_friend_268d4d8b889bd130, []int{16} } func (m *IsFriendReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_IsFriendReq.Unmarshal(m, b) @@ -843,26 +712,32 @@ func (m *IsFriendReq) XXX_DiscardUnknown() { var xxx_messageInfo_IsFriendReq proto.InternalMessageInfo -func (m *IsFriendReq) GetCommID() *CommID { +func (m *IsFriendReq) GetToUserID() string { if m != nil { - return m.CommID + return m.ToUserID } - return nil + return "" +} + +func (m *IsFriendReq) GetFromUserID() string { + if m != nil { + return m.FromUserID + } + return "" } type IsFriendResp struct { - CommonResp *sdk_ws.CommonResp `protobuf:"bytes,1,opt,name=commonResp" json:"commonResp,omitempty"` - Response bool `protobuf:"varint,2,opt,name=Response" json:"Response,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Response bool `protobuf:"varint,1,opt,name=Response" json:"Response,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *IsFriendResp) Reset() { *m = IsFriendResp{} } func (m *IsFriendResp) String() string { return proto.CompactTextString(m) } func (*IsFriendResp) ProtoMessage() {} func (*IsFriendResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_30fdefc06aa43365, []int{19} + return fileDescriptor_friend_268d4d8b889bd130, []int{17} } func (m *IsFriendResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_IsFriendResp.Unmarshal(m, b) @@ -882,13 +757,6 @@ func (m *IsFriendResp) XXX_DiscardUnknown() { var xxx_messageInfo_IsFriendResp proto.InternalMessageInfo -func (m *IsFriendResp) GetCommonResp() *sdk_ws.CommonResp { - if m != nil { - return m.CommonResp - } - return nil -} - func (m *IsFriendResp) GetResponse() bool { if m != nil { return m.Response @@ -897,7 +765,8 @@ func (m *IsFriendResp) GetResponse() bool { } type IsInBlackListReq struct { - CommID *CommID `protobuf:"bytes,1,opt,name=CommID" json:"CommID,omitempty"` + ToUserID string `protobuf:"bytes,1,opt,name=ToUserID" json:"ToUserID,omitempty"` + FromUserID string `protobuf:"bytes,2,opt,name=FromUserID" json:"FromUserID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -907,7 +776,7 @@ func (m *IsInBlackListReq) Reset() { *m = IsInBlackListReq{} } func (m *IsInBlackListReq) String() string { return proto.CompactTextString(m) } func (*IsInBlackListReq) ProtoMessage() {} func (*IsInBlackListReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_30fdefc06aa43365, []int{20} + return fileDescriptor_friend_268d4d8b889bd130, []int{18} } func (m *IsInBlackListReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_IsInBlackListReq.Unmarshal(m, b) @@ -927,26 +796,32 @@ func (m *IsInBlackListReq) XXX_DiscardUnknown() { var xxx_messageInfo_IsInBlackListReq proto.InternalMessageInfo -func (m *IsInBlackListReq) GetCommID() *CommID { +func (m *IsInBlackListReq) GetToUserID() string { if m != nil { - return m.CommID + return m.ToUserID } - return nil + return "" +} + +func (m *IsInBlackListReq) GetFromUserID() string { + if m != nil { + return m.FromUserID + } + return "" } type IsInBlackListResp struct { - CommonResp *sdk_ws.CommonResp `protobuf:"bytes,1,opt,name=commonResp" json:"commonResp,omitempty"` - Response bool `protobuf:"varint,2,opt,name=Response" json:"Response,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Response bool `protobuf:"varint,1,opt,name=Response" json:"Response,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *IsInBlackListResp) Reset() { *m = IsInBlackListResp{} } func (m *IsInBlackListResp) String() string { return proto.CompactTextString(m) } func (*IsInBlackListResp) ProtoMessage() {} func (*IsInBlackListResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_30fdefc06aa43365, []int{21} + return fileDescriptor_friend_268d4d8b889bd130, []int{19} } func (m *IsInBlackListResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_IsInBlackListResp.Unmarshal(m, b) @@ -966,13 +841,6 @@ func (m *IsInBlackListResp) XXX_DiscardUnknown() { var xxx_messageInfo_IsInBlackListResp proto.InternalMessageInfo -func (m *IsInBlackListResp) GetCommonResp() *sdk_ws.CommonResp { - if m != nil { - return m.CommonResp - } - return nil -} - func (m *IsInBlackListResp) GetResponse() bool { if m != nil { return m.Response @@ -981,7 +849,8 @@ func (m *IsInBlackListResp) GetResponse() bool { } type DeleteFriendReq struct { - CommID *CommID `protobuf:"bytes,1,opt,name=CommID" json:"CommID,omitempty"` + ToUserID string `protobuf:"bytes,1,opt,name=ToUserID" json:"ToUserID,omitempty"` + FromUserID string `protobuf:"bytes,2,opt,name=FromUserID" json:"FromUserID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -991,7 +860,7 @@ func (m *DeleteFriendReq) Reset() { *m = DeleteFriendReq{} } func (m *DeleteFriendReq) String() string { return proto.CompactTextString(m) } func (*DeleteFriendReq) ProtoMessage() {} func (*DeleteFriendReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_30fdefc06aa43365, []int{22} + return fileDescriptor_friend_268d4d8b889bd130, []int{20} } func (m *DeleteFriendReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DeleteFriendReq.Unmarshal(m, b) @@ -1011,25 +880,31 @@ func (m *DeleteFriendReq) XXX_DiscardUnknown() { var xxx_messageInfo_DeleteFriendReq proto.InternalMessageInfo -func (m *DeleteFriendReq) GetCommID() *CommID { +func (m *DeleteFriendReq) GetToUserID() string { if m != nil { - return m.CommID + return m.ToUserID } - return nil + return "" +} + +func (m *DeleteFriendReq) GetFromUserID() string { + if m != nil { + return m.FromUserID + } + return "" } type DeleteFriendResp struct { - CommonResp *sdk_ws.CommonResp `protobuf:"bytes,1,opt,name=commonResp" json:"commonResp,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *DeleteFriendResp) Reset() { *m = DeleteFriendResp{} } func (m *DeleteFriendResp) String() string { return proto.CompactTextString(m) } func (*DeleteFriendResp) ProtoMessage() {} func (*DeleteFriendResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_30fdefc06aa43365, []int{23} + return fileDescriptor_friend_268d4d8b889bd130, []int{21} } func (m *DeleteFriendResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DeleteFriendResp.Unmarshal(m, b) @@ -1049,18 +924,12 @@ func (m *DeleteFriendResp) XXX_DiscardUnknown() { var xxx_messageInfo_DeleteFriendResp proto.InternalMessageInfo -func (m *DeleteFriendResp) GetCommonResp() *sdk_ws.CommonResp { - if m != nil { - return m.CommonResp - } - return nil -} - // process type AddFriendResponseReq struct { - CommID *CommID `protobuf:"bytes,1,opt,name=CommID" json:"CommID,omitempty"` - HandleResult int32 `protobuf:"varint,2,opt,name=handleResult" json:"handleResult,omitempty"` - HandleMsg string `protobuf:"bytes,3,opt,name=handleMsg" json:"handleMsg,omitempty"` + ToUserID string `protobuf:"bytes,1,opt,name=ToUserID" json:"ToUserID,omitempty"` + FromUserID string `protobuf:"bytes,2,opt,name=FromUserID" json:"FromUserID,omitempty"` + HandleResult int32 `protobuf:"varint,3,opt,name=handleResult" json:"handleResult,omitempty"` + HandleMsg string `protobuf:"bytes,4,opt,name=handleMsg" json:"handleMsg,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1070,7 +939,7 @@ func (m *AddFriendResponseReq) Reset() { *m = AddFriendResponseReq{} } func (m *AddFriendResponseReq) String() string { return proto.CompactTextString(m) } func (*AddFriendResponseReq) ProtoMessage() {} func (*AddFriendResponseReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_30fdefc06aa43365, []int{24} + return fileDescriptor_friend_268d4d8b889bd130, []int{22} } func (m *AddFriendResponseReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AddFriendResponseReq.Unmarshal(m, b) @@ -1090,11 +959,18 @@ func (m *AddFriendResponseReq) XXX_DiscardUnknown() { var xxx_messageInfo_AddFriendResponseReq proto.InternalMessageInfo -func (m *AddFriendResponseReq) GetCommID() *CommID { +func (m *AddFriendResponseReq) GetToUserID() string { if m != nil { - return m.CommID + return m.ToUserID } - return nil + return "" +} + +func (m *AddFriendResponseReq) GetFromUserID() string { + if m != nil { + return m.FromUserID + } + return "" } func (m *AddFriendResponseReq) GetHandleResult() int32 { @@ -1112,17 +988,16 @@ func (m *AddFriendResponseReq) GetHandleMsg() string { } type AddFriendResponseResp struct { - CommonResp *sdk_ws.CommonResp `protobuf:"bytes,1,opt,name=commonResp" json:"commonResp,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *AddFriendResponseResp) Reset() { *m = AddFriendResponseResp{} } func (m *AddFriendResponseResp) String() string { return proto.CompactTextString(m) } func (*AddFriendResponseResp) ProtoMessage() {} func (*AddFriendResponseResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_30fdefc06aa43365, []int{25} + return fileDescriptor_friend_268d4d8b889bd130, []int{23} } func (m *AddFriendResponseResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AddFriendResponseResp.Unmarshal(m, b) @@ -1142,16 +1017,10 @@ func (m *AddFriendResponseResp) XXX_DiscardUnknown() { var xxx_messageInfo_AddFriendResponseResp proto.InternalMessageInfo -func (m *AddFriendResponseResp) GetCommonResp() *sdk_ws.CommonResp { - if m != nil { - return m.CommonResp - } - return nil -} - type SetFriendRemarkReq struct { - CommID *CommID `protobuf:"bytes,1,opt,name=CommID" json:"CommID,omitempty"` - Remark string `protobuf:"bytes,2,opt,name=Remark" json:"Remark,omitempty"` + ToUserID string `protobuf:"bytes,1,opt,name=ToUserID" json:"ToUserID,omitempty"` + FromUserID string `protobuf:"bytes,2,opt,name=FromUserID" json:"FromUserID,omitempty"` + Remark string `protobuf:"bytes,3,opt,name=Remark" json:"Remark,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1161,7 +1030,7 @@ func (m *SetFriendRemarkReq) Reset() { *m = SetFriendRemarkReq{} } func (m *SetFriendRemarkReq) String() string { return proto.CompactTextString(m) } func (*SetFriendRemarkReq) ProtoMessage() {} func (*SetFriendRemarkReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_30fdefc06aa43365, []int{26} + return fileDescriptor_friend_268d4d8b889bd130, []int{24} } func (m *SetFriendRemarkReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetFriendRemarkReq.Unmarshal(m, b) @@ -1181,11 +1050,18 @@ func (m *SetFriendRemarkReq) XXX_DiscardUnknown() { var xxx_messageInfo_SetFriendRemarkReq proto.InternalMessageInfo -func (m *SetFriendRemarkReq) GetCommID() *CommID { +func (m *SetFriendRemarkReq) GetToUserID() string { if m != nil { - return m.CommID + return m.ToUserID } - return nil + return "" +} + +func (m *SetFriendRemarkReq) GetFromUserID() string { + if m != nil { + return m.FromUserID + } + return "" } func (m *SetFriendRemarkReq) GetRemark() string { @@ -1196,17 +1072,16 @@ func (m *SetFriendRemarkReq) GetRemark() string { } type SetFriendRemarkResp struct { - CommonResp *sdk_ws.CommonResp `protobuf:"bytes,1,opt,name=commonResp" json:"commonResp,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *SetFriendRemarkResp) Reset() { *m = SetFriendRemarkResp{} } func (m *SetFriendRemarkResp) String() string { return proto.CompactTextString(m) } func (*SetFriendRemarkResp) ProtoMessage() {} func (*SetFriendRemarkResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_30fdefc06aa43365, []int{27} + return fileDescriptor_friend_268d4d8b889bd130, []int{25} } func (m *SetFriendRemarkResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetFriendRemarkResp.Unmarshal(m, b) @@ -1226,15 +1101,9 @@ func (m *SetFriendRemarkResp) XXX_DiscardUnknown() { var xxx_messageInfo_SetFriendRemarkResp proto.InternalMessageInfo -func (m *SetFriendRemarkResp) GetCommonResp() *sdk_ws.CommonResp { - if m != nil { - return m.CommonResp - } - return nil -} - type GetSelfApplyListReq struct { - CommID *CommID `protobuf:"bytes,1,opt,name=CommID" json:"CommID,omitempty"` + ToUserID string `protobuf:"bytes,1,opt,name=ToUserID" json:"ToUserID,omitempty"` + FromUserID string `protobuf:"bytes,2,opt,name=FromUserID" json:"FromUserID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1244,7 +1113,7 @@ func (m *GetSelfApplyListReq) Reset() { *m = GetSelfApplyListReq{} } func (m *GetSelfApplyListReq) String() string { return proto.CompactTextString(m) } func (*GetSelfApplyListReq) ProtoMessage() {} func (*GetSelfApplyListReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_30fdefc06aa43365, []int{28} + return fileDescriptor_friend_268d4d8b889bd130, []int{26} } func (m *GetSelfApplyListReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetSelfApplyListReq.Unmarshal(m, b) @@ -1264,16 +1133,22 @@ func (m *GetSelfApplyListReq) XXX_DiscardUnknown() { var xxx_messageInfo_GetSelfApplyListReq proto.InternalMessageInfo -func (m *GetSelfApplyListReq) GetCommID() *CommID { +func (m *GetSelfApplyListReq) GetToUserID() string { if m != nil { - return m.CommID + return m.ToUserID } - return nil + return "" +} + +func (m *GetSelfApplyListReq) GetFromUserID() string { + if m != nil { + return m.FromUserID + } + return "" } type GetSelfApplyListResp struct { - CommonResp *sdk_ws.CommonResp `protobuf:"bytes,1,opt,name=commonResp" json:"commonResp,omitempty"` - FriendRequestList []*sdk_ws.FriendRequest `protobuf:"bytes,2,rep,name=FriendRequestList" json:"FriendRequestList,omitempty"` + FriendRequestList []*sdk_ws.FriendRequest `protobuf:"bytes,1,rep,name=FriendRequestList" json:"FriendRequestList,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1283,7 +1158,7 @@ func (m *GetSelfApplyListResp) Reset() { *m = GetSelfApplyListResp{} } func (m *GetSelfApplyListResp) String() string { return proto.CompactTextString(m) } func (*GetSelfApplyListResp) ProtoMessage() {} func (*GetSelfApplyListResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_30fdefc06aa43365, []int{29} + return fileDescriptor_friend_268d4d8b889bd130, []int{27} } func (m *GetSelfApplyListResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetSelfApplyListResp.Unmarshal(m, b) @@ -1303,13 +1178,6 @@ func (m *GetSelfApplyListResp) XXX_DiscardUnknown() { var xxx_messageInfo_GetSelfApplyListResp proto.InternalMessageInfo -func (m *GetSelfApplyListResp) GetCommonResp() *sdk_ws.CommonResp { - if m != nil { - return m.CommonResp - } - return nil -} - func (m *GetSelfApplyListResp) GetFriendRequestList() []*sdk_ws.FriendRequest { if m != nil { return m.FriendRequestList @@ -1318,13 +1186,11 @@ func (m *GetSelfApplyListResp) GetFriendRequestList() []*sdk_ws.FriendRequest { } func init() { - proto.RegisterType((*CommID)(nil), "friend.CommID") proto.RegisterType((*GetFriendsInfoReq)(nil), "friend.GetFriendsInfoReq") proto.RegisterType((*GetFriendInfoResp)(nil), "friend.GetFriendInfoResp") proto.RegisterType((*AddFriendReq)(nil), "friend.AddFriendReq") proto.RegisterType((*AddFriendResp)(nil), "friend.AddFriendResp") proto.RegisterType((*ImportFriendReq)(nil), "friend.ImportFriendReq") - proto.RegisterType((*UserIDResult)(nil), "friend.UserIDResult") proto.RegisterType((*ImportFriendResp)(nil), "friend.ImportFriendResp") proto.RegisterType((*GetFriendApplyListReq)(nil), "friend.GetFriendApplyListReq") proto.RegisterType((*GetFriendApplyListResp)(nil), "friend.GetFriendApplyListResp") @@ -1361,7 +1227,6 @@ const _ = grpc.SupportPackageIsVersion4 // Client API for Friend service type FriendClient interface { - // rpc getFriendsInfo(GetFriendsInfoReq) returns(GetFriendInfoResp); AddFriend(ctx context.Context, in *AddFriendReq, opts ...grpc.CallOption) (*AddFriendResp, error) GetFriendApplyList(ctx context.Context, in *GetFriendApplyListReq, opts ...grpc.CallOption) (*GetFriendApplyListResp, error) GetSelfApplyList(ctx context.Context, in *GetSelfApplyListReq, opts ...grpc.CallOption) (*GetSelfApplyListResp, error) @@ -1505,7 +1370,6 @@ func (c *friendClient) ImportFriend(ctx context.Context, in *ImportFriendReq, op // Server API for Friend service type FriendServer interface { - // rpc getFriendsInfo(GetFriendsInfoReq) returns(GetFriendInfoResp); AddFriend(context.Context, *AddFriendReq) (*AddFriendResp, error) GetFriendApplyList(context.Context, *GetFriendApplyListReq) (*GetFriendApplyListResp, error) GetSelfApplyList(context.Context, *GetSelfApplyListReq) (*GetSelfApplyListResp, error) @@ -1820,66 +1684,57 @@ var _Friend_serviceDesc = grpc.ServiceDesc{ Metadata: "friend/friend.proto", } -func init() { proto.RegisterFile("friend/friend.proto", fileDescriptor_friend_30fdefc06aa43365) } +func init() { proto.RegisterFile("friend/friend.proto", fileDescriptor_friend_268d4d8b889bd130) } -var fileDescriptor_friend_30fdefc06aa43365 = []byte{ - // 914 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57, 0x5b, 0x4f, 0x3b, 0x45, - 0x14, 0xcf, 0x72, 0xa9, 0xed, 0xa1, 0xd0, 0x76, 0x5a, 0xb0, 0x2e, 0x17, 0xcb, 0x3e, 0x18, 0x62, - 0x02, 0x4d, 0x30, 0x24, 0x22, 0xa2, 0x16, 0x2b, 0x64, 0x8d, 0xa5, 0xb0, 0x45, 0x1f, 0x7c, 0x69, - 0x16, 0x76, 0xa8, 0x9b, 0xee, 0x65, 0xd8, 0x59, 0x20, 0xbe, 0x19, 0xbf, 0x82, 0x4f, 0xc6, 0x07, - 0x13, 0x13, 0xe3, 0xd7, 0x34, 0xbb, 0xb3, 0xdb, 0x9d, 0xbd, 0x94, 0xb8, 0x2c, 0x26, 0xff, 0xa7, - 0xed, 0xb9, 0xfc, 0x4e, 0xcf, 0x6d, 0xce, 0x99, 0x81, 0xe6, 0xbd, 0xa3, 0x63, 0x4b, 0xeb, 0xb2, - 0xcf, 0x01, 0x71, 0x6c, 0xd7, 0x46, 0x25, 0x46, 0x89, 0x7b, 0x43, 0x82, 0xad, 0x7d, 0x79, 0xb0, - 0x3f, 0xc2, 0xce, 0x13, 0x76, 0xba, 0x64, 0x3a, 0xe9, 0xfa, 0x1a, 0x5d, 0xaa, 0x4d, 0xc7, 0xcf, - 0xb4, 0xfb, 0x4c, 0x19, 0x42, 0xfa, 0x55, 0x80, 0xd2, 0xd7, 0xb6, 0x69, 0xca, 0x7d, 0x24, 0x42, - 0x79, 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x09, 0x1a, 0x01, 0x9a, 0xa4, 0x6e, 0x04, 0x68, 0x3b, 0x54, 0xce, 0xbc, 0x6f, - 0x88, 0x3b, 0x2f, 0x89, 0x29, 0x41, 0x03, 0xa8, 0x4f, 0x12, 0x09, 0x44, 0x9b, 0x1c, 0x26, 0x59, - 0x1a, 0x71, 0x6b, 0xbe, 0x90, 0x12, 0xd4, 0x87, 0xd5, 0x09, 0xbf, 0xcf, 0x51, 0x3b, 0xf5, 0xff, - 0xa1, 0xa1, 0x0f, 0xe6, 0x48, 0x28, 0x41, 0x3d, 0xa8, 0xaa, 0xdc, 0xfe, 0x44, 0xef, 0x73, 0x09, - 0xe1, 0xd7, 0x8d, 0xd8, 0xce, 0x16, 0x50, 0x82, 0xbe, 0x85, 0x9a, 0x13, 0xdf, 0x78, 0x48, 0x0c, - 0x95, 0xd3, 0x8b, 0x54, 0xdc, 0x9c, 0x2b, 0xa3, 0x04, 0x1d, 0x41, 0x59, 0x0f, 0x06, 0x3a, 0x6a, - 0x86, 0x8a, 0xdc, 0x66, 0x10, 0x5b, 0x69, 0x26, 0xcb, 0x85, 0xce, 0x0f, 0xd8, 0x28, 0x17, 0xc9, - 0x99, 0x1d, 0xe5, 0x22, 0x3d, 0x91, 0x7b, 0x50, 0x9d, 0x70, 0x8b, 0x32, 0xca, 0x45, 0x62, 0xf5, - 0x8a, 0xed, 0x6c, 0x01, 0x33, 0xa1, 0x71, 0xe3, 0x33, 0x32, 0x91, 0x98, 0xc7, 0x91, 0x89, 0xd4, - 0xb4, 0xbd, 0x82, 0x86, 0x9a, 0x9c, 0x55, 0x68, 0x2b, 0xb3, 0x4f, 0x83, 0x41, 0x2a, 0x6e, 0xbf, - 0x20, 0x65, 0x05, 0xa2, 0xf1, 0x79, 0x12, 0x15, 0x28, 0x3d, 0xbe, 0xa2, 0x02, 0x65, 0x0d, 0xa1, - 0x1e, 0x54, 0x75, 0xee, 0x09, 0x10, 0x05, 0x98, 0x78, 0xf6, 0x44, 0x01, 0x26, 0x5f, 0x0c, 0x67, - 0xbb, 0x3f, 0x7e, 0xe8, 0x3d, 0xa7, 0xc7, 0xf2, 0x80, 0x7b, 0x47, 0x33, 0xe5, 0x13, 0xf6, 0xb9, - 0x2d, 0xf9, 0xcc, 0x4f, 0xfe, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x64, 0x15, 0xbf, 0x17, 0x95, 0x0f, - 0x00, 0x00, +var fileDescriptor_friend_268d4d8b889bd130 = []byte{ + // 783 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4b, 0x4f, 0xdb, 0x40, + 0x10, 0x56, 0x4a, 0x4b, 0xc9, 0x10, 0x9a, 0x64, 0x92, 0x40, 0x6a, 0x1e, 0x85, 0x3d, 0x21, 0x24, + 0x12, 0x89, 0xaa, 0x52, 0xa5, 0xaa, 0x87, 0x50, 0x0a, 0x72, 0xd5, 0x00, 0x75, 0xda, 0x0b, 0x52, + 0x15, 0x99, 0x78, 0x13, 0xa2, 0x38, 0xf1, 0xe2, 0x31, 0xa0, 0xfe, 0x8f, 0xde, 0xfb, 0x57, 0x2b, + 0x3f, 0x62, 0xaf, 0x1f, 0x81, 0x03, 0x3e, 0x59, 0xf3, 0xfa, 0x66, 0x76, 0x66, 0xfd, 0xed, 0x40, + 0x6d, 0x68, 0x8f, 0xf9, 0xcc, 0x68, 0xfb, 0x9f, 0x96, 0xb0, 0x2d, 0xc7, 0xc2, 0x65, 0x5f, 0x52, + 0xf6, 0x2f, 0x04, 0x9f, 0x1d, 0xaa, 0xdd, 0xc3, 0x1e, 0xb7, 0xef, 0xb9, 0xdd, 0x16, 0x93, 0x51, + 0xdb, 0xf3, 0x68, 0x93, 0x31, 0xe9, 0x3f, 0x50, 0xfb, 0x81, 0xfc, 0x08, 0x76, 0x01, 0xd5, 0x33, + 0xee, 0x9c, 0x7a, 0x61, 0xa4, 0xce, 0x86, 0x96, 0xc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9, 0x50, 0x76, 0x0e, + 0x95, 0x30, 0x53, 0x1e, 0x95, 0xcb, 0x37, 0x32, 0x2c, 0x3a, 0xa7, 0x1b, 0xd9, 0x85, 0x72, 0xc7, + 0x30, 0x8e, 0x4d, 0x7d, 0x30, 0x31, 0x73, 0x28, 0x15, 0xa1, 0x12, 0x87, 0x23, 0xc1, 0x2e, 0x01, + 0x35, 0x3e, 0xb5, 0xee, 0x79, 0x6e, 0x59, 0x1a, 0x50, 0x4b, 0x21, 0x92, 0x70, 0xcf, 0x72, 0xc6, + 0x9d, 0xdc, 0xb2, 0x0c, 0xbc, 0x31, 0xc6, 0x52, 0xe0, 0x05, 0x54, 0x3d, 0x85, 0xe7, 0x12, 0x6f, + 0xfc, 0x5e, 0x46, 0xe3, 0x2f, 0xef, 0xae, 0xcd, 0xf1, 0x60, 0xee, 0xac, 0xa5, 0x63, 0x99, 0x0a, + 0xab, 0x2a, 0xe5, 0x42, 0x08, 0xec, 0x00, 0x4a, 0x11, 0x14, 0x09, 0x17, 0xcb, 0xfd, 0x5a, 0x33, + 0xe2, 0x1e, 0xd6, 0x8a, 0x16, 0xca, 0xee, 0x15, 0x55, 0x49, 0x9d, 0x79, 0xf5, 0xe4, 0x71, 0x45, + 0xdb, 0x50, 0x4d, 0xe0, 0x3d, 0x51, 0x40, 0x17, 0xca, 0x27, 0xdc, 0xe4, 0x0e, 0xcf, 0xe7, 0xec, + 0x08, 0x95, 0x38, 0x1c, 0x09, 0xf6, 0xb7, 0x00, 0xf5, 0x18, 0x13, 0xba, 0x89, 0x9f, 0xcb, 0xba, + 0x0c, 0x4a, 0x37, 0xfa, 0xcc, 0x30, 0xb9, 0xc6, 0xe9, 0xce, 0x74, 0x3c, 0xee, 0x7d, 0xa5, 0xc5, + 0x74, 0xb8, 0x05, 0x45, 0x5f, 0x76, 0xc9, 0xf9, 0xa5, 0x07, 0x11, 0x29, 0xd8, 0x06, 0x34, 0x32, + 0xaa, 0x22, 0xc1, 0x6e, 0x00, 0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xf1, 0x96, 0x28, 0xcd, + 0x6c, 0x83, 0x0f, 0x61, 0x48, 0xec, 0x13, 0x41, 0x24, 0x28, 0x2e, 0x82, 0x48, 0x92, 0x15, 0x5e, + 0x42, 0x55, 0x4f, 0xb2, 0x02, 0x6e, 0x65, 0xde, 0xd3, 0x80, 0xc6, 0x94, 0xed, 0x47, 0xac, 0xfe, + 0x80, 0x28, 0xfe, 0x93, 0x47, 0x03, 0x4a, 0xf3, 0x4c, 0x34, 0xa0, 0x0c, 0x66, 0x70, 0x0f, 0x38, + 0x96, 0x96, 0xb4, 0xe8, 0x80, 0x89, 0xcd, 0x30, 0x3a, 0x60, 0x72, 0xa7, 0x3b, 0xde, 0xbb, 0x7a, + 0xe7, 0xee, 0xf4, 0x7d, 0xb5, 0x2b, 0x2d, 0xf3, 0xbe, 0xf3, 0x27, 0xff, 0x73, 0xbd, 0xec, 0x29, + 0xdf, 0xff, 0x0f, 0x00, 0x00, 0xff, 0xff, 0x6e, 0x13, 0x7c, 0xdf, 0x1a, 0x0c, 0x00, 0x00, } From 3e344c16a2d26d6b09f321306c2b6e11da39c8ba Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Mon, 16 Jan 2023 16:05:37 +0800 Subject: [PATCH 06/13] 1 --- internal/rpc/friend/friend.go | 102 +++++++++++++++++----------------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/internal/rpc/friend/friend.go b/internal/rpc/friend/friend.go index c392f7fec..92d454745 100644 --- a/internal/rpc/friend/friend.go +++ b/internal/rpc/friend/friend.go @@ -111,10 +111,10 @@ func (s *friendServer) Run() { func (s *friendServer) AddBlacklist(ctx context.Context, req *pbFriend.AddBlacklistReq) (*pbFriend.AddBlacklistResp, error) { resp := &pbFriend.AddBlacklistResp{} - if err := token_verify.CheckAccessV3(ctx, req.CommID.FromUserID); err != nil { + if err := token_verify.CheckAccessV3(ctx, req.FromUserID); err != nil { return nil, err } - black := imdb.Black{OwnerUserID: req.CommID.FromUserID, BlockUserID: req.CommID.ToUserID, OperatorUserID: req.CommID.OpUserID} + black := imdb.Black{OwnerUserID: req.FromUserID, BlockUserID: req.ToUserID, OperatorUserID: tools.OpUserID(ctx)} if err := s.blackModel.Create(ctx, []*imdb.Black{&black}); err != nil { return nil, err } @@ -122,7 +122,7 @@ func (s *friendServer) AddBlacklist(ctx context.Context, req *pbFriend.AddBlackl if err != nil { return nil, err } - _, err = pbCache.NewCacheClient(etcdConn).DelBlackIDListFromCache(ctx, &pbCache.DelBlackIDListFromCacheReq{UserID: req.CommID.FromUserID}) + _, err = pbCache.NewCacheClient(etcdConn).DelBlackIDListFromCache(ctx, &pbCache.DelBlackIDListFromCacheReq{UserID: req.FromUserID}) if err != nil { return nil, err } @@ -132,25 +132,25 @@ func (s *friendServer) AddBlacklist(ctx context.Context, req *pbFriend.AddBlackl func (s *friendServer) AddFriend(ctx context.Context, req *pbFriend.AddFriendReq) (*pbFriend.AddFriendResp, error) { resp := &pbFriend.AddFriendResp{} - if err := token_verify.CheckAccessV3(ctx, req.CommID.FromUserID); err != nil { + if err := token_verify.CheckAccessV3(ctx, req.FromUserID); err != nil { return nil, err } if err := callbackBeforeAddFriendV1(req); err != nil { return nil, err } - userIDList, err := rocksCache.GetFriendIDListFromCache(ctx, req.CommID.ToUserID) + userIDList, err := rocksCache.GetFriendIDListFromCache(ctx, req.ToUserID) if err != nil { return nil, err } - userIDList2, err := rocksCache.GetFriendIDListFromCache(ctx, req.CommID.FromUserID) + userIDList2, err := rocksCache.GetFriendIDListFromCache(ctx, req.FromUserID) if err != nil { return nil, err } var isSend = true for _, v := range userIDList { - if v == req.CommID.FromUserID { + if v == req.FromUserID { for _, v2 := range userIDList2 { - if v2 == req.CommID.ToUserID { + if v2 == req.ToUserID { isSend = false break } @@ -162,12 +162,12 @@ func (s *friendServer) AddFriend(ctx context.Context, req *pbFriend.AddFriendReq //Cannot add non-existent users if isSend { - if _, err := GetUserInfo(ctx, req.CommID.ToUserID); err != nil { + if _, err := GetUserInfo(ctx, req.ToUserID); err != nil { return nil, err } friendRequest := imdb.FriendRequest{ - FromUserID: req.CommID.FromUserID, - ToUserID: req.CommID.ToUserID, + FromUserID: req.FromUserID, + ToUserID: req.ToUserID, HandleResult: 0, ReqMsg: req.ReqMsg, CreateTime: time.Now(), @@ -238,17 +238,17 @@ func (s *friendServer) ImportFriend(ctx context.Context, req *pbFriend.ImportFri // process Friend application func (s *friendServer) AddFriendResponse(ctx context.Context, req *pbFriend.AddFriendResponseReq) (*pbFriend.AddFriendResponseResp, error) { resp := &pbFriend.AddFriendResponseResp{} - if err := token_verify.CheckAccessV3(ctx, req.CommID.FromUserID); err != nil { + if err := token_verify.CheckAccessV3(ctx, req.FromUserID); err != nil { return nil, err } - friendRequest, err := s.friendRequestModel.Take(ctx, req.CommID.ToUserID, req.CommID.FromUserID) + friendRequest, err := s.friendRequestModel.Take(ctx, req.ToUserID, req.FromUserID) if err != nil { return nil, err } friendRequest.HandleResult = req.HandleResult friendRequest.HandleTime = time.Now() friendRequest.HandleMsg = req.HandleMsg - friendRequest.HandlerUserID = req.CommID.OpUserID + friendRequest.HandlerUserID = tools.OpUserID(ctx) err = imdb.UpdateFriendApplication(friendRequest) if err != nil { return nil, err @@ -258,9 +258,9 @@ func (s *friendServer) AddFriendResponse(ctx context.Context, req *pbFriend.AddF if req.HandleResult == constant.FriendFlag { var isInsert bool //Establish friendship after find friend relationship not exists - _, err := s.friendModel.Take(ctx, req.CommID.FromUserID, req.CommID.ToUserID) + _, err := s.friendModel.Take(ctx, req.FromUserID, req.ToUserID) if errors.Is(err, gorm.ErrRecordNotFound) { - if err := s.friendModel.Create(ctx, []*imdb.Friend{{OwnerUserID: req.CommID.FromUserID, FriendUserID: req.CommID.ToUserID, OperatorUserID: req.CommID.OpUserID}}); err != nil { + if err := s.friendModel.Create(ctx, []*imdb.Friend{{OwnerUserID: req.FromUserID, FriendUserID: req.ToUserID, OperatorUserID: tools.OpUserID(ctx)}}); err != nil { return nil, err } isInsert = true @@ -276,19 +276,19 @@ func (s *friendServer) AddFriendResponse(ctx context.Context, req *pbFriend.AddF } client := pbCache.NewCacheClient(etcdConn) - if _, err := client.DelFriendIDListFromCache(context.Background(), &pbCache.DelFriendIDListFromCacheReq{UserID: req.CommID.ToUserID}); err != nil { + if _, err := client.DelFriendIDListFromCache(context.Background(), &pbCache.DelFriendIDListFromCacheReq{UserID: req.ToUserID}); err != nil { return nil, err } - if _, err := client.DelFriendIDListFromCache(context.Background(), &pbCache.DelFriendIDListFromCacheReq{UserID: req.CommID.FromUserID}); err != nil { + if _, err := client.DelFriendIDListFromCache(context.Background(), &pbCache.DelFriendIDListFromCacheReq{UserID: req.FromUserID}); err != nil { return nil, err } - if err := rocksCache.DelAllFriendsInfoFromCache(ctx, req.CommID.ToUserID); err != nil { - trace_log.SetCtxInfo(ctx, "DelAllFriendsInfoFromCache", err, "userID", req.CommID.ToUserID) + if err := rocksCache.DelAllFriendsInfoFromCache(ctx, req.ToUserID); err != nil { + trace_log.SetCtxInfo(ctx, "DelAllFriendsInfoFromCache", err, "userID", req.ToUserID) } - if err := rocksCache.DelAllFriendsInfoFromCache(ctx, req.CommID.FromUserID); err != nil { - trace_log.SetCtxInfo(ctx, "DelAllFriendsInfoFromCache", err, "userID", req.CommID.FromUserID) + if err := rocksCache.DelAllFriendsInfoFromCache(ctx, req.FromUserID); err != nil { + trace_log.SetCtxInfo(ctx, "DelAllFriendsInfoFromCache", err, "userID", req.FromUserID) } - chat.FriendAddedNotification(tools.OperationID(ctx), tools.OpUserID(ctx), req.CommID.FromUserID, req.CommID.ToUserID) + chat.FriendAddedNotification(tools.OperationID(ctx), tools.OpUserID(ctx), req.FromUserID, req.ToUserID) } } @@ -304,25 +304,25 @@ func (s *friendServer) AddFriendResponse(ctx context.Context, req *pbFriend.AddF func (s *friendServer) DeleteFriend(ctx context.Context, req *pbFriend.DeleteFriendReq) (*pbFriend.DeleteFriendResp, error) { resp := &pbFriend.DeleteFriendResp{} - if err := token_verify.CheckAccessV3(ctx, req.CommID.FromUserID); err != nil { + if err := token_verify.CheckAccessV3(ctx, req.FromUserID); err != nil { return nil, err } - if err := s.friendModel.Delete(ctx, req.CommID.FromUserID, req.CommID.ToUserID); err != nil { + if err := s.friendModel.Delete(ctx, req.FromUserID, req.ToUserID); err != nil { return nil, err } etcdConn, err := getcdv3.GetConn(ctx, config.Config.RpcRegisterName.OpenImCacheName) if err != nil { return nil, err } - _, err = pbCache.NewCacheClient(etcdConn).DelFriendIDListFromCache(context.Background(), &pbCache.DelFriendIDListFromCacheReq{UserID: req.CommID.FromUserID}) + _, err = pbCache.NewCacheClient(etcdConn).DelFriendIDListFromCache(context.Background(), &pbCache.DelFriendIDListFromCacheReq{UserID: req.FromUserID}) if err != nil { return nil, err } - if err := rocksCache.DelAllFriendsInfoFromCache(ctx, req.CommID.FromUserID); err != nil { - trace_log.SetCtxInfo(ctx, "DelAllFriendsInfoFromCache", err, "DelAllFriendsInfoFromCache", req.CommID.FromUserID) + if err := rocksCache.DelAllFriendsInfoFromCache(ctx, req.FromUserID); err != nil { + trace_log.SetCtxInfo(ctx, "DelAllFriendsInfoFromCache", err, "DelAllFriendsInfoFromCache", req.FromUserID) } - if err := rocksCache.DelAllFriendsInfoFromCache(ctx, req.CommID.ToUserID); err != nil { - trace_log.SetCtxInfo(ctx, "DelAllFriendsInfoFromCache", err, "DelAllFriendsInfoFromCache", req.CommID.ToUserID) + if err := rocksCache.DelAllFriendsInfoFromCache(ctx, req.ToUserID); err != nil { + trace_log.SetCtxInfo(ctx, "DelAllFriendsInfoFromCache", err, "DelAllFriendsInfoFromCache", req.ToUserID) } chat.FriendDeletedNotification(req) return resp, nil @@ -330,10 +330,10 @@ func (s *friendServer) DeleteFriend(ctx context.Context, req *pbFriend.DeleteFri func (s *friendServer) GetBlacklist(ctx context.Context, req *pbFriend.GetBlacklistReq) (*pbFriend.GetBlacklistResp, error) { resp := &pbFriend.GetBlacklistResp{} - if err := token_verify.CheckAccessV3(ctx, req.CommID.FromUserID); err != nil { + if err := token_verify.CheckAccessV3(ctx, req.FromUserID); err != nil { return nil, err } - blackIDList, err := rocksCache.GetBlackListFromCache(ctx, req.CommID.FromUserID) + blackIDList, err := rocksCache.GetBlackListFromCache(ctx, req.FromUserID) if err != nil { return nil, err } @@ -352,33 +352,33 @@ func (s *friendServer) GetBlacklist(ctx context.Context, req *pbFriend.GetBlackl func (s *friendServer) SetFriendRemark(ctx context.Context, req *pbFriend.SetFriendRemarkReq) (*pbFriend.SetFriendRemarkResp, error) { resp := &pbFriend.SetFriendRemarkResp{} - if err := token_verify.CheckAccessV3(ctx, req.CommID.FromUserID); err != nil { + if err := token_verify.CheckAccessV3(ctx, req.FromUserID); err != nil { return nil, err } - if err := s.friendModel.UpdateRemark(ctx, req.CommID.FromUserID, req.CommID.ToUserID, req.Remark); err != nil { + if err := s.friendModel.UpdateRemark(ctx, req.FromUserID, req.ToUserID, req.Remark); err != nil { return nil, err } - if err := rocksCache.DelAllFriendsInfoFromCache(ctx, req.CommID.FromUserID); err != nil { + if err := rocksCache.DelAllFriendsInfoFromCache(ctx, req.FromUserID); err != nil { return nil, err } - chat.FriendRemarkSetNotification(tools.OperationID(ctx), tools.OpUserID(ctx), req.CommID.FromUserID, req.CommID.ToUserID) + chat.FriendRemarkSetNotification(tools.OperationID(ctx), tools.OpUserID(ctx), req.FromUserID, req.ToUserID) return resp, nil } func (s *friendServer) RemoveBlacklist(ctx context.Context, req *pbFriend.RemoveBlacklistReq) (*pbFriend.RemoveBlacklistResp, error) { resp := &pbFriend.RemoveBlacklistResp{} //Parse token, to find current user information - if err := token_verify.CheckAccessV3(ctx, req.CommID.FromUserID); err != nil { + if err := token_verify.CheckAccessV3(ctx, req.FromUserID); err != nil { return nil, err } - if err := s.blackModel.Delete(ctx, []*imdb.Black{{OwnerUserID: req.CommID.FromUserID, BlockUserID: req.CommID.ToUserID}}); err != nil { + if err := s.blackModel.Delete(ctx, []*imdb.Black{{OwnerUserID: req.FromUserID, BlockUserID: req.ToUserID}}); err != nil { return nil, err } etcdConn, err := getcdv3.GetConn(ctx, config.Config.RpcRegisterName.OpenImCacheName) if err != nil { return nil, err } - _, err = pbCache.NewCacheClient(etcdConn).DelBlackIDListFromCache(context.Background(), &pbCache.DelBlackIDListFromCacheReq{UserID: req.CommID.FromUserID}) + _, err = pbCache.NewCacheClient(etcdConn).DelBlackIDListFromCache(context.Background(), &pbCache.DelBlackIDListFromCacheReq{UserID: req.FromUserID}) if err != nil { return nil, err } @@ -388,36 +388,36 @@ func (s *friendServer) RemoveBlacklist(ctx context.Context, req *pbFriend.Remove func (s *friendServer) IsInBlackList(ctx context.Context, req *pbFriend.IsInBlackListReq) (*pbFriend.IsInBlackListResp, error) { resp := &pbFriend.IsInBlackListResp{} - if err := token_verify.CheckAccessV3(ctx, req.CommID.FromUserID); err != nil { + if err := token_verify.CheckAccessV3(ctx, req.FromUserID); err != nil { return nil, err } - blackIDList, err := rocksCache.GetBlackListFromCache(ctx, req.CommID.FromUserID) + blackIDList, err := rocksCache.GetBlackListFromCache(ctx, req.FromUserID) if err != nil { return nil, err } - resp.Response = utils.IsContain(req.CommID.ToUserID, blackIDList) + resp.Response = utils.IsContain(req.ToUserID, blackIDList) return resp, nil } func (s *friendServer) IsFriend(ctx context.Context, req *pbFriend.IsFriendReq) (*pbFriend.IsFriendResp, error) { resp := &pbFriend.IsFriendResp{} - if err := token_verify.CheckAccessV3(ctx, req.CommID.FromUserID); err != nil { + if err := token_verify.CheckAccessV3(ctx, req.FromUserID); err != nil { return nil, err } - friendIDList, err := rocksCache.GetFriendIDListFromCache(ctx, req.CommID.FromUserID) + friendIDList, err := rocksCache.GetFriendIDListFromCache(ctx, req.FromUserID) if err != nil { return nil, err } - resp.Response = utils.IsContain(req.CommID.ToUserID, friendIDList) + resp.Response = utils.IsContain(req.ToUserID, friendIDList) return resp, nil } func (s *friendServer) GetFriendList(ctx context.Context, req *pbFriend.GetFriendListReq) (*pbFriend.GetFriendListResp, error) { resp := &pbFriend.GetFriendListResp{} - if err := token_verify.CheckAccessV3(ctx, req.CommID.FromUserID); err != nil { + if err := token_verify.CheckAccessV3(ctx, req.FromUserID); err != nil { return nil, err } - friendList, err := rocksCache.GetAllFriendsInfoFromCache(ctx, req.CommID.FromUserID) + friendList, err := rocksCache.GetAllFriendsInfoFromCache(ctx, req.FromUserID) if err != nil { return nil, err } @@ -434,11 +434,11 @@ func (s *friendServer) GetFriendList(ctx context.Context, req *pbFriend.GetFrien func (s *friendServer) GetFriendApplyList(ctx context.Context, req *pbFriend.GetFriendApplyListReq) (*pbFriend.GetFriendApplyListResp, error) { resp := &pbFriend.GetFriendApplyListResp{} //Parse token, to find current user information - if err := token_verify.CheckAccessV3(ctx, req.CommID.FromUserID); err != nil { + if err := token_verify.CheckAccessV3(ctx, req.FromUserID); err != nil { return nil, err } // Find the current user friend applications received - applyUsersInfo, err := s.friendRequestModel.FindToUserID(ctx, req.CommID.FromUserID) + applyUsersInfo, err := s.friendRequestModel.FindToUserID(ctx, req.FromUserID) if err != nil { return nil, err } @@ -453,11 +453,11 @@ func (s *friendServer) GetFriendApplyList(ctx context.Context, req *pbFriend.Get func (s *friendServer) GetSelfApplyList(ctx context.Context, req *pbFriend.GetSelfApplyListReq) (*pbFriend.GetSelfApplyListResp, error) { resp := &pbFriend.GetSelfApplyListResp{} //Parse token, to find current user information - if err := token_verify.CheckAccessV3(ctx, req.CommID.FromUserID); err != nil { + if err := token_verify.CheckAccessV3(ctx, req.FromUserID); err != nil { return nil, err } // Find the self add other userinfo - usersInfo, err := s.friendRequestModel.FindFromUserID(ctx, req.CommID.FromUserID) + usersInfo, err := s.friendRequestModel.FindFromUserID(ctx, req.FromUserID) if err != nil { return nil, err } From 3f739459db20e64f6812d1d0f578d00427ec14d5 Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Mon, 16 Jan 2023 16:07:42 +0800 Subject: [PATCH 07/13] 1 --- internal/rpc/friend/friend.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/rpc/friend/friend.go b/internal/rpc/friend/friend.go index 92d454745..183bdd0ca 100644 --- a/internal/rpc/friend/friend.go +++ b/internal/rpc/friend/friend.go @@ -4,6 +4,7 @@ import ( chat "Open_IM/internal/rpc/msg" "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" + "Open_IM/pkg/common/db" imdb "Open_IM/pkg/common/db/mysql_model/im_mysql_model" rocksCache "Open_IM/pkg/common/db/rocks_cache" "Open_IM/pkg/common/log" @@ -43,14 +44,15 @@ type friendServer struct { func NewFriendServer(port int) *friendServer { log.NewPrivateLog(constant.LogFileName) + DB := db.DB.MysqlDB.DefaultGormDB() return &friendServer{ rpcPort: port, rpcRegisterName: config.Config.RpcRegisterName.OpenImFriendName, etcdSchema: config.Config.Etcd.EtcdSchema, etcdAddr: config.Config.Etcd.EtcdAddr, - friendModel: imdb.NewFriend(nil), // TODO - friendRequestModel: imdb.NewFriendRequest(nil), - blackModel: imdb.NewBlack(nil), + friendModel: imdb.NewFriend(DB), + friendRequestModel: imdb.NewFriendRequest(DB), + blackModel: imdb.NewBlack(DB), } } From b14863aea6f177e4088d9d68eaf6ad9b171a828f Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Mon, 16 Jan 2023 16:21:39 +0800 Subject: [PATCH 08/13] 1 --- internal/api_to_rpc/api.go | 3 +-- pkg/common/trace_log/ctx.go | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/internal/api_to_rpc/api.go b/internal/api_to_rpc/api.go index 19c965b86..5cc1a9ac4 100644 --- a/internal/api_to_rpc/api.go +++ b/internal/api_to_rpc/api.go @@ -13,8 +13,7 @@ import ( func ApiToRpc(c *gin.Context, apiReq, apiResp interface{}, rpcName string, rpcClientFunc interface{}, rpcFuncName string) { logFuncName := fmt.Sprintf("[ApiToRpc: %s]%s", utils2.GetFuncName(1), rpcFuncName) - operationID := c.GetHeader("operationID") - nCtx := trace_log.NewCtx1(c, rpcFuncName, operationID) + nCtx := trace_log.NewCtx1(c, rpcFuncName) defer log.ShowLog(nCtx) if err := c.BindJSON(apiReq); err != nil { trace_log.WriteErrorResponse(nCtx, "BindJSON", err) diff --git a/pkg/common/trace_log/ctx.go b/pkg/common/trace_log/ctx.go index 1e431e5b8..faf7d7740 100644 --- a/pkg/common/trace_log/ctx.go +++ b/pkg/common/trace_log/ctx.go @@ -22,8 +22,8 @@ func NewCtx(c *gin.Context, api string) context.Context { return context.WithValue(c, TraceLogKey, req) } -func NewCtx1(c *gin.Context, api, operationID string) context.Context { - req := &ApiInfo{ApiName: api, GinCtx: c, OperationID: operationID, Funcs: &[]FuncInfo{}} +func NewCtx1(c *gin.Context, api string) context.Context { + req := &ApiInfo{ApiName: api, GinCtx: c, OperationID: c.GetHeader("operationID"), Funcs: &[]FuncInfo{}} return context.WithValue(c, TraceLogKey, req) } From 7061bf76676840a11bc7e08ea9fbd5bd5865f4bc Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Mon, 16 Jan 2023 16:37:55 +0800 Subject: [PATCH 09/13] 1 --- internal/api_to_rpc/api.go | 49 +++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/internal/api_to_rpc/api.go b/internal/api_to_rpc/api.go index 5cc1a9ac4..572ff444e 100644 --- a/internal/api_to_rpc/api.go +++ b/internal/api_to_rpc/api.go @@ -1,58 +1,59 @@ package common import ( + api "Open_IM/pkg/base_info" + "Open_IM/pkg/common/config" "Open_IM/pkg/common/log" "Open_IM/pkg/common/trace_log" "Open_IM/pkg/getcdv3" + rpc "Open_IM/pkg/proto/friend" utils2 "Open_IM/pkg/utils" "context" "fmt" + utils "github.com/OpenIMSDK/open_utils" "github.com/gin-gonic/gin" "reflect" ) +func a(c *gin.Context) { + ApiToRpc(c, &api.AddBlacklistReq{}, &api.AddBlacklistResp{}, config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, utils.GetSelfFuncName()) +} + func ApiToRpc(c *gin.Context, apiReq, apiResp interface{}, rpcName string, rpcClientFunc interface{}, rpcFuncName string) { logFuncName := fmt.Sprintf("[ApiToRpc: %s]%s", utils2.GetFuncName(1), rpcFuncName) - nCtx := trace_log.NewCtx1(c, rpcFuncName) - defer log.ShowLog(nCtx) + ctx := trace_log.NewCtx1(c, rpcFuncName) + defer log.ShowLog(ctx) if err := c.BindJSON(apiReq); err != nil { - trace_log.WriteErrorResponse(nCtx, "BindJSON", err) + trace_log.WriteErrorResponse(ctx, "BindJSON", err) return } - trace_log.SetCtxInfo(nCtx, logFuncName, nil, "apiReq", apiReq) - etcdConn, err := getcdv3.GetConn(nCtx, rpcName) + trace_log.SetCtxInfo(ctx, logFuncName, nil, "apiReq", apiReq) + etcdConn, err := getcdv3.GetConn(ctx, rpcName) if err != nil { - trace_log.WriteErrorResponse(nCtx, "GetConn", err) + trace_log.WriteErrorResponse(ctx, "GetConn", err) return } - rpc := reflect.ValueOf(rpcClientFunc).Call([]reflect.Value{ + rpcClient := reflect.ValueOf(rpcClientFunc).Call([]reflect.Value{ reflect.ValueOf(etcdConn), - })[0].MethodByName(rpcFuncName) // rpc func - rpcReqPtr := reflect.New(rpc.Type().In(1).Elem()) // *req参数 - //if err := utils.CopyStructFields(rpcReqPtr.Interface(), apiReq); err != nil { - // trace_log.WriteErrorResponse(nCtx, "CopyStructFields_RpcReq", err) - // return - //} + })[0].MethodByName(rpcFuncName) // rpcClient func + rpcReqPtr := reflect.New(rpcClient.Type().In(1).Elem()) // *req CopyAny(apiReq, rpcReqPtr.Interface()) - trace_log.SetCtxInfo(nCtx, logFuncName, nil, "opUserID", c.GetString("opUserID"), "callRpcReq", rpcString(rpcReqPtr.Elem().Interface())) - respArr := rpc.Call([]reflect.Value{ - reflect.ValueOf(context.Context(c)), // context.Context - rpcReqPtr, // rpc apiReq + trace_log.SetCtxInfo(ctx, logFuncName, nil, "opUserID", c.GetString("opUserID"), "callRpcReq", rpcString(rpcReqPtr.Elem().Interface())) + respArr := rpcClient.Call([]reflect.Value{ + reflect.ValueOf(context.Context(c)), // context.Context (ctx operationID. opUserID) + rpcReqPtr, // rpcClient apiReq }) // respArr => (apiResp, error) - if !respArr[1].IsNil() { // rpc err != nil + if !respArr[1].IsNil() { // rpcClient err != nil err := respArr[1].Interface().(error) - trace_log.WriteErrorResponse(nCtx, rpcFuncName, err, "callRpcResp", "error") + trace_log.WriteErrorResponse(ctx, rpcFuncName, err, "callRpcResp", "error") return } rpcResp := respArr[0].Elem() - trace_log.SetCtxInfo(nCtx, rpcFuncName, nil, "callRpcResp", rpcString(rpcResp.Interface())) + trace_log.SetCtxInfo(ctx, rpcFuncName, nil, "callRpcResp", rpcString(rpcResp.Interface())) if apiResp != nil { - //if err := utils.CopyStructFields(apiResp, rpcResp.Interface()); err != nil { - // trace_log.SetCtxInfo(nCtx, "CopyStructFields_RpcResp", err, "apiResp", fmt.Sprintf("%T", apiResp), "rpcResp", fmt.Sprintf("%T", rpcResp.Interface())) - //} CopyAny(rpcResp.Interface(), apiResp) } - trace_log.SetSuccess(nCtx, rpcFuncName, apiResp) + trace_log.SetSuccess(ctx, rpcFuncName, apiResp) } func rpcString(v interface{}) string { From 689611bcd566e15b14b71b42b1539f5af81aa9d2 Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Mon, 16 Jan 2023 16:38:21 +0800 Subject: [PATCH 10/13] 1 --- internal/api_to_rpc/api.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/internal/api_to_rpc/api.go b/internal/api_to_rpc/api.go index 572ff444e..f7d0fc506 100644 --- a/internal/api_to_rpc/api.go +++ b/internal/api_to_rpc/api.go @@ -1,23 +1,19 @@ package common import ( - api "Open_IM/pkg/base_info" - "Open_IM/pkg/common/config" "Open_IM/pkg/common/log" "Open_IM/pkg/common/trace_log" "Open_IM/pkg/getcdv3" - rpc "Open_IM/pkg/proto/friend" utils2 "Open_IM/pkg/utils" "context" "fmt" - utils "github.com/OpenIMSDK/open_utils" "github.com/gin-gonic/gin" "reflect" ) -func a(c *gin.Context) { - ApiToRpc(c, &api.AddBlacklistReq{}, &api.AddBlacklistResp{}, config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, utils.GetSelfFuncName()) -} +//func a(c *gin.Context) { +// ApiToRpc(c, &api.AddBlacklistReq{}, &api.AddBlacklistResp{}, config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, utils.GetSelfFuncName()) +//} func ApiToRpc(c *gin.Context, apiReq, apiResp interface{}, rpcName string, rpcClientFunc interface{}, rpcFuncName string) { logFuncName := fmt.Sprintf("[ApiToRpc: %s]%s", utils2.GetFuncName(1), rpcFuncName) From 07d3467b7acd5e400e51e4b3ed6f5a9a87632e5c Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Mon, 16 Jan 2023 18:48:40 +0800 Subject: [PATCH 11/13] 1 --- cmd/open_im_api/main.go | 22 +- internal/api/friend/friend.go | 1352 ++++++++++++++-------------- internal/api/friend/friend1.go | 54 +- internal/api_to_rpc/api.go | 81 +- pkg/base_info/friend_api_struct.go | 261 ++++-- pkg/proto/friend/friend.pb.go | 171 ++-- pkg/proto/friend/friend.proto | 3 +- 7 files changed, 1011 insertions(+), 933 deletions(-) diff --git a/cmd/open_im_api/main.go b/cmd/open_im_api/main.go index 2622bdfdf..717f87b33 100644 --- a/cmd/open_im_api/main.go +++ b/cmd/open_im_api/main.go @@ -3,14 +3,12 @@ package main import ( _ "Open_IM/cmd/open_im_api/docs" apiAuth "Open_IM/internal/api/auth" - clientInit "Open_IM/internal/api/client_init" "Open_IM/internal/api/conversation" "Open_IM/internal/api/friend" "Open_IM/internal/api/group" "Open_IM/internal/api/manage" apiChat "Open_IM/internal/api/msg" "Open_IM/internal/api/office" - "Open_IM/internal/api/organization" apiThird "Open_IM/internal/api/third" "Open_IM/internal/api/user" "Open_IM/pkg/common/config" @@ -81,17 +79,17 @@ func main() { friendRouterGroup := r.Group("/friend") { // friendRouterGroup.POST("/get_friends_info", friend.GetFriendsInfo) - friendRouterGroup.POST("/add_friend", friend.AddFriend) //1 - friendRouterGroup.POST("/delete_friend", friend.DeleteFriend) //1 - friendRouterGroup.POST("/get_friend_apply_list", friend.GetFriendApplyList) //1 - friendRouterGroup.POST("/get_self_friend_apply_list", friend.GetSelfFriendApplyList) //1 - friendRouterGroup.POST("/get_friend_list", friend.GetFriendList) //1 - friendRouterGroup.POST("/add_friend_response", friend.AddFriendResponse) //1 - friendRouterGroup.POST("/set_friend_remark", friend.SetFriendRemark) //1 + friendRouterGroup.POST("/add_friend", friend.AddFriend) //1 + friendRouterGroup.POST("/delete_friend", friend.DeleteFriend) //1 + friendRouterGroup.POST("/get_friend_apply_list", friend.GetFriendApplyList) //1 + friendRouterGroup.POST("/get_self_friend_apply_list", friend.GetSelfApplyList) //1 + friendRouterGroup.POST("/get_friend_list", friend.GetFriendList) //1 + friendRouterGroup.POST("/add_friend_response", friend.AddFriendResponse) //1 + friendRouterGroup.POST("/set_friend_remark", friend.SetFriendRemark) //1 - friendRouterGroup.POST("/add_black", friend.AddBlack) //1 - friendRouterGroup.POST("/get_black_list", friend.GetBlacklist) //1 - friendRouterGroup.POST("/remove_black", friend.RemoveBlack) //1 + friendRouterGroup.POST("/add_black", friend.AddBlack) //1 + friendRouterGroup.POST("/get_black_list", friend.GetBlacklist) //1 + friendRouterGroup.POST("/remove_black", friend.RemoveBlacklist) //1 friendRouterGroup.POST("/import_friend", friend.ImportFriend) //1 friendRouterGroup.POST("/is_friend", friend.IsFriend) //1 diff --git a/internal/api/friend/friend.go b/internal/api/friend/friend.go index 4282fe56b..7c4ca05d6 100644 --- a/internal/api/friend/friend.go +++ b/internal/api/friend/friend.go @@ -1,678 +1,678 @@ package friend -import ( - jsonData "Open_IM/internal/utils" - api "Open_IM/pkg/base_info" - "Open_IM/pkg/common/config" - "Open_IM/pkg/common/log" - "Open_IM/pkg/common/token_verify" - "Open_IM/pkg/getcdv3" - rpc "Open_IM/pkg/proto/friend" - open_im_sdk "Open_IM/pkg/proto/sdk_ws" - "Open_IM/pkg/utils" - "context" - "github.com/gin-gonic/gin" - "net/http" - "strings" -) - -// @Summary 添加黑名单 -// @Description 添加黑名单 -// @Tags 好友相关 -// @ID AddBlack -// @Accept json -// @Param token header string true "im token" -// @Param req body api.AddBlacklistReq true "fromUserID为设置的用户
toUserID为被设置的用户" -// @Produce json -// @Success 0 {object} api.AddBlacklistResp -// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" -// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" -// @Router /friend/add_black [post] -func AddBlack(c *gin.Context) { - params := api.AddBlacklistReq{} - if err := c.BindJSON(¶ms); err != nil { - log.NewError("0", "BindJSON failed ", err.Error()) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &rpc.AddBlacklistReq{CommID: &rpc.CommID{}} - utils.CopyStructFields(req.CommID, ¶ms) - var ok bool - var errInfo string - ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) - if !ok { - errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - log.NewInfo(params.OperationID, "AddBlacklist args ", req.String()) - - etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) - client := rpc.NewFriendClient(etcdConn) - RpcResp, err := client.AddBlacklist(context.Background(), req) - if err != nil { - log.NewError(req.CommID.OperationID, "AddBlacklist failed ", err.Error()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call add blacklist rpc server failed"}) - return - } - resp := api.AddBlacklistResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} - log.NewInfo(req.CommID.OperationID, "AddBlacklist api return ", resp) - c.JSON(http.StatusOK, resp) -} - -// @Summary 批量加好友 -// @Description 批量加好友 -// @Tags 好友相关 -// @ID ImportFriend -// @Accept json -// @Param token header string true "im token" -// @Param req body api.ImportFriendReq true "fromUserID批量加好友的用户ID
friendUserIDList为" -// @Produce json -// @Success 0 {object} api.ImportFriendResp "data列表中对象的result-1为添加该用户失败
0为成功" -// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" -// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" -// @Router /friend/import_friend [post] -func ImportFriend(c *gin.Context) { - params := api.ImportFriendReq{} - if err := c.BindJSON(¶ms); err != nil { - log.NewError("0", "BindJSON failed ", err.Error()) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &rpc.ImportFriendReq{} - utils.CopyStructFields(req, ¶ms) - var ok bool - var errInfo string - ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID) - if !ok { - errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") - log.NewError(req.OperationID, errMsg) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - - log.NewInfo(req.OperationID, "ImportFriend args ", req.String()) - etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.OperationID) - if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" - log.NewError(req.OperationID, errMsg) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - - client := rpc.NewFriendClient(etcdConn) - RpcResp, err := client.ImportFriend(context.Background(), req) - if err != nil { - log.NewError(req.OperationID, "ImportFriend failed ", err.Error(), req.String()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "ImportFriend failed "}) - return - } - resp := api.ImportFriendResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} - if resp.ErrCode == 0 { - for _, v := range RpcResp.UserIDResultList { - resp.UserIDResultList = append(resp.UserIDResultList, api.UserIDResult{UserID: v.UserID, Result: v.Result}) - } - } - if len(resp.UserIDResultList) == 0 { - resp.UserIDResultList = []api.UserIDResult{} - } - log.NewInfo(req.OperationID, "ImportFriend api return ", resp) - c.JSON(http.StatusOK, resp) -} - -// @Summary 添加好友 -// @Description 添加好友 -// @Tags 好友相关 -// @ID AddFriend -// @Accept json -// @Param token header string true "im token" -// @Param req body api.AddFriendReq true "reqMsg为申请信息
fromUserID为申请用户
toUserID为被添加用户" -// @Produce json -// @Success 0 {object} api.AddFriendResp -// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" -// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" -// @Router /friend/add_friend [post] -func AddFriend(c *gin.Context) { - params := api.AddFriendReq{} - if err := c.BindJSON(¶ms); err != nil { - log.NewError("0", "BindJSON failed ", err.Error()) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &rpc.AddFriendReq{CommID: &rpc.CommID{}} - utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend) - req.ReqMsg = params.ReqMsg - - var ok bool - var errInfo string - ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) - if !ok { - errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": errMsg}) - return - } - - log.NewInfo(req.CommID.OperationID, "AddFriend args ", req.String()) - - etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) - if etcdConn == nil { - errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - client := rpc.NewFriendClient(etcdConn) - RpcResp, err := client.AddFriend(context.Background(), req) - if err != nil { - log.NewError(req.CommID.OperationID, "AddFriend failed ", err.Error(), req.String()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call AddFriend rpc server failed"}) - return - } - - resp := api.AddFriendResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} - log.NewInfo(req.CommID.OperationID, "AddFriend api return ", resp) - c.JSON(http.StatusOK, resp) -} - -// @Summary 同意/拒绝好友请求 -// @Description 同意/拒绝好友请求 -// @Tags 好友相关 -// @ID AddFriendResponse -// @Accept json -// @Param token header string true "im token" -// @Param req body api.AddFriendResponseReq true "fromUserID同意/拒绝的用户ID
toUserID为申请用户D
handleMsg为处理信息
flag为具体操作, 1为同意, 2为拒绝" -// @Produce json -// @Success 0 {object} api.AddFriendResponseResp -// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" -// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" -// @Router /friend/add_friend_response [post] -func AddFriendResponse(c *gin.Context) { - params := api.AddFriendResponseReq{} - if err := c.BindJSON(¶ms); err != nil { - log.NewError("0", "BindJSON failed ", err.Error()) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &rpc.AddFriendResponseReq{CommID: &rpc.CommID{}} - utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend) - req.HandleMsg = params.HandleMsg - req.HandleResult = params.Flag - - var ok bool - var errInfo string - ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) - if !ok { - errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": errMsg}) - return - } - - utils.CopyStructFields(req, ¶ms) - log.NewInfo(req.CommID.OperationID, "AddFriendResponse args ", req.String()) - - etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) - if etcdConn == nil { - errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - - client := rpc.NewFriendClient(etcdConn) - RpcResp, err := client.AddFriendResponse(context.Background(), req) - if err != nil { - log.NewError(req.CommID.OperationID, "AddFriendResponse failed ", err.Error(), req.String()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call add_friend_response rpc server failed"}) - return - } - - resp := api.AddFriendResponseResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} - log.NewInfo(req.CommID.OperationID, "AddFriendResponse api return ", resp) - c.JSON(http.StatusOK, resp) -} - -// @Summary 删除好友 -// @Description 删除好友 -// @Tags 好友相关 -// @ID DeleteFriend -// @Accept json -// @Param token header string true "im token" -// @Param req body api.DeleteFriendReq true "fromUserID为操作用户
toUserID为被删除用户" -// @Produce json -// @Success 0 {object} api.DeleteFriendResp -// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" -// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" -// @Router /friend/delete_friend [post] -func DeleteFriend(c *gin.Context) { - params := api.DeleteFriendReq{} - if err := c.BindJSON(¶ms); err != nil { - log.NewError("0", "BindJSON failed ", err.Error()) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &rpc.DeleteFriendReq{CommID: &rpc.CommID{}} - utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend) - - var ok bool - var errInfo string - ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) - if !ok { - errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - - log.NewInfo(req.CommID.OperationID, "DeleteFriend args ", req.String()) - - etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) - if etcdConn == nil { - errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - client := rpc.NewFriendClient(etcdConn) - RpcResp, err := client.DeleteFriend(context.Background(), req) - if err != nil { - log.NewError(req.CommID.OperationID, "DeleteFriend failed ", err, req.String()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call delete_friend rpc server failed"}) - return - } - - resp := api.DeleteFriendResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} - log.NewInfo(req.CommID.OperationID, "DeleteFriend api return ", resp) - c.JSON(http.StatusOK, resp) -} - -// @Summary 获取黑名单列表 -// @Description 获取黑名单列表 -// @Tags 好友相关 -// @ID GetBlacklist -// @Accept json -// @Param token header string true "im token" -// @Param req body api.GetBlackListReq true "fromUserID要获取黑名单的用户" -// @Produce json -// @Success 0 {object} api.GetBlackListResp{data=[]open_im_sdk.PublicUserInfo} -// @Failure 500 {object} api.Swagger400Resp "errCode为500 一般为服务器内部错误" -// @Failure 400 {object} api.Swagger500Resp "errCode为400 一般为参数输入错误, token未带上等" -// @Router /friend/get_black_list [post] -func GetBlacklist(c *gin.Context) { - params := api.GetBlackListReq{} - if err := c.BindJSON(¶ms); err != nil { - log.NewError("0", "BindJSON failed ", err.Error()) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &rpc.GetBlacklistReq{CommID: &rpc.CommID{}} - utils.CopyStructFields(req.CommID, ¶ms) - - var ok bool - var errInfo string - ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) - if !ok { - errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - - log.NewInfo(req.CommID.OperationID, "GetBlacklist args ", req.String()) - - etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) - if etcdConn == nil { - errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - client := rpc.NewFriendClient(etcdConn) - RpcResp, err := client.GetBlacklist(context.Background(), req) - if err != nil { - log.NewError(req.CommID.OperationID, "GetBlacklist failed ", err.Error(), req.String()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call get blacklist rpc server failed"}) - return - } - - resp := api.GetBlackListResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} - for _, v := range RpcResp.BlackUserInfoList { - black := open_im_sdk.PublicUserInfo{} - utils.CopyStructFields(&black, v) - resp.BlackUserInfoList = append(resp.BlackUserInfoList, &black) - } - resp.Data = jsonData.JsonDataList(resp.BlackUserInfoList) - log.NewInfo(req.CommID.OperationID, "GetBlacklist api return ", resp) - c.JSON(http.StatusOK, resp) -} - -// @Summary 设置好友备注 -// @Description 设置好友备注 -// @Tags 好友相关 -// @ID SetFriendRemark -// @Accept json -// @Param token header string true "im token" -// @Param req body api.SetFriendRemarkReq true "fromUserID为设置的用户
toUserID为被设置的用户
remark为好友备注" -// @Produce json -// @Success 0 {object} api.SetFriendRemarkResp -// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" -// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" -// @Router /friend/set_friend_remark [post] -func SetFriendRemark(c *gin.Context) { - params := api.SetFriendRemarkReq{} - if err := c.BindJSON(¶ms); err != nil { - log.NewError("0", "BindJSON failed ", err.Error()) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &rpc.SetFriendRemarkReq{CommID: &rpc.CommID{}} - utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend) - req.Remark = params.Remark - - var ok bool - var errInfo string - ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) - if !ok { - errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - - log.NewInfo(req.CommID.OperationID, "SetFriendComment args ", req.String()) - - etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) - if etcdConn == nil { - errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - client := rpc.NewFriendClient(etcdConn) - RpcResp, err := client.SetFriendRemark(context.Background(), req) - if err != nil { - log.NewError(req.CommID.OperationID, "SetFriendComment failed ", err.Error(), req.String()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call set friend comment rpc server failed"}) - return - } - resp := api.SetFriendRemarkResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} - - log.NewInfo(req.CommID.OperationID, "SetFriendComment api return ", resp) - c.JSON(http.StatusOK, resp) -} - -// @Summary 把用户移除黑名单 -// @Description 把用户移除黑名单 -// @Tags 好友相关 -// @ID RemoveBlack -// @Accept json -// @Param token header string true "im token" -// @Param req body api.RemoveBlackListReq true "fromUserID要获取黑名单的用户" -// @Produce json -// @Success 0 {object} api.RemoveBlackListResp -// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" -// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" -// @Router /friend/remove_black [post] -func RemoveBlack(c *gin.Context) { - params := api.RemoveBlackListReq{} - if err := c.BindJSON(¶ms); err != nil { - log.NewError("0", "BindJSON failed ", err.Error()) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &rpc.RemoveBlacklistReq{CommID: &rpc.CommID{}} - utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend) - - var ok bool - var errInfo string - ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) - if !ok { - errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - - log.NewInfo(req.CommID.OperationID, "RemoveBlacklist args ", req.String()) - etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) - if etcdConn == nil { - errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - - client := rpc.NewFriendClient(etcdConn) - RpcResp, err := client.RemoveBlacklist(context.Background(), req) - if err != nil { - log.NewError(req.CommID.OperationID, "RemoveBlacklist failed ", err.Error(), req.String()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call remove blacklist rpc server failed"}) - return - } - resp := api.RemoveBlackListResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} - log.NewInfo(req.CommID.OperationID, "RemoveBlacklist api return ", resp) - c.JSON(http.StatusOK, resp) -} - -// @Summary 检查用户之间是否为好友 -// @Description 检查用户之间是否为好友 -// @Tags 好友相关 -// @ID IsFriend -// @Accept json -// @Param token header string true "im token" -// @Param req body api.IsFriendReq true "fromUserID为请求用户
toUserID为要检查的用户" -// @Produce json -// @Success 0 {object} api.IsFriendResp -// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" -// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" -// @Router /friend/is_friend [post] -func IsFriend(c *gin.Context) { - params := api.IsFriendReq{} - if err := c.BindJSON(¶ms); err != nil { - log.NewError("0", "BindJSON failed ", err.Error()) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &rpc.IsFriendReq{CommID: &rpc.CommID{}} - utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend) - - var ok bool - var errInfo string - ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) - if !ok { - errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": errMsg}) - return - } - - log.NewInfo(req.CommID.OperationID, "IsFriend args ", req.String()) - - etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) - if etcdConn == nil { - errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - client := rpc.NewFriendClient(etcdConn) - RpcResp, err := client.IsFriend(context.Background(), req) - if err != nil { - log.NewError(req.CommID.OperationID, "IsFriend failed ", err.Error(), req.String()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call add friend rpc server failed"}) - return - } - resp := api.IsFriendResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} - resp.Response.Friend = RpcResp.Response - - log.NewInfo(req.CommID.OperationID, "IsFriend api return ", resp) - c.JSON(http.StatusOK, resp) -} - -// @Summary 获取用户的好友列表 -// @Description 获取用户的好友列表 -// @Tags 好友相关 -// @ID GetFriendList -// @Accept json -// @Param token header string true "im token" -// @Param req body api.GetFriendListReq true "fromUserID为要获取好友列表的用户ID" -// @Produce json -// @Success 0 {object} api.GetFriendListResp{data=[]open_im_sdk.FriendInfo} -// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" -// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" -// @Router /friend/get_friend_list [post] -func GetFriendList(c *gin.Context) { - params := api.GetFriendListReq{} - if err := c.BindJSON(¶ms); err != nil { - log.NewError("0", "BindJSON failed ", err.Error()) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &rpc.GetFriendListReq{CommID: &rpc.CommID{}} - utils.CopyStructFields(req.CommID, ¶ms) - - var ok bool - var errInfo string - ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) - if !ok { - errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - - log.NewInfo(req.CommID.OperationID, "GetFriendList args ", req.String()) - - etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) - if etcdConn == nil { - errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - client := rpc.NewFriendClient(etcdConn) - RpcResp, err := client.GetFriendList(context.Background(), req) - if err != nil { - log.NewError(req.CommID.OperationID, "GetFriendList failed ", err.Error(), req.String()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call get friend list rpc server failed"}) - return - } - - resp := api.GetFriendListResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, FriendInfoList: RpcResp.FriendInfoList} - resp.Data = jsonData.JsonDataList(resp.FriendInfoList) - log.NewInfo(req.CommID.OperationID, "GetFriendList api return ", resp) - c.JSON(http.StatusOK, resp) - //c.JSON(http.StatusOK, resp) -} - -// @Summary 获取好友申请列表 -// @Description 删除好友 -// @Tags 好友相关 -// @ID GetFriendApplyList -// @Accept json -// @Param token header string true "im token" -// @Param req body api.GetFriendApplyListReq true "fromUserID为要获取申请列表的用户ID" -// @Produce json -// @Success 0 {object} api.GetFriendApplyListResp{data=[]open_im_sdk.FriendRequest} -// @Failure 500 {object} api.Swagger400Resp "errCode为500 一般为服务器内部错误" -// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" -// @Router /friend/get_friend_apply_list [post] -func GetFriendApplyList(c *gin.Context) { - params := api.GetFriendApplyListReq{} - if err := c.BindJSON(¶ms); err != nil { - log.NewError("0", "BindJSON failed ", err.Error()) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &rpc.GetFriendApplyListReq{CommID: &rpc.CommID{}} - utils.CopyStructFields(req.CommID, ¶ms) - - var ok bool - var errInfo string - ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) - if !ok { - errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - - log.NewInfo(req.CommID.OperationID, "GetFriendApplyList args ", req.String()) - - etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) - if etcdConn == nil { - errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - client := rpc.NewFriendClient(etcdConn) - - RpcResp, err := client.GetFriendApplyList(context.Background(), req) - if err != nil { - log.NewError(req.CommID.OperationID, "GetFriendApplyList failed ", err.Error(), req.String()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call get friend apply list rpc server failed"}) - return - } - - resp := api.GetFriendApplyListResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, FriendRequestList: RpcResp.FriendRequestList} - resp.Data = jsonData.JsonDataList(resp.FriendRequestList) - log.NewInfo(req.CommID.OperationID, "GetFriendApplyList api return ", resp) - c.JSON(http.StatusOK, resp) -} - -// @Summary 获取自己的好友申请列表 -// @Description 获取自己的好友申请列表 -// @Tags 好友相关 -// @ID GetSelfFriendApplyList -// @Accept json -// @Param token header string true "im token" -// @Param req body api.GetSelfApplyListReq true "fromUserID为自己的用户ID" -// @Produce json -// @Success 0 {object} api.GetSelfApplyListResp{data=[]open_im_sdk.FriendRequest} -// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" -// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" -// @Router /friend/get_self_friend_apply_list [post] -func GetSelfFriendApplyList(c *gin.Context) { - params := api.GetSelfApplyListReq{} - if err := c.BindJSON(¶ms); err != nil { - log.NewError("0", "BindJSON failed ", err.Error()) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &rpc.GetSelfApplyListReq{CommID: &rpc.CommID{}} - utils.CopyStructFields(req.CommID, ¶ms) - - var ok bool - var errInfo string - ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) - if !ok { - errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - - log.NewInfo(req.CommID.OperationID, "GetSelfApplyList args ", req.String()) - - etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) - if etcdConn == nil { - errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - client := rpc.NewFriendClient(etcdConn) - RpcResp, err := client.GetSelfApplyList(context.Background(), req) - if err != nil { - log.NewError(req.CommID.OperationID, "GetSelfApplyList failed ", err.Error(), req.String()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call get self apply list rpc server failed"}) - return - } - resp := api.GetSelfApplyListResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, FriendRequestList: RpcResp.FriendRequestList} - resp.Data = jsonData.JsonDataList(resp.FriendRequestList) - log.NewInfo(req.CommID.OperationID, "GetSelfApplyList api return ", resp) - c.JSON(http.StatusOK, resp) -} +//import ( +// jsonData "Open_IM/internal/utils" +// api "Open_IM/pkg/base_info" +// "Open_IM/pkg/common/config" +// "Open_IM/pkg/common/log" +// "Open_IM/pkg/common/token_verify" +// "Open_IM/pkg/getcdv3" +// rpc "Open_IM/pkg/proto/friend" +// open_im_sdk "Open_IM/pkg/proto/sdk_ws" +// "Open_IM/pkg/utils" +// "context" +// "github.com/gin-gonic/gin" +// "net/http" +// "strings" +//) +// +//// @Summary 添加黑名单 +//// @Description 添加黑名单 +//// @Tags 好友相关 +//// @ID AddBlack +//// @Accept json +//// @Param token header string true "im token" +//// @Param req body api.AddBlacklistReq true "fromUserID为设置的用户
toUserID为被设置的用户" +//// @Produce json +//// @Success 0 {object} api.AddBlacklistResp +//// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" +//// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" +//// @Router /friend/add_black [post] +//func AddBlack(c *gin.Context) { +// params := api.AddBlacklistReq{} +// if err := c.BindJSON(¶ms); err != nil { +// log.NewError("0", "BindJSON failed ", err.Error()) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) +// return +// } +// req := &rpc.AddBlacklistReq{CommID: &rpc.CommID{}} +// utils.CopyStructFields(req.CommID, ¶ms) +// var ok bool +// var errInfo string +// ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) +// if !ok { +// errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg}) +// return +// } +// log.NewInfo(params.OperationID, "AddBlacklist args ", req.String()) +// +// etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) +// client := rpc.NewFriendClient(etcdConn) +// RpcResp, err := client.AddBlacklist(context.Background(), req) +// if err != nil { +// log.NewError(req.CommID.OperationID, "AddBlacklist failed ", err.Error()) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call add blacklist rpc server failed"}) +// return +// } +// resp := api.AddBlacklistResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} +// log.NewInfo(req.CommID.OperationID, "AddBlacklist api return ", resp) +// c.JSON(http.StatusOK, resp) +//} +// +//// @Summary 批量加好友 +//// @Description 批量加好友 +//// @Tags 好友相关 +//// @ID ImportFriend +//// @Accept json +//// @Param token header string true "im token" +//// @Param req body api.ImportFriendReq true "fromUserID批量加好友的用户ID
friendUserIDList为" +//// @Produce json +//// @Success 0 {object} api.ImportFriendResp "data列表中对象的result-1为添加该用户失败
0为成功" +//// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" +//// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" +//// @Router /friend/import_friend [post] +//func ImportFriend(c *gin.Context) { +// params := api.ImportFriendReq{} +// if err := c.BindJSON(¶ms); err != nil { +// log.NewError("0", "BindJSON failed ", err.Error()) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) +// return +// } +// req := &rpc.ImportFriendReq{} +// utils.CopyStructFields(req, ¶ms) +// var ok bool +// var errInfo string +// ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID) +// if !ok { +// errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") +// log.NewError(req.OperationID, errMsg) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg}) +// return +// } +// +// log.NewInfo(req.OperationID, "ImportFriend args ", req.String()) +// etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.OperationID) +// if etcdConn == nil { +// errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" +// log.NewError(req.OperationID, errMsg) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) +// return +// } +// +// client := rpc.NewFriendClient(etcdConn) +// RpcResp, err := client.ImportFriend(context.Background(), req) +// if err != nil { +// log.NewError(req.OperationID, "ImportFriend failed ", err.Error(), req.String()) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "ImportFriend failed "}) +// return +// } +// resp := api.ImportFriendResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} +// if resp.ErrCode == 0 { +// for _, v := range RpcResp.UserIDResultList { +// resp.UserIDResultList = append(resp.UserIDResultList, api.UserIDResult{UserID: v.UserID, Result: v.Result}) +// } +// } +// if len(resp.UserIDResultList) == 0 { +// resp.UserIDResultList = []api.UserIDResult{} +// } +// log.NewInfo(req.OperationID, "ImportFriend api return ", resp) +// c.JSON(http.StatusOK, resp) +//} +// +//// @Summary 添加好友 +//// @Description 添加好友 +//// @Tags 好友相关 +//// @ID AddFriend +//// @Accept json +//// @Param token header string true "im token" +//// @Param req body api.AddFriendReq true "reqMsg为申请信息
fromUserID为申请用户
toUserID为被添加用户" +//// @Produce json +//// @Success 0 {object} api.AddFriendResp +//// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" +//// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" +//// @Router /friend/add_friend [post] +//func AddFriend(c *gin.Context) { +// params := api.AddFriendReq{} +// if err := c.BindJSON(¶ms); err != nil { +// log.NewError("0", "BindJSON failed ", err.Error()) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) +// return +// } +// req := &rpc.AddFriendReq{CommID: &rpc.CommID{}} +// utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend) +// req.ReqMsg = params.ReqMsg +// +// var ok bool +// var errInfo string +// ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) +// if !ok { +// errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": errMsg}) +// return +// } +// +// log.NewInfo(req.CommID.OperationID, "AddFriend args ", req.String()) +// +// etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) +// if etcdConn == nil { +// errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) +// return +// } +// client := rpc.NewFriendClient(etcdConn) +// RpcResp, err := client.AddFriend(context.Background(), req) +// if err != nil { +// log.NewError(req.CommID.OperationID, "AddFriend failed ", err.Error(), req.String()) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call AddFriend rpc server failed"}) +// return +// } +// +// resp := api.AddFriendResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} +// log.NewInfo(req.CommID.OperationID, "AddFriend api return ", resp) +// c.JSON(http.StatusOK, resp) +//} +// +//// @Summary 同意/拒绝好友请求 +//// @Description 同意/拒绝好友请求 +//// @Tags 好友相关 +//// @ID AddFriendResponse +//// @Accept json +//// @Param token header string true "im token" +//// @Param req body api.AddFriendResponseReq true "fromUserID同意/拒绝的用户ID
toUserID为申请用户D
handleMsg为处理信息
flag为具体操作, 1为同意, 2为拒绝" +//// @Produce json +//// @Success 0 {object} api.AddFriendResponseResp +//// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" +//// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" +//// @Router /friend/add_friend_response [post] +//func AddFriendResponse(c *gin.Context) { +// params := api.AddFriendResponseReq{} +// if err := c.BindJSON(¶ms); err != nil { +// log.NewError("0", "BindJSON failed ", err.Error()) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) +// return +// } +// req := &rpc.AddFriendResponseReq{CommID: &rpc.CommID{}} +// utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend) +// req.HandleMsg = params.HandleMsg +// req.HandleResult = params.Flag +// +// var ok bool +// var errInfo string +// ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) +// if !ok { +// errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": errMsg}) +// return +// } +// +// utils.CopyStructFields(req, ¶ms) +// log.NewInfo(req.CommID.OperationID, "AddFriendResponse args ", req.String()) +// +// etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) +// if etcdConn == nil { +// errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) +// return +// } +// +// client := rpc.NewFriendClient(etcdConn) +// RpcResp, err := client.AddFriendResponse(context.Background(), req) +// if err != nil { +// log.NewError(req.CommID.OperationID, "AddFriendResponse failed ", err.Error(), req.String()) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call add_friend_response rpc server failed"}) +// return +// } +// +// resp := api.AddFriendResponseResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} +// log.NewInfo(req.CommID.OperationID, "AddFriendResponse api return ", resp) +// c.JSON(http.StatusOK, resp) +//} +// +//// @Summary 删除好友 +//// @Description 删除好友 +//// @Tags 好友相关 +//// @ID DeleteFriend +//// @Accept json +//// @Param token header string true "im token" +//// @Param req body api.DeleteFriendReq true "fromUserID为操作用户
toUserID为被删除用户" +//// @Produce json +//// @Success 0 {object} api.DeleteFriendResp +//// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" +//// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" +//// @Router /friend/delete_friend [post] +//func DeleteFriend(c *gin.Context) { +// params := api.DeleteFriendReq{} +// if err := c.BindJSON(¶ms); err != nil { +// log.NewError("0", "BindJSON failed ", err.Error()) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) +// return +// } +// req := &rpc.DeleteFriendReq{CommID: &rpc.CommID{}} +// utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend) +// +// var ok bool +// var errInfo string +// ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) +// if !ok { +// errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg}) +// return +// } +// +// log.NewInfo(req.CommID.OperationID, "DeleteFriend args ", req.String()) +// +// etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) +// if etcdConn == nil { +// errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) +// return +// } +// client := rpc.NewFriendClient(etcdConn) +// RpcResp, err := client.DeleteFriend(context.Background(), req) +// if err != nil { +// log.NewError(req.CommID.OperationID, "DeleteFriend failed ", err, req.String()) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call delete_friend rpc server failed"}) +// return +// } +// +// resp := api.DeleteFriendResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} +// log.NewInfo(req.CommID.OperationID, "DeleteFriend api return ", resp) +// c.JSON(http.StatusOK, resp) +//} +// +//// @Summary 获取黑名单列表 +//// @Description 获取黑名单列表 +//// @Tags 好友相关 +//// @ID GetBlacklist +//// @Accept json +//// @Param token header string true "im token" +//// @Param req body api.GetBlackListReq true "fromUserID要获取黑名单的用户" +//// @Produce json +//// @Success 0 {object} api.GetBlackListResp{data=[]open_im_sdk.PublicUserInfo} +//// @Failure 500 {object} api.Swagger400Resp "errCode为500 一般为服务器内部错误" +//// @Failure 400 {object} api.Swagger500Resp "errCode为400 一般为参数输入错误, token未带上等" +//// @Router /friend/get_black_list [post] +//func GetBlacklist(c *gin.Context) { +// params := api.GetBlackListReq{} +// if err := c.BindJSON(¶ms); err != nil { +// log.NewError("0", "BindJSON failed ", err.Error()) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) +// return +// } +// req := &rpc.GetBlacklistReq{CommID: &rpc.CommID{}} +// utils.CopyStructFields(req.CommID, ¶ms) +// +// var ok bool +// var errInfo string +// ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) +// if !ok { +// errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg}) +// return +// } +// +// log.NewInfo(req.CommID.OperationID, "GetBlacklist args ", req.String()) +// +// etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) +// if etcdConn == nil { +// errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) +// return +// } +// client := rpc.NewFriendClient(etcdConn) +// RpcResp, err := client.GetBlacklist(context.Background(), req) +// if err != nil { +// log.NewError(req.CommID.OperationID, "GetBlacklist failed ", err.Error(), req.String()) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call get blacklist rpc server failed"}) +// return +// } +// +// resp := api.GetBlackListResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} +// for _, v := range RpcResp.BlackUserInfoList { +// black := open_im_sdk.PublicUserInfo{} +// utils.CopyStructFields(&black, v) +// resp.BlackUserInfoList = append(resp.BlackUserInfoList, &black) +// } +// resp.Data = jsonData.JsonDataList(resp.BlackUserInfoList) +// log.NewInfo(req.CommID.OperationID, "GetBlacklist api return ", resp) +// c.JSON(http.StatusOK, resp) +//} +// +//// @Summary 设置好友备注 +//// @Description 设置好友备注 +//// @Tags 好友相关 +//// @ID SetFriendRemark +//// @Accept json +//// @Param token header string true "im token" +//// @Param req body api.SetFriendRemarkReq true "fromUserID为设置的用户
toUserID为被设置的用户
remark为好友备注" +//// @Produce json +//// @Success 0 {object} api.SetFriendRemarkResp +//// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" +//// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" +//// @Router /friend/set_friend_remark [post] +//func SetFriendRemark(c *gin.Context) { +// params := api.SetFriendRemarkReq{} +// if err := c.BindJSON(¶ms); err != nil { +// log.NewError("0", "BindJSON failed ", err.Error()) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) +// return +// } +// req := &rpc.SetFriendRemarkReq{CommID: &rpc.CommID{}} +// utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend) +// req.Remark = params.Remark +// +// var ok bool +// var errInfo string +// ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) +// if !ok { +// errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg}) +// return +// } +// +// log.NewInfo(req.CommID.OperationID, "SetFriendComment args ", req.String()) +// +// etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) +// if etcdConn == nil { +// errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) +// return +// } +// client := rpc.NewFriendClient(etcdConn) +// RpcResp, err := client.SetFriendRemark(context.Background(), req) +// if err != nil { +// log.NewError(req.CommID.OperationID, "SetFriendComment failed ", err.Error(), req.String()) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call set friend comment rpc server failed"}) +// return +// } +// resp := api.SetFriendRemarkResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} +// +// log.NewInfo(req.CommID.OperationID, "SetFriendComment api return ", resp) +// c.JSON(http.StatusOK, resp) +//} +// +//// @Summary 把用户移除黑名单 +//// @Description 把用户移除黑名单 +//// @Tags 好友相关 +//// @ID RemoveBlacklist +//// @Accept json +//// @Param token header string true "im token" +//// @Param req body api.RemoveBlackListReq true "fromUserID要获取黑名单的用户" +//// @Produce json +//// @Success 0 {object} api.RemoveBlackListResp +//// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" +//// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" +//// @Router /friend/remove_black [post] +//func RemoveBlacklist(c *gin.Context) { +// params := api.RemoveBlackListReq{} +// if err := c.BindJSON(¶ms); err != nil { +// log.NewError("0", "BindJSON failed ", err.Error()) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) +// return +// } +// req := &rpc.RemoveBlacklistReq{CommID: &rpc.CommID{}} +// utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend) +// +// var ok bool +// var errInfo string +// ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) +// if !ok { +// errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg}) +// return +// } +// +// log.NewInfo(req.CommID.OperationID, "RemoveBlacklist args ", req.String()) +// etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) +// if etcdConn == nil { +// errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) +// return +// } +// +// client := rpc.NewFriendClient(etcdConn) +// RpcResp, err := client.RemoveBlacklist(context.Background(), req) +// if err != nil { +// log.NewError(req.CommID.OperationID, "RemoveBlacklist failed ", err.Error(), req.String()) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call remove blacklist rpc server failed"}) +// return +// } +// resp := api.RemoveBlackListResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} +// log.NewInfo(req.CommID.OperationID, "RemoveBlacklist api return ", resp) +// c.JSON(http.StatusOK, resp) +//} +// +//// @Summary 检查用户之间是否为好友 +//// @Description 检查用户之间是否为好友 +//// @Tags 好友相关 +//// @ID IsFriend +//// @Accept json +//// @Param token header string true "im token" +//// @Param req body api.IsFriendReq true "fromUserID为请求用户
toUserID为要检查的用户" +//// @Produce json +//// @Success 0 {object} api.IsFriendResp +//// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" +//// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" +//// @Router /friend/is_friend [post] +//func IsFriend(c *gin.Context) { +// params := api.IsFriendReq{} +// if err := c.BindJSON(¶ms); err != nil { +// log.NewError("0", "BindJSON failed ", err.Error()) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) +// return +// } +// req := &rpc.IsFriendReq{CommID: &rpc.CommID{}} +// utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend) +// +// var ok bool +// var errInfo string +// ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) +// if !ok { +// errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": errMsg}) +// return +// } +// +// log.NewInfo(req.CommID.OperationID, "IsFriend args ", req.String()) +// +// etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) +// if etcdConn == nil { +// errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) +// return +// } +// client := rpc.NewFriendClient(etcdConn) +// RpcResp, err := client.IsFriend(context.Background(), req) +// if err != nil { +// log.NewError(req.CommID.OperationID, "IsFriend failed ", err.Error(), req.String()) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call add friend rpc server failed"}) +// return +// } +// resp := api.IsFriendResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} +// resp.Response.Friend = RpcResp.Response +// +// log.NewInfo(req.CommID.OperationID, "IsFriend api return ", resp) +// c.JSON(http.StatusOK, resp) +//} +// +//// @Summary 获取用户的好友列表 +//// @Description 获取用户的好友列表 +//// @Tags 好友相关 +//// @ID GetFriendList +//// @Accept json +//// @Param token header string true "im token" +//// @Param req body api.GetFriendListReq true "fromUserID为要获取好友列表的用户ID" +//// @Produce json +//// @Success 0 {object} api.GetFriendListResp{data=[]open_im_sdk.FriendInfo} +//// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" +//// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" +//// @Router /friend/get_friend_list [post] +//func GetFriendList(c *gin.Context) { +// params := api.GetFriendListReq{} +// if err := c.BindJSON(¶ms); err != nil { +// log.NewError("0", "BindJSON failed ", err.Error()) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) +// return +// } +// req := &rpc.GetFriendListReq{CommID: &rpc.CommID{}} +// utils.CopyStructFields(req.CommID, ¶ms) +// +// var ok bool +// var errInfo string +// ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) +// if !ok { +// errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg}) +// return +// } +// +// log.NewInfo(req.CommID.OperationID, "GetFriendList args ", req.String()) +// +// etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) +// if etcdConn == nil { +// errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) +// return +// } +// client := rpc.NewFriendClient(etcdConn) +// RpcResp, err := client.GetFriendList(context.Background(), req) +// if err != nil { +// log.NewError(req.CommID.OperationID, "GetFriendList failed ", err.Error(), req.String()) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call get friend list rpc server failed"}) +// return +// } +// +// resp := api.GetFriendListResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, FriendInfoList: RpcResp.FriendInfoList} +// resp.Data = jsonData.JsonDataList(resp.FriendInfoList) +// log.NewInfo(req.CommID.OperationID, "GetFriendList api return ", resp) +// c.JSON(http.StatusOK, resp) +// //c.JSON(http.StatusOK, resp) +//} +// +//// @Summary 获取好友申请列表 +//// @Description 删除好友 +//// @Tags 好友相关 +//// @ID GetFriendApplyList +//// @Accept json +//// @Param token header string true "im token" +//// @Param req body api.GetFriendApplyListReq true "fromUserID为要获取申请列表的用户ID" +//// @Produce json +//// @Success 0 {object} api.GetFriendApplyListResp{data=[]open_im_sdk.FriendRequest} +//// @Failure 500 {object} api.Swagger400Resp "errCode为500 一般为服务器内部错误" +//// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" +//// @Router /friend/get_friend_apply_list [post] +//func GetFriendApplyList(c *gin.Context) { +// params := api.GetFriendApplyListReq{} +// if err := c.BindJSON(¶ms); err != nil { +// log.NewError("0", "BindJSON failed ", err.Error()) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) +// return +// } +// req := &rpc.GetFriendApplyListReq{CommID: &rpc.CommID{}} +// utils.CopyStructFields(req.CommID, ¶ms) +// +// var ok bool +// var errInfo string +// ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) +// if !ok { +// errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg}) +// return +// } +// +// log.NewInfo(req.CommID.OperationID, "GetFriendApplyList args ", req.String()) +// +// etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) +// if etcdConn == nil { +// errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) +// return +// } +// client := rpc.NewFriendClient(etcdConn) +// +// RpcResp, err := client.GetFriendApplyList(context.Background(), req) +// if err != nil { +// log.NewError(req.CommID.OperationID, "GetFriendApplyList failed ", err.Error(), req.String()) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call get friend apply list rpc server failed"}) +// return +// } +// +// resp := api.GetFriendApplyListResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, FriendRequestList: RpcResp.FriendRequestList} +// resp.Data = jsonData.JsonDataList(resp.FriendRequestList) +// log.NewInfo(req.CommID.OperationID, "GetFriendApplyList api return ", resp) +// c.JSON(http.StatusOK, resp) +//} +// +//// @Summary 获取自己的好友申请列表 +//// @Description 获取自己的好友申请列表 +//// @Tags 好友相关 +//// @ID GetSelfApplyList +//// @Accept json +//// @Param token header string true "im token" +//// @Param req body api.GetSelfApplyListReq true "fromUserID为自己的用户ID" +//// @Produce json +//// @Success 0 {object} api.GetSelfApplyListResp{data=[]open_im_sdk.FriendRequest} +//// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" +//// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" +//// @Router /friend/get_self_friend_apply_list [post] +//func GetSelfApplyList(c *gin.Context) { +// params := api.GetSelfApplyListReq{} +// if err := c.BindJSON(¶ms); err != nil { +// log.NewError("0", "BindJSON failed ", err.Error()) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) +// return +// } +// req := &rpc.GetSelfApplyListReq{CommID: &rpc.CommID{}} +// utils.CopyStructFields(req.CommID, ¶ms) +// +// var ok bool +// var errInfo string +// ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) +// if !ok { +// errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg}) +// return +// } +// +// log.NewInfo(req.CommID.OperationID, "GetSelfApplyList args ", req.String()) +// +// etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) +// if etcdConn == nil { +// errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) +// return +// } +// client := rpc.NewFriendClient(etcdConn) +// RpcResp, err := client.GetSelfApplyList(context.Background(), req) +// if err != nil { +// log.NewError(req.CommID.OperationID, "GetSelfApplyList failed ", err.Error(), req.String()) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call get self apply list rpc server failed"}) +// return +// } +// resp := api.GetSelfApplyListResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, FriendRequestList: RpcResp.FriendRequestList} +// resp.Data = jsonData.JsonDataList(resp.FriendRequestList) +// log.NewInfo(req.CommID.OperationID, "GetSelfApplyList api return ", resp) +// c.JSON(http.StatusOK, resp) +//} diff --git a/internal/api/friend/friend1.go b/internal/api/friend/friend1.go index 0eb2ca79a..f4fdf9bb1 100644 --- a/internal/api/friend/friend1.go +++ b/internal/api/friend/friend1.go @@ -5,27 +5,53 @@ import ( api "Open_IM/pkg/base_info" "Open_IM/pkg/common/config" rpc "Open_IM/pkg/proto/friend" - "Open_IM/pkg/utils" "github.com/gin-gonic/gin" ) -// 不一致 -func AddBlacklist(c *gin.Context) { - common.ApiToRpc(c, &api.AddBlacklistReq{}, &api.AddBlacklistResp{}, - config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, utils.GetSelfFuncName()) +func AddBlack(c *gin.Context) { + common.ApiToRpc(c, &api.AddBlacklistReq{}, &api.AddBlacklistResp{}, config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, "") } -func ImportFriend1(c *gin.Context) { - common.ApiToRpc(c, &api.ImportFriendReq{}, &api.ImportFriendResp{}, - config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, utils.GetSelfFuncName()) +func ImportFriend(c *gin.Context) { + common.ApiToRpc(c, &api.ImportFriendReq{}, &api.ImportFriendResp{}, config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, "") } -func AddFriend1(c *gin.Context) { - common.ApiToRpc(c, &api.AddFriendReq{}, &api.AddFriendResp{}, - config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, utils.GetSelfFuncName()) +func AddFriend(c *gin.Context) { + common.ApiToRpc(c, &api.AddFriendReq{}, &api.AddFriendResp{}, config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, "") } -func AddFriendResponse1(c *gin.Context) { - common.ApiToRpc(c, &api.AddFriendResponseReq{}, &api.AddFriendResponseResp{}, - config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, utils.GetSelfFuncName()) +func AddFriendResponse(c *gin.Context) { + common.ApiToRpc(c, &api.AddFriendResponseReq{}, &api.AddFriendResponseResp{}, config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, "") +} + +func DeleteFriend(c *gin.Context) { + common.ApiToRpc(c, &api.DeleteFriendReq{}, &api.DeleteFriendResp{}, config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, "") +} + +func GetBlacklist(c *gin.Context) { + common.ApiToRpc(c, &api.GetBlackListReq{}, &api.GetBlackListResp{}, config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, "") +} + +func SetFriendRemark(c *gin.Context) { + common.ApiToRpc(c, &api.SetFriendRemarkReq{}, &api.SetFriendRemarkResp{}, config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, "") +} + +func RemoveBlacklist(c *gin.Context) { + common.ApiToRpc(c, &api.RemoveBlacklistReq{}, &api.RemoveBlacklistResp{}, config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, "") +} + +func IsFriend(c *gin.Context) { + common.ApiToRpc(c, &api.IsFriendReq{}, &api.IsFriendResp{}, config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, "") +} + +func GetFriendList(c *gin.Context) { + common.ApiToRpc(c, &api.GetFriendListReq{}, &api.GetFriendListResp{}, config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, "") +} + +func GetFriendApplyList(c *gin.Context) { + common.ApiToRpc(c, &api.GetFriendApplyListReq{}, &api.GetFriendApplyListResp{}, config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, "") +} + +func GetSelfApplyList(c *gin.Context) { + common.ApiToRpc(c, &api.GetSelfApplyListReq{}, &api.GetSelfApplyListResp{}, config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, "") } diff --git a/internal/api_to_rpc/api.go b/internal/api_to_rpc/api.go index f7d0fc506..c066546ab 100644 --- a/internal/api_to_rpc/api.go +++ b/internal/api_to_rpc/api.go @@ -11,11 +11,10 @@ import ( "reflect" ) -//func a(c *gin.Context) { -// ApiToRpc(c, &api.AddBlacklistReq{}, &api.AddBlacklistResp{}, config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, utils.GetSelfFuncName()) -//} - func ApiToRpc(c *gin.Context, apiReq, apiResp interface{}, rpcName string, rpcClientFunc interface{}, rpcFuncName string) { + if rpcName == "" { + rpcName = utils2.GetFuncName(1) + } logFuncName := fmt.Sprintf("[ApiToRpc: %s]%s", utils2.GetFuncName(1), rpcFuncName) ctx := trace_log.NewCtx1(c, rpcFuncName) defer log.ShowLog(ctx) @@ -58,77 +57,3 @@ func rpcString(v interface{}) string { } return fmt.Sprintf("%+v", v) } - -//func ApiToRpc(c *gin.Context, apiReq, apiResp interface{}, rpcName string, fn interface{}, rpcFuncName string, tokenFunc func(token string, operationID string) (string, error)) { -// nCtx := trace_log.NewCtx(c, rpcFuncName) -// defer trace_log.ShowLog(nCtx) -// if err := c.BindJSON(apiReq); err != nil { -// trace_log.WriteErrorResponse(nCtx, "BindJSON", err) -// return -// } -// reqValue := reflect.ValueOf(apiReq).Elem() -// operationID := reqValue.FieldByName("OperationID").String() -// trace_log.SetOperationID(nCtx, operationID) -// trace_log.SetCtxInfo(nCtx, "BindJSON", nil, "params", apiReq) -// etcdConn, err := utils2.GetConn(c, rpcName) -// if err != nil { -// trace_log.WriteErrorResponse(nCtx, "GetDefaultConn", err) -// return -// } -// rpc := reflect.ValueOf(fn).Call([]reflect.Value{ -// reflect.ValueOf(etcdConn), -// })[0].MethodByName(rpcFuncName) // rpc func -// rpcReqPtr := reflect.New(rpc.Type().In(1).Elem()) // *req参数 -// var opUserID string -// if tokenFunc != nil { -// var err error -// opUserID, err = tokenFunc(c.GetHeader("token"), operationID) -// if err != nil { -// trace_log.WriteErrorResponse(nCtx, "TokenFunc", err) -// return -// } -// } -// if opID := rpcReqPtr.Elem().FieldByName("OperationID"); opID.IsValid() { -// opID.SetString(operationID) -// if opU := rpcReqPtr.Elem().FieldByName("OpUserID"); opU.IsValid() { -// opU.SetString(opUserID) -// } -// } else { -// op := rpcReqPtr.Elem().FieldByName("Operation").Elem() -// op.FieldByName("OperationID").SetString(operationID) -// op.FieldByName("OpUserID").SetString(opUserID) -// } -// if err := utils.CopyStructFields(rpcReqPtr.Interface(), apiReq); err != nil { -// trace_log.WriteErrorResponse(nCtx, "CopyStructFields_RpcReq", err) -// return -// } -// respArr := rpc.Call([]reflect.Value{ -// reflect.ValueOf(context.Context(c)), // context.Context -// rpcReqPtr, // rpc apiReq -// }) // respArr => (apiResp, error) -// if !respArr[1].IsNil() { // rpc err != nil -// err := respArr[1].Interface().(error) -// trace_log.WriteErrorResponse(nCtx, rpcFuncName, err, "rpc req", rpcReqPtr.Interface()) -// return -// } -// rpcResp := respArr[0].Elem() -// trace_log.SetCtxInfo(nCtx, rpcFuncName, nil, "rpc req", rpcReqPtr.Interface(), "resp", rpcResp.Interface()) -// commonResp := rpcResp.FieldByName("CommonResp").Elem() -// errCodeVal := commonResp.FieldByName("ErrCode") -// errMsgVal := commonResp.FieldByName("ErrMsg").Interface().(string) -// errCode := errCodeVal.Interface().(int32) -// if errCode != 0 { -// trace_log.WriteErrorResponse(nCtx, "RpcErrCode", &constant.ErrInfo{ -// ErrCode: errCode, -// ErrMsg: errMsgVal, -// }) -// return -// } -// if apiResp != nil { -// if err := utils.CopyStructFields(apiResp, rpcResp.Interface()); err != nil { -// trace_log.WriteErrorResponse(nCtx, "CopyStructFields_RpcResp", err) -// return -// } -// } -// trace_log.SetSuccess(nCtx, rpcFuncName, apiResp) -//} diff --git a/pkg/base_info/friend_api_struct.go b/pkg/base_info/friend_api_struct.go index 21b1912e7..8c6da6b53 100644 --- a/pkg/base_info/friend_api_struct.go +++ b/pkg/base_info/friend_api_struct.go @@ -1,128 +1,267 @@ package base_info -import open_im_sdk "Open_IM/pkg/proto/sdk_ws" +//type ParamsCommFriend struct { +// OperationID string `json:"operationID" binding:"required"` +// ToUserID string `json:"toUserID" binding:"required"` +// FromUserID string `json:"fromUserID" binding:"required"` +//} +// +//type AddBlacklistReq struct { +// ParamsCommFriend +//} +//type AddBlacklistResp struct { +// CommResp +//} +// +//type ImportFriendReq struct { +// FriendUserIDList []string `json:"friendUserIDList" binding:"required"` +// OperationID string `json:"operationID" binding:"required"` +// FromUserID string `json:"fromUserID" binding:"required"` +//} +//type UserIDResult struct { +// UserID string `json:"userID"` +// Result int32 `json:"result"` +//} +//type ImportFriendResp struct { +// CommResp +// UserIDResultList []UserIDResult `json:"data"` +//} +// +//type AddFriendReq struct { +// ParamsCommFriend +// ReqMsg string `json:"reqMsg"` +//} +//type AddFriendResp struct { +// CommResp +//} +// +//type AddFriendResponseReq struct { +// ParamsCommFriend +// Flag int32 `json:"flag" binding:"required,oneof=-1 0 1"` +// HandleMsg string `json:"handleMsg"` +//} +//type AddFriendResponseResp struct { +// CommResp +//} +// +//type DeleteFriendReq struct { +// ParamsCommFriend +//} +//type DeleteFriendResp struct { +// CommResp +//} +// +//type GetBlackListReq struct { +// OperationID string `json:"operationID" binding:"required"` +// FromUserID string `json:"fromUserID" binding:"required"` +//} +//type GetBlackListResp struct { +// CommResp +// BlackUserInfoList []*open_im_sdk.PublicUserInfo `json:"-"` +// Data []map[string]interface{} `json:"data" swaggerignore:"true"` +//} +// +////type PublicUserInfo struct { +//// UserID string `json:"userID"` +//// Nickname string `json:"nickname"` +//// FaceUrl string `json:"faceUrl"` +//// Gender int32 `json:"gender"` +////} +// +//type SetFriendRemarkReq struct { +// ParamsCommFriend +// Remark string `json:"remark"` +//} +//type SetFriendRemarkResp struct { +// CommResp +//} +// +//type RemoveBlacklistReq struct { +// ParamsCommFriend +//} +//type RemoveBlacklistResp struct { +// CommResp +//} +// +//type IsFriendReq struct { +// ParamsCommFriend +//} +//type Response struct { +// Friend bool `json:"isFriend"` +//} +//type IsFriendResp struct { +// CommResp +// Response Response `json:"data"` +//} +// +//type GetFriendsInfoReq struct { +// ParamsCommFriend +//} +//type GetFriendsInfoResp struct { +// CommResp +// FriendInfoList []*open_im_sdk.FriendInfo `json:"-"` +// Data []map[string]interface{} `json:"data" swaggerignore:"true"` +//} +// +//type GetFriendListReq struct { +// OperationID string `json:"operationID" binding:"required"` +// FromUserID string `json:"fromUserID" binding:"required"` +//} +//type GetFriendListResp struct { +// CommResp +// FriendInfoList []*open_im_sdk.FriendInfo `json:"-"` +// Data []map[string]interface{} `json:"data" swaggerignore:"true"` +//} +// +//type GetFriendApplyListReq struct { +// OperationID string `json:"operationID" binding:"required"` +// FromUserID string `json:"fromUserID" binding:"required"` +//} +//type GetFriendApplyListResp struct { +// CommResp +// FriendRequestList []*open_im_sdk.FriendRequest `json:"-"` +// Data []map[string]interface{} `json:"data" swaggerignore:"true"` +//} +// +//type GetSelfApplyListReq struct { +// OperationID string `json:"operationID" binding:"required"` +// FromUserID string `json:"fromUserID" binding:"required"` +//} +//type GetSelfApplyListResp struct { +// CommResp +// FriendRequestList []*open_im_sdk.FriendRequest `json:"-"` +// Data []map[string]interface{} `json:"data" swaggerignore:"true"` +//} -type ParamsCommFriend struct { - OperationID string `json:"operationID" binding:"required"` - ToUserID string `json:"toUserID" binding:"required"` - FromUserID string `json:"fromUserID" binding:"required"` +type FriendInfo struct { + UserID string `json:"userID"` + Nickname string `json:"nickname"` + FaceURL string `json:"faceURL"` + Gender int32 `json:"gender"` + Ex string `json:"ex"` +} + +type PublicUserInfo struct { + UserID string `json:"userID"` + Nickname string `json:"nickname"` + FaceURL string `json:"faceURL"` + Gender int32 `json:"gender"` + Ex string `json:"ex"` +} + +type FriendRequest struct { + FromUserID string `json:"fromUserID"` + FromNickname string `json:"fromNickname"` + FromFaceURL string `json:"fromFaceURL"` + FromGender int32 `json:"fromGender"` + ToUserID string `json:"toUserID"` + ToNickname string `json:"toNickname"` + ToFaceURL string `json:"toFaceURL"` + ToGender int32 `json:"toGender"` + HandleResult int32 `json:"handleResult"` + ReqMsg string `json:"reqMsg"` + CreateTime uint32 `json:"createTime"` + HandlerUserID string `json:"handlerUserID"` + HandleMsg string `json:"handleMsg"` + HandleTime uint32 `json:"handleTime"` + Ex string `json:"ex"` } type AddBlacklistReq struct { - ParamsCommFriend + ToUserID string `json:"toUserID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` } type AddBlacklistResp struct { - CommResp } type ImportFriendReq struct { FriendUserIDList []string `json:"friendUserIDList" binding:"required"` - OperationID string `json:"operationID" binding:"required"` FromUserID string `json:"fromUserID" binding:"required"` } -type UserIDResult struct { - UserID string `json:"userID"` - Result int32 `json:"result"` -} + type ImportFriendResp struct { - CommResp - UserIDResultList []UserIDResult `json:"data"` + //CommResp } type AddFriendReq struct { - ParamsCommFriend - ReqMsg string `json:"reqMsg"` + ToUserID string `json:"toUserID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` + ReqMsg string `json:"reqMsg"` } type AddFriendResp struct { - CommResp + //CommResp } type AddFriendResponseReq struct { - ParamsCommFriend - Flag int32 `json:"flag" binding:"required,oneof=-1 0 1"` - HandleMsg string `json:"handleMsg"` + ToUserID string `json:"toUserID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` + HandleResult int32 `json:"flag" binding:"required,oneof=-1 0 1"` + HandleMsg string `json:"handleMsg"` } type AddFriendResponseResp struct { - CommResp } type DeleteFriendReq struct { - ParamsCommFriend + ToUserID string `json:"toUserID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` } type DeleteFriendResp struct { - CommResp } type GetBlackListReq struct { - OperationID string `json:"operationID" binding:"required"` - FromUserID string `json:"fromUserID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` } type GetBlackListResp struct { - CommResp - BlackUserInfoList []*open_im_sdk.PublicUserInfo `json:"-"` - Data []map[string]interface{} `json:"data" swaggerignore:"true"` + BlackUserInfoList []PublicUserInfo `json:"blackUserInfoList"` } -//type PublicUserInfo struct { -// UserID string `json:"userID"` -// Nickname string `json:"nickname"` -// FaceUrl string `json:"faceUrl"` -// Gender int32 `json:"gender"` -//} - type SetFriendRemarkReq struct { - ParamsCommFriend - Remark string `json:"remark"` + ToUserID string `json:"toUserID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` + Remark string `json:"remark"` } type SetFriendRemarkResp struct { - CommResp } -type RemoveBlackListReq struct { - ParamsCommFriend +type RemoveBlacklistReq struct { + ToUserID string `json:"toUserID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` } -type RemoveBlackListResp struct { - CommResp +type RemoveBlacklistResp struct { } type IsFriendReq struct { - ParamsCommFriend + ToUserID string `json:"toUserID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` } type Response struct { Friend bool `json:"isFriend"` } type IsFriendResp struct { - CommResp Response Response `json:"data"` } -type GetFriendsInfoReq struct { - ParamsCommFriend -} -type GetFriendsInfoResp struct { - CommResp - FriendInfoList []*open_im_sdk.FriendInfo `json:"-"` - Data []map[string]interface{} `json:"data" swaggerignore:"true"` -} - type GetFriendListReq struct { OperationID string `json:"operationID" binding:"required"` FromUserID string `json:"fromUserID" binding:"required"` } type GetFriendListResp struct { - CommResp - FriendInfoList []*open_im_sdk.FriendInfo `json:"-"` - Data []map[string]interface{} `json:"data" swaggerignore:"true"` + OwnerUserID string `json:"ownerUserID"` + Remark string `json:"remark"` + CreateTime uint32 `json:"createTime"` + AddSource int32 `json:"addSource"` + OperatorUserID string `json:"operatorUserID"` + Ex string `json:"ex"` + //FriendUser *UserInfo // TODO } type GetFriendApplyListReq struct { OperationID string `json:"operationID" binding:"required"` FromUserID string `json:"fromUserID" binding:"required"` } + type GetFriendApplyListResp struct { - CommResp - FriendRequestList []*open_im_sdk.FriendRequest `json:"-"` - Data []map[string]interface{} `json:"data" swaggerignore:"true"` + FriendRequestList []FriendRequest `json:"friendRequestList"` } type GetSelfApplyListReq struct { @@ -130,7 +269,5 @@ type GetSelfApplyListReq struct { FromUserID string `json:"fromUserID" binding:"required"` } type GetSelfApplyListResp struct { - CommResp - FriendRequestList []*open_im_sdk.FriendRequest `json:"-"` - Data []map[string]interface{} `json:"data" swaggerignore:"true"` + FriendRequestList []FriendRequest `json:"friendRequestList"` } diff --git a/pkg/proto/friend/friend.pb.go b/pkg/proto/friend/friend.pb.go index c68eb3194..46a39bc7b 100644 --- a/pkg/proto/friend/friend.pb.go +++ b/pkg/proto/friend/friend.pb.go @@ -36,7 +36,7 @@ func (m *GetFriendsInfoReq) Reset() { *m = GetFriendsInfoReq{} } func (m *GetFriendsInfoReq) String() string { return proto.CompactTextString(m) } func (*GetFriendsInfoReq) ProtoMessage() {} func (*GetFriendsInfoReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{0} + return fileDescriptor_friend_ee3ed328aecab868, []int{0} } func (m *GetFriendsInfoReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetFriendsInfoReq.Unmarshal(m, b) @@ -81,7 +81,7 @@ func (m *GetFriendInfoResp) Reset() { *m = GetFriendInfoResp{} } func (m *GetFriendInfoResp) String() string { return proto.CompactTextString(m) } func (*GetFriendInfoResp) ProtoMessage() {} func (*GetFriendInfoResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{1} + return fileDescriptor_friend_ee3ed328aecab868, []int{1} } func (m *GetFriendInfoResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetFriendInfoResp.Unmarshal(m, b) @@ -121,7 +121,7 @@ func (m *AddFriendReq) Reset() { *m = AddFriendReq{} } func (m *AddFriendReq) String() string { return proto.CompactTextString(m) } func (*AddFriendReq) ProtoMessage() {} func (*AddFriendReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{2} + return fileDescriptor_friend_ee3ed328aecab868, []int{2} } func (m *AddFriendReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AddFriendReq.Unmarshal(m, b) @@ -173,7 +173,7 @@ func (m *AddFriendResp) Reset() { *m = AddFriendResp{} } func (m *AddFriendResp) String() string { return proto.CompactTextString(m) } func (*AddFriendResp) ProtoMessage() {} func (*AddFriendResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{3} + return fileDescriptor_friend_ee3ed328aecab868, []int{3} } func (m *AddFriendResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AddFriendResp.Unmarshal(m, b) @@ -212,7 +212,7 @@ func (m *ImportFriendReq) Reset() { *m = ImportFriendReq{} } func (m *ImportFriendReq) String() string { return proto.CompactTextString(m) } func (*ImportFriendReq) ProtoMessage() {} func (*ImportFriendReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{4} + return fileDescriptor_friend_ee3ed328aecab868, []int{4} } func (m *ImportFriendReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ImportFriendReq.Unmarshal(m, b) @@ -256,7 +256,7 @@ func (m *ImportFriendResp) Reset() { *m = ImportFriendResp{} } func (m *ImportFriendResp) String() string { return proto.CompactTextString(m) } func (*ImportFriendResp) ProtoMessage() {} func (*ImportFriendResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{5} + return fileDescriptor_friend_ee3ed328aecab868, []int{5} } func (m *ImportFriendResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ImportFriendResp.Unmarshal(m, b) @@ -288,7 +288,7 @@ func (m *GetFriendApplyListReq) Reset() { *m = GetFriendApplyListReq{} } func (m *GetFriendApplyListReq) String() string { return proto.CompactTextString(m) } func (*GetFriendApplyListReq) ProtoMessage() {} func (*GetFriendApplyListReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{6} + return fileDescriptor_friend_ee3ed328aecab868, []int{6} } func (m *GetFriendApplyListReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetFriendApplyListReq.Unmarshal(m, b) @@ -333,7 +333,7 @@ func (m *GetFriendApplyListResp) Reset() { *m = GetFriendApplyListResp{} func (m *GetFriendApplyListResp) String() string { return proto.CompactTextString(m) } func (*GetFriendApplyListResp) ProtoMessage() {} func (*GetFriendApplyListResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{7} + return fileDescriptor_friend_ee3ed328aecab868, []int{7} } func (m *GetFriendApplyListResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetFriendApplyListResp.Unmarshal(m, b) @@ -372,7 +372,7 @@ func (m *GetFriendListReq) Reset() { *m = GetFriendListReq{} } func (m *GetFriendListReq) String() string { return proto.CompactTextString(m) } func (*GetFriendListReq) ProtoMessage() {} func (*GetFriendListReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{8} + return fileDescriptor_friend_ee3ed328aecab868, []int{8} } func (m *GetFriendListReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetFriendListReq.Unmarshal(m, b) @@ -417,7 +417,7 @@ func (m *GetFriendListResp) Reset() { *m = GetFriendListResp{} } func (m *GetFriendListResp) String() string { return proto.CompactTextString(m) } func (*GetFriendListResp) ProtoMessage() {} func (*GetFriendListResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{9} + return fileDescriptor_friend_ee3ed328aecab868, []int{9} } func (m *GetFriendListResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetFriendListResp.Unmarshal(m, b) @@ -456,7 +456,7 @@ func (m *AddBlacklistReq) Reset() { *m = AddBlacklistReq{} } func (m *AddBlacklistReq) String() string { return proto.CompactTextString(m) } func (*AddBlacklistReq) ProtoMessage() {} func (*AddBlacklistReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{10} + return fileDescriptor_friend_ee3ed328aecab868, []int{10} } func (m *AddBlacklistReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AddBlacklistReq.Unmarshal(m, b) @@ -500,7 +500,7 @@ func (m *AddBlacklistResp) Reset() { *m = AddBlacklistResp{} } func (m *AddBlacklistResp) String() string { return proto.CompactTextString(m) } func (*AddBlacklistResp) ProtoMessage() {} func (*AddBlacklistResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{11} + return fileDescriptor_friend_ee3ed328aecab868, []int{11} } func (m *AddBlacklistResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AddBlacklistResp.Unmarshal(m, b) @@ -532,7 +532,7 @@ func (m *RemoveBlacklistReq) Reset() { *m = RemoveBlacklistReq{} } func (m *RemoveBlacklistReq) String() string { return proto.CompactTextString(m) } func (*RemoveBlacklistReq) ProtoMessage() {} func (*RemoveBlacklistReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{12} + return fileDescriptor_friend_ee3ed328aecab868, []int{12} } func (m *RemoveBlacklistReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RemoveBlacklistReq.Unmarshal(m, b) @@ -576,7 +576,7 @@ func (m *RemoveBlacklistResp) Reset() { *m = RemoveBlacklistResp{} } func (m *RemoveBlacklistResp) String() string { return proto.CompactTextString(m) } func (*RemoveBlacklistResp) ProtoMessage() {} func (*RemoveBlacklistResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{13} + return fileDescriptor_friend_ee3ed328aecab868, []int{13} } func (m *RemoveBlacklistResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RemoveBlacklistResp.Unmarshal(m, b) @@ -597,8 +597,7 @@ func (m *RemoveBlacklistResp) XXX_DiscardUnknown() { var xxx_messageInfo_RemoveBlacklistResp proto.InternalMessageInfo type GetBlacklistReq struct { - ToUserID string `protobuf:"bytes,1,opt,name=ToUserID" json:"ToUserID,omitempty"` - FromUserID string `protobuf:"bytes,2,opt,name=FromUserID" json:"FromUserID,omitempty"` + FromUserID string `protobuf:"bytes,1,opt,name=FromUserID" json:"FromUserID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -608,7 +607,7 @@ func (m *GetBlacklistReq) Reset() { *m = GetBlacklistReq{} } func (m *GetBlacklistReq) String() string { return proto.CompactTextString(m) } func (*GetBlacklistReq) ProtoMessage() {} func (*GetBlacklistReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{14} + return fileDescriptor_friend_ee3ed328aecab868, []int{14} } func (m *GetBlacklistReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetBlacklistReq.Unmarshal(m, b) @@ -628,13 +627,6 @@ func (m *GetBlacklistReq) XXX_DiscardUnknown() { var xxx_messageInfo_GetBlacklistReq proto.InternalMessageInfo -func (m *GetBlacklistReq) GetToUserID() string { - if m != nil { - return m.ToUserID - } - return "" -} - func (m *GetBlacklistReq) GetFromUserID() string { if m != nil { return m.FromUserID @@ -653,7 +645,7 @@ func (m *GetBlacklistResp) Reset() { *m = GetBlacklistResp{} } func (m *GetBlacklistResp) String() string { return proto.CompactTextString(m) } func (*GetBlacklistResp) ProtoMessage() {} func (*GetBlacklistResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{15} + return fileDescriptor_friend_ee3ed328aecab868, []int{15} } func (m *GetBlacklistResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetBlacklistResp.Unmarshal(m, b) @@ -692,7 +684,7 @@ func (m *IsFriendReq) Reset() { *m = IsFriendReq{} } func (m *IsFriendReq) String() string { return proto.CompactTextString(m) } func (*IsFriendReq) ProtoMessage() {} func (*IsFriendReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{16} + return fileDescriptor_friend_ee3ed328aecab868, []int{16} } func (m *IsFriendReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_IsFriendReq.Unmarshal(m, b) @@ -737,7 +729,7 @@ func (m *IsFriendResp) Reset() { *m = IsFriendResp{} } func (m *IsFriendResp) String() string { return proto.CompactTextString(m) } func (*IsFriendResp) ProtoMessage() {} func (*IsFriendResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{17} + return fileDescriptor_friend_ee3ed328aecab868, []int{17} } func (m *IsFriendResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_IsFriendResp.Unmarshal(m, b) @@ -776,7 +768,7 @@ func (m *IsInBlackListReq) Reset() { *m = IsInBlackListReq{} } func (m *IsInBlackListReq) String() string { return proto.CompactTextString(m) } func (*IsInBlackListReq) ProtoMessage() {} func (*IsInBlackListReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{18} + return fileDescriptor_friend_ee3ed328aecab868, []int{18} } func (m *IsInBlackListReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_IsInBlackListReq.Unmarshal(m, b) @@ -821,7 +813,7 @@ func (m *IsInBlackListResp) Reset() { *m = IsInBlackListResp{} } func (m *IsInBlackListResp) String() string { return proto.CompactTextString(m) } func (*IsInBlackListResp) ProtoMessage() {} func (*IsInBlackListResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{19} + return fileDescriptor_friend_ee3ed328aecab868, []int{19} } func (m *IsInBlackListResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_IsInBlackListResp.Unmarshal(m, b) @@ -860,7 +852,7 @@ func (m *DeleteFriendReq) Reset() { *m = DeleteFriendReq{} } func (m *DeleteFriendReq) String() string { return proto.CompactTextString(m) } func (*DeleteFriendReq) ProtoMessage() {} func (*DeleteFriendReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{20} + return fileDescriptor_friend_ee3ed328aecab868, []int{20} } func (m *DeleteFriendReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DeleteFriendReq.Unmarshal(m, b) @@ -904,7 +896,7 @@ func (m *DeleteFriendResp) Reset() { *m = DeleteFriendResp{} } func (m *DeleteFriendResp) String() string { return proto.CompactTextString(m) } func (*DeleteFriendResp) ProtoMessage() {} func (*DeleteFriendResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{21} + return fileDescriptor_friend_ee3ed328aecab868, []int{21} } func (m *DeleteFriendResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DeleteFriendResp.Unmarshal(m, b) @@ -939,7 +931,7 @@ func (m *AddFriendResponseReq) Reset() { *m = AddFriendResponseReq{} } func (m *AddFriendResponseReq) String() string { return proto.CompactTextString(m) } func (*AddFriendResponseReq) ProtoMessage() {} func (*AddFriendResponseReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{22} + return fileDescriptor_friend_ee3ed328aecab868, []int{22} } func (m *AddFriendResponseReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AddFriendResponseReq.Unmarshal(m, b) @@ -997,7 +989,7 @@ func (m *AddFriendResponseResp) Reset() { *m = AddFriendResponseResp{} } func (m *AddFriendResponseResp) String() string { return proto.CompactTextString(m) } func (*AddFriendResponseResp) ProtoMessage() {} func (*AddFriendResponseResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{23} + return fileDescriptor_friend_ee3ed328aecab868, []int{23} } func (m *AddFriendResponseResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AddFriendResponseResp.Unmarshal(m, b) @@ -1030,7 +1022,7 @@ func (m *SetFriendRemarkReq) Reset() { *m = SetFriendRemarkReq{} } func (m *SetFriendRemarkReq) String() string { return proto.CompactTextString(m) } func (*SetFriendRemarkReq) ProtoMessage() {} func (*SetFriendRemarkReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{24} + return fileDescriptor_friend_ee3ed328aecab868, []int{24} } func (m *SetFriendRemarkReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetFriendRemarkReq.Unmarshal(m, b) @@ -1081,7 +1073,7 @@ func (m *SetFriendRemarkResp) Reset() { *m = SetFriendRemarkResp{} } func (m *SetFriendRemarkResp) String() string { return proto.CompactTextString(m) } func (*SetFriendRemarkResp) ProtoMessage() {} func (*SetFriendRemarkResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{25} + return fileDescriptor_friend_ee3ed328aecab868, []int{25} } func (m *SetFriendRemarkResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetFriendRemarkResp.Unmarshal(m, b) @@ -1113,7 +1105,7 @@ func (m *GetSelfApplyListReq) Reset() { *m = GetSelfApplyListReq{} } func (m *GetSelfApplyListReq) String() string { return proto.CompactTextString(m) } func (*GetSelfApplyListReq) ProtoMessage() {} func (*GetSelfApplyListReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{26} + return fileDescriptor_friend_ee3ed328aecab868, []int{26} } func (m *GetSelfApplyListReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetSelfApplyListReq.Unmarshal(m, b) @@ -1158,7 +1150,7 @@ func (m *GetSelfApplyListResp) Reset() { *m = GetSelfApplyListResp{} } func (m *GetSelfApplyListResp) String() string { return proto.CompactTextString(m) } func (*GetSelfApplyListResp) ProtoMessage() {} func (*GetSelfApplyListResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{27} + return fileDescriptor_friend_ee3ed328aecab868, []int{27} } func (m *GetSelfApplyListResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetSelfApplyListResp.Unmarshal(m, b) @@ -1684,57 +1676,58 @@ var _Friend_serviceDesc = grpc.ServiceDesc{ Metadata: "friend/friend.proto", } -func init() { proto.RegisterFile("friend/friend.proto", fileDescriptor_friend_268d4d8b889bd130) } +func init() { proto.RegisterFile("friend/friend.proto", fileDescriptor_friend_ee3ed328aecab868) } -var fileDescriptor_friend_268d4d8b889bd130 = []byte{ - // 783 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4b, 0x4f, 0xdb, 0x40, - 0x10, 0x56, 0x4a, 0x4b, 0xc9, 0x10, 0x9a, 0x64, 0x92, 0x40, 0x6a, 0x1e, 0x85, 0x3d, 0x21, 0x24, - 0x12, 0x89, 0xaa, 0x52, 0xa5, 0xaa, 0x87, 0x50, 0x0a, 0x72, 0xd5, 0x00, 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- 0x76, 0x2b, 0x5b, 0x8b, 0x8d, 0x24, 0xf0, 0x04, 0xd6, 0x46, 0xf2, 0x5b, 0x80, 0xcd, 0x54, 0xfe, - 0x39, 0xd0, 0xdb, 0x05, 0x16, 0x12, 0xd8, 0x81, 0x92, 0x2e, 0xd1, 0x34, 0x6e, 0x48, 0x0d, 0x91, - 0xf9, 0x53, 0x69, 0x66, 0x1b, 0x48, 0xe0, 0x37, 0x28, 0xdb, 0x71, 0x0e, 0x46, 0x65, 0xee, 0x9c, - 0xa6, 0x7b, 0x65, 0x73, 0xa1, 0x8d, 0x04, 0x7e, 0x80, 0x95, 0x71, 0xc0, 0x5c, 0x58, 0x9b, 0x3b, - 0x4a, 0xb4, 0xa8, 0xd4, 0xd3, 0x4a, 0xbf, 0x17, 0x63, 0x99, 0x74, 0xa2, 0x5e, 0x24, 0xb9, 0x2d, - 0xea, 0x45, 0x9a, 0xa5, 0x3a, 0x50, 0x1a, 0x49, 0x34, 0x1f, 0xf5, 0x22, 0xf1, 0x96, 0x28, 0xcd, - 0x6c, 0x83, 0x0f, 0x61, 0x48, 0xec, 0x13, 0x41, 0x24, 0x28, 0x2e, 0x82, 0x48, 0x92, 0x15, 0x5e, - 0x42, 0x55, 0x4f, 0xb2, 0x02, 0x6e, 0x65, 0xde, 0xd3, 0x80, 0xc6, 0x94, 0xed, 0x47, 0xac, 0xfe, - 0x80, 0x28, 0xfe, 0x93, 0x47, 0x03, 0x4a, 0xf3, 0x4c, 0x34, 0xa0, 0x0c, 0x66, 0x70, 0x0f, 0x38, - 0x96, 0x96, 0xb4, 0xe8, 0x80, 0x89, 0xcd, 0x30, 0x3a, 0x60, 0x72, 0xa7, 0x3b, 0xde, 0xbb, 0x7a, - 0xe7, 0xee, 0xf4, 0x7d, 0xb5, 0x2b, 0x2d, 0xf3, 0xbe, 0xf3, 0x27, 0xff, 0x73, 0xbd, 0xec, 0x29, - 0xdf, 0xff, 0x0f, 0x00, 0x00, 0xff, 0xff, 0x6e, 0x13, 0x7c, 0xdf, 0x1a, 0x0c, 0x00, 0x00, +var fileDescriptor_friend_ee3ed328aecab868 = []byte{ + // 790 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4b, 0x4f, 0xdb, 0x4e, + 0x10, 0x57, 0xfe, 0xfc, 0x4b, 0xc9, 0x10, 0x9a, 0x64, 0x92, 0x40, 0x6a, 0x1e, 0x85, 0x3d, 0x21, + 0x24, 0x12, 0x95, 0xaa, 0x52, 0xa5, 0xaa, 0x87, 0x50, 0x0a, 0x72, 0xd5, 0x00, 0x75, 0xda, 0x0b, + 0x52, 0x15, 0x99, 0x78, 0x13, 0xa2, 0x38, 0xf1, 0xe2, 0x31, 0xa0, 0x7e, 0x8f, 0xde, 0xfb, 0x55, + 0x2b, 0x3f, 0x62, 0xaf, 0x1f, 0x81, 0x03, 0x3e, 0x59, 0xf3, 0xfa, 0xcd, 0xec, 0xcc, 0xfa, 0xb7, + 0x03, 0xb5, 0xa1, 0x3d, 0xe6, 0x33, 0xa3, 0xed, 0x7f, 0x5a, 0xc2, 0xb6, 0x1c, 0x0b, 0x97, 0x7d, + 0x49, 0xd9, 0xbf, 0x10, 0x7c, 0x76, 0xa8, 0x76, 0x0f, 0x7b, 0xdc, 0xbe, 0xe7, 0x76, 0x5b, 0x4c, + 0x46, 0x6d, 0xcf, 0xa3, 0x4d, 0xc6, 0xa4, 0xff, 0x40, 0xed, 0x07, 0xf2, 0x23, 0xd8, 0x05, 0x54, + 0xcf, 0xb8, 0x73, 0xea, 0x85, 0x91, 0x3a, 0x1b, 0x5a, 0x1a, 0xbf, 0x45, 0x05, 0x56, 0x7e, 0x58, + 0x3f, 0x89, 0xdb, 0xea, 0x49, 0xb3, 0xb0, 0x5b, 0xd8, 0x2f, 0x6a, 0xa1, 0x8c, 0x3b, 0x00, 0xa7, + 0xb6, 0x35, 0x0d, 0xac, 0xff, 0x79, 0x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 0xc6, 0x9d, 0x1e, 0x37, 0x87, 0xb9, 0x11, 0xeb, 0x10, 0xea, 0x69, + 0xc8, 0xfc, 0x69, 0xf5, 0xe8, 0xef, 0x4b, 0x08, 0xd6, 0x03, 0xfc, 0x00, 0x45, 0x7d, 0xde, 0x5f, + 0xac, 0xb7, 0x82, 0x15, 0x42, 0x7e, 0x5a, 0x95, 0x46, 0x86, 0x96, 0x04, 0xf6, 0x00, 0x47, 0xa9, + 0x57, 0x00, 0xb7, 0xe7, 0xce, 0x99, 0xcf, 0x8e, 0xb2, 0xf3, 0x98, 0x99, 0x04, 0x76, 0xa1, 0x32, + 0x4a, 0x74, 0x00, 0x37, 0xa5, 0x98, 0x64, 0xbb, 0x95, 0xad, 0xc5, 0x46, 0x12, 0x78, 0x02, 0x6b, + 0x23, 0x99, 0xef, 0xb1, 0x99, 0xca, 0x3f, 0x07, 0x7a, 0xbd, 0xc0, 0x42, 0x02, 0x3b, 0x50, 0xd2, + 0x25, 0x2a, 0xc6, 0x0d, 0xa9, 0x21, 0x32, 0x47, 0x2a, 0xcd, 0x6c, 0x03, 0x09, 0xfc, 0x0a, 0x65, + 0x3b, 0xce, 0xb3, 0xa8, 0xcc, 0x9d, 0xd3, 0x94, 0xae, 0x6c, 0x2e, 0xb4, 0x91, 0xc0, 0xf7, 0xb0, + 0x32, 0x0e, 0x98, 0x0b, 0x6b, 0x73, 0x47, 0x89, 0x16, 0x95, 0x7a, 0x5a, 0xe9, 0xf7, 0x62, 0x2c, + 0x93, 0x4e, 0xd4, 0x8b, 0x24, 0xb7, 0x45, 0xbd, 0x48, 0xb3, 0x54, 0x07, 0x4a, 0x23, 0x89, 0xe6, + 0xa3, 0x5e, 0x24, 0xde, 0x0b, 0xa5, 0x99, 0x6d, 0xf0, 0x21, 0x0c, 0x89, 0x7d, 0x22, 0x88, 0x04, + 0xc5, 0x45, 0x10, 0x49, 0xb2, 0xc2, 0x4b, 0xa8, 0xea, 0x49, 0x56, 0xc0, 0xad, 0xcc, 0x7b, 0x1a, + 0xd0, 0x98, 0xb2, 0xfd, 0x88, 0xd5, 0x1f, 0x10, 0xc5, 0x7f, 0xf2, 0x68, 0x40, 0x69, 0x9e, 0x89, + 0x06, 0x94, 0xc1, 0x0c, 0xee, 0x01, 0xc7, 0xd2, 0x22, 0x16, 0x1d, 0x30, 0xb1, 0xfd, 0x45, 0x07, + 0x4c, 0xee, 0x6d, 0xc7, 0x7b, 0x57, 0x6f, 0xdc, 0xbd, 0xbd, 0xaf, 0x76, 0xa5, 0x85, 0xdd, 0x77, + 0xfe, 0xe8, 0x7f, 0xae, 0x97, 0x3d, 0xe5, 0xbb, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xfe, 0xab, + 0x18, 0x07, 0xfe, 0x0b, 0x00, 0x00, } diff --git a/pkg/proto/friend/friend.proto b/pkg/proto/friend/friend.proto index 10e54b956..56158cb11 100644 --- a/pkg/proto/friend/friend.proto +++ b/pkg/proto/friend/friend.proto @@ -67,8 +67,7 @@ message RemoveBlacklistResp{ } message GetBlacklistReq{ - string ToUserID = 1; - string FromUserID = 2; + string FromUserID = 1; } message GetBlacklistResp{ repeated server_api_params.PublicUserInfo BlackUserInfoList = 1; From 21ea555183900eb1ed474fa7645082fb23eb280b Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Mon, 16 Jan 2023 18:50:05 +0800 Subject: [PATCH 12/13] 1 --- .../im_mysql_model/friend_model.go | 162 +++++++++--------- .../im_mysql_model/friend_model_k.go | 2 +- 2 files changed, 82 insertions(+), 82 deletions(-) diff --git a/pkg/common/db/mysql_model/im_mysql_model/friend_model.go b/pkg/common/db/mysql_model/im_mysql_model/friend_model.go index 4bba5931d..b5ef1306a 100644 --- a/pkg/common/db/mysql_model/im_mysql_model/friend_model.go +++ b/pkg/common/db/mysql_model/im_mysql_model/friend_model.go @@ -1,83 +1,83 @@ package im_mysql_model -import ( - "fmt" - "time" -) - -func InsertToFriend(toInsertFollow *Friend) error { - toInsertFollow.CreateTime = time.Now() - err := FriendDB.Table("friends").Create(toInsertFollow).Error - if err != nil { - return err - } - return nil -} - -func GetFriendRelationshipFromFriend(OwnerUserID, FriendUserID string) (*Friend, error) { - var friend Friend - err := FriendDB.Table("friends").Where("owner_user_id=? and friend_user_id=?", OwnerUserID, FriendUserID).Take(&friend).Error - if err != nil { - return nil, err - } - return &friend, err -} - -func GetFriendListByUserID(OwnerUserID string) ([]Friend, error) { - var friends []Friend - var x Friend - x.OwnerUserID = OwnerUserID - err := FriendDB.Table("friends").Where("owner_user_id=?", OwnerUserID).Find(&friends).Error - if err != nil { - return nil, err - } - return friends, nil -} - -func GetFriendIDListByUserID(OwnerUserID string) ([]string, error) { - var friendIDList []string - err := FriendDB.Table("friends").Where("owner_user_id=?", OwnerUserID).Pluck("friend_user_id", &friendIDList).Error - if err != nil { - return nil, err - } - return friendIDList, nil -} - -func UpdateFriendComment(OwnerUserID, FriendUserID, Remark string) error { - return FriendDB.Exec("update friends set remark=? where owner_user_id=? and friend_user_id=?", Remark, OwnerUserID, FriendUserID).Error -} - -func DeleteSingleFriendInfo(OwnerUserID, FriendUserID string) error { - return FriendDB.Table("friends").Where("owner_user_id=? and friend_user_id=?", OwnerUserID, FriendUserID).Delete(Friend{}).Error -} - -type FriendUser struct { - Friend - Nickname string `gorm:"column:name;size:255"` -} - -func GetUserFriendsCMS(ownerUserID, friendUserName string, pageNumber, showNumber int32) (friendUserList []*FriendUser, count int64, err error) { - db := FriendDB.Table("friends"). - Select("friends.*, users.name"). - Where("friends.owner_user_id=?", ownerUserID).Limit(int(showNumber)). - Joins("left join users on friends.friend_user_id = users.user_id"). - Offset(int(showNumber * (pageNumber - 1))) - if friendUserName != "" { - db = db.Where("users.name like ?", fmt.Sprintf("%%%s%%", friendUserName)) - } - if err = db.Count(&count).Error; err != nil { - return - } - err = db.Find(&friendUserList).Error - return -} - -func GetFriendByIDCMS(ownerUserID, friendUserID string) (friendUser *FriendUser, err error) { - friendUser = &FriendUser{} - err = FriendDB.Table("friends"). - Select("friends.*, users.name"). - Where("friends.owner_user_id=? and friends.friend_user_id=?", ownerUserID, friendUserID). - Joins("left join users on friends.friend_user_id = users.user_id"). - Take(friendUser).Error - return friendUser, err -} +//import ( +// "fmt" +// "time" +//) +// +//func InsertToFriend(toInsertFollow *Friend) error { +// toInsertFollow.CreateTime = time.Now() +// err := FriendDB.Table("friends").Create(toInsertFollow).Error +// if err != nil { +// return err +// } +// return nil +//} +// +//func GetFriendRelationshipFromFriend(OwnerUserID, FriendUserID string) (*Friend, error) { +// var friend Friend +// err := FriendDB.Table("friends").Where("owner_user_id=? and friend_user_id=?", OwnerUserID, FriendUserID).Take(&friend).Error +// if err != nil { +// return nil, err +// } +// return &friend, err +//} +// +//func GetFriendListByUserID(OwnerUserID string) ([]Friend, error) { +// var friends []Friend +// var x Friend +// x.OwnerUserID = OwnerUserID +// err := FriendDB.Table("friends").Where("owner_user_id=?", OwnerUserID).Find(&friends).Error +// if err != nil { +// return nil, err +// } +// return friends, nil +//} +// +//func GetFriendIDListByUserID(OwnerUserID string) ([]string, error) { +// var friendIDList []string +// err := FriendDB.Table("friends").Where("owner_user_id=?", OwnerUserID).Pluck("friend_user_id", &friendIDList).Error +// if err != nil { +// return nil, err +// } +// return friendIDList, nil +//} +// +//func UpdateFriendComment(OwnerUserID, FriendUserID, Remark string) error { +// return FriendDB.Exec("update friends set remark=? where owner_user_id=? and friend_user_id=?", Remark, OwnerUserID, FriendUserID).Error +//} +// +//func DeleteSingleFriendInfo(OwnerUserID, FriendUserID string) error { +// return FriendDB.Table("friends").Where("owner_user_id=? and friend_user_id=?", OwnerUserID, FriendUserID).Delete(Friend{}).Error +//} +// +//type FriendUser struct { +// Friend +// Nickname string `gorm:"column:name;size:255"` +//} +// +//func GetUserFriendsCMS(ownerUserID, friendUserName string, pageNumber, showNumber int32) (friendUserList []*FriendUser, count int64, err error) { +// db := FriendDB.Table("friends"). +// Select("friends.*, users.name"). +// Where("friends.owner_user_id=?", ownerUserID).Limit(int(showNumber)). +// Joins("left join users on friends.friend_user_id = users.user_id"). +// Offset(int(showNumber * (pageNumber - 1))) +// if friendUserName != "" { +// db = db.Where("users.name like ?", fmt.Sprintf("%%%s%%", friendUserName)) +// } +// if err = db.Count(&count).Error; err != nil { +// return +// } +// err = db.Find(&friendUserList).Error +// return +//} +// +//func GetFriendByIDCMS(ownerUserID, friendUserID string) (friendUser *FriendUser, err error) { +// friendUser = &FriendUser{} +// err = FriendDB.Table("friends"). +// Select("friends.*, users.name"). +// Where("friends.owner_user_id=? and friends.friend_user_id=?", ownerUserID, friendUserID). +// Joins("left join users on friends.friend_user_id = users.user_id"). +// Take(friendUser).Error +// return friendUser, err +//} diff --git a/pkg/common/db/mysql_model/im_mysql_model/friend_model_k.go b/pkg/common/db/mysql_model/im_mysql_model/friend_model_k.go index cdb317db9..dfbae4e87 100644 --- a/pkg/common/db/mysql_model/im_mysql_model/friend_model_k.go +++ b/pkg/common/db/mysql_model/im_mysql_model/friend_model_k.go @@ -68,7 +68,7 @@ func (f *Friend) Find(ctx context.Context, ownerUserID string) (friends []*Frien func (f *Friend) Take(ctx context.Context, ownerUserID, friendUserID string) (friend *Friend, err error) { friend = &Friend{} - defer trace_log.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "ownerUserID", ownerUserID, "friendUserID", friendUserID, "group", *friend) + defer trace_log.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "ownerUserID", ownerUserID, "friendUserID", friendUserID, "friend", friend) return friend, utils.Wrap(f.db.Where("owner_user_id = ? and friend_user_id", ownerUserID, friendUserID).Take(friend).Error, "") } From 38013d272b3663c37912aced88ad323bcc145a47 Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Mon, 16 Jan 2023 19:14:05 +0800 Subject: [PATCH 13/13] 1 --- internal/api_to_rpc/copy.go | 123 +++++++++++++++++++----------------- 1 file changed, 66 insertions(+), 57 deletions(-) diff --git a/internal/api_to_rpc/copy.go b/internal/api_to_rpc/copy.go index f2a887bb3..60e9cc94a 100644 --- a/internal/api_to_rpc/copy.go +++ b/internal/api_to_rpc/copy.go @@ -6,25 +6,6 @@ import ( "reflect" ) -func setBaseValue(from, to reflect.Value) { - if isBaseNil(from) { - return - } - var l int - t := to.Type() - for t.Kind() == reflect.Ptr { - l++ - t = t.Elem() - } - v := baseValue(from) - for i := 0; i < l; i++ { - t := reflect.New(v.Type()) - t.Elem().Set(v) - v = t - } - to.Set(v) -} - func CopyAny(from, to interface{}) { t := reflect.ValueOf(to) if t.Kind() == reflect.Ptr { @@ -50,31 +31,35 @@ func copyAny(from, to reflect.Value) { if isBaseNil(to) { to.Set(getBaseZeroValue(to.Type())) } - btfrom := baseType(from.Type()) - btto := baseType(to.Type()) - if typeEq(btfrom, btto) { + btFrom := baseType(from.Type()) + btTo := baseType(to.Type()) + if btTo.Kind() == reflect.Interface || typeEq(btFrom, btTo) { setBaseValue(from, to) return } - if _, ok := wrapType[btto.String()]; ok { // string -> wrapperspb.StringValue - val := reflect.New(btto).Elem() + if _, ok := wrapType[btTo.String()]; ok { // string -> wrapperspb.StringValue + val := reflect.New(btTo).Elem() copyAny(from, val.FieldByName("Value")) setBaseValue(val, to) return } - if _, ok := wrapType[btfrom.String()]; ok { // wrapperspb.StringValue -> string + if _, ok := wrapType[btFrom.String()]; ok { // wrapperspb.StringValue -> string copyAny(baseValue(from).FieldByName("Value"), to) return } - if btfrom.Kind() == reflect.Struct && btto.Kind() == reflect.Struct { + if btFrom.Kind() == reflect.Struct && btTo.Kind() == reflect.Struct { copyStruct(baseValue(from), baseValue(to)) return } - if btfrom.Kind() == reflect.Slice && btto.Kind() == reflect.Slice { + if btFrom.Kind() == reflect.Slice && btTo.Kind() == reflect.Slice { copySlice(baseValue(from), baseValue(to)) return } - if btto.Kind() == reflect.String { + if btFrom.Kind() == reflect.Map && btTo.Kind() == reflect.Map { + copyMap(baseValue(from), baseValue(to)) + return + } + if btTo.Kind() == reflect.String { if isBaseNil(to) { to.Set(getBaseZeroValue(baseType(to.Type()))) } @@ -84,6 +69,26 @@ func copyAny(from, to reflect.Value) { if toNumber(from, to) { return } + +} + +func setBaseValue(from, to reflect.Value) { + if isBaseNil(from) { + return + } + var l int + t := to.Type() + for t.Kind() == reflect.Ptr { + l++ + t = t.Elem() + } + v := baseValue(from) + for i := 0; i < l; i++ { + t := reflect.New(v.Type()) + t.Elem().Set(v) + v = t + } + to.Set(v) } func getBaseZeroValue(t reflect.Type) reflect.Value { @@ -121,15 +126,6 @@ func baseType(t reflect.Type) reflect.Type { return t } -func baseLayer(t reflect.Type) int { - var layer int - for t.Kind() == reflect.Ptr { - layer++ - t = t.Elem() - } - return layer -} - func typeEq(t1, t2 reflect.Type) bool { return t1.String() == t2.String() } @@ -174,59 +170,72 @@ func copySlice(from, to reflect.Value) { to.Set(temp) } +func copyMap(from, to reflect.Value) { + // todo copy map +} + func toString(value reflect.Value) string { if value.Kind() == reflect.Slice { switch value.Type().String() { - case "[]uint8": + case "[]uint8": // []byte -> []uint8 return string(value.Interface().([]uint8)) - case "[]int32": + case "[]int32": // []rune -> []int32 return string(value.Interface().([]int32)) } } return fmt.Sprint(value.Interface()) } -func toNumber(from1, to1 reflect.Value) bool { - if isBaseNil(to1) { - to1.Set(getBaseZeroValue(to1.Type())) +func toNumber(from, to reflect.Value) bool { + initTo := func() { + if isBaseNil(to) { + to.Set(getBaseZeroValue(to.Type())) + } } - from := baseValue(from1) - to := baseValue(to1) - switch from.Kind() { + switch baseValue(from).Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - switch to.Kind() { + switch baseValue(to).Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - to.SetInt(from.Int()) + initTo() + baseValue(to).SetInt(baseValue(from).Int()) return true case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: - to.SetUint(uint64(from.Int())) + initTo() + baseValue(to).SetUint(uint64(baseValue(from).Int())) return true case reflect.Float64, reflect.Float32: - to.SetFloat(float64(from.Int())) + initTo() + baseValue(to).SetFloat(float64(baseValue(from).Int())) return true } case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: - switch to.Kind() { + switch baseValue(to).Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - to.SetInt(int64(from.Uint())) + initTo() + baseValue(to).SetInt(int64(baseValue(from).Uint())) return true case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: - to.SetInt(int64(from.Uint())) + initTo() + baseValue(to).SetInt(int64(baseValue(from).Uint())) return true case reflect.Float64, reflect.Float32: - to.SetFloat(float64(from.Uint())) + initTo() + baseValue(to).SetFloat(float64(baseValue(from).Uint())) return true } case reflect.Float64, reflect.Float32: - switch to.Kind() { + switch baseValue(to).Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - to.SetInt(int64(from.Float())) + initTo() + baseValue(to).SetInt(int64(baseValue(from).Float())) return true case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: - to.SetUint(uint64(from.Float())) + initTo() + baseValue(to).SetUint(uint64(baseValue(from).Float())) return true case reflect.Float64, reflect.Float32: - to.SetFloat(from.Float()) + initTo() + baseValue(to).SetFloat(baseValue(from).Float()) return true } }