diff --git a/cmd/robot/friend.go b/cmd/robot/friend.go index 14b28ce76..d49482cf0 100644 --- a/cmd/robot/friend.go +++ b/cmd/robot/friend.go @@ -2,21 +2,36 @@ package robot import ( "go_dreamfactory/comm" + "go_dreamfactory/modules/friend" "go_dreamfactory/pb" "log" ) func (r *Robot) handleFriendMsg(msg *pb.UserMessage) { switch msg.SubType { - case "add": - r.handleFriendAdd(msg) + case friend.Friend_SubType_Apply: + r.handleFriendApply(msg) + case friend.Friend_SubType_ApplyList: + r.handleFriendApplyList(msg) + case friend.Friend_SubType_Agree: + r.handleFriendAgree(msg) + case friend.Friend_SubType_Refuse: + r.handleFriendRefuse(msg) + case friend.Friend_SubType_Blacklist: + r.handleFriendBlacklist(msg) + case friend.Friend_SubType_AddBlack: + r.handleFriendAddBlack(msg) + case friend.Friend_SubType_DelBlack: + r.handleFriendDelBlack(msg) + case friend.Friend_SubType_Search: + r.handleFriendSearch(msg) } } -//添加好友 -func (r *Robot) FriendAdd() { - req := &pb.FriendAddReq{} - head := &pb.UserMessage{MainType: "friend", SubType: "add"} +//好友列表 +func (r *Robot) FriendList() { + req := &pb.FriendListReq{} + head := &pb.UserMessage{MainType: string(comm.SM_FriendModule), SubType: friend.Friend_SubType_List} defer traceFunc(head.MainType, head.SubType, r.user.UserData.GetUserId(), req) err := r.SendToClient(head, req) if err != nil { @@ -24,8 +39,170 @@ func (r *Robot) FriendAdd() { } } -func (r *Robot) handleFriendAdd(msg *pb.UserMessage) { - rsp := &pb.FriendAddRsp{} +func (r *Robot) handleFriendList(msg *pb.UserMessage) { + rsp := &pb.FriendListRsp{} + if !comm.ProtoDecode(msg, rsp) { + return + } + printReply(msg, rsp) +} + +//好友搜索 +func (r *Robot) FriendSearch(nickName string) { + req := &pb.FriendSearchReq{ + NickName: nickName, + } + head := &pb.UserMessage{MainType: string(comm.SM_FriendModule), SubType: friend.Friend_SubType_Search} + defer traceFunc(head.MainType, head.SubType, r.user.UserData.GetUserId(), req) + err := r.SendToClient(head, req) + if err != nil { + log.Fatal(err) + } +} + +func (r *Robot) handleFriendSearch(msg *pb.UserMessage) { + rsp := &pb.FriendSearchRsp{} + if !comm.ProtoDecode(msg, rsp) { + return + } + printReply(msg, rsp) +} + +//好友申请 +func (r *Robot) FriendApply(friendId string) { + req := &pb.FriendApplyReq{ + FriendId: friendId, + } + head := &pb.UserMessage{MainType: string(comm.SM_FriendModule), SubType: friend.Friend_SubType_Apply} + defer traceFunc(head.MainType, head.SubType, r.user.UserData.GetUserId(), req) + err := r.SendToClient(head, req) + if err != nil { + log.Fatal(err) + } +} + +func (r *Robot) handleFriendApply(msg *pb.UserMessage) { + rsp := &pb.FriendApplyRsp{} + if !comm.ProtoDecode(msg, rsp) { + return + } + printReply(msg, rsp) +} + +//申请列表 +func (r *Robot) FriendApplyList() { + req := &pb.FriendApplyListReq{} + head := &pb.UserMessage{MainType: string(comm.SM_FriendModule), SubType: friend.Friend_SubType_ApplyList} + defer traceFunc(head.MainType, head.SubType, r.user.UserData.GetUserId(), req) + err := r.SendToClient(head, req) + if err != nil { + log.Fatal(err) + } +} + +func (r *Robot) handleFriendApplyList(msg *pb.UserMessage) { + rsp := &pb.FriendApplyListRsp{} + if !comm.ProtoDecode(msg, rsp) { + return + } + printReply(msg, rsp) +} + +//同意 +func (r *Robot) FriendAgree(friendIds []string) { + req := &pb.FriendAgreeReq{ + FriendIds: friendIds, + } + head := &pb.UserMessage{MainType: string(comm.SM_FriendModule), SubType: friend.Friend_SubType_Apply} + defer traceFunc(head.MainType, head.SubType, r.user.UserData.GetUserId(), req) + err := r.SendToClient(head, req) + if err != nil { + log.Fatal(err) + } +} + +func (r *Robot) handleFriendAgree(msg *pb.UserMessage) { + rsp := &pb.FriendAgreeRsp{} + if !comm.ProtoDecode(msg, rsp) { + return + } + printReply(msg, rsp) +} + +//拒绝 +func (r *Robot) FriendRefuse(friendIds []string) { + req := &pb.FriendRefuseReq{ + FriendIds: friendIds, + } + head := &pb.UserMessage{MainType: string(comm.SM_FriendModule), SubType: friend.Friend_SubType_Refuse} + defer traceFunc(head.MainType, head.SubType, r.user.UserData.GetUserId(), req) + err := r.SendToClient(head, req) + if err != nil { + log.Fatal(err) + } +} + +func (r *Robot) handleFriendRefuse(msg *pb.UserMessage) { + rsp := &pb.FriendRefuseRsp{} + if !comm.ProtoDecode(msg, rsp) { + return + } + printReply(msg, rsp) +} + +//黑名单列表 +func (r *Robot) FriendBlacklist() { + req := &pb.FriendBlackListReq{} + head := &pb.UserMessage{MainType: string(comm.SM_FriendModule), SubType: friend.Friend_SubType_Blacklist} + defer traceFunc(head.MainType, head.SubType, r.user.UserData.GetUserId(), req) + err := r.SendToClient(head, req) + if err != nil { + log.Fatal(err) + } +} + +func (r *Robot) handleFriendBlacklist(msg *pb.UserMessage) { + rsp := &pb.FriendBlackListRsp{} + if !comm.ProtoDecode(msg, rsp) { + return + } + printReply(msg, rsp) +} + +//添加黑名单 +func (r *Robot) FriendAddBlack() { + req := &pb.FriendBlackAddReq{} + head := &pb.UserMessage{MainType: string(comm.SM_FriendModule), SubType: friend.Friend_SubType_AddBlack} + defer traceFunc(head.MainType, head.SubType, r.user.UserData.GetUserId(), req) + err := r.SendToClient(head, req) + if err != nil { + log.Fatal(err) + } +} + +func (r *Robot) handleFriendAddBlack(msg *pb.UserMessage) { + rsp := &pb.FriendBlackAddRsp{} + if !comm.ProtoDecode(msg, rsp) { + return + } + printReply(msg, rsp) +} + +//删除黑名单 +func (r *Robot) FriendDelBlack(friendId string) { + req := &pb.FriendDelBlackReq{ + FriendId: friendId, + } + head := &pb.UserMessage{MainType: string(comm.SM_FriendModule), SubType: friend.Friend_SubType_DelBlack} + defer traceFunc(head.MainType, head.SubType, r.user.UserData.GetUserId(), req) + err := r.SendToClient(head, req) + if err != nil { + log.Fatal(err) + } +} + +func (r *Robot) handleFriendDelBlack(msg *pb.UserMessage) { + rsp := &pb.FriendDelBlackRsp{} if !comm.ProtoDecode(msg, rsp) { return } diff --git a/cmd/robot/pack.go b/cmd/robot/pack.go index 80c1b8912..4bdecfc09 100644 --- a/cmd/robot/pack.go +++ b/cmd/robot/pack.go @@ -9,7 +9,7 @@ import ( func (r *Robot) handlePackMsg(msg *pb.UserMessage) { switch msg.SubType { case "queryuserpackresp": - r.handleFriendAdd(msg) + r.handleQueryUserPack(msg) } } diff --git a/cmd/robot/readme.md b/cmd/robot/readme.md index 345e2fc58..1fe809ced 100644 --- a/cmd/robot/readme.md +++ b/cmd/robot/readme.md @@ -10,3 +10,51 @@ go run cmd.go run --account yourAccount #使用新账号测试接口 go run cmd.go run --account newAccount --create true ``` + +@[TOC] + + +### 添加测试接口 + +* 请求的方法 + +```go +// 好友申请,参数根据实际业务添加 +func (r *Robot) FriendApply(friendIds []string) { + ... +} +``` + +* 响应的方法 + +```go +func (r *Robot) handleFriendApply(msg *pb.UserMessage) { + ... +} +``` + +### 添加subType,调用响应方法 + +```go +//根据实际情况添加subtype +func (r *Robot) handleFriendMsg(msg *pb.UserMessage) { + switch msg.SubType { + case "apply": + //调用响应 + r.handleFriendApply(msg) + } +} +``` + +### 修改请求方法调用 + +```go +func (r *Robot) onUserLoaded() { + switch msg.MainType { + case "user": + r.handleUserMsg(msg) + case "friend": + r.handleFriendMsg(msg) + ... +} +``` \ No newline at end of file diff --git a/cmd/robot/robot.go b/cmd/robot/robot.go index d740acf54..d4d903b57 100644 --- a/cmd/robot/robot.go +++ b/cmd/robot/robot.go @@ -9,9 +9,9 @@ import ( "log" "net/http" + "github.com/golang/protobuf/proto" "github.com/gorilla/websocket" jsoniter "github.com/json-iterator/go" - "google.golang.org/protobuf/proto" ) type Robot struct { @@ -79,11 +79,22 @@ func (r *Robot) handleMsg(msg *pb.UserMessage) { //在这里添加玩家成功登录以后的测试方法 func (r *Robot) onUserLoaded() { //user - r.CreateUser("user671") + // r.CreateUser("乐谷4") //friend - // r.FriendAdd() - r.QueryUserPack() + // r.FriendApply("629f147e3d276120561bfa18") + // r.FriendAgree([]string{}) + // r.FriendRefuse([]string{}) + // r.FriendApplyList() + // r.FriendList() + // r.FriendBlacklist() + // r.FriendAddBlack() + // r.FriendDelBlack("") + r.FriendSearch("乐谷5") + + //pack + // r.QueryUserPack() + } func (r *Robot) SendToClient(msg *pb.UserMessage, rsp proto.Message) error { @@ -134,10 +145,12 @@ func (r *Robot) AccountRegister() { } } +//打印响应 func printReply(msg *pb.UserMessage, rsp interface{}) { log.Printf("rsp [%s.%s] [%d] [%v]", msg.MainType, msg.SubType, msg.Code, rsp) } +//方法参数跟踪 func traceFunc(module string, funcName string, uid string, funcArgs interface{}) { log.Printf("req [%s.%s] [%s] [%v]", module, funcName, uid, funcArgs) } diff --git a/cmd/robot/user.go b/cmd/robot/user.go index e8883c0a5..51f87b32d 100644 --- a/cmd/robot/user.go +++ b/cmd/robot/user.go @@ -2,6 +2,7 @@ package robot import ( "go_dreamfactory/comm" + "go_dreamfactory/modules/user" "go_dreamfactory/pb" "log" ) @@ -40,8 +41,8 @@ func (r *Robot) CreateUser(NickName string) { } head := &pb.UserMessage{ - MainType: "user", - SubType: "create", + MainType: string(comm.SM_UserModule), + SubType: user.User_SubType_Create, } defer traceFunc(head.MainType, head.SubType, r.user.UserData.GetUserId(), req) diff --git a/comm/core.go b/comm/core.go index 6bc46b22a..d5246fce7 100644 --- a/comm/core.go +++ b/comm/core.go @@ -7,7 +7,8 @@ import ( "go_dreamfactory/lego/core" "go_dreamfactory/lego/sys/log" - "google.golang.org/protobuf/proto" + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" ) const ( @@ -68,7 +69,7 @@ type IUserSession interface { } func ProtoDecode(msg *pb.UserMessage, req proto.Message) (ok bool) { - err := proto.Unmarshal(msg.Data, req) + err := ptypes.UnmarshalAny(msg.Data, req) if err != nil { log.Errorf("%s.%s %v", msg.MainType, msg.SubType, err) return @@ -77,7 +78,7 @@ func ProtoDecode(msg *pb.UserMessage, req proto.Message) (ok bool) { } func ProtoEncode(rsp proto.Message, msg *pb.UserMessage) (ok bool) { - data, err := proto.Marshal(rsp) + data, err := ptypes.MarshalAny(rsp) if err != nil { log.Errorf("%s.%s %v", msg.MainType, msg.SubType, err) return diff --git a/comm/usersession.go b/comm/usersession.go index 02a70e262..b08f3b5a2 100644 --- a/comm/usersession.go +++ b/comm/usersession.go @@ -8,7 +8,8 @@ import ( "go_dreamfactory/lego/base" "go_dreamfactory/lego/sys/log" - "google.golang.org/protobuf/proto" + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" ) /* @@ -86,7 +87,7 @@ func (this *UserSession) UnBind() (err error) { //向用户发送消息 func (this *UserSession) SendMsg(mainType, subType string, code pb.ErrorCode, msg proto.Message) (err error) { reply := &pb.RPCMessageReply{} - data, _ := proto.Marshal(msg) + data, _ := ptypes.MarshalAny(msg) log.Debugf("SendMsg to SessionId:[%s] UserId:[%s] Code:%d Data: %v", this.UserId, code, msg) if err := this.service.RpcCall(context.Background(), fmt.Sprintf("%s/%s", Service_Gateway, this.GatewayServiceId), string(Rpc_GatewayAgentSendMsg), &pb.AgentSendMessageReq{ UserSessionId: this.SessionId, diff --git a/go.mod b/go.mod index ca004b778..3f7ae1d15 100644 --- a/go.mod +++ b/go.mod @@ -7,6 +7,7 @@ require ( github.com/go-playground/validator/v10 v10.10.1 github.com/go-redis/redis/v8 v8.11.5 github.com/golang-jwt/jwt v3.2.2+incompatible + github.com/golang/protobuf v1.5.2 github.com/gorilla/websocket v1.4.2 github.com/hashicorp/consul/api v1.12.0 github.com/json-iterator/go v1.1.12 diff --git a/modules/friend/friend_comp.go b/modules/friend/friend_comp.go index e41da828c..7e835645e 100644 --- a/modules/friend/friend_comp.go +++ b/modules/friend/friend_comp.go @@ -3,30 +3,192 @@ package friend import ( "context" "go_dreamfactory/comm" + "go_dreamfactory/lego/core" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/modules" "go_dreamfactory/pb" + "go_dreamfactory/sys/cache" + "go_dreamfactory/sys/db" + "go_dreamfactory/utils" +) + +const ( + Friend_SubType_List = "list" + Friend_SubType_Apply = "apply" + Friend_SubType_ApplyList = "applylist" + Friend_SubType_AddBlack = "addblack" + Friend_SubType_DelBlack = "delblack" + Friend_SubType_Blacklist = "blacklist" + Friend_SubType_Agree = "agree" + Friend_SubType_Refuse = "refuse" + Friend_SubType_Search = "search" ) type FriendComp struct { modules.MComp_GateComp + module *Friend +} + +func (this *FriendComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { + this.MComp_GateComp.Init(service, module, comp, options) + this.module = module.(*Friend) + return } //搜索 func (this *FriendComp) Search(ctx context.Context, session comm.IUserSession, req *pb.FriendSearchReq) error { + var ( + code pb.ErrorCode + rsp *pb.FriendSearchRsp + friend *pb.FriendBase + ) + defer func() { + if code == pb.ErrorCode_Success { + rsp = &pb.FriendSearchRsp{ + Friend: friend, + } + } + session.SendMsg(string(this.module.GetType()), Friend_SubType_Search, code, rsp) + }() + + user := db.Defsys.Frined_FindCond(req.NickName) + if user != nil { + friend = &pb.FriendBase{ + UserId: user.UserId, + NickName: user.NiceName, + } + } return nil } -//添加好友 -func (this *FriendComp) Apply(ctx context.Context, session comm.IUserSession, req *pb.FriendAddReq) error { - //判断是否超过最大好友数量 - //判断对方是否也超过最大好友数量 - //判断是否是自己 - //判断是否是好友 - //判断是否已经申请 - //判断是否在黑名单中 - //判断是否在对方的黑名单中 +//好友申请 +func (this *FriendComp) Apply(ctx context.Context, session comm.IUserSession, req *pb.FriendApplyReq) (err error) { + var ( + code pb.ErrorCode + self *pb.Cache_FriendData + target *pb.Cache_FriendData + rsp *pb.FriendApplyRsp + ) + + defer func() { + utils.TraceFunc(session.GetUserId(), string(this.module.GetType()), Friend_SubType_Apply, req, rsp) + }() + + defer func() { + if code == pb.ErrorCode_Success { + rsp = &pb.FriendApplyRsp{ + UserId: session.GetUserId(), + FriendId: req.FriendId, + } + } + session.SendMsg(string(this.module.GetType()), Friend_SubType_Apply, code, rsp) + }() + + self, err = cache.Defsys.Friend_Get(session.GetUserId()) + if self == nil || err != nil { + code = pb.ErrorCode_FriendSelfNoData + return + } + + target, err = cache.Defsys.Friend_Get(req.FriendId) + if target == nil || err != nil { + code = pb.ErrorCode_FriendTargetNoData + return + } + + //判断是否是自己 + if req.FriendId == session.GetUserId() { + code = pb.ErrorCode_FriendNotSelf + return + } + + //判断是否超过最大好友数量 + //TODO 最大数从全局配置中获取 + var max int32 = 50 + total := cache.Defsys.Friend_Total(session.GetUserId()) + if total >= max { + code = pb.ErrorCode_FriendSelfMax + return + } + + //判断对方是否也超过最大好友数量 + ttotal := cache.Defsys.Friend_Total(req.FriendId) + if ttotal >= max { + code = pb.ErrorCode_FriendTargetMax + return + } + + //判断是否是好友 + if _, ok := utils.Find(self.FriendIds, req.FriendId); ok { + code = pb.ErrorCode_FriendYet + return + } + + //判断自己是否在目标用户的申请列表中 + if _, ok := utils.Find(target.ApplyIds, self.UserId); ok { + code = pb.ErrorCode_FriendApplyYet + return + } + + //判断目标用户是否在黑名单中 + if _, ok := utils.Find(self.BlackIds, req.FriendId); ok { + code = pb.ErrorCode_FriendSelfBlackYet + return + } + + //判断是否在对方的黑名单中 + if _, ok := utils.Find(target.BlackIds, self.UserId); ok { + code = pb.ErrorCode_FriendTargetBlackYet + return + } + + //将自己加入到目标用户的申请列表中 + target.ApplyIds = append(target.ApplyIds, self.UserId) + err = cache.Defsys.Friend_Update(&pb.Cache_FriendData{ + UserId: req.FriendId, + ApplyIds: target.ApplyIds, + }) + + if err != nil { + log.Errorf("firend Apply err:%v", err) + code = pb.ErrorCode_FriendApplyError + return + } + + return +} + +//申请列表 +func (this *FriendComp) ApplyList(ctx context.Context, session comm.IUserSession, req *pb.FriendApplyListReq) (err error) { + var ( + code pb.ErrorCode + self *pb.Cache_FriendData + rsp *pb.FriendApplyListRsp + list []*pb.FriendBase + ) + + defer func() { + if code == pb.ErrorCode_Success { + rsp = &pb.FriendApplyListRsp{ + List: list, + } + } + session.SendMsg(string(this.module.GetType()), Friend_SubType_ApplyList, code, rsp) + }() + + self, err = cache.Defsys.Friend_Get(session.GetUserId()) + if self == nil || err != nil { + code = pb.ErrorCode_FriendSelfNoData + return + } + + for _, userId := range self.ApplyIds { + //TODO 组装FriendBase明细数据 + list = append(list, &pb.FriendBase{ + UserId: userId, + }) + } - return nil } @@ -36,27 +198,142 @@ func (this *FriendComp) Del(ctx context.Context, session comm.IUserSession, req } //好友列表 -func (this *FriendComp) List(ctx context.Context, session comm.IUserSession, req *pb.FriendListReq) error { +func (this *FriendComp) List(ctx context.Context, session comm.IUserSession, req *pb.FriendListReq) (err error) { + var ( + code pb.ErrorCode + self *pb.Cache_FriendData + rsp *pb.FriendListRsp + list []*pb.FriendBase + ) + + defer func() { + if code == pb.ErrorCode_Success { + rsp = &pb.FriendListRsp{ + List: list, + } + } + session.SendMsg(string(this.module.GetType()), Friend_SubType_List, code, rsp) + }() + + self, err = cache.Defsys.Friend_Get(session.GetUserId()) + if self == nil || err != nil { + code = pb.ErrorCode_FriendSelfNoData + return + } + + for _, userId := range self.FriendIds { + list = append(list, &pb.FriendBase{ + UserId: userId, + }) + } + return nil } -//同意或拒绝 -func (this *FriendComp) Check(ctx context.Context, session comm.IUserSession, req *pb.FriendAgreeOrRefuseReq) error { +//单个/批量同意 +func (this *FriendComp) Agree(ctx context.Context, session comm.IUserSession, req *pb.FriendAgreeReq) (err error) { + var ( + code pb.ErrorCode + self *pb.Cache_FriendData + rsp *pb.FriendAgreeRsp + optNum int32 + ) + + defer func() { + if code == pb.ErrorCode_Success { + rsp = &pb.FriendAgreeRsp{ + Num: optNum, + } + } + session.SendMsg(string(this.module.GetType()), Friend_SubType_Agree, code, rsp) + }() + + self, err = cache.Defsys.Friend_Get(session.GetUserId()) + if self == nil || err != nil { + code = pb.ErrorCode_FriendSelfNoData + return + } + + //将申请人加入到自己的好友列表中 + for _, userId := range req.FriendIds { + if _, ok := utils.Find(self.FriendIds, userId); !ok { + self.FriendIds = append(self.FriendIds, userId) + } + } + + //将自己加入到申请人的好友列表中 + for _, userId := range req.FriendIds { + target, err2 := cache.Defsys.Friend_Get(userId) + if target == nil || err2 != nil { + code = pb.ErrorCode_FriendTargetNoData + continue + } + if _, ok := utils.Find(target.FriendIds, self.UserId); !ok { + target.FriendIds = append(target.FriendIds, self.UserId) + } + err = cache.Defsys.Friend_Update(target) + if err != nil { + code = pb.ErrorCode_DBError + return + } + } + + //将申请人从申请列表中删除 + for _, userId := range req.FriendIds { + self.ApplyIds = utils.DeleteString(self.ApplyIds, userId) + optNum++ + } + + //更新 + err = cache.Defsys.Friend_Update(self) + if err != nil { + code = pb.ErrorCode_DBError + return + } return nil } -//批量同意或拒绝 -func (this *FriendComp) CheckAll(ctx context.Context, session comm.IUserSession, req *pb.FriendAgreeOrRefuseReq) error { +//单个/批量拒绝 +func (this *FriendComp) Refuse(ctx context.Context, session comm.IUserSession, req *pb.FriendRefuseReq) (err error) { + //将申请人从申请列表中删除 + var ( + code pb.ErrorCode + self *pb.Cache_FriendData + rsp *pb.FriendAgreeRsp + optNum int32 + ) + defer func() { + if code == pb.ErrorCode_Success { + rsp = &pb.FriendAgreeRsp{ + Num: optNum, + } + } + session.SendMsg(string(this.module.GetType()), Friend_SubType_Refuse, code, rsp) + }() + + self, err = cache.Defsys.Friend_Get(session.GetUserId()) + if self == nil || err != nil { + code = pb.ErrorCode_FriendSelfNoData + return + } + + //将申请人从申请列表中删除 + for _, userId := range req.FriendIds { + self.ApplyIds = utils.DeleteString(self.ApplyIds, userId) + optNum++ + } + + //更新 + err = cache.Defsys.Friend_Update(self) + if err != nil { + code = pb.ErrorCode_DBError + return + } return nil } //赠送或接收 -func (this *FriendComp) ReceSend(ctx context.Context, session comm.IUserSession, req *pb.FriendReceiveOrSendReq) error { - return nil -} - -//好友数量 -func (this *FriendComp) Total(ctx context.Context, session comm.IUserSession, req *pb.FriendTotalReq) error { +func (this *FriendComp) ReceSend(ctx context.Context, session comm.IUserSession, req *pb.FriendReceiveReq) error { return nil } @@ -66,11 +343,129 @@ func (this *FriendComp) Detail(ctx context.Context, session comm.IUserSession, r } //黑名单 -func (this *FriendComp) Blacklist(ctx context.Context, session comm.IUserSession, req *pb.FriendBlackListReq) error { +func (this *FriendComp) Blacklist(ctx context.Context, session comm.IUserSession, req *pb.FriendBlackListReq) (err error) { + var ( + code pb.ErrorCode + self *pb.Cache_FriendData + rsp *pb.FriendBlackListRsp + list []*pb.FriendBase + ) + + defer func() { + if code == pb.ErrorCode_Success { + rsp = &pb.FriendBlackListRsp{ + Friends: list, + } + } + session.SendMsg(string(this.module.GetType()), Friend_SubType_Blacklist, code, rsp) + }() + + self, err = cache.Defsys.Friend_Get(session.GetUserId()) + if self == nil || err != nil { + code = pb.ErrorCode_FriendSelfNoData + return + } + + for _, userId := range self.BlackIds { + //TODO 完善FriendBase信息 + list = append(list, &pb.FriendBase{ + UserId: userId, + }) + } + return nil } //加入黑名单 -func (this *FriendComp) Addblack(ctx context.Context, session comm.IUserSession, req *pb.FriendBlackAddReq) error { +func (this *FriendComp) Addblack(ctx context.Context, session comm.IUserSession, req *pb.FriendBlackAddReq) (err error) { + var ( + code pb.ErrorCode + self *pb.Cache_FriendData + target *pb.Cache_FriendData + rsp *pb.FriendBlackAddRsp + blackNumMax = 50 //TODO 从配置中读取 + ) + + defer func() { + if code == pb.ErrorCode_Success { + rsp = &pb.FriendBlackAddRsp{ + FriendId: req.FriendId, + UserId: session.GetUserId(), + } + } + session.SendMsg(string(this.module.GetType()), Friend_SubType_AddBlack, code, rsp) + }() + + self, err = cache.Defsys.Friend_Get(session.GetUserId()) + if self == nil || err != nil { + code = pb.ErrorCode_FriendSelfNoData + return + } + + target, err = cache.Defsys.Friend_Get(req.FriendId) + if target == nil || err != nil { + code = pb.ErrorCode_FriendTargetNoData + return + } + + //判断目标是否在好友列表里面 + if _, ok := utils.Find(self.FriendIds, req.FriendId); ok { + code = pb.ErrorCode_FriendSelfBlackYet + return + } + + // 判断自己是否在对方的黑名单中 + if _, ok := utils.Find(target.BlackIds, self.UserId); ok { + code = pb.ErrorCode_FriendTargetBlackYet + return + } + + // 判断是否黑名单人数已满 + if len(self.BlackIds) >= blackNumMax { + code = pb.ErrorCode_FriendBlackMax + return + } + + //将目标加入黑名单 + self.BlackIds = append(self.BlackIds, req.FriendId) + //更新黑名单 + err = cache.Defsys.Friend_Update(self) + if err != nil { + code = pb.ErrorCode_DBError + return + } + return nil +} + +//删除黑名单 +func (this *FriendComp) delblack(ctx context.Context, session comm.IUserSession, req *pb.FriendDelBlackReq) (err error) { + var ( + code pb.ErrorCode + self *pb.Cache_FriendData + rsp *pb.FriendDelBlackRsp + ) + defer func() { + if code == pb.ErrorCode_Success { + rsp = &pb.FriendDelBlackRsp{ + FriendId: req.FriendId, + UserId: session.GetUserId(), + } + } + session.SendMsg(string(this.module.GetType()), Friend_SubType_AddBlack, code, rsp) + }() + self, err = cache.Defsys.Friend_Get(session.GetUserId()) + if self == nil || err != nil { + code = pb.ErrorCode_FriendSelfNoData + return + } + + //从黑名单列表中删除目标 + self.BlackIds = utils.DeleteString(self.BlackIds, req.FriendId) + //更新黑名单 + err = cache.Defsys.Friend_Update(self) + if err != nil { + code = pb.ErrorCode_DBError + return + } return nil } diff --git a/modules/mail/api.go b/modules/mail/api.go new file mode 100644 index 000000000..fc54b31de --- /dev/null +++ b/modules/mail/api.go @@ -0,0 +1,42 @@ +package mail + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/modules" + + "go_dreamfactory/lego/core" +) + +const ( + QueryUserMailResp = "queryusermailresp" + ReadUserMailResp = "readusermailresp" + GetUserMailAttachmentResp = "getusermailattachmentresp" + DelUserMailResp = "delusermailresp" + GetNewEMailResp = "getnewEmailresp" +) + +type Api_Comp struct { + modules.MComp_GateComp + service core.IService + module *Mail + pack comm.IPack +} + +func (this *Api_Comp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { + this.MComp_GateComp.Init(service, module, comp, options) + this.service = service + this.module = module.(*Mail) + return +} + +func (this *Api_Comp) Start() (err error) { + err = this.MComp_GateComp.Start() + var module core.IModule + + if module, err = this.service.GetModule(comm.SM_PackModule); err != nil { + return + } + this.pack = module.(comm.IPack) + + return +} diff --git a/modules/mail/api_comp.go b/modules/mail/api_comp.go deleted file mode 100644 index 27c70b7bb..000000000 --- a/modules/mail/api_comp.go +++ /dev/null @@ -1,157 +0,0 @@ -package mail - -import ( - "context" - "go_dreamfactory/comm" - "go_dreamfactory/modules" - "go_dreamfactory/pb" - "go_dreamfactory/sys/cache" - "go_dreamfactory/sys/db" - - "go_dreamfactory/lego/core" - "go_dreamfactory/lego/sys/log" -) - -const ( - QueryUserMailResp = "queryusermailresp" - ReadUserMailResp = "readusermailresp" - GetUserMailAttachmentResp = "getusermailattachmentresp" - DelUserMailResp = "delusermailresp" - GetNewEMailResp = "getnewEmailresp" -) - -type Api_Comp struct { - modules.MComp_GateComp - service core.IService - module *Mail - pack comm.IPack -} - -func (this *Api_Comp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { - this.MComp_GateComp.Init(service, module, comp, options) - this.service = service - this.module = module.(*Mail) - return -} - -func (this *Api_Comp) Start() (err error) { - err = this.MComp_GateComp.Start() - var module core.IModule - - if module, err = this.service.GetModule(comm.SM_PackModule); err != nil { - return - } - this.pack = module.(comm.IPack) - - return -} - -// 查看所有邮件信息 -func (this *Api_Comp) QueryUserMailReq(ctx context.Context, session comm.IUserSession, req *pb.QueryUserMailReq) (err error) { - - code := pb.ErrorCode_Success - mailinfo := make([]*pb.DB_MailData, 0) - defer func() { - session.SendMsg(string(this.module.GetType()), QueryUserMailResp, code, &pb.QueryUserMailResp{Mails: mailinfo}) - }() - if session.GetUserId() == "" { - code = pb.ErrorCode_NoLogin - return - } - if mailinfo, err = cache.Defsys.QueryUserMail(session.GetUserId()); err != nil { - log.Errorf("QueryUserMailResp err:%v", err) - code = pb.ErrorCode_CacheReadError - return - } - - return -} - -// 查看某一封邮件 -func (this *Api_Comp) ReadUserMailReq(ctx context.Context, session comm.IUserSession, req *pb.ReadUserMailReq) (err error) { - var ( - code pb.ErrorCode - mail *pb.DB_MailData - ) - defer func() { - session.SendMsg(string(this.module.GetType()), ReadUserMailResp, code, &pb.ReadUserMailResp{Mail: mail}) - }() - if session.GetUserId() == "" { - code = pb.ErrorCode_NoLogin - return - } - - mail, err = db.Defsys.Mail_ReadOneMail(req.ObjID) - if err != nil { - code = pb.ErrorCode_ReqParameterError - } - - return -} - -// 领取附件 -func (this *Api_Comp) GetUserMailAttachmentReq(ctx context.Context, session comm.IUserSession, req *pb.GetUserMailAttachmentReq) (err error) { - - var ( - code pb.ErrorCode - mail *pb.DB_MailData - ) - defer func() { - session.SendMsg(string(this.module.GetType()), GetUserMailAttachmentResp, code, &pb.GetUserMailAttachmentResp{Mail: mail}) - }() - if session.GetUserId() == "" { - code = pb.ErrorCode_NoLogin - return - } - _bGet := db.Defsys.Mail_GetMailAttachmentState(req.ObjID) - if !_bGet { - code = pb.ErrorCode_StateInvalid - return - } - _data, err := db.Defsys.Mail_GetMailAttachment(req.ObjID) - if err != nil { - if len(_data) > 0 { - // todo 领取附件 - _items := make(map[uint32]uint32, 0) - for _, v := range _data { - _items[v.ItemId] += v.ItemCount - } - // bRet := this.pack.GetRewaredItems(mail.UserId, _items) - // if bRet { - // // 修改状态 - // db.Defsys.Mail_UpdateMailAttachmentState(req.ObjID) - // mail.Reward = true - // return - // } - } - code = pb.ErrorCode_SystemError - } - - return -} - -// 删除邮件 -func (this *Api_Comp) DelUserMailReq(ctx context.Context, session comm.IUserSession, req *pb.DelUserMailReq) (err error) { - - code := pb.ErrorCode_Success - mailinfo := make([]*pb.DB_MailData, 0) - defer func() { - session.SendMsg(string(this.module.GetType()), DelUserMailResp, code, &pb.DelUserMailResp{Mail: mailinfo}) - }() - if session.GetUserId() == "" { - code = pb.ErrorCode_NoLogin - return - } - bRet := db.Defsys.Mail_DelUserMail(req.ObjID) - if !bRet { - code = pb.ErrorCode_DBError - return - } - if mailinfo, err = cache.Defsys.QueryUserMail(session.GetUserId()); err != nil { - log.Errorf("QueryUserMailResp err:%v", err) - code = pb.ErrorCode_CacheReadError - return - } - - return -} diff --git a/modules/mail/api_delmail.go b/modules/mail/api_delmail.go new file mode 100644 index 000000000..98a47a96e --- /dev/null +++ b/modules/mail/api_delmail.go @@ -0,0 +1,35 @@ +package mail + +import ( + "context" + "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/log" + "go_dreamfactory/pb" + "go_dreamfactory/sys/db" +) + +// 删除邮件 +func (this *Api_Comp) DelUserMailReq(ctx context.Context, session comm.IUserSession, req *pb.DelUserMailReq) (err error) { + + code := pb.ErrorCode_Success + mailinfo := make([]*pb.DB_MailData, 0) + defer func() { + session.SendMsg(string(this.module.GetType()), DelUserMailResp, code, &pb.DelUserMailResp{Mail: mailinfo}) + }() + if session.GetUserId() == "" { + code = pb.ErrorCode_NoLogin + return + } + bRet := db.Defsys.Mail_DelUserMail(req.ObjID) + if !bRet { + code = pb.ErrorCode_DBError + return + } + if mailinfo, err = db.Defsys.Mail_QueryUserMail(session.GetUserId()); err != nil { + log.Errorf("QueryUserMailResp err:%v", err) + code = pb.ErrorCode_CacheReadError + return + } + + return +} diff --git a/modules/mail/api_getAttachment.go b/modules/mail/api_getAttachment.go new file mode 100644 index 000000000..68d2ed57b --- /dev/null +++ b/modules/mail/api_getAttachment.go @@ -0,0 +1,49 @@ +package mail + +import ( + "context" + "go_dreamfactory/comm" + "go_dreamfactory/pb" + "go_dreamfactory/sys/db" +) + +// 领取附件 +func (this *Api_Comp) GetUserMailAttachmentReq(ctx context.Context, session comm.IUserSession, req *pb.GetUserMailAttachmentReq) (err error) { + + var ( + code pb.ErrorCode + mail *pb.DB_MailData + ) + defer func() { + session.SendMsg(string(this.module.GetType()), GetUserMailAttachmentResp, code, &pb.GetUserMailAttachmentResp{Mail: mail}) + }() + if session.GetUserId() == "" { + code = pb.ErrorCode_NoLogin + return + } + _bGet := db.Defsys.Mail_GetMailAttachmentState(req.ObjID) + if !_bGet { + code = pb.ErrorCode_StateInvalid + return + } + _data, err := db.Defsys.Mail_GetMailAttachment(req.ObjID) + if err != nil { + if len(_data) > 0 { + // todo 领取附件 + _items := make(map[int32]int32, 0) + for _, v := range _data { + _items[int32(v.ItemId)] += int32(v.ItemCount) + } + bRet := this.pack.AddItemsToUserPack(mail.UserId, _items) + if bRet != nil { + // 修改状态 + db.Defsys.Mail_UpdateMailAttachmentState(req.ObjID) + mail.Reward = true + return + } + } + code = pb.ErrorCode_SystemError + } + + return +} diff --git a/modules/mail/api_getmail.go b/modules/mail/api_getmail.go new file mode 100644 index 000000000..673682c37 --- /dev/null +++ b/modules/mail/api_getmail.go @@ -0,0 +1,30 @@ +package mail + +import ( + "context" + "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/log" + "go_dreamfactory/pb" + "go_dreamfactory/sys/db" +) + +// 查看所有邮件信息 +func (this *Api_Comp) QueryUserMailReq(ctx context.Context, session comm.IUserSession, req *pb.QueryUserMailReq) (err error) { + + code := pb.ErrorCode_Success + mailinfo := make([]*pb.DB_MailData, 0) + defer func() { + session.SendMsg(string(this.module.GetType()), QueryUserMailResp, code, &pb.QueryUserMailResp{Mails: mailinfo}) + }() + if session.GetUserId() == "" { + code = pb.ErrorCode_NoLogin + return + } + if mailinfo, err = db.Defsys.Mail_QueryUserMail(session.GetUserId()); err != nil { + log.Errorf("QueryUserMailResp err:%v", err) + code = pb.ErrorCode_CacheReadError + return + } + + return +} diff --git a/modules/mail/api_readmail.go b/modules/mail/api_readmail.go new file mode 100644 index 000000000..d83db2499 --- /dev/null +++ b/modules/mail/api_readmail.go @@ -0,0 +1,30 @@ +package mail + +import ( + "context" + "go_dreamfactory/comm" + "go_dreamfactory/pb" + "go_dreamfactory/sys/db" +) + +// 查看某一封邮件 +func (this *Api_Comp) ReadUserMailReq(ctx context.Context, session comm.IUserSession, req *pb.ReadUserMailReq) (err error) { + var ( + code pb.ErrorCode + mail *pb.DB_MailData + ) + defer func() { + session.SendMsg(string(this.module.GetType()), ReadUserMailResp, code, &pb.ReadUserMailResp{Mail: mail}) + }() + if session.GetUserId() == "" { + code = pb.ErrorCode_NoLogin + return + } + + mail, err = db.Defsys.Mail_ReadOneMail(req.ObjID) + if err != nil { + code = pb.ErrorCode_ReqParameterError + } + + return +} diff --git a/modules/modulebase.go b/modules/modulebase.go index f26ea5b53..3bc18aaa7 100644 --- a/modules/modulebase.go +++ b/modules/modulebase.go @@ -11,7 +11,8 @@ import ( "go_dreamfactory/lego/core/cbase" "go_dreamfactory/lego/sys/log" - "google.golang.org/protobuf/proto" + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" ) /* @@ -32,7 +33,7 @@ func (this *ModuleBase) Init(service core.IService, module core.IModule, options //向指定用户发送消息 func (this *ModuleBase) SendMsgToUser(mainType, subType string, msg proto.Message, user *pb.Cache_UserData) (err error) { reply := &pb.RPCMessageReply{} - data, _ := proto.Marshal(msg) + data, _ := ptypes.MarshalAny(msg) if _, err = this.service.RpcGo(context.Background(), fmt.Sprintf("%s/%s", comm.Service_Gateway, user.GatewayServiceId), string(comm.Rpc_GatewayAgentSendMsg), &pb.AgentSendMessageReq{ UserSessionId: user.SessionId, MainType: mainType, @@ -59,7 +60,7 @@ func (this *ModuleBase) SendMsgToUsers(mainType, subType string, msg proto.Messa gateway = append(gateway, v.SessionId) } reply := &pb.RPCMessageReply{} - data, _ := proto.Marshal(msg) + data, _ := ptypes.MarshalAny(msg) for k, v := range gateways { if _, err = this.service.RpcGo(context.Background(), fmt.Sprintf("%s/%s", comm.Service_Gateway, k), string(comm.Rpc_GatewayAgentSendMsg), &pb.BatchMessageReq{ UserSessionIds: v, diff --git a/modules/user/login_comp.go b/modules/user/login_comp.go index 9a382e2c7..3c8f29029 100644 --- a/modules/user/login_comp.go +++ b/modules/user/login_comp.go @@ -22,8 +22,8 @@ type LoginComp struct { modules.MComp_GateComp } -func DecodeUserData(base64Str string) *pb.DB_UserData { - //解码 +//解码 +func decodeUserData(base64Str string) *pb.DB_UserData { dec, err := base64.StdEncoding.DecodeString(base64Str[35:]) if err != nil { log.Errorf("base64 decode err %v", err) @@ -44,17 +44,30 @@ func DecodeUserData(base64Str string) *pb.DB_UserData { } //登录 -func (this *LoginComp) Login(ctx context.Context, session comm.IUserSession, req *pb.UserLoginReq) error { - log.Debugf("User - Login: session:%v rsp:%v", session.ToString(), req) - var code pb.ErrorCode = pb.ErrorCode_Success +func (this *LoginComp) Login(ctx context.Context, session comm.IUserSession, req *pb.UserLoginReq) (err error) { + var ( + code pb.ErrorCode + db_user *pb.DB_UserData + ) + + defer func() { + session.SendMsg("user", "login", code, &pb.UserLoginResp{ + Data: &pb.Cache_UserData{ + UserData: db_user, + }, + }) + + event.TriggerEvent(comm.Event_UserLogin, db_user.UserId) + }() + if !utils.ValidSecretKey(req.Sec) { - session.SendMsg("user", "login", pb.ErrorCode_SecKeyInvalid, nil) - return nil + code = pb.ErrorCode_SecKeyInvalid + return } - user := DecodeUserData(req.Sec) + user := decodeUserData(req.Sec) - db_user, err := db.Defsys.User_FindUserByAccount(user) + db_user, err = db.Defsys.User_FindByAccount(user) if err != nil { if err != mongo.ErrNoDocuments { return err @@ -63,10 +76,10 @@ func (this *LoginComp) Login(ctx context.Context, session comm.IUserSession, req //如果是新玩家,创建一条基础的数据,页面会引导进入创角页面 if db_user == nil { - err = db.Defsys.User_CreateUser(user) + err = db.Defsys.User_Create(user) if err != nil { log.Errorf("User_CreateUser err %v", err) - return err + return } session.Bind(user.UserId, this.S.GetId()) } else { @@ -84,16 +97,7 @@ func (this *LoginComp) Login(ctx context.Context, session comm.IUserSession, req return err } - err = session.SendMsg("user", "login", code, &pb.UserLoginResp{ - Data: &pb.Cache_UserData{ - UserData: db_user, - }, - }) - if err != nil { - return err - } - event.TriggerEvent(comm.Event_UserLogin, db_user.UserId) - return nil + return } //注销 diff --git a/modules/user/user_comp.go b/modules/user/user_comp.go index 8031ff667..4cee7f1cf 100644 --- a/modules/user/user_comp.go +++ b/modules/user/user_comp.go @@ -13,6 +13,10 @@ import ( "go_dreamfactory/lego/sys/log" ) +const ( + User_SubType_Create = "create" +) + type UserComp struct { modules.MComp_GateComp module *User @@ -25,21 +29,26 @@ func (this *UserComp) Init(service core.IService, module core.IModule, comp core } //创角 -func (this *UserComp) Create(ctx context.Context, session comm.IUserSession, req *pb.UserCreateReq) error { - defer utils.TraceFunc(session.GetUserId(), "user", "create", req, nil) +func (this *UserComp) Create(ctx context.Context, session comm.IUserSession, req *pb.UserCreateReq) (err error) { + defer utils.TraceFunc(session.GetUserId(), string(this.module.GetType()), User_SubType_Create, req, nil) user := cache.Defsys.Get(session.GetUserId()) + var code pb.ErrorCode + defer func() { + session.SendMsg(string(this.module.GetType()), User_SubType_Create, code, &pb.UserCreateRsp{}) + }() if user == nil { log.Errorf("user no exist") - session.SendMsg("user", "create", pb.ErrorCode_UserSessionNobeing, nil) - return nil + code = pb.ErrorCode_UserSessionNobeing + return } user.UserData.NiceName = req.NickName - err := cache.Defsys.Update(user) + err = cache.Defsys.Update(user) if err != nil { log.Errorf("cache update err") + code = pb.ErrorCode_DBError + return } event.RegisterGO(comm.Event_CreateUser, session.GetUserId()) - session.SendMsg("user", "create", pb.ErrorCode_Success, &pb.UserCreateRsp{}) return nil } diff --git a/modules/web/api_comp.go b/modules/web/api_comp.go index 64bfb7d97..f68b4adf5 100644 --- a/modules/web/api_comp.go +++ b/modules/web/api_comp.go @@ -37,7 +37,7 @@ func (this *Api_Comp) Register(c *engine.Context) { rsp := &pb.UserRegisterRsp{} err := c.BindJSON(&req) if err == nil { - err := db.Defsys.User_CreateUser(&pb.DB_UserData{ + err := db.Defsys.User_Create(&pb.DB_UserData{ Account: req.Account, }) if err != nil { diff --git a/pb.bat b/pb.bat index 1f12a60ee..0e3355eaf 100644 --- a/pb.bat +++ b/pb.bat @@ -2,11 +2,15 @@ set PROJECT_ROOT=.\ +set PROJECT_ROOT=. + set SRC=%PROJECT_ROOT%\pb\proto set TAR=%PROJECT_ROOT%\pb +protoc --proto_path=%SRC% --go_out=%TAR% --go_opt=paths=import %SRC%\*.proto +protoc --proto_path=%SRC% --go_out=%TAR% --go_opt=paths=import %SRC%\friend\*.proto +protoc --proto_path=%SRC% --go_out=%TAR% --go_opt=paths=import %SRC%\pack\*.proto +protoc --proto_path=%SRC% --go_out=%TAR% --go_opt=paths=import %SRC%\mail\*.proto -protoc --proto_path=%SRC% --go_out=%TAR% --go_opt=paths=source_relative %SRC%\*.proto -protoc --proto_path=%SRC% --go_out=%TAR% --go_opt=paths=source_relative %SRC%\*.proto pause \ No newline at end of file diff --git a/pb/comm.pb.go b/pb/comm.pb.go index d1ce2baff..c0e33ac47 100644 --- a/pb/comm.pb.go +++ b/pb/comm.pb.go @@ -9,6 +9,7 @@ package pb import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + anypb "google.golang.org/protobuf/types/known/anypb" reflect "reflect" sync "sync" ) @@ -26,10 +27,10 @@ type UserMessage struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - MainType string `protobuf:"bytes,1,opt,name=MainType,proto3" json:"MainType,omitempty"` - SubType string `protobuf:"bytes,2,opt,name=SubType,proto3" json:"SubType,omitempty"` - Code ErrorCode `protobuf:"varint,3,opt,name=Code,proto3,enum=ErrorCode" json:"Code,omitempty"` - Data []byte `protobuf:"bytes,4,opt,name=Data,proto3" json:"Data,omitempty"` + MainType string `protobuf:"bytes,1,opt,name=MainType,proto3" json:"MainType,omitempty"` + SubType string `protobuf:"bytes,2,opt,name=SubType,proto3" json:"SubType,omitempty"` + Code ErrorCode `protobuf:"varint,3,opt,name=Code,proto3,enum=ErrorCode" json:"Code,omitempty"` + Data *anypb.Any `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` } func (x *UserMessage) Reset() { @@ -85,7 +86,7 @@ func (x *UserMessage) GetCode() ErrorCode { return ErrorCode_Success } -func (x *UserMessage) GetData() []byte { +func (x *UserMessage) GetData() *anypb.Any { if x != nil { return x.Data } @@ -98,12 +99,12 @@ type AgentMessage struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Ip string `protobuf:"bytes,1,opt,name=Ip,proto3" json:"Ip,omitempty"` - UserSessionId string `protobuf:"bytes,2,opt,name=UserSessionId,proto3" json:"UserSessionId,omitempty"` - UserId string `protobuf:"bytes,3,opt,name=UserId,proto3" json:"UserId,omitempty"` - GatewayServiceId string `protobuf:"bytes,4,opt,name=GatewayServiceId,proto3" json:"GatewayServiceId,omitempty"` - Method string `protobuf:"bytes,5,opt,name=Method,proto3" json:"Method,omitempty"` - Message []byte `protobuf:"bytes,6,opt,name=Message,proto3" json:"Message,omitempty"` + Ip string `protobuf:"bytes,1,opt,name=Ip,proto3" json:"Ip,omitempty"` + UserSessionId string `protobuf:"bytes,2,opt,name=UserSessionId,proto3" json:"UserSessionId,omitempty"` + UserId string `protobuf:"bytes,3,opt,name=UserId,proto3" json:"UserId,omitempty"` + GatewayServiceId string `protobuf:"bytes,4,opt,name=GatewayServiceId,proto3" json:"GatewayServiceId,omitempty"` + Method string `protobuf:"bytes,5,opt,name=Method,proto3" json:"Method,omitempty"` + Message *anypb.Any `protobuf:"bytes,6,opt,name=Message,proto3" json:"Message,omitempty"` } func (x *AgentMessage) Reset() { @@ -173,7 +174,7 @@ func (x *AgentMessage) GetMethod() string { return "" } -func (x *AgentMessage) GetMessage() []byte { +func (x *AgentMessage) GetMessage() *anypb.Any { if x != nil { return x.Message } @@ -346,11 +347,11 @@ type AgentSendMessageReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserSessionId string `protobuf:"bytes,1,opt,name=UserSessionId,proto3" json:"UserSessionId,omitempty"` - MainType string `protobuf:"bytes,2,opt,name=MainType,proto3" json:"MainType,omitempty"` - SubType string `protobuf:"bytes,3,opt,name=SubType,proto3" json:"SubType,omitempty"` - Code ErrorCode `protobuf:"varint,4,opt,name=Code,proto3,enum=ErrorCode" json:"Code,omitempty"` - Data []byte `protobuf:"bytes,5,opt,name=Data,proto3" json:"Data,omitempty"` + UserSessionId string `protobuf:"bytes,1,opt,name=UserSessionId,proto3" json:"UserSessionId,omitempty"` + MainType string `protobuf:"bytes,2,opt,name=MainType,proto3" json:"MainType,omitempty"` + SubType string `protobuf:"bytes,3,opt,name=SubType,proto3" json:"SubType,omitempty"` + Code ErrorCode `protobuf:"varint,4,opt,name=Code,proto3,enum=ErrorCode" json:"Code,omitempty"` + Data *anypb.Any `protobuf:"bytes,5,opt,name=Data,proto3" json:"Data,omitempty"` } func (x *AgentSendMessageReq) Reset() { @@ -413,7 +414,7 @@ func (x *AgentSendMessageReq) GetCode() ErrorCode { return ErrorCode_Success } -func (x *AgentSendMessageReq) GetData() []byte { +func (x *AgentSendMessageReq) GetData() *anypb.Any { if x != nil { return x.Data } @@ -426,10 +427,10 @@ type BatchMessageReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserSessionIds []string `protobuf:"bytes,1,rep,name=UserSessionIds,proto3" json:"UserSessionIds,omitempty"` - MainType string `protobuf:"bytes,2,opt,name=MainType,proto3" json:"MainType,omitempty"` - SubType string `protobuf:"bytes,3,opt,name=SubType,proto3" json:"SubType,omitempty"` - Data []byte `protobuf:"bytes,4,opt,name=Data,proto3" json:"Data,omitempty"` + UserSessionIds []string `protobuf:"bytes,1,rep,name=UserSessionIds,proto3" json:"UserSessionIds,omitempty"` + MainType string `protobuf:"bytes,2,opt,name=MainType,proto3" json:"MainType,omitempty"` + SubType string `protobuf:"bytes,3,opt,name=SubType,proto3" json:"SubType,omitempty"` + Data *anypb.Any `protobuf:"bytes,4,opt,name=Data,proto3" json:"Data,omitempty"` } func (x *BatchMessageReq) Reset() { @@ -485,7 +486,7 @@ func (x *BatchMessageReq) GetSubType() string { return "" } -func (x *BatchMessageReq) GetData() []byte { +func (x *BatchMessageReq) GetData() *anypb.Any { if x != nil { return x.Data } @@ -498,9 +499,9 @@ type BroadCastMessageReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - MainType string `protobuf:"bytes,1,opt,name=MainType,proto3" json:"MainType,omitempty"` //服务名 - SubType string `protobuf:"bytes,2,opt,name=SubType,proto3" json:"SubType,omitempty"` - Data []byte `protobuf:"bytes,3,opt,name=Data,proto3" json:"Data,omitempty"` + MainType string `protobuf:"bytes,1,opt,name=MainType,proto3" json:"MainType,omitempty"` //服务名 + SubType string `protobuf:"bytes,2,opt,name=SubType,proto3" json:"SubType,omitempty"` + Data *anypb.Any `protobuf:"bytes,3,opt,name=Data,proto3" json:"Data,omitempty"` } func (x *BroadCastMessageReq) Reset() { @@ -549,7 +550,7 @@ func (x *BroadCastMessageReq) GetSubType() string { return "" } -func (x *BroadCastMessageReq) GetData() []byte { +func (x *BroadCastMessageReq) GetData() *anypb.Any { if x != nil { return x.Data } @@ -608,69 +609,78 @@ var File_comm_proto protoreflect.FileDescriptor var file_comm_proto_rawDesc = []byte{ 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x65, 0x72, - 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x77, 0x0a, - 0x0b, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08, - 0x4d, 0x61, 0x69, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x4d, 0x61, 0x69, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x53, 0x75, 0x62, 0x54, - 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x53, 0x75, 0x62, 0x54, 0x79, - 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x0a, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x43, 0x6f, - 0x64, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x04, 0x44, 0x61, 0x74, 0x61, 0x22, 0xba, 0x01, 0x0a, 0x0c, 0x41, 0x67, 0x65, 0x6e, 0x74, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x70, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x70, 0x12, 0x24, 0x0a, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x53, - 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, - 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x16, 0x0a, - 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x55, - 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x2a, 0x0a, 0x10, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x10, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, - 0x64, 0x12, 0x16, 0x0a, 0x06, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x22, 0x43, 0x0a, 0x0f, 0x52, 0x50, 0x43, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x1e, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0a, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, - 0x52, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x03, 0x4d, 0x73, 0x67, 0x22, 0x4d, 0x0a, 0x0d, 0x41, 0x67, 0x65, 0x6e, - 0x74, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x52, 0x65, 0x71, 0x12, 0x24, 0x0a, 0x0d, 0x55, 0x73, 0x65, - 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, + 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8d, 0x01, 0x0a, 0x0b, 0x55, 0x73, 0x65, + 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x4d, 0x61, 0x69, 0x6e, + 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4d, 0x61, 0x69, 0x6e, + 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x53, 0x75, 0x62, 0x54, 0x79, 0x70, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x53, 0x75, 0x62, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1e, + 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0a, 0x2e, 0x45, + 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x28, + 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, + 0x6e, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0xd0, 0x01, 0x0a, 0x0c, 0x41, 0x67, 0x65, + 0x6e, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x70, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x70, 0x12, 0x24, 0x0a, 0x0d, 0x55, 0x73, 0x65, + 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, - 0x16, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x37, 0x0a, 0x0f, 0x41, 0x67, 0x65, 0x6e, 0x74, - 0x55, 0x6e, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x52, 0x65, 0x71, 0x12, 0x24, 0x0a, 0x0d, 0x55, 0x73, - 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, - 0x22, 0xa5, 0x01, 0x0a, 0x13, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x12, 0x24, 0x0a, 0x0d, 0x55, 0x73, 0x65, 0x72, - 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0d, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x1a, - 0x0a, 0x08, 0x4d, 0x61, 0x69, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x08, 0x4d, 0x61, 0x69, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x53, 0x75, - 0x62, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x53, 0x75, 0x62, - 0x54, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x0a, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, - 0x43, 0x6f, 0x64, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x04, 0x44, 0x61, 0x74, 0x61, 0x22, 0x83, 0x01, 0x0a, 0x0f, 0x42, 0x61, 0x74, - 0x63, 0x68, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x12, 0x26, 0x0a, 0x0e, - 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, - 0x6e, 0x49, 0x64, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x4d, 0x61, 0x69, 0x6e, 0x54, 0x79, 0x70, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4d, 0x61, 0x69, 0x6e, 0x54, 0x79, 0x70, 0x65, - 0x12, 0x18, 0x0a, 0x07, 0x53, 0x75, 0x62, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x07, 0x53, 0x75, 0x62, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x44, 0x61, - 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x44, 0x61, 0x74, 0x61, 0x22, 0x5f, - 0x0a, 0x13, 0x42, 0x72, 0x6f, 0x61, 0x64, 0x43, 0x61, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x4d, 0x61, 0x69, 0x6e, 0x54, 0x79, 0x70, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4d, 0x61, 0x69, 0x6e, 0x54, 0x79, 0x70, - 0x65, 0x12, 0x18, 0x0a, 0x07, 0x53, 0x75, 0x62, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x53, 0x75, 0x62, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x44, - 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x44, 0x61, 0x74, 0x61, 0x22, - 0x36, 0x0a, 0x0e, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x65, 0x52, 0x65, + 0x16, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x2a, 0x0a, 0x10, 0x47, 0x61, 0x74, 0x65, 0x77, + 0x61, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x10, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x2e, 0x0a, 0x07, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, + 0x6e, 0x79, 0x52, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x43, 0x0a, 0x0f, 0x52, + 0x50, 0x43, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x1e, + 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0a, 0x2e, 0x45, + 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, + 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x4d, 0x73, 0x67, + 0x22, 0x4d, 0x0a, 0x0d, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x52, 0x65, 0x71, 0x12, 0x24, 0x0a, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, - 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, + 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, + 0x37, 0x0a, 0x0f, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x55, 0x6e, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x52, + 0x65, 0x71, 0x12, 0x24, 0x0a, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x53, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0xbb, 0x01, 0x0a, 0x13, 0x41, 0x67, 0x65, + 0x6e, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, + 0x12, 0x24, 0x0a, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x4d, 0x61, 0x69, 0x6e, 0x54, 0x79, + 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4d, 0x61, 0x69, 0x6e, 0x54, 0x79, + 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x53, 0x75, 0x62, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x53, 0x75, 0x62, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x04, + 0x43, 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0a, 0x2e, 0x45, 0x72, 0x72, + 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x28, 0x0a, 0x04, + 0x44, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, + 0x52, 0x04, 0x44, 0x61, 0x74, 0x61, 0x22, 0x99, 0x01, 0x0a, 0x0f, 0x42, 0x61, 0x74, 0x63, 0x68, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x12, 0x26, 0x0a, 0x0e, 0x55, 0x73, + 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x0e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, + 0x64, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x4d, 0x61, 0x69, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4d, 0x61, 0x69, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, + 0x0a, 0x07, 0x53, 0x75, 0x62, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x53, 0x75, 0x62, 0x54, 0x79, 0x70, 0x65, 0x12, 0x28, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x44, 0x61, + 0x74, 0x61, 0x22, 0x75, 0x0a, 0x13, 0x42, 0x72, 0x6f, 0x61, 0x64, 0x43, 0x61, 0x73, 0x74, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x4d, 0x61, 0x69, + 0x6e, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4d, 0x61, 0x69, + 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x53, 0x75, 0x62, 0x54, 0x79, 0x70, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x53, 0x75, 0x62, 0x54, 0x79, 0x70, 0x65, 0x12, + 0x28, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x41, 0x6e, 0x79, 0x52, 0x04, 0x44, 0x61, 0x74, 0x61, 0x22, 0x36, 0x0a, 0x0e, 0x41, 0x67, 0x65, + 0x6e, 0x74, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x65, 0x52, 0x65, 0x71, 0x12, 0x24, 0x0a, 0x0d, 0x55, + 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, + 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( @@ -697,16 +707,22 @@ var file_comm_proto_goTypes = []interface{}{ (*BroadCastMessageReq)(nil), // 7: BroadCastMessageReq (*AgentCloseeReq)(nil), // 8: AgentCloseeReq (ErrorCode)(0), // 9: ErrorCode + (*anypb.Any)(nil), // 10: google.protobuf.Any } var file_comm_proto_depIdxs = []int32{ - 9, // 0: UserMessage.Code:type_name -> ErrorCode - 9, // 1: RPCMessageReply.Code:type_name -> ErrorCode - 9, // 2: AgentSendMessageReq.Code:type_name -> ErrorCode - 3, // [3:3] is the sub-list for method output_type - 3, // [3:3] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name + 9, // 0: UserMessage.Code:type_name -> ErrorCode + 10, // 1: UserMessage.data:type_name -> google.protobuf.Any + 10, // 2: AgentMessage.Message:type_name -> google.protobuf.Any + 9, // 3: RPCMessageReply.Code:type_name -> ErrorCode + 9, // 4: AgentSendMessageReq.Code:type_name -> ErrorCode + 10, // 5: AgentSendMessageReq.Data:type_name -> google.protobuf.Any + 10, // 6: BatchMessageReq.Data:type_name -> google.protobuf.Any + 10, // 7: BroadCastMessageReq.Data:type_name -> google.protobuf.Any + 8, // [8:8] is the sub-list for method output_type + 8, // [8:8] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name } func init() { file_comm_proto_init() } diff --git a/pb/errorcode.pb.go b/pb/errorcode.pb.go index 721cb3939..3a3ec720f 100644 --- a/pb/errorcode.pb.go +++ b/pb/errorcode.pb.go @@ -33,31 +33,55 @@ const ( ErrorCode_InsufficientPermissions ErrorCode = 16 //权限不足 ErrorCode_NoLogin ErrorCode = 17 //未登录 ErrorCode_UserSessionNobeing ErrorCode = 18 //用户不存在 - ErrorCode_SecKey ErrorCode = 19 //秘钥格式错误 - ErrorCode_SecKeyInvalid ErrorCode = 20 //秘钥无效 ErrorCode_StateInvalid ErrorCode = 21 //无效状态 ErrorCode_DBError ErrorCode = 22 // 数据库操作失败 ErrorCode_SystemError ErrorCode = 23 // 通用错误 + //user + ErrorCode_SecKeyInvalid ErrorCode = 1000 //秘钥无效 + ErrorCode_SecKey ErrorCode = 1001 //秘钥格式错误 + //friend + ErrorCode_FriendNotSelf ErrorCode = 1100 //不能是自己 + ErrorCode_FriendSelfMax ErrorCode = 1101 //超出好友最大数量 + ErrorCode_FriendTargetMax ErrorCode = 1102 //超出目标好友最大数量 + ErrorCode_FriendSelfNoData ErrorCode = 1103 //无好友记录 + ErrorCode_FriendTargetNoData ErrorCode = 1104 //无目标好友记录 + ErrorCode_FriendYet ErrorCode = 1105 //已是好友 + ErrorCode_FriendApplyYet ErrorCode = 1106 //已申请该好友 + ErrorCode_FriendSelfBlackYet ErrorCode = 1107 //已在自己黑名单中 + ErrorCode_FriendTargetBlackYet ErrorCode = 1108 //已在对方的黑名单中 + ErrorCode_FriendApplyError ErrorCode = 1109 //申请失败 + ErrorCode_FriendBlackMax ErrorCode = 1110 //黑名单最大数量 ) // Enum value maps for ErrorCode. var ( ErrorCode_name = map[int32]string{ - 0: "Success", - 10: "NoFindService", - 11: "RpcFuncExecutionError", - 12: "CacheReadError", - 13: "SqlExecutionError", - 14: "ReqParameterError", - 15: "SignError", - 16: "InsufficientPermissions", - 17: "NoLogin", - 18: "UserSessionNobeing", - 19: "SecKey", - 20: "SecKeyInvalid", - 21: "StateInvalid", - 22: "DBError", - 23: "SystemError", + 0: "Success", + 10: "NoFindService", + 11: "RpcFuncExecutionError", + 12: "CacheReadError", + 13: "SqlExecutionError", + 14: "ReqParameterError", + 15: "SignError", + 16: "InsufficientPermissions", + 17: "NoLogin", + 18: "UserSessionNobeing", + 21: "StateInvalid", + 22: "DBError", + 23: "SystemError", + 1000: "SecKeyInvalid", + 1001: "SecKey", + 1100: "FriendNotSelf", + 1101: "FriendSelfMax", + 1102: "FriendTargetMax", + 1103: "FriendSelfNoData", + 1104: "FriendTargetNoData", + 1105: "FriendYet", + 1106: "FriendApplyYet", + 1107: "FriendSelfBlackYet", + 1108: "FriendTargetBlackYet", + 1109: "FriendApplyError", + 1110: "FriendBlackMax", } ErrorCode_value = map[string]int32{ "Success": 0, @@ -70,11 +94,22 @@ var ( "InsufficientPermissions": 16, "NoLogin": 17, "UserSessionNobeing": 18, - "SecKey": 19, - "SecKeyInvalid": 20, "StateInvalid": 21, "DBError": 22, "SystemError": 23, + "SecKeyInvalid": 1000, + "SecKey": 1001, + "FriendNotSelf": 1100, + "FriendSelfMax": 1101, + "FriendTargetMax": 1102, + "FriendSelfNoData": 1103, + "FriendTargetNoData": 1104, + "FriendYet": 1105, + "FriendApplyYet": 1106, + "FriendSelfBlackYet": 1107, + "FriendTargetBlackYet": 1108, + "FriendApplyError": 1109, + "FriendBlackMax": 1110, } ) @@ -109,7 +144,7 @@ var File_errorcode_proto protoreflect.FileDescriptor var file_errorcode_proto_rawDesc = []byte{ 0x0a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2a, 0xa8, 0x02, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, + 0x6f, 0x2a, 0x9d, 0x04, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x10, 0x0a, 0x12, 0x19, 0x0a, 0x15, 0x52, 0x70, 0x63, 0x46, 0x75, 0x6e, 0x63, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, @@ -122,13 +157,29 @@ var file_errorcode_proto_rawDesc = []byte{ 0x6e, 0x73, 0x75, 0x66, 0x66, 0x69, 0x63, 0x69, 0x65, 0x6e, 0x74, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x10, 0x10, 0x12, 0x0b, 0x0a, 0x07, 0x4e, 0x6f, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x10, 0x11, 0x12, 0x16, 0x0a, 0x12, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x4e, 0x6f, 0x62, 0x65, 0x69, 0x6e, 0x67, 0x10, 0x12, 0x12, 0x0a, 0x0a, - 0x06, 0x53, 0x65, 0x63, 0x4b, 0x65, 0x79, 0x10, 0x13, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x65, 0x63, - 0x4b, 0x65, 0x79, 0x49, 0x6e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x10, 0x14, 0x12, 0x10, 0x0a, 0x0c, - 0x53, 0x74, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x10, 0x15, 0x12, 0x0b, - 0x0a, 0x07, 0x44, 0x42, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x16, 0x12, 0x0f, 0x0a, 0x0b, 0x53, - 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x17, 0x42, 0x06, 0x5a, 0x04, - 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x69, 0x6f, 0x6e, 0x4e, 0x6f, 0x62, 0x65, 0x69, 0x6e, 0x67, 0x10, 0x12, 0x12, 0x10, 0x0a, + 0x0c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x10, 0x15, 0x12, + 0x0b, 0x0a, 0x07, 0x44, 0x42, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x16, 0x12, 0x0f, 0x0a, 0x0b, + 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x17, 0x12, 0x12, 0x0a, + 0x0d, 0x53, 0x65, 0x63, 0x4b, 0x65, 0x79, 0x49, 0x6e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x10, 0xe8, + 0x07, 0x12, 0x0b, 0x0a, 0x06, 0x53, 0x65, 0x63, 0x4b, 0x65, 0x79, 0x10, 0xe9, 0x07, 0x12, 0x12, + 0x0a, 0x0d, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x4e, 0x6f, 0x74, 0x53, 0x65, 0x6c, 0x66, 0x10, + 0xcc, 0x08, 0x12, 0x12, 0x0a, 0x0d, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x6c, 0x66, + 0x4d, 0x61, 0x78, 0x10, 0xcd, 0x08, 0x12, 0x14, 0x0a, 0x0f, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, + 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x4d, 0x61, 0x78, 0x10, 0xce, 0x08, 0x12, 0x15, 0x0a, 0x10, + 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x6c, 0x66, 0x4e, 0x6f, 0x44, 0x61, 0x74, 0x61, + 0x10, 0xcf, 0x08, 0x12, 0x17, 0x0a, 0x12, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x54, 0x61, 0x72, + 0x67, 0x65, 0x74, 0x4e, 0x6f, 0x44, 0x61, 0x74, 0x61, 0x10, 0xd0, 0x08, 0x12, 0x0e, 0x0a, 0x09, + 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x59, 0x65, 0x74, 0x10, 0xd1, 0x08, 0x12, 0x13, 0x0a, 0x0e, + 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x59, 0x65, 0x74, 0x10, 0xd2, + 0x08, 0x12, 0x17, 0x0a, 0x12, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x6c, 0x66, 0x42, + 0x6c, 0x61, 0x63, 0x6b, 0x59, 0x65, 0x74, 0x10, 0xd3, 0x08, 0x12, 0x19, 0x0a, 0x14, 0x46, 0x72, + 0x69, 0x65, 0x6e, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x42, 0x6c, 0x61, 0x63, 0x6b, 0x59, + 0x65, 0x74, 0x10, 0xd4, 0x08, 0x12, 0x15, 0x0a, 0x10, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x41, + 0x70, 0x70, 0x6c, 0x79, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0xd5, 0x08, 0x12, 0x13, 0x0a, 0x0e, + 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x42, 0x6c, 0x61, 0x63, 0x6b, 0x4d, 0x61, 0x78, 0x10, 0xd6, + 0x08, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( diff --git a/pb/friend_db.pb.go b/pb/friend_db.pb.go index c961ac9aa..8e5d8ac2a 100644 --- a/pb/friend_db.pb.go +++ b/pb/friend_db.pb.go @@ -25,8 +25,10 @@ type Cache_FriendData struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty" bson:"_id"` //tags:{bson:"_id"}用户Id - FriendId []string `protobuf:"bytes,2,rep,name=friendId,proto3" json:"friendId,omitempty"` + UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty" bson:"_id"` // ID + FriendIds []string `protobuf:"bytes,2,rep,name=friendIds,proto3" json:"friendIds,omitempty"` //好友ID + ApplyIds []string `protobuf:"bytes,3,rep,name=applyIds,proto3" json:"applyIds,omitempty"` //申请用户ID + BlackIds []string `protobuf:"bytes,4,rep,name=blackIds,proto3" json:"blackIds,omitempty"` //黑名单ID } func (x *Cache_FriendData) Reset() { @@ -68,9 +70,23 @@ func (x *Cache_FriendData) GetUserId() string { return "" } -func (x *Cache_FriendData) GetFriendId() []string { +func (x *Cache_FriendData) GetFriendIds() []string { if x != nil { - return x.FriendId + return x.FriendIds + } + return nil +} + +func (x *Cache_FriendData) GetApplyIds() []string { + if x != nil { + return x.ApplyIds + } + return nil +} + +func (x *Cache_FriendData) GetBlackIds() []string { + if x != nil { + return x.BlackIds } return nil } @@ -79,12 +95,16 @@ var File_friend_friend_db_proto protoreflect.FileDescriptor var file_friend_friend_db_proto_rawDesc = []byte{ 0x0a, 0x16, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x2f, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x5f, - 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x46, 0x0a, 0x10, 0x43, 0x61, 0x63, 0x68, - 0x65, 0x5f, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x44, 0x61, 0x74, 0x61, 0x12, 0x16, 0x0a, 0x06, - 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, - 0x65, 0x72, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, - 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, - 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x80, 0x01, 0x0a, 0x10, 0x43, 0x61, 0x63, + 0x68, 0x65, 0x5f, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x44, 0x61, 0x74, 0x61, 0x12, 0x16, 0x0a, + 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, + 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, + 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, + 0x49, 0x64, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x49, 0x64, 0x73, 0x18, + 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x49, 0x64, 0x73, 0x12, + 0x1a, 0x0a, 0x08, 0x62, 0x6c, 0x61, 0x63, 0x6b, 0x49, 0x64, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x08, 0x62, 0x6c, 0x61, 0x63, 0x6b, 0x49, 0x64, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, + 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/pb/friend_msg.pb.go b/pb/friend_msg.pb.go index 7770af397..725a918e5 100644 --- a/pb/friend_msg.pb.go +++ b/pb/friend_msg.pb.go @@ -159,7 +159,7 @@ type FriendListRsp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - List []*Cache_FriendData `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` + List []*FriendBase `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` } func (x *FriendListRsp) Reset() { @@ -194,15 +194,15 @@ func (*FriendListRsp) Descriptor() ([]byte, []int) { return file_friend_friend_msg_proto_rawDescGZIP(), []int{2} } -func (x *FriendListRsp) GetList() []*Cache_FriendData { +func (x *FriendListRsp) GetList() []*FriendBase { if x != nil { return x.List } return nil } -//添加好友 -type FriendAddReq struct { +//申请好友 +type FriendApplyReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -210,8 +210,8 @@ type FriendAddReq struct { FriendId string `protobuf:"bytes,1,opt,name=friendId,proto3" json:"friendId,omitempty"` //好友ID } -func (x *FriendAddReq) Reset() { - *x = FriendAddReq{} +func (x *FriendApplyReq) Reset() { + *x = FriendApplyReq{} if protoimpl.UnsafeEnabled { mi := &file_friend_friend_msg_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -219,13 +219,13 @@ func (x *FriendAddReq) Reset() { } } -func (x *FriendAddReq) String() string { +func (x *FriendApplyReq) String() string { return protoimpl.X.MessageStringOf(x) } -func (*FriendAddReq) ProtoMessage() {} +func (*FriendApplyReq) ProtoMessage() {} -func (x *FriendAddReq) ProtoReflect() protoreflect.Message { +func (x *FriendApplyReq) ProtoReflect() protoreflect.Message { mi := &file_friend_friend_msg_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -237,28 +237,29 @@ func (x *FriendAddReq) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use FriendAddReq.ProtoReflect.Descriptor instead. -func (*FriendAddReq) Descriptor() ([]byte, []int) { +// Deprecated: Use FriendApplyReq.ProtoReflect.Descriptor instead. +func (*FriendApplyReq) Descriptor() ([]byte, []int) { return file_friend_friend_msg_proto_rawDescGZIP(), []int{3} } -func (x *FriendAddReq) GetFriendId() string { +func (x *FriendApplyReq) GetFriendId() string { if x != nil { return x.FriendId } return "" } -type FriendAddRsp struct { +type FriendApplyRsp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` //用户ID + UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` //用户ID + FriendId string `protobuf:"bytes,2,opt,name=friendId,proto3" json:"friendId,omitempty"` //好友ID } -func (x *FriendAddRsp) Reset() { - *x = FriendAddRsp{} +func (x *FriendApplyRsp) Reset() { + *x = FriendApplyRsp{} if protoimpl.UnsafeEnabled { mi := &file_friend_friend_msg_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -266,13 +267,13 @@ func (x *FriendAddRsp) Reset() { } } -func (x *FriendAddRsp) String() string { +func (x *FriendApplyRsp) String() string { return protoimpl.X.MessageStringOf(x) } -func (*FriendAddRsp) ProtoMessage() {} +func (*FriendApplyRsp) ProtoMessage() {} -func (x *FriendAddRsp) ProtoReflect() protoreflect.Message { +func (x *FriendApplyRsp) ProtoReflect() protoreflect.Message { mi := &file_friend_friend_msg_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -284,18 +285,25 @@ func (x *FriendAddRsp) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use FriendAddRsp.ProtoReflect.Descriptor instead. -func (*FriendAddRsp) Descriptor() ([]byte, []int) { +// Deprecated: Use FriendApplyRsp.ProtoReflect.Descriptor instead. +func (*FriendApplyRsp) Descriptor() ([]byte, []int) { return file_friend_friend_msg_proto_rawDescGZIP(), []int{4} } -func (x *FriendAddRsp) GetUserId() string { +func (x *FriendApplyRsp) GetUserId() string { if x != nil { return x.UserId } return "" } +func (x *FriendApplyRsp) GetFriendId() string { + if x != nil { + return x.FriendId + } + return "" +} + //删除好友 type FriendDelReq struct { state protoimpl.MessageState @@ -399,18 +407,17 @@ func (x *FriendDelRsp) GetUserId() string { return "" } -//同意或拒绝 -type FriendAgreeOrRefuseReq struct { +//同意 +type FriendAgreeReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - FriendId string `protobuf:"bytes,1,opt,name=friendId,proto3" json:"friendId,omitempty"` //被同意或拒绝的用户 - IsAgree bool `protobuf:"varint,2,opt,name=isAgree,proto3" json:"isAgree,omitempty"` + FriendIds []string `protobuf:"bytes,1,rep,name=friendIds,proto3" json:"friendIds,omitempty"` //被同意的用户 } -func (x *FriendAgreeOrRefuseReq) Reset() { - *x = FriendAgreeOrRefuseReq{} +func (x *FriendAgreeReq) Reset() { + *x = FriendAgreeReq{} if protoimpl.UnsafeEnabled { mi := &file_friend_friend_msg_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -418,13 +425,13 @@ func (x *FriendAgreeOrRefuseReq) Reset() { } } -func (x *FriendAgreeOrRefuseReq) String() string { +func (x *FriendAgreeReq) String() string { return protoimpl.X.MessageStringOf(x) } -func (*FriendAgreeOrRefuseReq) ProtoMessage() {} +func (*FriendAgreeReq) ProtoMessage() {} -func (x *FriendAgreeOrRefuseReq) ProtoReflect() protoreflect.Message { +func (x *FriendAgreeReq) ProtoReflect() protoreflect.Message { mi := &file_friend_friend_msg_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -436,36 +443,28 @@ func (x *FriendAgreeOrRefuseReq) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use FriendAgreeOrRefuseReq.ProtoReflect.Descriptor instead. -func (*FriendAgreeOrRefuseReq) Descriptor() ([]byte, []int) { +// Deprecated: Use FriendAgreeReq.ProtoReflect.Descriptor instead. +func (*FriendAgreeReq) Descriptor() ([]byte, []int) { return file_friend_friend_msg_proto_rawDescGZIP(), []int{7} } -func (x *FriendAgreeOrRefuseReq) GetFriendId() string { +func (x *FriendAgreeReq) GetFriendIds() []string { if x != nil { - return x.FriendId + return x.FriendIds } - return "" + return nil } -func (x *FriendAgreeOrRefuseReq) GetIsAgree() bool { - if x != nil { - return x.IsAgree - } - return false -} - -type FriendAgressOrRefuseRsp struct { +type FriendAgreeRsp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Num int32 `protobuf:"varint,1,opt,name=Num,proto3" json:"Num,omitempty"` //操作的数量 - IsAgree bool `protobuf:"varint,2,opt,name=isAgree,proto3" json:"isAgree,omitempty"` + Num int32 `protobuf:"varint,1,opt,name=Num,proto3" json:"Num,omitempty"` //操作的数量 } -func (x *FriendAgressOrRefuseRsp) Reset() { - *x = FriendAgressOrRefuseRsp{} +func (x *FriendAgreeRsp) Reset() { + *x = FriendAgreeRsp{} if protoimpl.UnsafeEnabled { mi := &file_friend_friend_msg_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -473,13 +472,13 @@ func (x *FriendAgressOrRefuseRsp) Reset() { } } -func (x *FriendAgressOrRefuseRsp) String() string { +func (x *FriendAgreeRsp) String() string { return protoimpl.X.MessageStringOf(x) } -func (*FriendAgressOrRefuseRsp) ProtoMessage() {} +func (*FriendAgreeRsp) ProtoMessage() {} -func (x *FriendAgressOrRefuseRsp) ProtoReflect() protoreflect.Message { +func (x *FriendAgreeRsp) ProtoReflect() protoreflect.Message { mi := &file_friend_friend_msg_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -491,23 +490,111 @@ func (x *FriendAgressOrRefuseRsp) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use FriendAgressOrRefuseRsp.ProtoReflect.Descriptor instead. -func (*FriendAgressOrRefuseRsp) Descriptor() ([]byte, []int) { +// Deprecated: Use FriendAgreeRsp.ProtoReflect.Descriptor instead. +func (*FriendAgreeRsp) Descriptor() ([]byte, []int) { return file_friend_friend_msg_proto_rawDescGZIP(), []int{8} } -func (x *FriendAgressOrRefuseRsp) GetNum() int32 { +func (x *FriendAgreeRsp) GetNum() int32 { if x != nil { return x.Num } return 0 } -func (x *FriendAgressOrRefuseRsp) GetIsAgree() bool { - if x != nil { - return x.IsAgree +//拒绝 +type FriendRefuseReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + FriendIds []string `protobuf:"bytes,1,rep,name=friendIds,proto3" json:"friendIds,omitempty"` //被拒绝的用户 +} + +func (x *FriendRefuseReq) Reset() { + *x = FriendRefuseReq{} + if protoimpl.UnsafeEnabled { + mi := &file_friend_friend_msg_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - return false +} + +func (x *FriendRefuseReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FriendRefuseReq) ProtoMessage() {} + +func (x *FriendRefuseReq) ProtoReflect() protoreflect.Message { + mi := &file_friend_friend_msg_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FriendRefuseReq.ProtoReflect.Descriptor instead. +func (*FriendRefuseReq) Descriptor() ([]byte, []int) { + return file_friend_friend_msg_proto_rawDescGZIP(), []int{9} +} + +func (x *FriendRefuseReq) GetFriendIds() []string { + if x != nil { + return x.FriendIds + } + return nil +} + +type FriendRefuseRsp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Num int32 `protobuf:"varint,1,opt,name=Num,proto3" json:"Num,omitempty"` //操作的数量 +} + +func (x *FriendRefuseRsp) Reset() { + *x = FriendRefuseRsp{} + if protoimpl.UnsafeEnabled { + mi := &file_friend_friend_msg_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FriendRefuseRsp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FriendRefuseRsp) ProtoMessage() {} + +func (x *FriendRefuseRsp) ProtoReflect() protoreflect.Message { + mi := &file_friend_friend_msg_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FriendRefuseRsp.ProtoReflect.Descriptor instead. +func (*FriendRefuseRsp) Descriptor() ([]byte, []int) { + return file_friend_friend_msg_proto_rawDescGZIP(), []int{10} +} + +func (x *FriendRefuseRsp) GetNum() int32 { + if x != nil { + return x.Num + } + return 0 } //好友申请列表 @@ -520,7 +607,7 @@ type FriendApplyListReq struct { func (x *FriendApplyListReq) Reset() { *x = FriendApplyListReq{} if protoimpl.UnsafeEnabled { - mi := &file_friend_friend_msg_proto_msgTypes[9] + mi := &file_friend_friend_msg_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -533,7 +620,7 @@ func (x *FriendApplyListReq) String() string { func (*FriendApplyListReq) ProtoMessage() {} func (x *FriendApplyListReq) ProtoReflect() protoreflect.Message { - mi := &file_friend_friend_msg_proto_msgTypes[9] + mi := &file_friend_friend_msg_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -546,19 +633,21 @@ func (x *FriendApplyListReq) ProtoReflect() protoreflect.Message { // Deprecated: Use FriendApplyListReq.ProtoReflect.Descriptor instead. func (*FriendApplyListReq) Descriptor() ([]byte, []int) { - return file_friend_friend_msg_proto_rawDescGZIP(), []int{9} + return file_friend_friend_msg_proto_rawDescGZIP(), []int{11} } type FriendApplyListRsp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + List []*FriendBase `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` } func (x *FriendApplyListRsp) Reset() { *x = FriendApplyListRsp{} if protoimpl.UnsafeEnabled { - mi := &file_friend_friend_msg_proto_msgTypes[10] + mi := &file_friend_friend_msg_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -571,7 +660,7 @@ func (x *FriendApplyListRsp) String() string { func (*FriendApplyListRsp) ProtoMessage() {} func (x *FriendApplyListRsp) ProtoReflect() protoreflect.Message { - mi := &file_friend_friend_msg_proto_msgTypes[10] + mi := &file_friend_friend_msg_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -584,7 +673,14 @@ func (x *FriendApplyListRsp) ProtoReflect() protoreflect.Message { // Deprecated: Use FriendApplyListRsp.ProtoReflect.Descriptor instead. func (*FriendApplyListRsp) Descriptor() ([]byte, []int) { - return file_friend_friend_msg_proto_rawDescGZIP(), []int{10} + return file_friend_friend_msg_proto_rawDescGZIP(), []int{12} +} + +func (x *FriendApplyListRsp) GetList() []*FriendBase { + if x != nil { + return x.List + } + return nil } //好友搜索 @@ -593,14 +689,13 @@ type FriendSearchReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - FriendId string `protobuf:"bytes,1,opt,name=friendId,proto3" json:"friendId,omitempty"` - NickName string `protobuf:"bytes,2,opt,name=nickName,proto3" json:"nickName,omitempty"` //好友昵称 + NickName string `protobuf:"bytes,1,opt,name=nickName,proto3" json:"nickName,omitempty"` //好友昵称 } func (x *FriendSearchReq) Reset() { *x = FriendSearchReq{} if protoimpl.UnsafeEnabled { - mi := &file_friend_friend_msg_proto_msgTypes[11] + mi := &file_friend_friend_msg_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -613,7 +708,7 @@ func (x *FriendSearchReq) String() string { func (*FriendSearchReq) ProtoMessage() {} func (x *FriendSearchReq) ProtoReflect() protoreflect.Message { - mi := &file_friend_friend_msg_proto_msgTypes[11] + mi := &file_friend_friend_msg_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -626,14 +721,7 @@ func (x *FriendSearchReq) ProtoReflect() protoreflect.Message { // Deprecated: Use FriendSearchReq.ProtoReflect.Descriptor instead. func (*FriendSearchReq) Descriptor() ([]byte, []int) { - return file_friend_friend_msg_proto_rawDescGZIP(), []int{11} -} - -func (x *FriendSearchReq) GetFriendId() string { - if x != nil { - return x.FriendId - } - return "" + return file_friend_friend_msg_proto_rawDescGZIP(), []int{13} } func (x *FriendSearchReq) GetNickName() string { @@ -648,13 +736,13 @@ type FriendSearchRsp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Friends []*FriendBase `protobuf:"bytes,1,rep,name=friends,proto3" json:"friends,omitempty"` + Friend *FriendBase `protobuf:"bytes,1,opt,name=friend,proto3" json:"friend,omitempty"` } func (x *FriendSearchRsp) Reset() { *x = FriendSearchRsp{} if protoimpl.UnsafeEnabled { - mi := &file_friend_friend_msg_proto_msgTypes[12] + mi := &file_friend_friend_msg_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -667,7 +755,7 @@ func (x *FriendSearchRsp) String() string { func (*FriendSearchRsp) ProtoMessage() {} func (x *FriendSearchRsp) ProtoReflect() protoreflect.Message { - mi := &file_friend_friend_msg_proto_msgTypes[12] + mi := &file_friend_friend_msg_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -680,12 +768,12 @@ func (x *FriendSearchRsp) ProtoReflect() protoreflect.Message { // Deprecated: Use FriendSearchRsp.ProtoReflect.Descriptor instead. func (*FriendSearchRsp) Descriptor() ([]byte, []int) { - return file_friend_friend_msg_proto_rawDescGZIP(), []int{12} + return file_friend_friend_msg_proto_rawDescGZIP(), []int{14} } -func (x *FriendSearchRsp) GetFriends() []*FriendBase { +func (x *FriendSearchRsp) GetFriend() *FriendBase { if x != nil { - return x.Friends + return x.Friend } return nil } @@ -700,7 +788,7 @@ type FriendBlackListReq struct { func (x *FriendBlackListReq) Reset() { *x = FriendBlackListReq{} if protoimpl.UnsafeEnabled { - mi := &file_friend_friend_msg_proto_msgTypes[13] + mi := &file_friend_friend_msg_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -713,7 +801,7 @@ func (x *FriendBlackListReq) String() string { func (*FriendBlackListReq) ProtoMessage() {} func (x *FriendBlackListReq) ProtoReflect() protoreflect.Message { - mi := &file_friend_friend_msg_proto_msgTypes[13] + mi := &file_friend_friend_msg_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -726,7 +814,7 @@ func (x *FriendBlackListReq) ProtoReflect() protoreflect.Message { // Deprecated: Use FriendBlackListReq.ProtoReflect.Descriptor instead. func (*FriendBlackListReq) Descriptor() ([]byte, []int) { - return file_friend_friend_msg_proto_rawDescGZIP(), []int{13} + return file_friend_friend_msg_proto_rawDescGZIP(), []int{15} } type FriendBlackListRsp struct { @@ -740,7 +828,7 @@ type FriendBlackListRsp struct { func (x *FriendBlackListRsp) Reset() { *x = FriendBlackListRsp{} if protoimpl.UnsafeEnabled { - mi := &file_friend_friend_msg_proto_msgTypes[14] + mi := &file_friend_friend_msg_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -753,7 +841,7 @@ func (x *FriendBlackListRsp) String() string { func (*FriendBlackListRsp) ProtoMessage() {} func (x *FriendBlackListRsp) ProtoReflect() protoreflect.Message { - mi := &file_friend_friend_msg_proto_msgTypes[14] + mi := &file_friend_friend_msg_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -766,7 +854,7 @@ func (x *FriendBlackListRsp) ProtoReflect() protoreflect.Message { // Deprecated: Use FriendBlackListRsp.ProtoReflect.Descriptor instead. func (*FriendBlackListRsp) Descriptor() ([]byte, []int) { - return file_friend_friend_msg_proto_rawDescGZIP(), []int{14} + return file_friend_friend_msg_proto_rawDescGZIP(), []int{16} } func (x *FriendBlackListRsp) GetFriends() []*FriendBase { @@ -788,7 +876,7 @@ type FriendBlackAddReq struct { func (x *FriendBlackAddReq) Reset() { *x = FriendBlackAddReq{} if protoimpl.UnsafeEnabled { - mi := &file_friend_friend_msg_proto_msgTypes[15] + mi := &file_friend_friend_msg_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -801,7 +889,7 @@ func (x *FriendBlackAddReq) String() string { func (*FriendBlackAddReq) ProtoMessage() {} func (x *FriendBlackAddReq) ProtoReflect() protoreflect.Message { - mi := &file_friend_friend_msg_proto_msgTypes[15] + mi := &file_friend_friend_msg_proto_msgTypes[17] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -814,7 +902,7 @@ func (x *FriendBlackAddReq) ProtoReflect() protoreflect.Message { // Deprecated: Use FriendBlackAddReq.ProtoReflect.Descriptor instead. func (*FriendBlackAddReq) Descriptor() ([]byte, []int) { - return file_friend_friend_msg_proto_rawDescGZIP(), []int{15} + return file_friend_friend_msg_proto_rawDescGZIP(), []int{17} } func (x *FriendBlackAddReq) GetFriendId() string { @@ -836,7 +924,7 @@ type FriendBlackAddRsp struct { func (x *FriendBlackAddRsp) Reset() { *x = FriendBlackAddRsp{} if protoimpl.UnsafeEnabled { - mi := &file_friend_friend_msg_proto_msgTypes[16] + mi := &file_friend_friend_msg_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -849,7 +937,7 @@ func (x *FriendBlackAddRsp) String() string { func (*FriendBlackAddRsp) ProtoMessage() {} func (x *FriendBlackAddRsp) ProtoReflect() protoreflect.Message { - mi := &file_friend_friend_msg_proto_msgTypes[16] + mi := &file_friend_friend_msg_proto_msgTypes[18] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -862,7 +950,7 @@ func (x *FriendBlackAddRsp) ProtoReflect() protoreflect.Message { // Deprecated: Use FriendBlackAddRsp.ProtoReflect.Descriptor instead. func (*FriendBlackAddRsp) Descriptor() ([]byte, []int) { - return file_friend_friend_msg_proto_rawDescGZIP(), []int{16} + return file_friend_friend_msg_proto_rawDescGZIP(), []int{18} } func (x *FriendBlackAddRsp) GetFriendId() string { @@ -879,33 +967,32 @@ func (x *FriendBlackAddRsp) GetUserId() string { return "" } -//赠送或接收 -type FriendReceiveOrSendReq struct { +//删除黑名单 +type FriendDelBlackReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - FriendId string `protobuf:"bytes,1,opt,name=friendId,proto3" json:"friendId,omitempty"` - IsReceive bool `protobuf:"varint,2,opt,name=isReceive,proto3" json:"isReceive,omitempty"` + FriendId string `protobuf:"bytes,1,opt,name=friendId,proto3" json:"friendId,omitempty"` } -func (x *FriendReceiveOrSendReq) Reset() { - *x = FriendReceiveOrSendReq{} +func (x *FriendDelBlackReq) Reset() { + *x = FriendDelBlackReq{} if protoimpl.UnsafeEnabled { - mi := &file_friend_friend_msg_proto_msgTypes[17] + mi := &file_friend_friend_msg_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *FriendReceiveOrSendReq) String() string { +func (x *FriendDelBlackReq) String() string { return protoimpl.X.MessageStringOf(x) } -func (*FriendReceiveOrSendReq) ProtoMessage() {} +func (*FriendDelBlackReq) ProtoMessage() {} -func (x *FriendReceiveOrSendReq) ProtoReflect() protoreflect.Message { - mi := &file_friend_friend_msg_proto_msgTypes[17] +func (x *FriendDelBlackReq) ProtoReflect() protoreflect.Message { + mi := &file_friend_friend_msg_proto_msgTypes[19] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -916,52 +1003,44 @@ func (x *FriendReceiveOrSendReq) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use FriendReceiveOrSendReq.ProtoReflect.Descriptor instead. -func (*FriendReceiveOrSendReq) Descriptor() ([]byte, []int) { - return file_friend_friend_msg_proto_rawDescGZIP(), []int{17} +// Deprecated: Use FriendDelBlackReq.ProtoReflect.Descriptor instead. +func (*FriendDelBlackReq) Descriptor() ([]byte, []int) { + return file_friend_friend_msg_proto_rawDescGZIP(), []int{19} } -func (x *FriendReceiveOrSendReq) GetFriendId() string { +func (x *FriendDelBlackReq) GetFriendId() string { if x != nil { return x.FriendId } return "" } -func (x *FriendReceiveOrSendReq) GetIsReceive() bool { - if x != nil { - return x.IsReceive - } - return false -} - -type FriendReceiveOrSendRsp struct { +type FriendDelBlackRsp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - FriendId string `protobuf:"bytes,1,opt,name=friendId,proto3" json:"friendId,omitempty"` - UserId string `protobuf:"bytes,2,opt,name=userId,proto3" json:"userId,omitempty"` - IsReceive bool `protobuf:"varint,3,opt,name=isReceive,proto3" json:"isReceive,omitempty"` + FriendId string `protobuf:"bytes,1,opt,name=friendId,proto3" json:"friendId,omitempty"` + UserId string `protobuf:"bytes,2,opt,name=userId,proto3" json:"userId,omitempty"` } -func (x *FriendReceiveOrSendRsp) Reset() { - *x = FriendReceiveOrSendRsp{} +func (x *FriendDelBlackRsp) Reset() { + *x = FriendDelBlackRsp{} if protoimpl.UnsafeEnabled { - mi := &file_friend_friend_msg_proto_msgTypes[18] + mi := &file_friend_friend_msg_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *FriendReceiveOrSendRsp) String() string { +func (x *FriendDelBlackRsp) String() string { return protoimpl.X.MessageStringOf(x) } -func (*FriendReceiveOrSendRsp) ProtoMessage() {} +func (*FriendDelBlackRsp) ProtoMessage() {} -func (x *FriendReceiveOrSendRsp) ProtoReflect() protoreflect.Message { - mi := &file_friend_friend_msg_proto_msgTypes[18] +func (x *FriendDelBlackRsp) ProtoReflect() protoreflect.Message { + mi := &file_friend_friend_msg_proto_msgTypes[20] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -972,30 +1051,229 @@ func (x *FriendReceiveOrSendRsp) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use FriendReceiveOrSendRsp.ProtoReflect.Descriptor instead. -func (*FriendReceiveOrSendRsp) Descriptor() ([]byte, []int) { - return file_friend_friend_msg_proto_rawDescGZIP(), []int{18} +// Deprecated: Use FriendDelBlackRsp.ProtoReflect.Descriptor instead. +func (*FriendDelBlackRsp) Descriptor() ([]byte, []int) { + return file_friend_friend_msg_proto_rawDescGZIP(), []int{20} } -func (x *FriendReceiveOrSendRsp) GetFriendId() string { +func (x *FriendDelBlackRsp) GetFriendId() string { if x != nil { return x.FriendId } return "" } -func (x *FriendReceiveOrSendRsp) GetUserId() string { +func (x *FriendDelBlackRsp) GetUserId() string { if x != nil { return x.UserId } return "" } -func (x *FriendReceiveOrSendRsp) GetIsReceive() bool { - if x != nil { - return x.IsReceive +//接收 +type FriendReceiveReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + FriendId string `protobuf:"bytes,1,opt,name=friendId,proto3" json:"friendId,omitempty"` +} + +func (x *FriendReceiveReq) Reset() { + *x = FriendReceiveReq{} + if protoimpl.UnsafeEnabled { + mi := &file_friend_friend_msg_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - return false +} + +func (x *FriendReceiveReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FriendReceiveReq) ProtoMessage() {} + +func (x *FriendReceiveReq) ProtoReflect() protoreflect.Message { + mi := &file_friend_friend_msg_proto_msgTypes[21] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FriendReceiveReq.ProtoReflect.Descriptor instead. +func (*FriendReceiveReq) Descriptor() ([]byte, []int) { + return file_friend_friend_msg_proto_rawDescGZIP(), []int{21} +} + +func (x *FriendReceiveReq) GetFriendId() string { + if x != nil { + return x.FriendId + } + return "" +} + +type FriendReceiveRsp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + FriendId string `protobuf:"bytes,1,opt,name=friendId,proto3" json:"friendId,omitempty"` + UserId string `protobuf:"bytes,2,opt,name=userId,proto3" json:"userId,omitempty"` +} + +func (x *FriendReceiveRsp) Reset() { + *x = FriendReceiveRsp{} + if protoimpl.UnsafeEnabled { + mi := &file_friend_friend_msg_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FriendReceiveRsp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FriendReceiveRsp) ProtoMessage() {} + +func (x *FriendReceiveRsp) ProtoReflect() protoreflect.Message { + mi := &file_friend_friend_msg_proto_msgTypes[22] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FriendReceiveRsp.ProtoReflect.Descriptor instead. +func (*FriendReceiveRsp) Descriptor() ([]byte, []int) { + return file_friend_friend_msg_proto_rawDescGZIP(), []int{22} +} + +func (x *FriendReceiveRsp) GetFriendId() string { + if x != nil { + return x.FriendId + } + return "" +} + +func (x *FriendReceiveRsp) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +//赠送 +type FriendGiveReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + FriendId string `protobuf:"bytes,1,opt,name=friendId,proto3" json:"friendId,omitempty"` +} + +func (x *FriendGiveReq) Reset() { + *x = FriendGiveReq{} + if protoimpl.UnsafeEnabled { + mi := &file_friend_friend_msg_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FriendGiveReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FriendGiveReq) ProtoMessage() {} + +func (x *FriendGiveReq) ProtoReflect() protoreflect.Message { + mi := &file_friend_friend_msg_proto_msgTypes[23] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FriendGiveReq.ProtoReflect.Descriptor instead. +func (*FriendGiveReq) Descriptor() ([]byte, []int) { + return file_friend_friend_msg_proto_rawDescGZIP(), []int{23} +} + +func (x *FriendGiveReq) GetFriendId() string { + if x != nil { + return x.FriendId + } + return "" +} + +type FriendGiveRsp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + FriendId string `protobuf:"bytes,1,opt,name=friendId,proto3" json:"friendId,omitempty"` + UserId string `protobuf:"bytes,2,opt,name=userId,proto3" json:"userId,omitempty"` +} + +func (x *FriendGiveRsp) Reset() { + *x = FriendGiveRsp{} + if protoimpl.UnsafeEnabled { + mi := &file_friend_friend_msg_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FriendGiveRsp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FriendGiveRsp) ProtoMessage() {} + +func (x *FriendGiveRsp) ProtoReflect() protoreflect.Message { + mi := &file_friend_friend_msg_proto_msgTypes[24] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FriendGiveRsp.ProtoReflect.Descriptor instead. +func (*FriendGiveRsp) Descriptor() ([]byte, []int) { + return file_friend_friend_msg_proto_rawDescGZIP(), []int{24} +} + +func (x *FriendGiveRsp) GetFriendId() string { + if x != nil { + return x.FriendId + } + return "" +} + +func (x *FriendGiveRsp) GetUserId() string { + if x != nil { + return x.UserId + } + return "" } //好友数量 @@ -1010,7 +1288,7 @@ type FriendTotalReq struct { func (x *FriendTotalReq) Reset() { *x = FriendTotalReq{} if protoimpl.UnsafeEnabled { - mi := &file_friend_friend_msg_proto_msgTypes[19] + mi := &file_friend_friend_msg_proto_msgTypes[25] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1023,7 +1301,7 @@ func (x *FriendTotalReq) String() string { func (*FriendTotalReq) ProtoMessage() {} func (x *FriendTotalReq) ProtoReflect() protoreflect.Message { - mi := &file_friend_friend_msg_proto_msgTypes[19] + mi := &file_friend_friend_msg_proto_msgTypes[25] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1036,7 +1314,7 @@ func (x *FriendTotalReq) ProtoReflect() protoreflect.Message { // Deprecated: Use FriendTotalReq.ProtoReflect.Descriptor instead. func (*FriendTotalReq) Descriptor() ([]byte, []int) { - return file_friend_friend_msg_proto_rawDescGZIP(), []int{19} + return file_friend_friend_msg_proto_rawDescGZIP(), []int{25} } func (x *FriendTotalReq) GetFriendId() string { @@ -1058,7 +1336,7 @@ type FriendTotalRsp struct { func (x *FriendTotalRsp) Reset() { *x = FriendTotalRsp{} if protoimpl.UnsafeEnabled { - mi := &file_friend_friend_msg_proto_msgTypes[20] + mi := &file_friend_friend_msg_proto_msgTypes[26] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1071,7 +1349,7 @@ func (x *FriendTotalRsp) String() string { func (*FriendTotalRsp) ProtoMessage() {} func (x *FriendTotalRsp) ProtoReflect() protoreflect.Message { - mi := &file_friend_friend_msg_proto_msgTypes[20] + mi := &file_friend_friend_msg_proto_msgTypes[26] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1084,7 +1362,7 @@ func (x *FriendTotalRsp) ProtoReflect() protoreflect.Message { // Deprecated: Use FriendTotalRsp.ProtoReflect.Descriptor instead. func (*FriendTotalRsp) Descriptor() ([]byte, []int) { - return file_friend_friend_msg_proto_rawDescGZIP(), []int{20} + return file_friend_friend_msg_proto_rawDescGZIP(), []int{26} } func (x *FriendTotalRsp) GetFriendId() string { @@ -1105,91 +1383,103 @@ var File_friend_friend_msg_proto protoreflect.FileDescriptor var file_friend_friend_msg_proto_rawDesc = []byte{ 0x0a, 0x17, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x2f, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x5f, - 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x16, 0x66, 0x72, 0x69, 0x65, 0x6e, - 0x64, 0x2f, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x22, 0xc8, 0x01, 0x0a, 0x0a, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x42, 0x61, 0x73, 0x65, - 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x4e, 0x69, 0x63, 0x6b, - 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4e, 0x69, 0x63, 0x6b, - 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x76, - 0x61, 0x74, 0x61, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, - 0x61, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x74, 0x72, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x73, 0x74, 0x72, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x1a, - 0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x6f, 0x66, - 0x66, 0x6c, 0x69, 0x6e, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x0b, 0x6f, 0x66, 0x66, 0x6c, 0x69, 0x6e, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x0f, 0x0a, 0x0d, - 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x22, 0x36, 0x0a, - 0x0d, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x73, 0x70, 0x12, 0x25, - 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x43, - 0x61, 0x63, 0x68, 0x65, 0x5f, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, - 0x04, 0x6c, 0x69, 0x73, 0x74, 0x22, 0x2a, 0x0a, 0x0c, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x41, - 0x64, 0x64, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, - 0x64, 0x22, 0x26, 0x0a, 0x0c, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x41, 0x64, 0x64, 0x52, 0x73, - 0x70, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x2a, 0x0a, 0x0c, 0x46, 0x72, 0x69, - 0x65, 0x6e, 0x64, 0x44, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x72, 0x69, + 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc8, 0x01, 0x0a, 0x0a, 0x46, 0x72, + 0x69, 0x65, 0x6e, 0x64, 0x42, 0x61, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, + 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, + 0x12, 0x1a, 0x0a, 0x08, 0x4e, 0x69, 0x63, 0x6b, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x4e, 0x69, 0x63, 0x6b, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, + 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x65, 0x76, + 0x65, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x74, + 0x72, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x73, 0x74, + 0x72, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x49, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x49, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x6f, 0x66, 0x66, 0x6c, 0x69, 0x6e, 0x65, 0x54, 0x69, 0x6d, + 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x6f, 0x66, 0x66, 0x6c, 0x69, 0x6e, 0x65, + 0x54, 0x69, 0x6d, 0x65, 0x22, 0x0f, 0x0a, 0x0d, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x4c, 0x69, + 0x73, 0x74, 0x52, 0x65, 0x71, 0x22, 0x30, 0x0a, 0x0d, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x4c, + 0x69, 0x73, 0x74, 0x52, 0x73, 0x70, 0x12, 0x1f, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x42, 0x61, 0x73, + 0x65, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x22, 0x2c, 0x0a, 0x0e, 0x46, 0x72, 0x69, 0x65, 0x6e, + 0x64, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x72, 0x69, - 0x65, 0x6e, 0x64, 0x49, 0x64, 0x22, 0x42, 0x0a, 0x0c, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x44, - 0x65, 0x6c, 0x52, 0x73, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, - 0x64, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x4e, 0x0a, 0x16, 0x46, 0x72, 0x69, - 0x65, 0x6e, 0x64, 0x41, 0x67, 0x72, 0x65, 0x65, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x75, 0x73, 0x65, - 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x12, - 0x18, 0x0a, 0x07, 0x69, 0x73, 0x41, 0x67, 0x72, 0x65, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x07, 0x69, 0x73, 0x41, 0x67, 0x72, 0x65, 0x65, 0x22, 0x45, 0x0a, 0x17, 0x46, 0x72, 0x69, - 0x65, 0x6e, 0x64, 0x41, 0x67, 0x72, 0x65, 0x73, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x75, 0x73, - 0x65, 0x52, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x4e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x03, 0x4e, 0x75, 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x69, 0x73, 0x41, 0x67, 0x72, 0x65, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x73, 0x41, 0x67, 0x72, 0x65, 0x65, - 0x22, 0x14, 0x0a, 0x12, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x4c, - 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x22, 0x14, 0x0a, 0x12, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, - 0x41, 0x70, 0x70, 0x6c, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x73, 0x70, 0x22, 0x49, 0x0a, 0x0f, - 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x12, - 0x1a, 0x0a, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6e, - 0x69, 0x63, 0x6b, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, - 0x69, 0x63, 0x6b, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x38, 0x0a, 0x0f, 0x46, 0x72, 0x69, 0x65, 0x6e, - 0x64, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x73, 0x70, 0x12, 0x25, 0x0a, 0x07, 0x66, 0x72, - 0x69, 0x65, 0x6e, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x46, 0x72, - 0x69, 0x65, 0x6e, 0x64, 0x42, 0x61, 0x73, 0x65, 0x52, 0x07, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, - 0x73, 0x22, 0x14, 0x0a, 0x12, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x42, 0x6c, 0x61, 0x63, 0x6b, - 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x22, 0x3b, 0x0a, 0x12, 0x46, 0x72, 0x69, 0x65, 0x6e, - 0x64, 0x42, 0x6c, 0x61, 0x63, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x73, 0x70, 0x12, 0x25, 0x0a, - 0x07, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, - 0x2e, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x42, 0x61, 0x73, 0x65, 0x52, 0x07, 0x66, 0x72, 0x69, - 0x65, 0x6e, 0x64, 0x73, 0x22, 0x2f, 0x0a, 0x11, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x42, 0x6c, - 0x61, 0x63, 0x6b, 0x41, 0x64, 0x64, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x72, 0x69, - 0x65, 0x6e, 0x64, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x72, 0x69, - 0x65, 0x6e, 0x64, 0x49, 0x64, 0x22, 0x47, 0x0a, 0x11, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x42, - 0x6c, 0x61, 0x63, 0x6b, 0x41, 0x64, 0x64, 0x52, 0x73, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x72, - 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x72, - 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x52, - 0x0a, 0x16, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x4f, - 0x72, 0x53, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x72, 0x69, 0x65, - 0x6e, 0x64, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x72, 0x69, 0x65, - 0x6e, 0x64, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x73, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x69, 0x73, 0x52, 0x65, 0x63, 0x65, 0x69, - 0x76, 0x65, 0x22, 0x6a, 0x0a, 0x16, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x63, 0x65, - 0x69, 0x76, 0x65, 0x4f, 0x72, 0x53, 0x65, 0x6e, 0x64, 0x52, 0x73, 0x70, 0x12, 0x1a, 0x0a, 0x08, + 0x65, 0x6e, 0x64, 0x49, 0x64, 0x22, 0x44, 0x0a, 0x0e, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x41, + 0x70, 0x70, 0x6c, 0x79, 0x52, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, + 0x1a, 0x0a, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x22, 0x2a, 0x0a, 0x0c, 0x46, + 0x72, 0x69, 0x65, 0x6e, 0x64, 0x44, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x66, + 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, + 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x22, 0x42, 0x0a, 0x0c, 0x46, 0x72, 0x69, 0x65, 0x6e, + 0x64, 0x44, 0x65, 0x6c, 0x52, 0x73, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, + 0x64, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, + 0x64, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x2e, 0x0a, 0x0e, 0x46, + 0x72, 0x69, 0x65, 0x6e, 0x64, 0x41, 0x67, 0x72, 0x65, 0x65, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, + 0x09, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x09, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x73, 0x22, 0x22, 0x0a, 0x0e, 0x46, + 0x72, 0x69, 0x65, 0x6e, 0x64, 0x41, 0x67, 0x72, 0x65, 0x65, 0x52, 0x73, 0x70, 0x12, 0x10, 0x0a, + 0x03, 0x4e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x4e, 0x75, 0x6d, 0x22, + 0x2f, 0x0a, 0x0f, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x66, 0x75, 0x73, 0x65, 0x52, + 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x73, + 0x22, 0x23, 0x0a, 0x0f, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x66, 0x75, 0x73, 0x65, + 0x52, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x4e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x03, 0x4e, 0x75, 0x6d, 0x22, 0x14, 0x0a, 0x12, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x41, + 0x70, 0x70, 0x6c, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x22, 0x35, 0x0a, 0x12, 0x46, + 0x72, 0x69, 0x65, 0x6e, 0x64, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x73, + 0x70, 0x12, 0x1f, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x0b, 0x2e, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x42, 0x61, 0x73, 0x65, 0x52, 0x04, 0x6c, 0x69, + 0x73, 0x74, 0x22, 0x2d, 0x0a, 0x0f, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x61, 0x72, + 0x63, 0x68, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x4e, 0x61, 0x6d, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x4e, 0x61, 0x6d, + 0x65, 0x22, 0x36, 0x0a, 0x0f, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x61, 0x72, 0x63, + 0x68, 0x52, 0x73, 0x70, 0x12, 0x23, 0x0a, 0x06, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x42, 0x61, 0x73, + 0x65, 0x52, 0x06, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x22, 0x14, 0x0a, 0x12, 0x46, 0x72, 0x69, + 0x65, 0x6e, 0x64, 0x42, 0x6c, 0x61, 0x63, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x22, + 0x3b, 0x0a, 0x12, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x42, 0x6c, 0x61, 0x63, 0x6b, 0x4c, 0x69, + 0x73, 0x74, 0x52, 0x73, 0x70, 0x12, 0x25, 0x0a, 0x07, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x42, + 0x61, 0x73, 0x65, 0x52, 0x07, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x73, 0x22, 0x2f, 0x0a, 0x11, + 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x42, 0x6c, 0x61, 0x63, 0x6b, 0x41, 0x64, 0x64, 0x52, 0x65, + 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x22, 0x47, 0x0a, + 0x11, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x42, 0x6c, 0x61, 0x63, 0x6b, 0x41, 0x64, 0x64, 0x52, + 0x73, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x12, 0x16, + 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x2f, 0x0a, 0x11, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, + 0x44, 0x65, 0x6c, 0x42, 0x6c, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x66, + 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, + 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x22, 0x47, 0x0a, 0x11, 0x46, 0x72, 0x69, 0x65, 0x6e, + 0x64, 0x44, 0x65, 0x6c, 0x42, 0x6c, 0x61, 0x63, 0x6b, 0x52, 0x73, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, - 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x73, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x09, 0x69, 0x73, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x22, 0x2c, - 0x0a, 0x0e, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x52, 0x65, 0x71, - 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x22, 0x42, 0x0a, 0x0e, - 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x52, 0x73, 0x70, 0x12, 0x1a, - 0x0a, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, - 0x74, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, - 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x22, 0x2e, 0x0a, 0x10, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, + 0x65, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, + 0x22, 0x46, 0x0a, 0x10, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, + 0x65, 0x52, 0x73, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, + 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x2b, 0x0a, 0x0d, 0x46, 0x72, 0x69, 0x65, + 0x6e, 0x64, 0x47, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x72, 0x69, + 0x65, 0x6e, 0x64, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x72, 0x69, + 0x65, 0x6e, 0x64, 0x49, 0x64, 0x22, 0x43, 0x0a, 0x0d, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x47, + 0x69, 0x76, 0x65, 0x52, 0x73, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, + 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, + 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x2c, 0x0a, 0x0e, 0x46, 0x72, + 0x69, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, + 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x22, 0x42, 0x0a, 0x0e, 0x46, 0x72, 0x69, 0x65, + 0x6e, 0x64, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x52, 0x73, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x72, + 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x72, + 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x42, 0x06, 0x5a, 0x04, + 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1204,40 +1494,46 @@ func file_friend_friend_msg_proto_rawDescGZIP() []byte { return file_friend_friend_msg_proto_rawDescData } -var file_friend_friend_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 21) +var file_friend_friend_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 27) var file_friend_friend_msg_proto_goTypes = []interface{}{ - (*FriendBase)(nil), // 0: FriendBase - (*FriendListReq)(nil), // 1: FriendListReq - (*FriendListRsp)(nil), // 2: FriendListRsp - (*FriendAddReq)(nil), // 3: FriendAddReq - (*FriendAddRsp)(nil), // 4: FriendAddRsp - (*FriendDelReq)(nil), // 5: FriendDelReq - (*FriendDelRsp)(nil), // 6: FriendDelRsp - (*FriendAgreeOrRefuseReq)(nil), // 7: FriendAgreeOrRefuseReq - (*FriendAgressOrRefuseRsp)(nil), // 8: FriendAgressOrRefuseRsp - (*FriendApplyListReq)(nil), // 9: FriendApplyListReq - (*FriendApplyListRsp)(nil), // 10: FriendApplyListRsp - (*FriendSearchReq)(nil), // 11: FriendSearchReq - (*FriendSearchRsp)(nil), // 12: FriendSearchRsp - (*FriendBlackListReq)(nil), // 13: FriendBlackListReq - (*FriendBlackListRsp)(nil), // 14: FriendBlackListRsp - (*FriendBlackAddReq)(nil), // 15: FriendBlackAddReq - (*FriendBlackAddRsp)(nil), // 16: FriendBlackAddRsp - (*FriendReceiveOrSendReq)(nil), // 17: FriendReceiveOrSendReq - (*FriendReceiveOrSendRsp)(nil), // 18: FriendReceiveOrSendRsp - (*FriendTotalReq)(nil), // 19: FriendTotalReq - (*FriendTotalRsp)(nil), // 20: FriendTotalRsp - (*Cache_FriendData)(nil), // 21: Cache_FriendData + (*FriendBase)(nil), // 0: FriendBase + (*FriendListReq)(nil), // 1: FriendListReq + (*FriendListRsp)(nil), // 2: FriendListRsp + (*FriendApplyReq)(nil), // 3: FriendApplyReq + (*FriendApplyRsp)(nil), // 4: FriendApplyRsp + (*FriendDelReq)(nil), // 5: FriendDelReq + (*FriendDelRsp)(nil), // 6: FriendDelRsp + (*FriendAgreeReq)(nil), // 7: FriendAgreeReq + (*FriendAgreeRsp)(nil), // 8: FriendAgreeRsp + (*FriendRefuseReq)(nil), // 9: FriendRefuseReq + (*FriendRefuseRsp)(nil), // 10: FriendRefuseRsp + (*FriendApplyListReq)(nil), // 11: FriendApplyListReq + (*FriendApplyListRsp)(nil), // 12: FriendApplyListRsp + (*FriendSearchReq)(nil), // 13: FriendSearchReq + (*FriendSearchRsp)(nil), // 14: FriendSearchRsp + (*FriendBlackListReq)(nil), // 15: FriendBlackListReq + (*FriendBlackListRsp)(nil), // 16: FriendBlackListRsp + (*FriendBlackAddReq)(nil), // 17: FriendBlackAddReq + (*FriendBlackAddRsp)(nil), // 18: FriendBlackAddRsp + (*FriendDelBlackReq)(nil), // 19: FriendDelBlackReq + (*FriendDelBlackRsp)(nil), // 20: FriendDelBlackRsp + (*FriendReceiveReq)(nil), // 21: FriendReceiveReq + (*FriendReceiveRsp)(nil), // 22: FriendReceiveRsp + (*FriendGiveReq)(nil), // 23: FriendGiveReq + (*FriendGiveRsp)(nil), // 24: FriendGiveRsp + (*FriendTotalReq)(nil), // 25: FriendTotalReq + (*FriendTotalRsp)(nil), // 26: FriendTotalRsp } var file_friend_friend_msg_proto_depIdxs = []int32{ - 21, // 0: FriendListRsp.list:type_name -> Cache_FriendData - 0, // 1: FriendSearchRsp.friends:type_name -> FriendBase - 0, // 2: FriendBlackListRsp.friends:type_name -> FriendBase - 3, // [3:3] is the sub-list for method output_type - 3, // [3:3] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name + 0, // 0: FriendListRsp.list:type_name -> FriendBase + 0, // 1: FriendApplyListRsp.list:type_name -> FriendBase + 0, // 2: FriendSearchRsp.friend:type_name -> FriendBase + 0, // 3: FriendBlackListRsp.friends:type_name -> FriendBase + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name } func init() { file_friend_friend_msg_proto_init() } @@ -1245,7 +1541,6 @@ func file_friend_friend_msg_proto_init() { if File_friend_friend_msg_proto != nil { return } - file_friend_friend_db_proto_init() if !protoimpl.UnsafeEnabled { file_friend_friend_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FriendBase); i { @@ -1284,7 +1579,7 @@ func file_friend_friend_msg_proto_init() { } } file_friend_friend_msg_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FriendAddReq); i { + switch v := v.(*FriendApplyReq); i { case 0: return &v.state case 1: @@ -1296,7 +1591,7 @@ func file_friend_friend_msg_proto_init() { } } file_friend_friend_msg_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FriendAddRsp); i { + switch v := v.(*FriendApplyRsp); i { case 0: return &v.state case 1: @@ -1332,7 +1627,7 @@ func file_friend_friend_msg_proto_init() { } } file_friend_friend_msg_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FriendAgreeOrRefuseReq); i { + switch v := v.(*FriendAgreeReq); i { case 0: return &v.state case 1: @@ -1344,7 +1639,7 @@ func file_friend_friend_msg_proto_init() { } } file_friend_friend_msg_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FriendAgressOrRefuseRsp); i { + switch v := v.(*FriendAgreeRsp); i { case 0: return &v.state case 1: @@ -1356,7 +1651,7 @@ func file_friend_friend_msg_proto_init() { } } file_friend_friend_msg_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FriendApplyListReq); i { + switch v := v.(*FriendRefuseReq); i { case 0: return &v.state case 1: @@ -1368,7 +1663,7 @@ func file_friend_friend_msg_proto_init() { } } file_friend_friend_msg_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FriendApplyListRsp); i { + switch v := v.(*FriendRefuseRsp); i { case 0: return &v.state case 1: @@ -1380,7 +1675,7 @@ func file_friend_friend_msg_proto_init() { } } file_friend_friend_msg_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FriendSearchReq); i { + switch v := v.(*FriendApplyListReq); i { case 0: return &v.state case 1: @@ -1392,7 +1687,7 @@ func file_friend_friend_msg_proto_init() { } } file_friend_friend_msg_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FriendSearchRsp); i { + switch v := v.(*FriendApplyListRsp); i { case 0: return &v.state case 1: @@ -1404,7 +1699,7 @@ func file_friend_friend_msg_proto_init() { } } file_friend_friend_msg_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FriendBlackListReq); i { + switch v := v.(*FriendSearchReq); i { case 0: return &v.state case 1: @@ -1416,7 +1711,7 @@ func file_friend_friend_msg_proto_init() { } } file_friend_friend_msg_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FriendBlackListRsp); i { + switch v := v.(*FriendSearchRsp); i { case 0: return &v.state case 1: @@ -1428,7 +1723,7 @@ func file_friend_friend_msg_proto_init() { } } file_friend_friend_msg_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FriendBlackAddReq); i { + switch v := v.(*FriendBlackListReq); i { case 0: return &v.state case 1: @@ -1440,7 +1735,7 @@ func file_friend_friend_msg_proto_init() { } } file_friend_friend_msg_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FriendBlackAddRsp); i { + switch v := v.(*FriendBlackListRsp); i { case 0: return &v.state case 1: @@ -1452,7 +1747,7 @@ func file_friend_friend_msg_proto_init() { } } file_friend_friend_msg_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FriendReceiveOrSendReq); i { + switch v := v.(*FriendBlackAddReq); i { case 0: return &v.state case 1: @@ -1464,7 +1759,7 @@ func file_friend_friend_msg_proto_init() { } } file_friend_friend_msg_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FriendReceiveOrSendRsp); i { + switch v := v.(*FriendBlackAddRsp); i { case 0: return &v.state case 1: @@ -1476,7 +1771,7 @@ func file_friend_friend_msg_proto_init() { } } file_friend_friend_msg_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FriendTotalReq); i { + switch v := v.(*FriendDelBlackReq); i { case 0: return &v.state case 1: @@ -1488,6 +1783,78 @@ func file_friend_friend_msg_proto_init() { } } file_friend_friend_msg_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FriendDelBlackRsp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_friend_friend_msg_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FriendReceiveReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_friend_friend_msg_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FriendReceiveRsp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_friend_friend_msg_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FriendGiveReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_friend_friend_msg_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FriendGiveRsp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_friend_friend_msg_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FriendTotalReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_friend_friend_msg_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FriendTotalRsp); i { case 0: return &v.state @@ -1506,7 +1873,7 @@ func file_friend_friend_msg_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_friend_friend_msg_proto_rawDesc, NumEnums: 0, - NumMessages: 21, + NumMessages: 27, NumExtensions: 0, NumServices: 0, }, diff --git a/pb/mail_db.pb.go b/pb/mail_db.pb.go index 1172f18d5..c4a422a41 100644 --- a/pb/mail_db.pb.go +++ b/pb/mail_db.pb.go @@ -80,7 +80,7 @@ type DB_MailData struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ObjId string `protobuf:"bytes,1,opt,name=ObjId,proto3" json:"ObjId,omitempty" bson:"_id"` // tags:{bson:"_id"} + ObjId string `protobuf:"bytes,1,opt,name=ObjId,proto3" json:"ObjId,omitempty" bson:"_id"` // ID UserId string `protobuf:"bytes,2,opt,name=UserId,proto3" json:"UserId,omitempty"` Title string `protobuf:"bytes,3,opt,name=Title,proto3" json:"Title,omitempty"` // 邮件标题 Contex string `protobuf:"bytes,4,opt,name=Contex,proto3" json:"Contex,omitempty"` // 邮件内容 diff --git a/pb/pack_db.pb.go b/pb/pack_db.pb.go index 619e8a2ef..dce5c063f 100644 --- a/pb/pack_db.pb.go +++ b/pb/pack_db.pb.go @@ -122,8 +122,8 @@ type DB_UserPackData struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserId string `protobuf:"bytes,1,opt,name=UserId,proto3" json:"UserId,omitempty" bson:"_id"` //tags:{bson:"_id"}用户Id - Pack []*DB_GridData `protobuf:"bytes,2,rep,name=Pack,proto3" json:"Pack,omitempty"` //背包列表 + UserId string `protobuf:"bytes,1,opt,name=UserId,proto3" json:"UserId,omitempty" bson:"_id"` // 用户Id + Pack []*DB_GridData `protobuf:"bytes,2,rep,name=Pack,proto3" json:"Pack,omitempty"` //背包列表 } func (x *DB_UserPackData) Reset() { diff --git a/pb/proto/comm.proto b/pb/proto/comm.proto index c32a58ad2..aee1926d4 100644 --- a/pb/proto/comm.proto +++ b/pb/proto/comm.proto @@ -1,13 +1,14 @@ syntax = "proto3"; option go_package = ".;pb"; import "errorcode.proto"; +import "google/protobuf/any.proto"; //用户消息流结构 message UserMessage { string MainType =1; string SubType = 2; ErrorCode Code = 3; - bytes Data = 4; + google.protobuf.Any data = 4; } //代理用户转发消息结构 @@ -17,7 +18,7 @@ message AgentMessage { string UserId = 3; string GatewayServiceId = 4; string Method = 5; - bytes Message = 6; + google.protobuf.Any Message = 6; } //RPC 服务固定回复结构 @@ -42,7 +43,7 @@ message AgentSendMessageReq { string MainType = 2; string SubType = 3; ErrorCode Code = 4; - bytes Data = 5; + google.protobuf.Any Data = 5; } //发送批量消息 @@ -50,14 +51,14 @@ message BatchMessageReq { repeated string UserSessionIds = 1; string MainType = 2; string SubType = 3; - bytes Data = 4; + google.protobuf.Any Data = 4; } //发送广播消息 message BroadCastMessageReq { string MainType = 1; //服务名 string SubType = 2; - bytes Data = 3; + google.protobuf.Any Data = 3; } //关闭用户代理 diff --git a/pb/proto/errorcode.proto b/pb/proto/errorcode.proto index 63e6db91b..d095cd53d 100644 --- a/pb/proto/errorcode.proto +++ b/pb/proto/errorcode.proto @@ -13,10 +13,24 @@ enum ErrorCode { InsufficientPermissions = 16; //权限不足 NoLogin = 17; //未登录 UserSessionNobeing = 18; //用户不存在 - SecKey = 19; //秘钥格式错误 - SecKeyInvalid = 20; //秘钥无效 StateInvalid = 21; //无效状态 DBError = 22; // 数据库操作失败 SystemError = 23; // 通用错误 + //user + SecKeyInvalid = 1000; //秘钥无效 + SecKey = 1001; //秘钥格式错误 + + //friend + FriendNotSelf = 1100; //不能是自己 + FriendSelfMax = 1101; //超出好友最大数量 + FriendTargetMax = 1102;//超出目标好友最大数量 + FriendSelfNoData = 1103; //无好友记录 + FriendTargetNoData = 1104; //无目标好友记录 + FriendYet = 1105; //已是好友 + FriendApplyYet =1106; //已申请该好友 + FriendSelfBlackYet = 1107;//已在自己黑名单中 + FriendTargetBlackYet = 1108;//已在对方的黑名单中 + FriendApplyError = 1109;//申请失败 + FriendBlackMax = 1110; //黑名单最大数量 } \ No newline at end of file diff --git a/pb/proto/friend/friend_db.proto b/pb/proto/friend/friend_db.proto index 3261f6da9..5262c988f 100644 --- a/pb/proto/friend/friend_db.proto +++ b/pb/proto/friend/friend_db.proto @@ -3,6 +3,9 @@ option go_package = ".;pb"; message Cache_FriendData { - string userId = 1; //tags:{bson:"_id"}用户Id - repeated string friendId = 2; + string userId = 1;// @go_tags(`bson:"_id"`) ID + repeated string friendIds = 2; //好友ID + repeated string applyIds = 3;//申请用户ID + repeated string blackIds = 4;//黑名单ID + } \ No newline at end of file diff --git a/pb/proto/friend/friend_msg.proto b/pb/proto/friend/friend_msg.proto index 8f10ab953..924a40e3c 100644 --- a/pb/proto/friend/friend_msg.proto +++ b/pb/proto/friend/friend_msg.proto @@ -1,6 +1,5 @@ syntax = "proto3"; option go_package = ".;pb"; -import "friend/friend_db.proto"; message FriendBase { string userId = 1; //ID @@ -18,15 +17,16 @@ message FriendListReq{ } message FriendListRsp{ - repeated Cache_FriendData list = 1; + repeated FriendBase list = 1; } -//添加好友 -message FriendAddReq{ +//申请好友 +message FriendApplyReq{ string friendId = 1; //好友ID } -message FriendAddRsp{ +message FriendApplyRsp{ string userId = 1; //用户ID + string friendId =2;//好友ID } //删除好友 @@ -40,15 +40,20 @@ message FriendDelRsp{ string userId = 2; //用户ID } -//同意或拒绝 -message FriendAgreeOrRefuseReq{ - string friendId = 1; //被同意或拒绝的用户 - bool isAgree = 2; - +//同意 +message FriendAgreeReq{ + repeated string friendIds = 1; //被同意的用户 } -message FriendAgressOrRefuseRsp{ +message FriendAgreeRsp{ + int32 Num = 1;//操作的数量 +} + +//拒绝 +message FriendRefuseReq{ + repeated string friendIds = 1; //被拒绝的用户 +} +message FriendRefuseRsp{ int32 Num = 1;//操作的数量 - bool isAgree = 2; } @@ -57,17 +62,16 @@ message FriendApplyListReq{ } message FriendApplyListRsp{ - + repeated FriendBase list = 1; } //好友搜索 message FriendSearchReq{ - string friendId = 1; - string nickName = 2; //好友昵称 + string nickName = 1; //好友昵称 } message FriendSearchRsp{ - repeated FriendBase friends = 1; + FriendBase friend = 1; } //黑名单 @@ -89,18 +93,37 @@ message FriendBlackAddRsp{ string userId = 2; } -//赠送或接收 -message FriendReceiveOrSendReq{ +//删除黑名单 +message FriendDelBlackReq{ string friendId = 1; - bool isReceive = 2; } -message FriendReceiveOrSendRsp{ +message FriendDelBlackRsp{ string friendId = 1; string userId = 2; - bool isReceive = 3; } +//接收 +message FriendReceiveReq{ + string friendId = 1; +} + +message FriendReceiveRsp{ + string friendId = 1; + string userId = 2; +} + +//赠送 +message FriendGiveReq{ + string friendId = 1; +} + +message FriendGiveRsp{ + string friendId = 1; + string userId = 2; +} + + //好友数量 message FriendTotalReq{ string friendId = 1; diff --git a/pb/proto/mail/mail_db.proto b/pb/proto/mail/mail_db.proto index aab8a6960..425629b70 100644 --- a/pb/proto/mail/mail_db.proto +++ b/pb/proto/mail/mail_db.proto @@ -12,7 +12,7 @@ message MailAttachment { // 附件 } message DB_MailData { - string ObjId = 1; // tags:{bson:"_id"} + string ObjId = 1; // @go_tags(`bson:"_id"`) ID string UserId = 2; string Title = 3; // 邮件标题 string Contex = 4; // 邮件内容 diff --git a/pb/proto/pack/pack_db.proto b/pb/proto/pack/pack_db.proto index 83b5bae01..de63fa96a 100644 --- a/pb/proto/pack/pack_db.proto +++ b/pb/proto/pack/pack_db.proto @@ -15,6 +15,6 @@ message DB_GridData { //用户背包 message DB_UserPackData { - string UserId = 1; //tags:{bson:"_id"}用户Id + string UserId = 1; // @go_tags(`bson:"_id"`) 用户Id repeated DB_GridData Pack = 2; //背包列表 } \ No newline at end of file diff --git a/pb/proto/user/user_db.proto b/pb/proto/user/user_db.proto index 8af1ddedd..a2851297b 100644 --- a/pb/proto/user/user_db.proto +++ b/pb/proto/user/user_db.proto @@ -8,7 +8,7 @@ message Cache_UserData { } message DB_UserData { - string UserId = 1; //tags:{bson:"_id"}动态Id + string UserId = 1; // @go_tags(`bson:"_id"`) ID string Account = 2; string NiceName = 3; int32 ServerId = 4; diff --git a/pb/user_db.pb.go b/pb/user_db.pb.go index 8d954cb8b..1ea0a64fc 100644 --- a/pb/user_db.pb.go +++ b/pb/user_db.pb.go @@ -88,7 +88,7 @@ type DB_UserData struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserId string `protobuf:"bytes,1,opt,name=UserId,proto3" json:"UserId,omitempty" bson:"_id"` //tags:{bson:"_id"}动态Id + UserId string `protobuf:"bytes,1,opt,name=UserId,proto3" json:"UserId,omitempty"` //tags:{bson:"_id"}动态Id Account string `protobuf:"bytes,2,opt,name=Account,proto3" json:"Account,omitempty"` NiceName string `protobuf:"bytes,3,opt,name=NiceName,proto3" json:"NiceName,omitempty"` ServerId int32 `protobuf:"varint,4,opt,name=ServerId,proto3" json:"ServerId,omitempty"` diff --git a/services/comp_gateroute.go b/services/comp_gateroute.go index 9f1ed05c9..a44c50692 100644 --- a/services/comp_gateroute.go +++ b/services/comp_gateroute.go @@ -13,7 +13,8 @@ import ( "go_dreamfactory/lego/core/cbase" "go_dreamfactory/lego/sys/log" - "google.golang.org/protobuf/proto" + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" ) /* @@ -118,7 +119,7 @@ func (this *SComp_GateRouteComp) ReceiveMsg(ctx context.Context, args *pb.AgentM if ok { session := comm.NewUserSession(this.service, args.Ip, args.UserSessionId, args.GatewayServiceId, args.UserId) msg := reflect.New(msghandle.msgType.Elem()).Interface() - if err := proto.Unmarshal(args.Message, msg.(proto.Message)); err != nil { + if err := ptypes.UnmarshalAny(args.Message, msg.(proto.Message)); err != nil { log.Errorf("UserMessage:%s Unmarshal err:%v", args.Method, err) return err } diff --git a/sys/cache/friend.go b/sys/cache/friend.go index 0ae639584..628096486 100644 --- a/sys/cache/friend.go +++ b/sys/cache/friend.go @@ -2,35 +2,58 @@ package cache import ( "fmt" + "go_dreamfactory/lego/sys/redis" "go_dreamfactory/pb" "go_dreamfactory/sys/db" ) const ( //Redis Redis_FriendCache string = "friend:%s" + Redis_Friend string = "apply:%s" ) -func getRdsUserKey(userId string) string { - return fmt.Sprintf(Redis_UserCache, userId) +func getRdsFriendKey(userId string) string { + return fmt.Sprintf(Redis_FriendCache, userId) } type IFriend interface { - FriendAdd(data *pb.Cache_FriendData) (err error) - FriendGetTotal(userId string) int32 + Friend_Update(data *pb.Cache_FriendData) (err error) + Friend_Total(userId string) int32 + Friend_Get(userId string) (*pb.Cache_FriendData, error) } -func (this *Cache) FriendAdd(data *pb.Cache_FriendData) (err error) { - if err = db.Defsys.FriendApply(data); err == nil { - err = this.redis.Set(fmt.Sprintf(Redis_FriendCache, data.UserId), data, 0) +//更新 +func (this *Cache) Friend_Update(data *pb.Cache_FriendData) (err error) { + if err = db.Defsys.Friend_SaveOrUpdate(data); err == nil { + //更新缓存 + err = this.redis.Set(getRdsFriendKey(data.UserId), data, 0) } return } -func (this *Cache) FriendGetTotal(userId string) int32 { +//好友总数 +func (this *Cache) Friend_Total(userId string) int32 { var friend *pb.Cache_FriendData - err := this.redis.Get(getRdsUserKey(userId), &friend) + err := this.redis.Get(getRdsFriendKey(userId), &friend) if err != nil { return 0 } - return int32(len(friend.FriendId)) + return int32(len(friend.FriendIds)) +} + +//好友获取 +func (this *Cache) Friend_Get(userId string) (*pb.Cache_FriendData, error) { + var d *pb.Cache_FriendData + err := this.redis.Get(getRdsFriendKey(userId), &d) + if err != nil { + if err.Error() == string(redis.RedisNil) { + d = &pb.Cache_FriendData{UserId: userId} + err = this.Friend_Update(d) + if err != nil { + return d, nil + } + } + return nil, err + } + return d, nil } diff --git a/sys/cache/friend_test.go b/sys/cache/friend_test.go index 5e7d1d234..cdf51022b 100644 --- a/sys/cache/friend_test.go +++ b/sys/cache/friend_test.go @@ -9,16 +9,23 @@ import ( "github.com/stretchr/testify/require" ) -func TestFriendAdd(t *testing.T) { - err := cache.Defsys.FriendAdd(&pb.Cache_FriendData{ - UserId: "629f159310d6970846f7ef26", - FriendId: []string{"629f147e3d276120561bfa18", "629eb3f4132dc4bb26139659"}, +func TestFriendApply(t *testing.T) { + err := cache.Defsys.Friend_Update(&pb.Cache_FriendData{ + UserId: "629f159310d6970846f7ef26", + FriendIds: []string{"629f147e3d276120561bfa18"}, + ApplyIds: []string{"629eb3f4132dc4bb26139659"}, }) require.Nil(t, err, nil) } func TestFriendGetTotal(t *testing.T) { - total := cache.Defsys.FriendGetTotal("629f159310d6970846f7ef26") - assert.Equal(t, total, int32(1)) + total := cache.Defsys.Friend_Total("629f159310d6970846f7ef26") + assert.Equal(t, total, int32(2)) +} + +func TestFriendGet(t *testing.T) { + data, err := cache.Defsys.Friend_Get("629f159310d6970846f7ef26") + require.NotNil(t, err, nil) + assert.Equal(t, data.UserId, "629f159310d6970846f7ef26") } diff --git a/sys/cache/user.go b/sys/cache/user.go index 38e5e0c81..d2074c4f6 100644 --- a/sys/cache/user.go +++ b/sys/cache/user.go @@ -3,6 +3,7 @@ package cache import ( "fmt" "go_dreamfactory/pb" + "go_dreamfactory/sys/db" "go_dreamfactory/lego/sys/log" ) @@ -17,7 +18,10 @@ type IUser interface { } func (this *Cache) Update(data *pb.Cache_UserData) (err error) { - err = this.redis.Set(fmt.Sprintf(Redis_UserCache, data.UserData.UserId), data, -1) + err = db.Defsys.User_Update(data.UserData) + if err == nil { + err = this.redis.Set(fmt.Sprintf(Redis_UserCache, data.UserData.UserId), data, -1) + } return } diff --git a/sys/db/friend.go b/sys/db/friend.go index 226fdcb5d..48336a8b9 100644 --- a/sys/db/friend.go +++ b/sys/db/friend.go @@ -2,9 +2,11 @@ package db import ( "go_dreamfactory/lego/core" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" "go.mongodb.org/mongo-driver/bson" + "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo/options" ) @@ -13,13 +15,34 @@ const ( ) type IFriend interface { - FriendApply(data *pb.Cache_FriendData) error + Friend_SaveOrUpdate(data *pb.Cache_FriendData) (err error) + Frined_FindCond(nickName string) *pb.DB_UserData } -func (this *DB) FriendApply(data *pb.Cache_FriendData) error { - err := this.mgo.FindOneAndUpdate(DB_FriendTable, +//好友 +func (this *DB) Friend_SaveOrUpdate(data *pb.Cache_FriendData) (err error) { + err = this.mgo.FindOneAndUpdate(DB_FriendTable, bson.M{"_id": data.UserId}, - bson.M{"$set": bson.M{"friendid": data.FriendId}}, + bson.M{"$set": bson.M{ + "friendids": data.FriendIds, + "applyids": data.ApplyIds}}, options.FindOneAndUpdate().SetUpsert(true)).Err() - return err + if err != nil { + if err == mongo.ErrNoDocuments { + _, err = this.mgo.InsertOne(DB_FriendTable, data) + } + } + return +} + +func (this *DB) Frined_FindCond(nickName string) *pb.DB_UserData { + var user *pb.DB_UserData + err := this.mgo.FindOne(DB_UserTable, bson.M{ + "nicename": nickName, + }).Decode(&user) + if err != nil { + log.Errorf("findCond err:%v", err) + return nil + } + return user } diff --git a/sys/db/friend_test.go b/sys/db/friend_test.go index a22de4f64..9d8b10f0c 100644 --- a/sys/db/friend_test.go +++ b/sys/db/friend_test.go @@ -1,6 +1,7 @@ package db import ( + "fmt" "go_dreamfactory/pb" "testing" @@ -8,12 +9,19 @@ import ( ) func TestFriendAdd(t *testing.T) { - err := db.FriendApply(&pb.Cache_FriendData{ + err := db.Friend_SaveOrUpdate(&pb.Cache_FriendData{ UserId: "629f159310d6970846f7ef26", - FriendId: []string{ + FriendIds: []string{ "629f147e3d276120561bfa18", }, }) require.Nil(t, err, nil) } + +func TestFriendFindCond(t *testing.T) { + user := db.Frined_FindCond("乐谷5") + require.NotNil(t, user, nil) + + fmt.Printf("%v", user) +} diff --git a/sys/db/user.go b/sys/db/user.go index 88c7cbd07..c20bd4301 100644 --- a/sys/db/user.go +++ b/sys/db/user.go @@ -15,16 +15,17 @@ const ( //Redis ) type IUser interface { - User_FindUserByAccount(user *pb.DB_UserData) (*pb.DB_UserData, error) - User_FindUserById(id string) (*pb.DB_UserData, error) - User_CreateUser(user *pb.DB_UserData) error - User_UpdateUser(data *pb.DB_UserData) (err error) + User_FindByAccount(user *pb.DB_UserData) (*pb.DB_UserData, error) + User_FindById(id string) (*pb.DB_UserData, error) + User_Create(user *pb.DB_UserData) error + User_Update(data *pb.DB_UserData) (err error) } -func (this *DB) User_FindUserByAccount(user *pb.DB_UserData) (*pb.DB_UserData, error) { - filter := bson.D{ - {"serverid", user.ServerId}, - {"account", user.Account}, +// +func (this *DB) User_FindByAccount(user *pb.DB_UserData) (*pb.DB_UserData, error) { + filter := bson.M{ + "serverid": user.ServerId, + "account": user.Account, } sr := this.mgo.FindOne(DB_UserTable, filter) var nd *pb.DB_UserData @@ -32,9 +33,9 @@ func (this *DB) User_FindUserByAccount(user *pb.DB_UserData) (*pb.DB_UserData, e return nd, err } -func (this *DB) User_FindUserById(id string) (*pb.DB_UserData, error) { - filter := bson.D{ - {"_id", id}, +func (this *DB) User_FindById(id string) (*pb.DB_UserData, error) { + filter := bson.M{ + "userid": id, } sr := this.mgo.FindOne(DB_UserTable, filter) user := &pb.DB_UserData{} @@ -42,21 +43,21 @@ func (this *DB) User_FindUserById(id string) (*pb.DB_UserData, error) { return user, err } -func (this *DB) User_CreateUser(user *pb.DB_UserData) (err error) { +func (this *DB) User_Create(user *pb.DB_UserData) (err error) { user.UserId = primitive.NewObjectID().Hex() _, err = this.mgo.InsertOne(DB_UserTable, user) return err } //更新用户数据到DB -func (this *DB) User_UpdateUser(data *pb.DB_UserData) (err error) { +func (this *DB) User_Update(data *pb.DB_UserData) (err error) { err = this.mgo.FindOneAndUpdate( DB_UserTable, - bson.M{"_id": data.UserId}, + bson.M{"userid": data.UserId}, bson.M{"$set": bson.M{ - "niceName": data.NiceName, + "nicename": data.NiceName, }}, - options.FindOneAndUpdate().SetUpsert(false).SetReturnDocument(options.After), - ).Decode(data) + options.FindOneAndUpdate().SetUpsert(true), + ).Err() return err } diff --git a/sys/db/user_test.go b/sys/db/user_test.go index 917e3d07a..3d26c2b7b 100644 --- a/sys/db/user_test.go +++ b/sys/db/user_test.go @@ -16,17 +16,17 @@ func TestCreate(t *testing.T) { ServerId: 1, } - err := db.User_CreateUser(user) + err := db.User_Create(user) require.Nil(t, err) } func TestFindOne(t *testing.T) { - user, err := db.User_FindUserById("629eb3f4132dc4bb26139659") + user, err := db.User_FindById("629eb3f4132dc4bb26139659") require.Nil(t, err) assert.Equal(t, "legu3", user.Account) // user.ServerId = 2 - user2, err := db.User_FindUserByAccount(user) + user2, err := db.User_FindByAccount(user) require.Nil(t, err) assert.Equal(t, "legu3", user2.Account) assert.Equal(t, int32(1), user2.ServerId) @@ -36,7 +36,7 @@ func TestUpdate(t *testing.T) { user := &pb.DB_UserData{ UserId: primitive.NewObjectID().Hex(), } - err := db.User_UpdateUser(user) + err := db.User_Update(user) require.Nil(t, err) assert.Equal(t, "NiceName", "") diff --git a/utils/base64.go b/utils/base64.go index 7676f36e4..9557d5bce 100644 --- a/utils/base64.go +++ b/utils/base64.go @@ -20,6 +20,7 @@ func Base64Decode(data string) string { return string(b) } +//校验加密串 func ValidSecretKey(secStr string) bool { if !strings.HasPrefix(secStr, "CE:") || len(secStr) < 35 { return false @@ -29,7 +30,6 @@ func ValidSecretKey(secStr string) bool { rawmsg := secStr[35:] log.Debugf("data base: %s", rawmsg) serverMd5Key := MD5Str(rawmsg) - // s := fmt.Sprintf("%x", serverMd5Key) if !strings.EqualFold(strings.ToLower(serverMd5Key), strings.ToLower(clientMd5Key)) { return false } diff --git a/utils/strings.go b/utils/strings.go index 34d87e3ed..c153704d4 100644 --- a/utils/strings.go +++ b/utils/strings.go @@ -15,3 +15,22 @@ func ParseP(p string) (string, string, bool) { return s[0], s[1], true } + +func Find(slice []string, val string) (int, bool) { + for i, item := range slice { + if item == val { + return i, true + } + } + return -1, false +} + +func DeleteString(list []string, ele string) []string { + result := make([]string, 0) + for _, v := range list { + if v != ele { + result = append(result, v) + } + } + return result +}