Merge branch 'errcode' of github.com:OpenIMSDK/Open-IM-Server into errcode

test-errcode
wangchuxiao 2 years ago
commit e0d05e1fa8

@ -1,4 +1,4 @@
package utils
package convert
import (
"Open_IM/pkg/common/db/relation"
@ -34,14 +34,14 @@ func NewPBFriend(friendInfo *sdk.FriendInfo) *PBFriend {
return &PBFriend{FriendInfo: friendInfo}
}
func (db *DBFriend) convert() (*sdk.FriendInfo, error) {
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
}
CopyStructFields(pbFriend.FriendUser, user[0])
utils.CopyStructFields(pbFriend.FriendUser, user[0])
pbFriend.CreateTime = db.CreateTime.Unix()
pbFriend.FriendUser.CreateTime = db.CreateTime.Unix()
@ -50,9 +50,9 @@ func (db *DBFriend) convert() (*sdk.FriendInfo, error) {
func (pb *PBFriend) Convert() (*relation.Friend, error) {
dbFriend := &relation.Friend{}
CopyStructFields(dbFriend, pb)
utils.CopyStructFields(dbFriend, pb)
dbFriend.FriendUserID = pb.FriendUser.UserID
dbFriend.CreateTime = UnixSecondToTime(pb.CreateTime)
dbFriend.CreateTime = utils.UnixSecondToTime(pb.CreateTime)
return dbFriend, nil
}
@ -126,7 +126,7 @@ func (pb *PBBlack) Convert() (*relation.Black, error) {
func (db *DBBlack) Convert() (*sdk.BlackInfo, error) {
pbBlack := &sdk.BlackInfo{}
utils.CopyStructFields(pbBlack, db)
pbBlack.CreateTime = uint32(db.CreateTime.Unix())
pbBlack.CreateTime = db.CreateTime.Unix()
user, err := getUsersInfo([]string{db.BlockUserID})
if err != nil {
return nil, err
@ -248,8 +248,8 @@ func (pb *PBGroupRequest) Convert() (*relation.GroupRequest, error) {
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())
dst.ReqTime = db.ReqTime.Unix()
dst.HandleTime = db.HandledTime.Unix()
return dst, nil
}

@ -0,0 +1,70 @@
package friend
import (
"Open_IM/internal/common/check"
"Open_IM/internal/common/convert"
chat "Open_IM/internal/rpc/msg"
"Open_IM/pkg/common/db/relation"
"Open_IM/pkg/common/token_verify"
"Open_IM/pkg/common/tracelog"
pbFriend "Open_IM/pkg/proto/friend"
"context"
)
func (s *friendServer) GetBlacks(ctx context.Context, req *pbFriend.GetBlacksReq) (*pbFriend.GetBlacksResp, error) {
resp := &pbFriend.GetBlacksResp{}
if err := check.Access(ctx, req.UserID); err != nil {
return nil, err
}
blacks, total, err := s.BlackInterface.FindOwnerBlacks(ctx, req.UserID, req.Pagination.PageNumber, req.Pagination.ShowNumber)
if err != nil {
return nil, err
}
blackIDList := make([]string, 0, len(blacks))
for _, black := range blacks {
b, err := convert.NewDBBlack(black).Convert()
if err != nil {
return nil, err
}
resp.Blacks = append(resp.Blacks, b)
blackIDList = append(blackIDList, black.BlockUserID)
}
resp.Total = int32(total)
return resp, nil
}
func (s *friendServer) IsBlack(ctx context.Context, req *pbFriend.IsBlackReq) (*pbFriend.IsBlackResp, error) {
resp := &pbFriend.IsBlackResp{}
in1, in2, err := s.BlackInterface.CheckIn(ctx, req.UserID1, req.UserID2)
if err != nil {
return nil, err
}
resp.InUser1Blacks = in1
resp.InUser2Blacks = in2
return resp, nil
}
func (s *friendServer) RemoveBlack(ctx context.Context, req *pbFriend.RemoveBlackReq) (*pbFriend.RemoveBlackResp, error) {
resp := &pbFriend.RemoveBlackResp{}
if err := check.Access(ctx, req.OwnerUserID); err != nil {
return nil, err
}
if err := s.BlackInterface.Delete(ctx, []*relation.Black{{OwnerUserID: req.OwnerUserID, BlockUserID: req.BlackUserID}}); err != nil {
return nil, err
}
chat.BlackDeletedNotification(req)
return resp, nil
}
func (s *friendServer) AddBlack(ctx context.Context, req *pbFriend.AddBlackReq) (*pbFriend.AddBlackResp, error) {
resp := &pbFriend.AddBlackResp{}
if err := token_verify.CheckAccessV3(ctx, req.OwnerUserID); err != nil {
return nil, err
}
black := relation.Black{OwnerUserID: req.OwnerUserID, BlockUserID: req.BlackUserID, OperatorUserID: tracelog.GetOpUserID(ctx)}
if err := s.BlackInterface.Create(ctx, []*relation.Black{&black}); err != nil {
return nil, err
}
chat.BlackAddedNotification(req)
return resp, nil
}

@ -1,17 +1,17 @@
package friend
import (
"Open_IM/internal/common/convert"
chat "Open_IM/internal/rpc/msg"
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant"
"Open_IM/pkg/common/db/controller"
"Open_IM/pkg/common/tracelog"
"Open_IM/pkg/common/db/relation"
"Open_IM/pkg/common/log"
"Open_IM/pkg/common/middleware"
promePkg "Open_IM/pkg/common/prometheus"
"Open_IM/pkg/common/token_verify"
"Open_IM/pkg/common/tracelog"
"Open_IM/pkg/getcdv3"
pbFriend "Open_IM/pkg/proto/friend"
sdkws "Open_IM/pkg/proto/sdk_ws"
@ -115,19 +115,6 @@ func (s *friendServer) Run() {
}
}
func (s *friendServer) AddBlack(ctx context.Context, req *pbFriend.AddBlackReq) (*pbFriend.AddBlackResp, error) {
resp := &pbFriend.AddBlackResp{}
if err := token_verify.CheckAccessV3(ctx, req.OwnerUserID); err != nil {
return nil, err
}
black := relation.Black{OwnerUserID: req.OwnerUserID, BlockUserID: req.BlackUserID, OperatorUserID: tracelog.OpUserID(ctx)}
if err := s.BlackInterface.Create(ctx, []*relation.Black{&black}); err != nil {
return nil, err
}
chat.BlackAddedNotification(req)
return resp, nil
}
func (s *friendServer) AddFriend(ctx context.Context, req *pbFriend.AddFriendReq) (*pbFriend.AddFriendResp, error) {
resp := &pbFriend.AddFriendResp{}
if err := token_verify.CheckAccessV3(ctx, req.FromUserID); err != nil {
@ -157,7 +144,7 @@ func (s *friendServer) AddFriend(ctx context.Context, req *pbFriend.AddFriendReq
return resp, nil
}
func (s *friendServer) ImportFriend(ctx context.Context, req *pbFriend.ImportFriendReq) (*pbFriend.ImportFriendResp, error) {
func (s *friendServer) ImportFriends(ctx context.Context, req *pbFriend.ImportFriendReq) (*pbFriend.ImportFriendResp, error) {
resp := &pbFriend.ImportFriendResp{}
if err := token_verify.CheckAdmin(ctx); err != nil {
return nil, err
@ -168,7 +155,7 @@ func (s *friendServer) ImportFriend(ctx context.Context, req *pbFriend.ImportFri
var friends []*relation.Friend
for _, userID := range utils.RemoveDuplicateElement(req.FriendUserIDs) {
friends = append(friends, &relation.Friend{OwnerUserID: userID, FriendUserID: req.OwnerUserID, AddSource: constant.BecomeFriendByImport, OperatorUserID: tools.OpUserID(ctx)})
friends = append(friends, &relation.Friend{OwnerUserID: userID, FriendUserID: req.OwnerUserID, AddSource: constant.BecomeFriendByImport, OperatorUserID: tracelog.GetOpUserID(ctx)})
}
if len(friends) > 0 {
if err := s.FriendInterface.BecomeFriend(ctx, friends); err != nil {
@ -181,7 +168,7 @@ func (s *friendServer) ImportFriend(ctx context.Context, req *pbFriend.ImportFri
// process Friend application
func (s *friendServer) RespondFriendApply(ctx context.Context, req *pbFriend.RespondFriendApplyReq) (*pbFriend.RespondFriendApplyResp, error) {
resp := &pbFriend.RespondFriendApplyResp{}
if err := token_verify.CheckAccessV3(ctx, req.ToUserID); err != nil {
if err := check.Access(ctx, req.ToUserID); err != nil {
return nil, err
}
friendRequest := relation.FriendRequest{FromUserID: req.FromUserID, ToUserID: req.ToUserID, HandleMsg: req.HandleMsg, HandleResult: req.HandleResult}
@ -206,7 +193,7 @@ func (s *friendServer) RespondFriendApply(ctx context.Context, req *pbFriend.Res
func (s *friendServer) DeleteFriend(ctx context.Context, req *pbFriend.DeleteFriendReq) (*pbFriend.DeleteFriendResp, error) {
resp := &pbFriend.DeleteFriendResp{}
if err := token_verify.CheckAccessV3(ctx, req.OwnerUserID); err != nil {
if err := check.Access(ctx, req.OwnerUserID); err != nil {
return nil, err
}
if err := s.FriendInterface.Delete(ctx, req.OwnerUserID, req.FriendUserID); err != nil {
@ -218,35 +205,22 @@ func (s *friendServer) DeleteFriend(ctx context.Context, req *pbFriend.DeleteFri
func (s *friendServer) SetFriendRemark(ctx context.Context, req *pbFriend.SetFriendRemarkReq) (*pbFriend.SetFriendRemarkResp, error) {
resp := &pbFriend.SetFriendRemarkResp{}
if err := token_verify.CheckAccessV3(ctx, req.OwnerUserID); err != nil {
if err := check.Access(ctx, req.OwnerUserID); err != nil {
return nil, err
}
if err := s.FriendInterface.UpdateRemark(ctx, req.OwnerUserID, req.FriendUserID, req.Remark); err != nil {
return nil, err
}
chat.FriendRemarkSetNotification(tools.OperationID(ctx), tools.OpUserID(ctx), req.OwnerUserID, req.FriendUserID)
chat.FriendRemarkSetNotification(tracelog.GetOperationID(ctx), tracelog.GetOpUserID(ctx), req.OwnerUserID, req.FriendUserID)
return resp, nil
}
func (s *friendServer) RemoveBlacklist(ctx context.Context, req *pbFriend.RemoveBlackReq) (*pbFriend.RemoveBlackResp, error) {
resp := &pbFriend.RemoveBlacklistResp{}
//Parse token, to find current user information
if err := token_verify.CheckAccessV3(ctx, req.FromUserID); err != nil {
func (s *friendServer) GetFriends(ctx context.Context, req *pbFriend.GetFriendsReq) (*pbFriend.GetFriendsResp, error) {
resp := &pbFriend.GetFriendsResp{}
if err := check.Access(ctx, req.UserID); err != nil {
return nil, err
}
if err := s.BlackInterface.Delete(ctx, []*relation.Black{{OwnerUserID: req.FromUserID, BlockUserID: req.ToUserID}}); err != nil {
return nil, err
}
chat.BlackDeletedNotification(req)
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.FromUserID); err != nil {
return nil, err
}
friends, err := s.FriendInterface.FindOwnerUserID(ctx, req.FromUserID)
friends, err := s.FriendInterface.FindOwnerFriends(ctx, req.UserID, req.Pagination.PageNumber, req.Pagination.ShowNumber)
if err != nil {
return nil, err
}
@ -254,7 +228,7 @@ func (s *friendServer) GetFriendList(ctx context.Context, req *pbFriend.GetFrien
for _, f := range friends {
userIDList = append(userIDList, f.FriendUserID)
}
users, err := GetUsersInfo(ctx, userIDList)
users, err := check.GetUsersInfo(ctx, userIDList)
if err != nil {
return nil, err
}
@ -263,124 +237,79 @@ func (s *friendServer) GetFriendList(ctx context.Context, req *pbFriend.GetFrien
userMap[user.UserID] = users[i]
}
for _, friendUser := range friends {
friendUserInfo := sdkws.FriendInfo{FriendUser: userMap[friendUser.FriendUserID]}
utils.CopyStructFields(&friendUserInfo, friendUser)
resp.FriendInfoList = append(resp.FriendInfoList, &friendUserInfo)
}
return resp, nil
}
// received
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.FromUserID); err != nil {
return nil, err
}
// Find the current user friend applications received
friendRequests, err := s.friendRequestModel.FindToUserID(ctx, req.FromUserID)
if err != nil {
return nil, err
}
userIDList := make([]string, 0, len(friendRequests))
for _, f := range friendRequests {
userIDList = append(userIDList, f.FromUserID)
}
users, err := GetPublicUserInfoBatch(ctx, userIDList)
if err != nil {
return nil, err
}
userMap := make(map[string]*sdkws.PublicUserInfo)
for i, user := range users {
userMap[user.UserID] = users[i]
}
for _, friendRequest := range friendRequests {
var userInfo sdkws.FriendRequest
if u, ok := userMap[friendRequest.FromUserID]; ok {
utils.CopyStructFields(&userInfo, u)
friendUserInfo, err := (convert.NewDBFriend(friendUser)).Convert()
if err != nil {
return nil, err
}
utils.CopyStructFields(&userInfo, friendRequest)
resp.FriendRequestList = append(resp.FriendRequestList, &userInfo)
resp.FriendsInfo = append(resp.FriendsInfo, friendUserInfo)
}
return resp, nil
}
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.FromUserID); err != nil {
// 获取接收到的好友申请(即别人主动申请的)
func (s *friendServer) GetToFriendsApply(ctx context.Context, req *pbFriend.GetToFriendsApplyReq) (*pbFriend.GetToFriendsApplyResp, error) {
resp := &pbFriend.GetToFriendsApplyResp{}
if err := check.Access(ctx, req.UserID); err != nil {
return nil, err
}
// Find the self add other userinfo
friendRequests, err := s.FriendRequestInterface.FindFromUserID(ctx, req.FromUserID)
friendRequests, err := s.FriendInterface.FindFriendRequestToMe(ctx, req.UserID, req.Pagination.PageNumber, req.Pagination.ShowNumber)
if err != nil {
return nil, err
}
userIDList := make([]string, 0, len(friendRequests))
for _, f := range friendRequests {
userIDList = append(userIDList, f.ToUserID)
}
users, err := GetPublicUserInfoBatch(ctx, userIDList)
if err != nil {
return nil, err
}
userMap := make(map[string]*sdkws.PublicUserInfo)
for i, user := range users {
userMap[user.UserID] = users[i]
}
for _, friendRequest := range friendRequests {
var userInfo sdkws.FriendRequest
if u, ok := userMap[friendRequest.ToUserID]; ok {
utils.CopyStructFields(&userInfo, u)
for _, v := range friendRequests {
fUser, err := convert.NewDBFriendRequest(v).Convert()
if err != nil {
return nil, err
}
utils.CopyStructFields(&userInfo, friendRequest)
resp.FriendRequestList = append(resp.FriendRequestList, &userInfo)
resp.FriendRequests = append(resp.FriendRequests, fUser)
}
return resp, nil
}
func (s *friendServer) GetBlacklist(ctx context.Context, req *pbFriend.GetBlacklistReq) (*pbFriend.GetBlacklistResp, error) {
resp := &pbFriend.GetBlacklistResp{}
if err := token_verify.CheckAccessV3(ctx, req.FromUserID); err != nil {
// 获取主动发出去的好友申请列表
func (s *friendServer) GetFromFriendsApply(ctx context.Context, req *pbFriend.GetFromFriendsApplyReq) (*pbFriend.GetFromFriendsApplyResp, error) {
resp := &pbFriend.GetFromFriendsApplyResp{}
if err := check.Access(ctx, req.UserID); err != nil {
return nil, err
}
blacks, err := s.BlackInterface.FindByOwnerUserID(ctx, req.FromUserID)
friendRequests, err := s.FriendInterface.FindFriendRequestFromMe(ctx, req.UserID, req.Pagination.PageNumber, req.Pagination.ShowNumber)
if err != nil {
return nil, err
}
blackIDList := make([]string, 0, len(blacks))
for _, black := range blacks {
blackIDList = append(blackIDList, black.BlockUserID)
}
resp.BlackUserInfoList, err = GetPublicUserInfoBatch(ctx, blackIDList)
if err != nil {
return nil, err
for _, v := range friendRequests {
fUser, err := convert.NewDBFriendRequest(v).Convert()
if err != nil {
return nil, err
}
resp.FriendRequests = append(resp.FriendRequests, fUser)
}
return resp, nil
}
func (s *friendServer) IsInBlackList(ctx context.Context, req *pbFriend.IsInBlackListReq) (*pbFriend.IsInBlackListResp, error) {
resp := &pbFriend.IsInBlackListResp{}
if err := token_verify.CheckAccessV3(ctx, req.FromUserID); err != nil {
return nil, err
}
exist, err := s.BlackInterface.IsExist(ctx, req.FromUserID, req.ToUserID)
func (s *friendServer) IsFriend(ctx context.Context, req *pbFriend.IsFriendReq) (*pbFriend.IsFriendResp, error) {
resp := &pbFriend.IsFriendResp{}
err, in1, in2 := s.FriendInterface.CheckIn(ctx, req.UserID1, req.UserID2)
if err != nil {
return nil, err
}
resp.Response = exist
resp.InUser1Friends = in1
resp.InUser2Friends = in2
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.FromUserID); err != nil {
return nil, err
}
exist, err := s.FriendInterface.IsExist(ctx, req.FromUserID, req.ToUserID)
func (s *friendServer) GetFriendsInfo(ctx context.Context, req *pbFriend.GetFriendsInfoReq) (*pbFriend.GetFriendsInfoResp, error) {
resp := pbFriend.GetFriendsInfoResp{}
friends, err := s.FriendInterface.FindFriends(ctx, req.OwnerUserID, req.FriendUserIDs)
if err != nil {
return nil, err
}
resp.Response = exist
return resp, nil
for _, v := range friends {
fUser, err := convert.NewDBFriend(v).Convert()
if err != nil {
return nil, err
}
resp.FriendsInfo = append(resp.FriendsInfo, fUser)
}
return &resp, nil
}

@ -1,6 +1,7 @@
package user
import (
"Open_IM/internal/common/convert"
chat "Open_IM/internal/rpc/msg"
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant"
@ -9,6 +10,7 @@ import (
"Open_IM/pkg/common/log"
promePkg "Open_IM/pkg/common/prometheus"
"Open_IM/pkg/common/token_verify"
"Open_IM/pkg/common/tracelog"
"Open_IM/pkg/getcdv3"
pbFriend "Open_IM/pkg/proto/friend"
pbGroup "Open_IM/pkg/proto/group"
@ -171,7 +173,7 @@ func (s *userServer) GetUsersInfo(ctx context.Context, req *pbUser.GetUsersInfoR
return nil, err
}
for _, v := range users {
n, err := utils.NewDBUser(v).Convert()
n, err := convert.NewDBUser(v).Convert()
if err != nil {
return nil, err
}
@ -188,13 +190,13 @@ func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbUser.UpdateUserI
}
oldNickname := ""
if req.UserInfo.Nickname != "" {
u, err := s.Take(ctx, req.UserInfo.UserID)
u, err := s.Find(ctx, []string{req.UserInfo.UserID})
if err != nil {
return nil, err
}
oldNickname = u.Nickname
oldNickname = u[0].Nickname
}
user, err := utils.NewPBUser(req.UserInfo).Convert()
user, err := convert.NewPBUser(req.UserInfo).Convert()
if err != nil {
return nil, err
}
@ -207,23 +209,23 @@ func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbUser.UpdateUserI
return nil, err
}
client := pbFriend.NewFriendClient(etcdConn)
newReq := &pbFriend.GetFriendListReq{UserID: req.UserInfo.UserID}
rpcResp, err := client.GetFriendList(context.Background(), newReq)
newReq := &pbFriend.GetFriendsReq{UserID: req.UserInfo.UserID}
rpcResp, err := client.GetFriends(context.Background(), newReq)
if err != nil {
return nil, err
}
go func() {
for _, v := range rpcResp.FriendInfoList {
chat.FriendInfoUpdatedNotification(utils.OperationID(ctx), req.UserInfo.UserID, v.FriendUser.UserID, utils.OpUserID(ctx))
for _, v := range rpcResp.FriendsInfo {
chat.FriendInfoUpdatedNotification(tracelog.GetOperationID(ctx), req.UserInfo.UserID, v.FriendUser.UserID, tracelog.GetOpUserID(ctx))
}
}()
chat.UserInfoUpdatedNotification(utils.OperationID(ctx), utils.OpUserID(ctx), req.UserInfo.UserID)
chat.UserInfoUpdatedNotification(tracelog.GetOperationID(ctx), tracelog.GetOpUserID(ctx), req.UserInfo.UserID)
if req.UserInfo.FaceURL != "" {
s.SyncJoinedGroupMemberFaceURL(ctx, req.UserInfo.UserID, req.UserInfo.FaceURL, utils.OperationID(ctx), utils.OpUserID(ctx))
s.SyncJoinedGroupMemberFaceURL(ctx, req.UserInfo.UserID, req.UserInfo.FaceURL, tracelog.GetOperationID(ctx), tracelog.GetOpUserID(ctx))
}
if req.UserInfo.Nickname != "" {
s.SyncJoinedGroupMemberNickname(ctx, req.UserInfo.UserID, req.UserInfo.Nickname, oldNickname, utils.OperationID(ctx), utils.OpUserID(ctx))
s.SyncJoinedGroupMemberNickname(ctx, req.UserInfo.UserID, req.UserInfo.Nickname, oldNickname, tracelog.GetOperationID(ctx), tracelog.GetOpUserID(ctx))
}
return &resp, nil
}
@ -236,13 +238,13 @@ func (s *userServer) SetGlobalRecvMessageOpt(ctx context.Context, req *pbUser.Se
if err != nil {
return nil, err
}
chat.UserInfoUpdatedNotification(utils.OperationID(ctx), req.UserID, req.UserID)
chat.UserInfoUpdatedNotification(tracelog.GetOperationID(ctx), req.UserID, req.UserID)
return &resp, nil
}
func (s *userServer) AccountCheck(ctx context.Context, req *pbUser.AccountCheckReq) (*pbUser.AccountCheckResp, error) {
resp := pbUser.AccountCheckResp{}
err := token_verify.CheckManagerUserID(ctx, utils.OpUserID(ctx))
err := token_verify.CheckManagerUserID(ctx, tracelog.GetOpUserID(ctx))
if err != nil {
return nil, err
}
@ -272,12 +274,12 @@ func (s *userServer) GetUsers(ctx context.Context, req *pbUser.GetUsersReq) (*pb
resp := pbUser.GetUsersResp{}
var err error
if req.UserID != "" {
u, err := s.Take(ctx, req.UserID)
u, err := s.Find(ctx, []string{req.UserID})
if err != nil {
return nil, err
}
resp.Total = 1
u1, err := utils.NewDBUser(u).Convert()
u1, err := convert.NewDBUser(u[0]).Convert()
if err != nil {
return nil, err
}
@ -292,7 +294,7 @@ func (s *userServer) GetUsers(ctx context.Context, req *pbUser.GetUsersReq) (*pb
}
resp.Total = int32(total)
for _, v := range usersDB {
u1, err := utils.NewDBUser(v).Convert()
u1, err := convert.NewDBUser(v).Convert()
if err != nil {
return nil, err
}
@ -306,7 +308,7 @@ func (s *userServer) GetUsers(ctx context.Context, req *pbUser.GetUsersReq) (*pb
}
resp.Total = int32(total)
for _, v := range usersDB {
u1, err := utils.NewDBUser(v).Convert()
u1, err := convert.NewDBUser(v).Convert()
if err != nil {
return nil, err
}
@ -323,7 +325,7 @@ func (s *userServer) GetUsers(ctx context.Context, req *pbUser.GetUsersReq) (*pb
resp.Total = int32(total)
for _, userDB := range usersDB {
u, err := utils.NewDBUser(userDB).Convert()
u, err := convert.NewDBUser(userDB).Convert()
if err != nil {
return nil, err
}

@ -3,17 +3,19 @@ package controller
import (
"Open_IM/pkg/common/db/relation"
"context"
"errors"
"gorm.io/gorm"
)
type BlackInterface interface {
// Create 增加黑名单
Create(ctx context.Context, blacks []*relation.Black) (err error)
// Delete 删除黑名单
Delete(ctx context.Context, blacks []*relation.Black) (err error)
UpdateByMap(ctx context.Context, ownerUserID, blockUserID string, args map[string]interface{}) (err error)
Update(ctx context.Context, blacks []*relation.Black) (err error)
Find(ctx context.Context, blacks []*relation.Black) (blackList []*relation.Black, err error)
Take(ctx context.Context, ownerUserID, blockUserID string) (black *relation.Black, err error)
FindByOwnerUserID(ctx context.Context, ownerUserID string) (blackList []*relation.Black, err error)
// FindOwnerBlacks 获取黑名单列表
FindOwnerBlacks(ctx context.Context, ownerUserID string, pageNumber, showNumber int32) (blacks []*relation.Black, total int64, err error)
// CheckIn 检查user2是否在user1的黑名单列表中(inUser1Blacks==true) 检查user1是否在user2的黑名单列表中(inUser2Blacks==true)
CheckIn(ctx context.Context, userID1, userID2 string) (inUser1Blacks bool, inUser2Blacks bool, err error)
}
type BlackController struct {
@ -23,36 +25,36 @@ type BlackController struct {
func NewBlackController(db *gorm.DB) *BlackController {
return &BlackController{database: NewBlackDatabase(db)}
}
func (f *BlackController) Create(ctx context.Context, blacks []*relation.Black) (err error) {
return f.database.Create(ctx, blacks)
}
func (f *BlackController) Delete(ctx context.Context, blacks []*relation.Black) (err error) {
return f.database.Delete(ctx, blacks)
}
func (f *BlackController) UpdateByMap(ctx context.Context, ownerUserID, blockUserID string, args map[string]interface{}) (err error) {
return f.database.UpdateByMap(ctx, ownerUserID, blockUserID, args)
}
func (f *BlackController) Update(ctx context.Context, blacks []*relation.Black) (err error) {
return f.database.Update(ctx, blacks)
// Create 增加黑名单
func (b *BlackController) Create(ctx context.Context, blacks []*relation.Black) (err error) {
return b.database.Create(ctx, blacks)
}
func (f *BlackController) Find(ctx context.Context, blacks []*relation.Black) (blackList []*relation.Black, err error) {
return f.database.Find(ctx, blacks)
// Delete 删除黑名单
func (b *BlackController) Delete(ctx context.Context, blacks []*relation.Black) (err error) {
return b.database.Delete(ctx, blacks)
}
func (f *BlackController) Take(ctx context.Context, ownerUserID, blockUserID string) (black *relation.Black, err error) {
return f.database.Take(ctx, ownerUserID, blockUserID)
// FindOwnerBlacks 获取黑名单列表
func (b *BlackController) FindOwnerBlacks(ctx context.Context, ownerUserID string, pageNumber, showNumber int32) (blackList []*relation.Black, total int64, err error) {
return b.database.FindOwnerBlacks(ctx, ownerUserID, pageNumber, showNumber)
}
func (f *BlackController) FindByOwnerUserID(ctx context.Context, ownerUserID string) (blackList []*relation.Black, err error) {
return f.database.FindByOwnerUserID(ctx, ownerUserID)
// CheckIn 检查user2是否在user1的黑名单列表中(inUser1Blacks==true) 检查user1是否在user2的黑名单列表中(inUser2Blacks==true)
func (b *BlackController) CheckIn(ctx context.Context, userID1, userID2 string) (inUser1Blacks bool, inUser2Blacks bool, err error) {
return b.database.CheckIn(ctx, userID1, userID2)
}
type BlackDatabaseInterface interface {
// Create 增加黑名单
Create(ctx context.Context, blacks []*relation.Black) (err error)
// Delete 删除黑名单
Delete(ctx context.Context, blacks []*relation.Black) (err error)
UpdateByMap(ctx context.Context, ownerUserID, blockUserID string, args map[string]interface{}) (err error)
Update(ctx context.Context, blacks []*relation.Black) (err error)
Find(ctx context.Context, blacks []*relation.Black) (blackList []*relation.Black, err error)
Take(ctx context.Context, ownerUserID, blockUserID string) (black *relation.Black, err error)
FindByOwnerUserID(ctx context.Context, ownerUserID string) (blackList []*relation.Black, err error)
// FindOwnerBlacks 获取黑名单列表
FindOwnerBlacks(ctx context.Context, ownerUserID string, pageNumber, showNumber int32) (blacks []*relation.Black, total int64, err error)
// CheckIn 检查user2是否在user1的黑名单列表中(inUser1Blacks==true) 检查user1是否在user2的黑名单列表中(inUser2Blacks==true)
CheckIn(ctx context.Context, userID1, userID2 string) (inUser1Blacks bool, inUser2Blacks bool, err error)
}
type BlackDatabase struct {
@ -67,24 +69,42 @@ func NewBlackDatabase(db *gorm.DB) *BlackDatabase {
return database
}
func (f *BlackDatabase) Create(ctx context.Context, blacks []*relation.Black) (err error) {
return f.sqlDB.Create(ctx, blacks)
}
func (f *BlackDatabase) Delete(ctx context.Context, blacks []*relation.Black) (err error) {
return f.sqlDB.Delete(ctx, blacks)
// Create 增加黑名单
func (b *BlackDatabase) Create(ctx context.Context, blacks []*relation.Black) (err error) {
return b.sqlDB.Create(ctx, blacks)
}
func (f *BlackDatabase) UpdateByMap(ctx context.Context, ownerUserID, blockUserID string, args map[string]interface{}) (err error) {
return f.sqlDB.UpdateByMap(ctx, ownerUserID, blockUserID, args)
}
func (f *BlackDatabase) Update(ctx context.Context, blacks []*relation.Black) (err error) {
return f.sqlDB.Update(ctx, blacks)
}
func (f *BlackDatabase) Find(ctx context.Context, blacks []*relation.Black) (blackList []*relation.Black, err error) {
return f.sqlDB.Find(ctx, blacks)
// Delete 删除黑名单
func (b *BlackDatabase) Delete(ctx context.Context, blacks []*relation.Black) (err error) {
return b.sqlDB.Delete(ctx, blacks)
}
func (f *BlackDatabase) Take(ctx context.Context, ownerUserID, blockUserID string) (black *relation.Black, err error) {
return f.sqlDB.Take(ctx, ownerUserID, blockUserID)
// FindOwnerBlacks 获取黑名单列表
func (b *BlackDatabase) FindOwnerBlacks(ctx context.Context, ownerUserID string, pageNumber, showNumber int32) (blacks []*relation.Black, total int64, err error) {
return b.sqlDB.FindOwnerBlacks(ctx, ownerUserID, pageNumber, showNumber)
}
func (f *BlackDatabase) FindByOwnerUserID(ctx context.Context, ownerUserID string) (blackList []*relation.Black, err error) {
return f.sqlDB.FindByOwnerUserID(ctx, ownerUserID)
// CheckIn 检查user2是否在user1的黑名单列表中(inUser1Blacks==true) 检查user1是否在user2的黑名单列表中(inUser2Blacks==true)
func (b *BlackDatabase) CheckIn(ctx context.Context, userID1, userID2 string) (inUser1Blacks bool, inUser2Blacks bool, err error) {
_, err = b.sqlDB.Take(ctx, userID1, userID2)
if err != nil {
if errors.Unwrap(err) != gorm.ErrRecordNotFound {
return
}
inUser1Blacks = false
} else {
inUser1Blacks = true
}
inUser2Blacks = true
_, err = b.sqlDB.Take(ctx, userID2, userID1)
if err != nil {
if errors.Unwrap(err) != gorm.ErrRecordNotFound {
return
}
inUser2Blacks = false
} else {
inUser2Blacks = true
}
return
}

@ -7,25 +7,30 @@ import (
)
type FriendInterface interface {
// CheckIn 检查fromUserID是否在toUserID的好友列表中(inTo==true) 检查toUserID是否在fromUserID的好友列表中(inFrom==true)
CheckIn(ctx context.Context, fromUserID, toUserID string) (err error, inTo bool, inFrom bool)
// CheckIn 检查user2是否在user1的好友列表中(inUser1Friends==true) 检查user1是否在user2的好友列表中(inUser2Friends==true)
CheckIn(ctx context.Context, user1, user2 string) (err error, inUser1Friends bool, inUser2Friends bool)
// AddFriendRequest 增加或者更新好友申请
AddFriendRequest(ctx context.Context, fromUserID, toUserID string, reqMsg string, ex string) (err error)
// 先判断是否在好友表,如果在则不插入
// BecomeFriend 先判断是否在好友表,如果在则不插入
BecomeFriend(ctx context.Context, friends []*relation.Friend) (err error)
//拒绝好友申请
// RefuseFriendRequest 拒绝好友申请
RefuseFriendRequest(ctx context.Context, friendRequest *relation.FriendRequest) (err error)
// 同意好友申请
// AgreeFriendRequest 同意好友申请
AgreeFriendRequest(ctx context.Context, friendRequest *relation.FriendRequest) (err error)
Create(ctx context.Context, friends []*relation.Friend) (err error)
// Delete 删除好友
Delete(ctx context.Context, ownerUserID string, friendUserIDs string) (err error)
UpdateByMap(ctx context.Context, ownerUserID string, args map[string]interface{}) (err error)
Update(ctx context.Context, friends []*relation.Friend) (err error)
// UpdateRemark 更新好友备注
UpdateRemark(ctx context.Context, ownerUserID, friendUserID, remark string) (err error)
FindOwnerUserID(ctx context.Context, ownerUserID string) (friends []*relation.Friend, err error)
FindFriendUserID(ctx context.Context, friendUserID string) (friends []*relation.Friend, err error)
Take(ctx context.Context, ownerUserID, friendUserID string) (friend *relation.Friend, err error)
FindUserState(ctx context.Context, userID1, userID2 string) (friends []*relation.Friend, err error)
// FindOwnerFriends 获取ownerUserID的好友列表
FindOwnerFriends(ctx context.Context, ownerUserID string, pageNumber, showNumber int32) (friends []*relation.Friend, err error)
// FindInWhoseFriends friendUserID在哪些人的好友列表中
FindInWhoseFriends(ctx context.Context, friendUserID string, pageNumber, showNumber int32) (friends []*relation.Friend, err error)
// FindFriendRequestFromMe 获取我发出去的好友申请
FindFriendRequestFromMe(ctx context.Context, userID string, pageNumber, showNumber int32) (friends []*relation.FriendRequest, err error)
// FindFriendRequestToMe 获取我收到的的好友申请
FindFriendRequestToMe(ctx context.Context, userID string, pageNumber, showNumber int32) (friends []*relation.FriendRequest, err error)
// FindFriends 获取某人指定好友的信息
FindFriends(ctx context.Context, ownerUserID string, friendUserIDs []string) (friends []*relation.Friend, err error)
}
type FriendController struct {
@ -36,44 +41,79 @@ func NewFriendController(db *gorm.DB) *FriendController {
return &FriendController{database: NewFriendDatabase(db)}
}
func (f *FriendController) Create(ctx context.Context, friends []*relation.Friend) (err error) {
return f.database.Create(ctx, friends)
// CheckIn 检查user2是否在user1的好友列表中(inUser1Friends==true) 检查user1是否在user2的好友列表中(inUser2Friends==true)
func (f *FriendController) CheckIn(ctx context.Context, user1, user2 string) (err error, inUser1Friends bool, inUser2Friends bool) {
}
func (f *FriendController) Delete(ctx context.Context, ownerUserID string, friendUserIDs string) (err error) {
return f.database.Delete(ctx, ownerUserID, friendUserIDs)
// AddFriendRequest 增加或者更新好友申请
func (f *FriendController) AddFriendRequest(ctx context.Context, fromUserID, toUserID string, reqMsg string, ex string) (err error) {
}
// BecomeFriend 先判断是否在好友表,如果在则不插入
func (f *FriendController) BecomeFriend(ctx context.Context, friends []*relation.Friend) (err error) {
}
// RefuseFriendRequest 拒绝好友申请
func (f *FriendController) RefuseFriendRequest(ctx context.Context, friendRequest *relation.FriendRequest) (err error) {
}
func (f *FriendController) UpdateByMap(ctx context.Context, ownerUserID string, args map[string]interface{}) (err error) {
return f.database.UpdateByMap(ctx, ownerUserID, args)
// AgreeFriendRequest 同意好友申请
func (f *FriendController) AgreeFriendRequest(ctx context.Context, friendRequest *relation.FriendRequest) (err error) {
}
func (f *FriendController) Update(ctx context.Context, friends []*relation.Friend) (err error) {
return f.database.Update(ctx, friends)
// Delete 删除好友
func (f *FriendController) Delete(ctx context.Context, ownerUserID string, friendUserIDs string) (err error) {
}
// UpdateRemark 更新好友备注
func (f *FriendController) UpdateRemark(ctx context.Context, ownerUserID, friendUserID, remark string) (err error) {
return f.database.UpdateRemark(ctx, ownerUserID, friendUserID, remark)
}
func (f *FriendController) FindOwnerUserID(ctx context.Context, ownerUserID string) (friends []*relation.Friend, err error) {
return f.database.FindOwnerUserID(ctx, ownerUserID)
// FindOwnerFriends 获取ownerUserID的好友列表
func (f *FriendController) FindOwnerFriends(ctx context.Context, ownerUserID string, pageNumber, showNumber int32) (friends []*relation.Friend, err error) {
}
func (f *FriendController) FindFriendUserID(ctx context.Context, friendUserID string) (friends []*relation.Friend, err error) {
return f.database.FindFriendUserID(ctx, friendUserID)
// FindInWhoseFriends friendUserID在哪些人的好友列表中
func (f *FriendController) FindInWhoseFriends(ctx context.Context, friendUserID string, pageNumber, showNumber int32) (friends []*relation.Friend, err error) {
}
func (f *FriendController) Take(ctx context.Context, ownerUserID, friendUserID string) (friend *relation.Friend, err error) {
return f.database.Take(ctx, ownerUserID, friendUserID)
// FindFriendRequestFromMe 获取我发出去的好友申请
func (f *FriendController) FindFriendRequestFromMe(ctx context.Context, userID string, pageNumber, showNumber int32) (friends []*relation.FriendRequest, err error) {
}
func (f *FriendController) FindUserState(ctx context.Context, userID1, userID2 string) (friends []*relation.Friend, err error) {
return f.database.FindUserState(ctx, userID1, userID2)
// FindFriendRequestToMe 获取我收到的的好友申请
func (f *FriendController) FindFriendRequestToMe(ctx context.Context, userID string, pageNumber, showNumber int32) (friends []*relation.FriendRequest, err error) {
}
// FindFriends 获取某人指定好友的信息
func (f *FriendController) FindFriends(ctx context.Context, ownerUserID string, friendUserIDs []string) (friends []*relation.Friend, err error) {
}
type FriendDatabaseInterface interface {
Create(ctx context.Context, friends []*relation.Friend) (err error)
// CheckIn 检查user2是否在user1的好友列表中(inUser1Friends==true) 检查user1是否在user2的好友列表中(inUser2Friends==true)
CheckIn(ctx context.Context, user1, user2 string) (err error, inUser1Friends bool, inUser2Friends bool)
// AddFriendRequest 增加或者更新好友申请
AddFriendRequest(ctx context.Context, fromUserID, toUserID string, reqMsg string, ex string) (err error)
// BecomeFriend 先判断是否在好友表,如果在则不插入
BecomeFriend(ctx context.Context, friends []*relation.Friend) (err error)
// RefuseFriendRequest 拒绝好友申请
RefuseFriendRequest(ctx context.Context, friendRequest *relation.FriendRequest) (err error)
// AgreeFriendRequest 同意好友申请
AgreeFriendRequest(ctx context.Context, friendRequest *relation.FriendRequest) (err error)
// Delete 删除好友
Delete(ctx context.Context, ownerUserID string, friendUserIDs string) (err error)
UpdateByMap(ctx context.Context, ownerUserID string, args map[string]interface{}) (err error)
Update(ctx context.Context, friends []*relation.Friend) (err error)
// UpdateRemark 更新好友备注
UpdateRemark(ctx context.Context, ownerUserID, friendUserID, remark string) (err error)
FindOwnerUserID(ctx context.Context, ownerUserID string) (friends []*relation.Friend, err error)
FindFriendUserID(ctx context.Context, friendUserID string) (friends []*relation.Friend, err error)
Take(ctx context.Context, ownerUserID, friendUserID string) (friend *relation.Friend, err error)
FindUserState(ctx context.Context, userID1, userID2 string) (friends []*relation.Friend, err error)
// FindOwnerFriends 获取ownerUserID的好友列表
FindOwnerFriends(ctx context.Context, ownerUserID string, pageNumber, showNumber int32) (friends []*relation.Friend, err error)
// FindInWhoseFriends friendUserID在哪些人的好友列表中
FindInWhoseFriends(ctx context.Context, friendUserID string, pageNumber, showNumber int32) (friends []*relation.Friend, err error)
// FindFriendRequestFromMe 获取我发出去的好友申请
FindFriendRequestFromMe(ctx context.Context, userID string, pageNumber, showNumber int32) (friends []*relation.FriendRequest, err error)
// FindFriendRequestToMe 获取我收到的的好友申请
FindFriendRequestToMe(ctx context.Context, userID string, pageNumber, showNumber int32) (friends []*relation.FriendRequest, err error)
// FindFriends 获取某人指定好友的信息
FindFriends(ctx context.Context, ownerUserID string, friendUserIDs []string) (friends []*relation.Friend, err error)
}
type FriendDatabase struct {
@ -88,30 +128,50 @@ func NewFriendDatabase(db *gorm.DB) *FriendDatabase {
return database
}
func (f *FriendDatabase) Create(ctx context.Context, friends []*relation.Friend) (err error) {
return f.sqlDB.Create(ctx, friends)
// CheckIn 检查user2是否在user1的好友列表中(inUser1Friends==true) 检查user1是否在user2的好友列表中(inUser2Friends==true)
func (f *FriendDatabase) CheckIn(ctx context.Context, user1, user2 string) (err error, inUser1Friends bool, inUser2Friends bool) {
}
func (f *FriendDatabase) Delete(ctx context.Context, ownerUserID string, friendUserIDs string) (err error) {
return f.sqlDB.Delete(ctx, ownerUserID, friendUserIDs)
// AddFriendRequest 增加或者更新好友申请
func (f *FriendDatabase) AddFriendRequest(ctx context.Context, fromUserID, toUserID string, reqMsg string, ex string) (err error) {
}
func (f *FriendDatabase) UpdateByMap(ctx context.Context, ownerUserID string, args map[string]interface{}) (err error) {
return f.sqlDB.UpdateByMap(ctx, ownerUserID, args)
// BecomeFriend 先判断是否在好友表,如果在则不插入
func (f *FriendDatabase) BecomeFriend(ctx context.Context, friends []*relation.Friend) (err error) {
}
// RefuseFriendRequest 拒绝好友申请
func (f *FriendDatabase) RefuseFriendRequest(ctx context.Context, friendRequest *relation.FriendRequest) (err error) {
}
// AgreeFriendRequest 同意好友申请
func (f *FriendDatabase) AgreeFriendRequest(ctx context.Context, friendRequest *relation.FriendRequest) (err error) {
}
func (f *FriendDatabase) Update(ctx context.Context, friends []*relation.Friend) (err error) {
return f.sqlDB.Update(ctx, friends)
// Delete 删除好友
func (f *FriendDatabase) Delete(ctx context.Context, ownerUserID string, friendUserIDs string) (err error) {
}
// UpdateRemark 更新好友备注
func (f *FriendDatabase) UpdateRemark(ctx context.Context, ownerUserID, friendUserID, remark string) (err error) {
return f.sqlDB.UpdateRemark(ctx, ownerUserID, friendUserID, remark)
}
func (f *FriendDatabase) FindOwnerUserID(ctx context.Context, ownerUserID string) (friends []*relation.Friend, err error) {
return f.sqlDB.FindOwnerUserID(ctx, ownerUserID)
// FindOwnerFriends 获取ownerUserID的好友列表
func (f *FriendDatabase) FindOwnerFriends(ctx context.Context, ownerUserID string, pageNumber, showNumber int32) (friends []*relation.Friend, err error) {
}
func (f *FriendDatabase) FindFriendUserID(ctx context.Context, friendUserID string) (friends []*relation.Friend, err error) {
return f.sqlDB.FindFriendUserID(ctx, friendUserID)
// FindInWhoseFriends friendUserID在哪些人的好友列表中
func (f *FriendDatabase) FindInWhoseFriends(ctx context.Context, friendUserID string, pageNumber, showNumber int32) (friends []*relation.Friend, err error) {
}
func (f *FriendDatabase) Take(ctx context.Context, ownerUserID, friendUserID string) (friend *relation.Friend, err error) {
return f.sqlDB.Take(ctx, ownerUserID, friendUserID)
// FindFriendRequestFromMe 获取我发出去的好友申请
func (f *FriendDatabase) FindFriendRequestFromMe(ctx context.Context, userID string, pageNumber, showNumber int32) (friends []*relation.FriendRequest, err error) {
}
// FindFriendRequestToMe 获取我收到的的好友申请
func (f *FriendDatabase) FindFriendRequestToMe(ctx context.Context, userID string, pageNumber, showNumber int32) (friends []*relation.FriendRequest, err error) {
}
func (f *FriendDatabase) FindUserState(ctx context.Context, userID1, userID2 string) (friends []*relation.Friend, err error) {
return f.sqlDB.FindUserState(ctx, userID1, userID2)
// FindFriends 获取某人指定好友的信息
func (f *FriendDatabase) FindFriends(ctx context.Context, ownerUserID string, friendUserIDs []string) (friends []*relation.Friend, err error) {
}

@ -1,110 +0,0 @@
package controller
import (
"Open_IM/pkg/common/db/relation"
"context"
"gorm.io/gorm"
)
type FriendRequestInterface interface {
Create(ctx context.Context, friends []*relation.FriendRequest) (err error)
Delete(ctx context.Context, fromUserID, toUserID string) (err error)
UpdateByMap(ctx context.Context, ownerUserID string, args map[string]interface{}) (err error)
Update(ctx context.Context, friends []*relation.FriendRequest) (err error)
Find(ctx context.Context, ownerUserID string) (friends []*relation.FriendRequest, err error)
Take(ctx context.Context, fromUserID, toUserID string) (friend *relation.FriendRequest, err error)
FindToUserID(ctx context.Context, toUserID string) (friends []*relation.FriendRequest, err error)
FindFromUserID(ctx context.Context, fromUserID string) (friends []*relation.FriendRequest, err error)
}
type FriendRequestController struct {
database FriendRequestInterface
}
func NewFriendRequestController(db *gorm.DB) *FriendRequestController {
return &FriendRequestController{database: NewFriendRequestDatabase(db)}
}
func (f *FriendRequestController) Create(ctx context.Context, friends []*relation.FriendRequest) (err error) {
return f.database.Create(ctx, friends)
}
func (f *FriendRequestController) Delete(ctx context.Context, fromUserID, toUserID string) (err error) {
return f.database.Delete(ctx, fromUserID, toUserID)
}
func (f *FriendRequestController) UpdateByMap(ctx context.Context, ownerUserID string, args map[string]interface{}) (err error) {
return f.database.UpdateByMap(ctx, ownerUserID, args)
}
func (f *FriendRequestController) Update(ctx context.Context, friends []*relation.FriendRequest) (err error) {
return f.database.Update(ctx, friends)
}
func (f *FriendRequestController) Find(ctx context.Context, ownerUserID string) (friends []*relation.FriendRequest, err error) {
return f.database.Find(ctx, ownerUserID)
}
func (f *FriendRequestController) Take(ctx context.Context, fromUserID, toUserID string) (friend *relation.FriendRequest, err error) {
return f.database.Take(ctx, fromUserID, toUserID)
}
func (f *FriendRequestController) FindToUserID(ctx context.Context, toUserID string) (friends []*relation.FriendRequest, err error) {
return f.database.FindToUserID(ctx, toUserID)
}
func (f *FriendRequestController) FindFromUserID(ctx context.Context, fromUserID string) (friends []*relation.FriendRequest, err error) {
return f.database.FindFromUserID(ctx, fromUserID)
}
type FriendRequestDatabaseInterface interface {
Create(ctx context.Context, friends []*relation.FriendRequest) (err error)
Delete(ctx context.Context, fromUserID, toUserID string) (err error)
UpdateByMap(ctx context.Context, ownerUserID string, args map[string]interface{}) (err error)
Update(ctx context.Context, friends []*relation.FriendRequest) (err error)
Find(ctx context.Context, ownerUserID string) (friends []*relation.FriendRequest, err error)
Take(ctx context.Context, fromUserID, toUserID string) (friend *relation.FriendRequest, err error)
FindToUserID(ctx context.Context, toUserID string) (friends []*relation.FriendRequest, err error)
FindFromUserID(ctx context.Context, fromUserID string) (friends []*relation.FriendRequest, err error)
}
type FriendRequestDatabase struct {
sqlDB *relation.FriendRequest
friend *FriendDatabase
}
func (f *FriendRequestDatabase) Update(ctx context.Context, friends []*relation.FriendRequest) (err error) {
return f.sqlDB.DB.Transaction(func(tx *gorm.DB) error {
if err := f.sqlDB.Update(ctx, friends); err != nil {
return err
}
if err := f.friend.Update(); err != nil {
return err
}
return nil
})
}
func NewFriendRequestDatabase(db *gorm.DB) *FriendRequestDatabase {
sqlDB := relation.NewFriendRequest(db)
database := &FriendRequestDatabase{
sqlDB: sqlDB,
}
return database
}
func (f *FriendRequestDatabase) Create(ctx context.Context, friends []*relation.FriendRequest) (err error) {
return f.sqlDB.Create(ctx, friends)
}
func (f *FriendRequestDatabase) Delete(ctx context.Context, fromUserID, toUserID string) (err error) {
return f.sqlDB.Delete(ctx, fromUserID, toUserID)
}
func (f *FriendRequestDatabase) UpdateByMap(ctx context.Context, ownerUserID string, args map[string]interface{}) (err error) {
return f.sqlDB.UpdateByMap(ctx, ownerUserID, args)
}
func (f *FriendRequestDatabase) Find(ctx context.Context, ownerUserID string) (friends []*relation.FriendRequest, err error) {
return f.sqlDB.Find(ctx, ownerUserID)
}
func (f *FriendRequestDatabase) Take(ctx context.Context, fromUserID, toUserID string) (friend *relation.FriendRequest, err error) {
return f.sqlDB.Take(ctx, fromUserID, toUserID)
}
func (f *FriendRequestDatabase) FindToUserID(ctx context.Context, toUserID string) (friends []*relation.FriendRequest, err error) {
return f.sqlDB.FindToUserID(ctx, toUserID)
}
func (f *FriendRequestDatabase) FindFromUserID(ctx context.Context, fromUserID string) (friends []*relation.FriendRequest, err error) {
return f.sqlDB.FindFromUserID(ctx, fromUserID)
}

@ -7,9 +7,9 @@ import (
)
type UserInterface interface {
//获取指定用户的信息 如果有记录未找到 也返回错误
Find(ctx context.Context, userIDs []string) (users []*relation.User, err error)
Create(ctx context.Context, users []*relation.User) error
Take(ctx context.Context, userID string) (user *relation.User, err error)
Update(ctx context.Context, users []*relation.User) (err error)
UpdateByMap(ctx context.Context, userID string, args map[string]interface{}) (err error)
GetByName(ctx context.Context, userName string, showNumber, pageNumber int32) (users []*relation.User, count int64, err error)

@ -71,44 +71,14 @@ func (b *Black) Take(ctx context.Context, ownerUserID, blockUserID string) (blac
return black, utils.Wrap(b.DB.Where("owner_user_id = ? and block_user_id = ?", ownerUserID, blockUserID).Take(black).Error, "")
}
func (b *Black) FindByOwnerUserID(ctx context.Context, ownerUserID string) (blackList []*Black, err error) {
func (b *Black) FindOwnerBlacks(ctx context.Context, ownerUserID string, pageNumber, showNumber int32) (blacks []*Black, total int64, err error) {
defer func() {
tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "blackList", blackList)
tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "blacks", blacks)
}()
return blackList, utils.Wrap(GroupMemberDB.Where("owner_user_id = ?", ownerUserID).Find(&blackList).Error, "")
}
func InsertInToUserBlackList(ctx context.Context, black Black) (err error) {
defer tracelog.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "black", black)
black.CreateTime = time.Now()
err = BlackDB.Create(black).Error
return err
}
func CheckBlack(ownerUserID, blockUserID string) error {
var black Black
return BlackDB.Where("owner_user_id=? and block_user_id=?", ownerUserID, blockUserID).Find(&black).Error
}
func RemoveBlackList(ownerUserID, blockUserID string) error {
err := BlackDB.Where("owner_user_id=? and block_user_id=?", ownerUserID, blockUserID).Delete(Black{}).Error
return utils.Wrap(err, "RemoveBlackList failed")
}
func GetBlackListByUserID(ownerUserID string) ([]Black, error) {
var blackListUsersInfo []Black
err := BlackDB.Where("owner_user_id=?", ownerUserID).Find(&blackListUsersInfo).Error
if err != nil {
return nil, err
}
return blackListUsersInfo, nil
}
func GetBlackIDListByUserID(ownerUserID string) ([]string, error) {
var blackIDList []string
err := b.db.Where("owner_user_id=?", ownerUserID).Pluck("block_user_id", &blackIDList).Error
err = b.DB.Model(b).Count(&total).Error
if err != nil {
return nil, err
return nil, 0, utils.Wrap(err, "")
}
return blackIDList, nil
err = utils.Wrap(b.DB.Limit(int(showNumber)).Offset(int(pageNumber*showNumber)).Find(&blacks).Error, "")
return
}

@ -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_a69e7413271cca0f, []int{0}
return fileDescriptor_friend_ae999c738a77e4f8, []int{0}
}
func (m *GetFriendsInfoReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetFriendsInfoReq.Unmarshal(m, b)
@ -81,7 +81,7 @@ func (m *GetFriendsInfoResp) Reset() { *m = GetFriendsInfoResp{} }
func (m *GetFriendsInfoResp) String() string { return proto.CompactTextString(m) }
func (*GetFriendsInfoResp) ProtoMessage() {}
func (*GetFriendsInfoResp) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_a69e7413271cca0f, []int{1}
return fileDescriptor_friend_ae999c738a77e4f8, []int{1}
}
func (m *GetFriendsInfoResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetFriendsInfoResp.Unmarshal(m, b)
@ -122,7 +122,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_a69e7413271cca0f, []int{2}
return fileDescriptor_friend_ae999c738a77e4f8, []int{2}
}
func (m *AddFriendReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AddFriendReq.Unmarshal(m, b)
@ -180,7 +180,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_a69e7413271cca0f, []int{3}
return fileDescriptor_friend_ae999c738a77e4f8, []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_a69e7413271cca0f, []int{4}
return fileDescriptor_friend_ae999c738a77e4f8, []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_a69e7413271cca0f, []int{5}
return fileDescriptor_friend_ae999c738a77e4f8, []int{5}
}
func (m *ImportFriendResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ImportFriendResp.Unmarshal(m, b)
@ -288,7 +288,7 @@ func (m *GetToFriendsApplyReq) Reset() { *m = GetToFriendsApplyReq{} }
func (m *GetToFriendsApplyReq) String() string { return proto.CompactTextString(m) }
func (*GetToFriendsApplyReq) ProtoMessage() {}
func (*GetToFriendsApplyReq) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_a69e7413271cca0f, []int{6}
return fileDescriptor_friend_ae999c738a77e4f8, []int{6}
}
func (m *GetToFriendsApplyReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetToFriendsApplyReq.Unmarshal(m, b)
@ -334,7 +334,7 @@ func (m *GetToFriendsApplyResp) Reset() { *m = GetToFriendsApplyResp{} }
func (m *GetToFriendsApplyResp) String() string { return proto.CompactTextString(m) }
func (*GetToFriendsApplyResp) ProtoMessage() {}
func (*GetToFriendsApplyResp) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_a69e7413271cca0f, []int{7}
return fileDescriptor_friend_ae999c738a77e4f8, []int{7}
}
func (m *GetToFriendsApplyResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetToFriendsApplyResp.Unmarshal(m, b)
@ -380,7 +380,7 @@ func (m *GetFriendsReq) Reset() { *m = GetFriendsReq{} }
func (m *GetFriendsReq) String() string { return proto.CompactTextString(m) }
func (*GetFriendsReq) ProtoMessage() {}
func (*GetFriendsReq) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_a69e7413271cca0f, []int{8}
return fileDescriptor_friend_ae999c738a77e4f8, []int{8}
}
func (m *GetFriendsReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetFriendsReq.Unmarshal(m, b)
@ -426,7 +426,7 @@ func (m *GetFriendsResp) Reset() { *m = GetFriendsResp{} }
func (m *GetFriendsResp) String() string { return proto.CompactTextString(m) }
func (*GetFriendsResp) ProtoMessage() {}
func (*GetFriendsResp) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_a69e7413271cca0f, []int{9}
return fileDescriptor_friend_ae999c738a77e4f8, []int{9}
}
func (m *GetFriendsResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetFriendsResp.Unmarshal(m, b)
@ -472,7 +472,7 @@ func (m *AddBlackReq) Reset() { *m = AddBlackReq{} }
func (m *AddBlackReq) String() string { return proto.CompactTextString(m) }
func (*AddBlackReq) ProtoMessage() {}
func (*AddBlackReq) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_a69e7413271cca0f, []int{10}
return fileDescriptor_friend_ae999c738a77e4f8, []int{10}
}
func (m *AddBlackReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AddBlackReq.Unmarshal(m, b)
@ -516,7 +516,7 @@ func (m *AddBlackResp) Reset() { *m = AddBlackResp{} }
func (m *AddBlackResp) String() string { return proto.CompactTextString(m) }
func (*AddBlackResp) ProtoMessage() {}
func (*AddBlackResp) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_a69e7413271cca0f, []int{11}
return fileDescriptor_friend_ae999c738a77e4f8, []int{11}
}
func (m *AddBlackResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AddBlackResp.Unmarshal(m, b)
@ -548,7 +548,7 @@ func (m *RemoveBlackReq) Reset() { *m = RemoveBlackReq{} }
func (m *RemoveBlackReq) String() string { return proto.CompactTextString(m) }
func (*RemoveBlackReq) ProtoMessage() {}
func (*RemoveBlackReq) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_a69e7413271cca0f, []int{12}
return fileDescriptor_friend_ae999c738a77e4f8, []int{12}
}
func (m *RemoveBlackReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RemoveBlackReq.Unmarshal(m, b)
@ -592,7 +592,7 @@ func (m *RemoveBlackResp) Reset() { *m = RemoveBlackResp{} }
func (m *RemoveBlackResp) String() string { return proto.CompactTextString(m) }
func (*RemoveBlackResp) ProtoMessage() {}
func (*RemoveBlackResp) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_a69e7413271cca0f, []int{13}
return fileDescriptor_friend_ae999c738a77e4f8, []int{13}
}
func (m *RemoveBlackResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RemoveBlackResp.Unmarshal(m, b)
@ -624,7 +624,7 @@ func (m *GetBlacksReq) Reset() { *m = GetBlacksReq{} }
func (m *GetBlacksReq) String() string { return proto.CompactTextString(m) }
func (*GetBlacksReq) ProtoMessage() {}
func (*GetBlacksReq) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_a69e7413271cca0f, []int{14}
return fileDescriptor_friend_ae999c738a77e4f8, []int{14}
}
func (m *GetBlacksReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetBlacksReq.Unmarshal(m, b)
@ -659,18 +659,18 @@ func (m *GetBlacksReq) GetPagination() *sdk_ws.RequestPagination {
}
type GetBlacksResp struct {
BlackUsersInfo []*sdk_ws.PublicUserInfo `protobuf:"bytes,1,rep,name=blackUsersInfo" json:"blackUsersInfo,omitempty"`
Total int32 `protobuf:"varint,2,opt,name=total" json:"total,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
Blacks []*sdk_ws.BlackInfo `protobuf:"bytes,1,rep,name=blacks" json:"blacks,omitempty"`
Total int32 `protobuf:"varint,2,opt,name=total" json:"total,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *GetBlacksResp) Reset() { *m = GetBlacksResp{} }
func (m *GetBlacksResp) String() string { return proto.CompactTextString(m) }
func (*GetBlacksResp) ProtoMessage() {}
func (*GetBlacksResp) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_a69e7413271cca0f, []int{15}
return fileDescriptor_friend_ae999c738a77e4f8, []int{15}
}
func (m *GetBlacksResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetBlacksResp.Unmarshal(m, b)
@ -690,9 +690,9 @@ func (m *GetBlacksResp) XXX_DiscardUnknown() {
var xxx_messageInfo_GetBlacksResp proto.InternalMessageInfo
func (m *GetBlacksResp) GetBlackUsersInfo() []*sdk_ws.PublicUserInfo {
func (m *GetBlacksResp) GetBlacks() []*sdk_ws.BlackInfo {
if m != nil {
return m.BlackUsersInfo
return m.Blacks
}
return nil
}
@ -705,8 +705,8 @@ func (m *GetBlacksResp) GetTotal() int32 {
}
type IsFriendReq struct {
OwnerUserID string `protobuf:"bytes,1,opt,name=ownerUserID" json:"ownerUserID,omitempty"`
FriendUserID string `protobuf:"bytes,2,opt,name=friendUserID" json:"friendUserID,omitempty"`
UserID1 string `protobuf:"bytes,1,opt,name=userID1" json:"userID1,omitempty"`
UserID2 string `protobuf:"bytes,2,opt,name=userID2" json:"userID2,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -716,7 +716,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_a69e7413271cca0f, []int{16}
return fileDescriptor_friend_ae999c738a77e4f8, []int{16}
}
func (m *IsFriendReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_IsFriendReq.Unmarshal(m, b)
@ -736,22 +736,23 @@ func (m *IsFriendReq) XXX_DiscardUnknown() {
var xxx_messageInfo_IsFriendReq proto.InternalMessageInfo
func (m *IsFriendReq) GetOwnerUserID() string {
func (m *IsFriendReq) GetUserID1() string {
if m != nil {
return m.OwnerUserID
return m.UserID1
}
return ""
}
func (m *IsFriendReq) GetFriendUserID() string {
func (m *IsFriendReq) GetUserID2() string {
if m != nil {
return m.FriendUserID
return m.UserID2
}
return ""
}
type IsFriendResp struct {
Response bool `protobuf:"varint,1,opt,name=response" json:"response,omitempty"`
InUser1Friends bool `protobuf:"varint,1,opt,name=inUser1Friends" json:"inUser1Friends,omitempty"`
InUser2Friends bool `protobuf:"varint,2,opt,name=inUser2Friends" json:"inUser2Friends,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -761,7 +762,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_a69e7413271cca0f, []int{17}
return fileDescriptor_friend_ae999c738a77e4f8, []int{17}
}
func (m *IsFriendResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_IsFriendResp.Unmarshal(m, b)
@ -781,16 +782,23 @@ func (m *IsFriendResp) XXX_DiscardUnknown() {
var xxx_messageInfo_IsFriendResp proto.InternalMessageInfo
func (m *IsFriendResp) GetResponse() bool {
func (m *IsFriendResp) GetInUser1Friends() bool {
if m != nil {
return m.InUser1Friends
}
return false
}
func (m *IsFriendResp) GetInUser2Friends() bool {
if m != nil {
return m.Response
return m.InUser2Friends
}
return false
}
type IsBlackReq struct {
OwnerUserID string `protobuf:"bytes,1,opt,name=ownerUserID" json:"ownerUserID,omitempty"`
BlackUserID string `protobuf:"bytes,2,opt,name=blackUserID" json:"blackUserID,omitempty"`
UserID1 string `protobuf:"bytes,1,opt,name=userID1" json:"userID1,omitempty"`
UserID2 string `protobuf:"bytes,2,opt,name=userID2" json:"userID2,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -800,7 +808,7 @@ func (m *IsBlackReq) Reset() { *m = IsBlackReq{} }
func (m *IsBlackReq) String() string { return proto.CompactTextString(m) }
func (*IsBlackReq) ProtoMessage() {}
func (*IsBlackReq) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_a69e7413271cca0f, []int{18}
return fileDescriptor_friend_ae999c738a77e4f8, []int{18}
}
func (m *IsBlackReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_IsBlackReq.Unmarshal(m, b)
@ -820,22 +828,23 @@ func (m *IsBlackReq) XXX_DiscardUnknown() {
var xxx_messageInfo_IsBlackReq proto.InternalMessageInfo
func (m *IsBlackReq) GetOwnerUserID() string {
func (m *IsBlackReq) GetUserID1() string {
if m != nil {
return m.OwnerUserID
return m.UserID1
}
return ""
}
func (m *IsBlackReq) GetBlackUserID() string {
func (m *IsBlackReq) GetUserID2() string {
if m != nil {
return m.BlackUserID
return m.UserID2
}
return ""
}
type IsBlackResp struct {
Response bool `protobuf:"varint,1,opt,name=response" json:"response,omitempty"`
InUser1Blacks bool `protobuf:"varint,1,opt,name=inUser1Blacks" json:"inUser1Blacks,omitempty"`
InUser2Blacks bool `protobuf:"varint,2,opt,name=inUser2Blacks" json:"inUser2Blacks,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -845,7 +854,7 @@ func (m *IsBlackResp) Reset() { *m = IsBlackResp{} }
func (m *IsBlackResp) String() string { return proto.CompactTextString(m) }
func (*IsBlackResp) ProtoMessage() {}
func (*IsBlackResp) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_a69e7413271cca0f, []int{19}
return fileDescriptor_friend_ae999c738a77e4f8, []int{19}
}
func (m *IsBlackResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_IsBlackResp.Unmarshal(m, b)
@ -865,9 +874,16 @@ func (m *IsBlackResp) XXX_DiscardUnknown() {
var xxx_messageInfo_IsBlackResp proto.InternalMessageInfo
func (m *IsBlackResp) GetResponse() bool {
func (m *IsBlackResp) GetInUser1Blacks() bool {
if m != nil {
return m.InUser1Blacks
}
return false
}
func (m *IsBlackResp) GetInUser2Blacks() bool {
if m != nil {
return m.Response
return m.InUser2Blacks
}
return false
}
@ -884,7 +900,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_a69e7413271cca0f, []int{20}
return fileDescriptor_friend_ae999c738a77e4f8, []int{20}
}
func (m *DeleteFriendReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DeleteFriendReq.Unmarshal(m, b)
@ -928,7 +944,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_a69e7413271cca0f, []int{21}
return fileDescriptor_friend_ae999c738a77e4f8, []int{21}
}
func (m *DeleteFriendResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DeleteFriendResp.Unmarshal(m, b)
@ -963,7 +979,7 @@ func (m *RespondFriendApplyReq) Reset() { *m = RespondFriendApplyReq{} }
func (m *RespondFriendApplyReq) String() string { return proto.CompactTextString(m) }
func (*RespondFriendApplyReq) ProtoMessage() {}
func (*RespondFriendApplyReq) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_a69e7413271cca0f, []int{22}
return fileDescriptor_friend_ae999c738a77e4f8, []int{22}
}
func (m *RespondFriendApplyReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RespondFriendApplyReq.Unmarshal(m, b)
@ -1021,7 +1037,7 @@ func (m *RespondFriendApplyResp) Reset() { *m = RespondFriendApplyResp{}
func (m *RespondFriendApplyResp) String() string { return proto.CompactTextString(m) }
func (*RespondFriendApplyResp) ProtoMessage() {}
func (*RespondFriendApplyResp) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_a69e7413271cca0f, []int{23}
return fileDescriptor_friend_ae999c738a77e4f8, []int{23}
}
func (m *RespondFriendApplyResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RespondFriendApplyResp.Unmarshal(m, b)
@ -1054,7 +1070,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_a69e7413271cca0f, []int{24}
return fileDescriptor_friend_ae999c738a77e4f8, []int{24}
}
func (m *SetFriendRemarkReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SetFriendRemarkReq.Unmarshal(m, b)
@ -1105,7 +1121,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_a69e7413271cca0f, []int{25}
return fileDescriptor_friend_ae999c738a77e4f8, []int{25}
}
func (m *SetFriendRemarkResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SetFriendRemarkResp.Unmarshal(m, b)
@ -1137,7 +1153,7 @@ func (m *GetFromFriendsApplyReq) Reset() { *m = GetFromFriendsApplyReq{}
func (m *GetFromFriendsApplyReq) String() string { return proto.CompactTextString(m) }
func (*GetFromFriendsApplyReq) ProtoMessage() {}
func (*GetFromFriendsApplyReq) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_a69e7413271cca0f, []int{26}
return fileDescriptor_friend_ae999c738a77e4f8, []int{26}
}
func (m *GetFromFriendsApplyReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetFromFriendsApplyReq.Unmarshal(m, b)
@ -1183,7 +1199,7 @@ func (m *GetFromFriendsApplyResp) Reset() { *m = GetFromFriendsApplyResp
func (m *GetFromFriendsApplyResp) String() string { return proto.CompactTextString(m) }
func (*GetFromFriendsApplyResp) ProtoMessage() {}
func (*GetFromFriendsApplyResp) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_a69e7413271cca0f, []int{27}
return fileDescriptor_friend_ae999c738a77e4f8, []int{27}
}
func (m *GetFromFriendsApplyResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetFromFriendsApplyResp.Unmarshal(m, b)
@ -1777,65 +1793,68 @@ var _Friend_serviceDesc = grpc.ServiceDesc{
Metadata: "friend/friend.proto",
}
func init() { proto.RegisterFile("friend/friend.proto", fileDescriptor_friend_a69e7413271cca0f) }
var fileDescriptor_friend_a69e7413271cca0f = []byte{
// 912 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0xe1, 0x6e, 0xdb, 0x46,
0x0c, 0x86, 0x9d, 0x25, 0x4d, 0x28, 0xc7, 0x6e, 0xe9, 0xd8, 0xf5, 0xb4, 0x26, 0x75, 0x0f, 0xfd,
0x91, 0x0d, 0x68, 0x0c, 0x64, 0x18, 0x30, 0xa0, 0xc0, 0x86, 0x06, 0x45, 0x37, 0x0f, 0x08, 0x96,
0x29, 0xed, 0x86, 0x6d, 0x3f, 0x02, 0xa5, 0x3a, 0x7b, 0x42, 0x64, 0x89, 0x11, 0x95, 0xb8, 0x7d,
0x90, 0xbd, 0xca, 0x9e, 0x6f, 0xd0, 0x9d, 0x2c, 0x9d, 0x6c, 0xd9, 0x68, 0x33, 0xaf, 0xbf, 0x04,
0x92, 0x47, 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2a, 0x50, 0xcd, 0x3e, 0x58, 0x65, 0x66, 0xc2, 0x9f, 0xa0, 0x35, 0x77, 0xd3,
0xd1, 0x9e, 0xb9, 0x2c, 0xc2, 0x8e, 0xfd, 0xc5, 0x52, 0x1b, 0x13, 0x9e, 0xc0, 0xae, 0xf9, 0x9a,
0xe4, 0xa2, 0xc8, 0xb9, 0xf7, 0x6b, 0x51, 0xe4, 0xfc, 0xeb, 0x13, 0x7f, 0x30, 0xdf, 0x47, 0x8a,
0x32, 0x3f, 0x5f, 0x9c, 0xb6, 0xec, 0xef, 0xc1, 0xb6, 0x97, 0x99, 0x98, 0x4e, 0x9e, 0xfc, 0xf1,
0x38, 0xfd, 0x35, 0xb9, 0x18, 0x9e, 0x1a, 0xff, 0x24, 0x7a, 0xf9, 0x73, 0xfd, 0xb9, 0xdc, 0x52,
0xca, 0xaf, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xf3, 0x1f, 0x6f, 0xae, 0xe1, 0x0c, 0x00, 0x00,
func init() { proto.RegisterFile("friend/friend.proto", fileDescriptor_friend_ae999c738a77e4f8) }
var fileDescriptor_friend_ae999c738a77e4f8 = []byte{
// 955 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0xef, 0x6e, 0x1b, 0x45,
0x10, 0x97, 0x1d, 0xe2, 0x24, 0x63, 0xc7, 0xa6, 0xe3, 0xd8, 0x3d, 0x8e, 0x24, 0x35, 0xab, 0x0a,
0xe5, 0x4b, 0x63, 0xd5, 0x80, 0x84, 0x54, 0x09, 0x48, 0x54, 0x15, 0x82, 0x14, 0x51, 0xae, 0x2d,
0xa8, 0x54, 0x22, 0xba, 0x72, 0x6b, 0x73, 0x8a, 0x7d, 0xb7, 0xb9, 0xb9, 0xc4, 0xed, 0x83, 0xf0,
0x2a, 0x3c, 0x1f, 0xba, 0xdd, 0xbd, 0xdb, 0x3d, 0xfb, 0x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 0xc2, 0x96, 0x76, 0xec, 0x08, 0x36, 0xf4, 0x46, 0x43,
0x34, 0x06, 0x45, 0xb8, 0xee, 0x12, 0x46, 0x22, 0x1b, 0x81, 0x82, 0x47, 0xcc, 0x08, 0xd8, 0x44,
0xe6, 0xf6, 0x2a, 0x50, 0x12, 0x78, 0x04, 0x2d, 0x7b, 0x17, 0x61, 0x51, 0xcd, 0xc2, 0xea, 0x73,
0x9d, 0x6a, 0x05, 0x09, 0x7c, 0x01, 0xb8, 0xbc, 0x22, 0x70, 0xcf, 0xb4, 0xa5, 0x62, 0xab, 0xb9,
0xfb, 0xd7, 0xa9, 0x49, 0xe0, 0x8f, 0xd0, 0x59, 0xf8, 0xa7, 0xa3, 0x9b, 0xbb, 0x2c, 0xaf, 0x1d,
0xf7, 0xd3, 0x95, 0x3a, 0x12, 0x78, 0x0c, 0xdb, 0xf6, 0xd3, 0x93, 0x4c, 0x91, 0x0b, 0x8f, 0x5d,
0x53, 0xe4, 0xe2, 0x53, 0x15, 0xbf, 0xb7, 0x1f, 0x53, 0xf2, 0x2d, 0xf4, 0xc9, 0xf2, 0xb4, 0xe9,
0x4f, 0x0d, 0xd7, 0x5d, 0xa5, 0x22, 0x71, 0xfc, 0xd9, 0x6f, 0x0f, 0xb2, 0xef, 0x98, 0xb3, 0x93,
0x53, 0xeb, 0x03, 0x46, 0x99, 0x3f, 0x51, 0x3f, 0x6f, 0x1b, 0x12, 0xfc, 0xe2, 0x9f, 0x00, 0x00,
0x00, 0xff, 0xff, 0xdd, 0xee, 0xa4, 0x0d, 0x0e, 0x0d, 0x00, 0x00,
}

@ -72,26 +72,28 @@ message getBlacksReq{
server_api_params.RequestPagination pagination = 2;
}
message getBlacksResp{
repeated server_api_params.PublicUserInfo blackUsersInfo= 1;
repeated server_api_params.BlackInfo blacks= 1;
int32 total = 2;
}
message isFriendReq{
string ownerUserID = 1;
string friendUserID = 2;
string userID1 = 1;
string userID2 = 2;
}
message isFriendResp{
bool response = 1;
bool inUser1Friends = 1; //userID2userID1 true
bool inUser2Friends = 2; //userID1userID2 true
}
message isBlackReq{
string ownerUserID = 1;
string blackUserID = 2;
string userID1 = 1;
string userID2 = 2;
}
message isBlackResp{
bool response = 1;
bool inUser1Blacks = 1; //userID2userID1 true
bool inUser2Blacks = 2; //userID1userID2 true
}

@ -7,7 +7,7 @@ package group;
message CreateGroupReq{
repeated string initMemberList = 1;
repeated string initMembers = 1;
server_api_params.GroupInfo groupInfo = 2;
repeated string adminUserIDs = 3;
string ownerUserID = 4; //owner
@ -105,7 +105,7 @@ message GetGroupMemberListResp {
message GetGroupMembersInfoReq {
string groupID = 1;
repeated string memberList = 2;
repeated string members = 2;
}
message GetGroupMembersInfoResp {
@ -114,7 +114,7 @@ message GetGroupMembersInfoResp {
message KickGroupMemberReq {
string groupID = 1;
repeated string kickedUserIDList = 2;
repeated string kickedUserIDs = 2;
string reason = 3;
}

@ -7,134 +7,142 @@ package user;
message GetAllUserIDReq{
message getAllUserIDReq{
server_api_params.RequestPagination pagination = 1;
}
message GetAllUserIDResp{
message getAllUserIDResp{
int32 total = 1;
repeated string UserIDList = 2;
repeated string userIDList = 2;
}
message AccountCheckReq{
message accountCheckReq{
repeated string checkUserIDs = 1;
}
message AccountCheckResp{
message SingleUserStatus {
message accountCheckResp{
message singleUserStatus {
string userID = 1;
string accountStatus = 2;
}
repeated SingleUserStatus results = 1;
repeated singleUserStatus results = 1;
}
message GetUsersInfoReq{
message getUsersInfoReq{
repeated string userIDs = 1;
}
message GetUsersInfoResp{
message getUsersInfoResp{
repeated server_api_params.UserInfo usersInfo = 1;
}
message UpdateUserInfoReq{
message updateUserInfoReq{
server_api_params.UserInfo userInfo = 1;
}
message UpdateUserInfoResp{
message updateUserInfoResp{
}
message SetGlobalRecvMessageOptReq{
message setGlobalRecvMessageOptReq{
string userID = 1;
int32 globalRecvMsgOpt = 3;
}
message SetGlobalRecvMessageOptResp{
message setGlobalRecvMessageOptResp{
}
message SetConversationReq{
conversation.Conversation Conversation = 1;
message setConversationReq{
conversation.Conversation conversation = 1;
int32 notificationType = 2;
string OperationID = 3;
string operationID = 3;
}
message SetConversationResp{
message setConversationResp{
}
message SetRecvMsgOptReq {
string OwnerUserID = 1;
string ConversationID = 2;
int32 RecvMsgOpt = 3;
message setRecvMsgOptReq {
string ownerUserID = 1;
string conversationID = 2;
int32 recvMsgOpt = 3;
int32 notificationType = 4;
string OperationID = 5;
string operationID = 5;
}
message SetRecvMsgOptResp {
message setRecvMsgOptResp {
}
message GetConversationReq{
string ConversationID = 1;
string OwnerUserID = 2;
string OperationID = 3;
message getConversationReq{
string conversationID = 1;
string ownerUserID = 2;
string operationID = 3;
}
message GetConversationResp{
conversation.Conversation Conversation = 2;
message getConversationResp{
conversation.Conversation conversation = 2;
}
message GetConversationsReq{
string OwnerUserID = 1;
repeated string ConversationIDs = 2;
string OperationID = 3;
message getConversationsReq{
string ownerUserID = 1;
repeated string conversationIDs = 2;
string operationID = 3;
}
message GetConversationsResp{
repeated conversation.Conversation Conversations = 2;
message getConversationsResp{
repeated conversation.Conversation conversations = 2;
}
message GetAllConversationsReq{
string OwnerUserID = 1;
string OperationID = 2;
message getAllConversationsReq{
string ownerUserID = 1;
string operationID = 2;
}
message GetAllConversationsResp{
repeated conversation.Conversation Conversations = 2;
message getAllConversationsResp{
repeated conversation.Conversation conversations = 2;
}
message BatchSetConversationsReq{
repeated conversation.Conversation Conversations = 1;
message batchSetConversationsReq{
repeated conversation.Conversation conversations = 1;
string OwnerUserID = 2;
int32 notificationType = 3;
string OperationID = 4;
}
message BatchSetConversationsResp{
message batchSetConversationsResp{
repeated string Success = 2;
repeated string Failed = 3;
}
message GetUsersReq {
message getUsersReq {
server_api_params.RequestPagination pagination = 2;
string userName = 3;
string userID = 4;
string content = 5;
}
message GetUsersResp{
message getUsersResp{
int32 total = 1;
repeated server_api_params.UserInfo users = 2;
}
message UserRegisterReq {
repeated server_api_params.UserInfo users = 1;
}
message UserRegisterResp {
}
service user {
//
rpc GetUsersInfo(GetUsersInfoReq) returns(GetUsersInfoResp);
rpc getUsersInfo(getUsersInfoReq) returns(getUsersInfoResp);
//
rpc UpdateUserInfo(UpdateUserInfoReq) returns(UpdateUserInfoResp);
rpc updateUserInfo(updateUserInfoReq) returns(updateUserInfoResp);
//
rpc SetGlobalRecvMessageOpt(SetGlobalRecvMessageOptReq) returns(SetGlobalRecvMessageOptResp);
rpc setGlobalRecvMessageOpt(setGlobalRecvMessageOptReq) returns(setGlobalRecvMessageOptResp);
//userID
rpc AccountCheck(AccountCheckReq)returns(AccountCheckResp);
rpc accountCheck(accountCheckReq)returns(accountCheckResp);
//userID
rpc GetUsers(GetUsersReq) returns (GetUsersResp);
rpc getUsers(getUsersReq) returns (getUsersResp);
}

Loading…
Cancel
Save