diff --git a/modules/gateway/agentmgr_comp.go b/modules/gateway/agentmgr_comp.go index 8ac746d99..c21b3002a 100644 --- a/modules/gateway/agentmgr_comp.go +++ b/modules/gateway/agentmgr_comp.go @@ -40,7 +40,8 @@ func (this *AgentMgrComp) DisConnect(a IAgent) { if a.UserId() != "" { //登录用户 通知业务服务处理玩家离线相关 reply := &pb.RPCMessageReply{} if _, err := this.service.RpcGo(context.Background(), fmt.Sprintf("%s/%s", comm.Service_Worker, a.WorkerId()), string(comm.Rpc_NoticeUserClose), &pb.NoticeUserCloseReq{ - UserId: a.UserId(), + UserSessionId: a.SessionId(), + UserId: a.UserId(), }, reply); err != nil { log.Errorf(" uId:%s Rpc_NoticeUserClose err:%v", a.UserId(), err) } diff --git a/pb/comm.pb.go b/pb/comm.pb.go index a21273297..2466829b2 100644 --- a/pb/comm.pb.go +++ b/pb/comm.pb.go @@ -692,7 +692,8 @@ type NoticeUserCloseReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserId string `protobuf:"bytes,1,opt,name=UserId,proto3" json:"UserId"` + UserSessionId string `protobuf:"bytes,1,opt,name=UserSessionId,proto3" json:"UserSessionId"` + UserId string `protobuf:"bytes,2,opt,name=UserId,proto3" json:"UserId"` } func (x *NoticeUserCloseReq) Reset() { @@ -727,6 +728,13 @@ func (*NoticeUserCloseReq) Descriptor() ([]byte, []int) { return file_comm_proto_rawDescGZIP(), []int{9} } +func (x *NoticeUserCloseReq) GetUserSessionId() string { + if x != nil { + return x.UserSessionId + } + return "" +} + func (x *NoticeUserCloseReq) GetUserId() string { if x != nil { return x.UserId @@ -814,15 +822,17 @@ var file_comm_proto_rawDesc = []byte{ 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, 0x22, 0x2c, 0x0a, 0x12, 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x43, - 0x6c, 0x6f, 0x73, 0x65, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x2a, - 0x43, 0x0a, 0x12, 0x48, 0x65, 0x72, 0x6f, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, - 0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x06, 0x0a, 0x02, 0x48, 0x70, 0x10, 0x00, 0x12, 0x07, 0x0a, - 0x03, 0x41, 0x74, 0x6b, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x44, 0x65, 0x66, 0x10, 0x02, 0x12, - 0x09, 0x0a, 0x05, 0x53, 0x70, 0x65, 0x65, 0x64, 0x10, 0x03, 0x12, 0x08, 0x0a, 0x04, 0x43, 0x72, - 0x69, 0x74, 0x10, 0x04, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x64, 0x22, 0x52, 0x0a, 0x12, 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x43, + 0x6c, 0x6f, 0x73, 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, 0x16, 0x0a, + 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x55, + 0x73, 0x65, 0x72, 0x49, 0x64, 0x2a, 0x43, 0x0a, 0x12, 0x48, 0x65, 0x72, 0x6f, 0x41, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x06, 0x0a, 0x02, 0x48, + 0x70, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x74, 0x6b, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, + 0x44, 0x65, 0x66, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x70, 0x65, 0x65, 0x64, 0x10, 0x03, + 0x12, 0x08, 0x0a, 0x04, 0x43, 0x72, 0x69, 0x74, 0x10, 0x04, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, + 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/pb/hero_msg.pb.go b/pb/hero_msg.pb.go index 82e092408..7a52ec9e1 100644 --- a/pb/hero_msg.pb.go +++ b/pb/hero_msg.pb.go @@ -430,7 +430,8 @@ type Hero_StrengthenUpStar_Req struct { unknownFields protoimpl.UnknownFields HeroObjID string `protobuf:"bytes,1,opt,name=heroObjID,proto3" json:"heroObjID"` // 英雄对象ID - Items []*CostCardData `protobuf:"bytes,2,rep,name=items,proto3" json:"items"` // 消耗卡牌对象ID + Hero []*CostCardData `protobuf:"bytes,2,rep,name=hero,proto3" json:"hero"` // 消耗卡牌对象ID + HeroRace []*CostCardData `protobuf:"bytes,3,rep,name=heroRace,proto3" json:"heroRace"` // 消耗种族卡牌对象ID } func (x *Hero_StrengthenUpStar_Req) Reset() { @@ -472,9 +473,16 @@ func (x *Hero_StrengthenUpStar_Req) GetHeroObjID() string { return "" } -func (x *Hero_StrengthenUpStar_Req) GetItems() []*CostCardData { +func (x *Hero_StrengthenUpStar_Req) GetHero() []*CostCardData { if x != nil { - return x.Items + return x.Hero + } + return nil +} + +func (x *Hero_StrengthenUpStar_Req) GetHeroRace() []*CostCardData { + if x != nil { + return x.HeroRace } return nil } @@ -1111,74 +1119,77 @@ var file_hero_hero_msg_proto_rawDesc = []byte{ 0x20, 0x0a, 0x0b, 0x63, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x72, 0x64, 0x4f, 0x62, 0x6a, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x72, 0x64, 0x4f, 0x62, 0x6a, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x61, 0x0a, 0x19, 0x48, 0x65, 0x72, - 0x6f, 0x5f, 0x53, 0x74, 0x72, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x65, 0x6e, 0x55, 0x70, 0x53, 0x74, - 0x61, 0x72, 0x5f, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x68, 0x65, 0x72, 0x6f, 0x4f, 0x62, - 0x6a, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x68, 0x65, 0x72, 0x6f, 0x4f, - 0x62, 0x6a, 0x49, 0x44, 0x12, 0x26, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x02, 0x20, + 0x05, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x8d, 0x01, 0x0a, 0x19, 0x48, 0x65, + 0x72, 0x6f, 0x5f, 0x53, 0x74, 0x72, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x65, 0x6e, 0x55, 0x70, 0x53, + 0x74, 0x61, 0x72, 0x5f, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x68, 0x65, 0x72, 0x6f, 0x4f, + 0x62, 0x6a, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x68, 0x65, 0x72, 0x6f, + 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x12, 0x24, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x72, - 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x41, 0x0a, 0x1a, - 0x48, 0x65, 0x72, 0x6f, 0x5f, 0x53, 0x74, 0x72, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x65, 0x6e, 0x55, - 0x70, 0x53, 0x74, 0x61, 0x72, 0x5f, 0x52, 0x65, 0x73, 0x70, 0x12, 0x23, 0x0a, 0x04, 0x68, 0x65, - 0x72, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x42, - 0x5f, 0x48, 0x65, 0x72, 0x6f, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x22, - 0x82, 0x01, 0x0a, 0x1a, 0x48, 0x65, 0x72, 0x6f, 0x5f, 0x53, 0x74, 0x72, 0x65, 0x6e, 0x67, 0x74, - 0x68, 0x65, 0x6e, 0x55, 0x70, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x5f, 0x52, 0x65, 0x71, 0x12, 0x1c, - 0x0a, 0x09, 0x68, 0x65, 0x72, 0x6f, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x09, 0x68, 0x65, 0x72, 0x6f, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x12, 0x1e, 0x0a, 0x0a, - 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x0a, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x26, 0x0a, 0x05, - 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x62, - 0x2e, 0x43, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x72, 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, 0x05, 0x69, - 0x74, 0x65, 0x6d, 0x73, 0x22, 0x42, 0x0a, 0x1b, 0x48, 0x65, 0x72, 0x6f, 0x5f, 0x53, 0x74, 0x72, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x65, 0x6e, 0x55, 0x70, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x5f, 0x52, - 0x65, 0x73, 0x70, 0x12, 0x23, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x42, 0x5f, 0x48, 0x65, 0x72, 0x6f, 0x44, 0x61, - 0x74, 0x61, 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x22, 0x4f, 0x0a, 0x11, 0x48, 0x65, 0x72, 0x6f, - 0x5f, 0x47, 0x6f, 0x6e, 0x67, 0x6d, 0x69, 0x6e, 0x67, 0x5f, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, - 0x09, 0x68, 0x65, 0x72, 0x6f, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x09, 0x68, 0x65, 0x72, 0x6f, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x63, - 0x6f, 0x73, 0x74, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, - 0x63, 0x6f, 0x73, 0x74, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x22, 0x82, 0x01, 0x0a, 0x12, 0x48, 0x65, - 0x72, 0x6f, 0x5f, 0x47, 0x6f, 0x6e, 0x67, 0x6d, 0x69, 0x6e, 0x67, 0x5f, 0x52, 0x65, 0x73, 0x70, + 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x12, 0x2c, 0x0a, 0x08, 0x68, + 0x65, 0x72, 0x6f, 0x52, 0x61, 0x63, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, + 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x72, 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, + 0x08, 0x68, 0x65, 0x72, 0x6f, 0x52, 0x61, 0x63, 0x65, 0x22, 0x41, 0x0a, 0x1a, 0x48, 0x65, 0x72, + 0x6f, 0x5f, 0x53, 0x74, 0x72, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x65, 0x6e, 0x55, 0x70, 0x53, 0x74, + 0x61, 0x72, 0x5f, 0x52, 0x65, 0x73, 0x70, 0x12, 0x23, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x42, 0x5f, 0x48, 0x65, + 0x72, 0x6f, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x22, 0x82, 0x01, 0x0a, + 0x1a, 0x48, 0x65, 0x72, 0x6f, 0x5f, 0x53, 0x74, 0x72, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x65, 0x6e, + 0x55, 0x70, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x5f, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x68, + 0x65, 0x72, 0x6f, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x68, 0x65, 0x72, 0x6f, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x6b, 0x69, + 0x6c, 0x6c, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x73, + 0x6b, 0x69, 0x6c, 0x6c, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x26, 0x0a, 0x05, 0x69, 0x74, 0x65, + 0x6d, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, + 0x73, 0x74, 0x43, 0x61, 0x72, 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, + 0x73, 0x22, 0x42, 0x0a, 0x1b, 0x48, 0x65, 0x72, 0x6f, 0x5f, 0x53, 0x74, 0x72, 0x65, 0x6e, 0x67, + 0x74, 0x68, 0x65, 0x6e, 0x55, 0x70, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x5f, 0x52, 0x65, 0x73, 0x70, 0x12, 0x23, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x42, 0x5f, 0x48, 0x65, 0x72, 0x6f, 0x44, 0x61, 0x74, 0x61, 0x52, - 0x04, 0x68, 0x65, 0x72, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x65, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x12, 0x2f, 0x0a, - 0x0a, 0x75, 0x70, 0x53, 0x74, 0x61, 0x72, 0x43, 0x61, 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x42, 0x5f, 0x48, 0x65, 0x72, 0x6f, 0x44, 0x61, - 0x74, 0x61, 0x52, 0x0a, 0x75, 0x70, 0x53, 0x74, 0x61, 0x72, 0x43, 0x61, 0x72, 0x64, 0x22, 0x36, - 0x0a, 0x16, 0x48, 0x65, 0x72, 0x6f, 0x5f, 0x47, 0x6f, 0x6e, 0x67, 0x6d, 0x69, 0x6e, 0x67, 0x52, - 0x65, 0x73, 0x65, 0x74, 0x5f, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x68, 0x65, 0x72, 0x6f, - 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x68, 0x65, 0x72, - 0x6f, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x22, 0x56, 0x0a, 0x17, 0x48, 0x65, 0x72, 0x6f, 0x5f, 0x47, - 0x6f, 0x6e, 0x67, 0x6d, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x65, 0x74, 0x5f, 0x52, 0x65, 0x73, - 0x70, 0x12, 0x23, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x42, 0x5f, 0x48, 0x65, 0x72, 0x6f, 0x44, 0x61, 0x74, 0x61, - 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x6e, 0x65, 0x72, 0x67, 0x79, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x65, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x22, 0x72, - 0x0a, 0x1a, 0x48, 0x65, 0x72, 0x6f, 0x5f, 0x47, 0x6f, 0x6e, 0x67, 0x6d, 0x69, 0x6e, 0x67, 0x55, - 0x73, 0x65, 0x45, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x5f, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, - 0x68, 0x65, 0x72, 0x6f, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x09, 0x68, 0x65, 0x72, 0x6f, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x75, 0x73, - 0x65, 0x45, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x75, - 0x73, 0x65, 0x45, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x54, - 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x75, 0x73, 0x65, 0x54, 0x79, - 0x70, 0x65, 0x22, 0x42, 0x0a, 0x1b, 0x48, 0x65, 0x72, 0x6f, 0x5f, 0x47, 0x6f, 0x6e, 0x67, 0x6d, - 0x69, 0x6e, 0x67, 0x55, 0x73, 0x65, 0x45, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x5f, 0x52, 0x65, 0x73, - 0x70, 0x12, 0x23, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x42, 0x5f, 0x48, 0x65, 0x72, 0x6f, 0x44, 0x61, 0x74, 0x61, - 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x22, 0x5c, 0x0a, 0x10, 0x48, 0x65, 0x72, 0x6f, 0x5f, 0x4a, - 0x75, 0x65, 0x78, 0x69, 0x6e, 0x67, 0x5f, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x68, 0x65, + 0x04, 0x68, 0x65, 0x72, 0x6f, 0x22, 0x4f, 0x0a, 0x11, 0x48, 0x65, 0x72, 0x6f, 0x5f, 0x47, 0x6f, + 0x6e, 0x67, 0x6d, 0x69, 0x6e, 0x67, 0x5f, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x68, 0x65, 0x72, 0x6f, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x68, - 0x65, 0x72, 0x6f, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x12, 0x2a, 0x0a, 0x09, 0x63, 0x6f, 0x73, 0x74, - 0x49, 0x74, 0x6d, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x62, - 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x44, 0x61, 0x74, 0x61, 0x52, 0x09, 0x63, 0x6f, 0x73, 0x74, 0x49, - 0x74, 0x6d, 0x65, 0x73, 0x22, 0x38, 0x0a, 0x11, 0x48, 0x65, 0x72, 0x6f, 0x5f, 0x4a, 0x75, 0x65, - 0x78, 0x69, 0x6e, 0x67, 0x5f, 0x52, 0x65, 0x73, 0x70, 0x12, 0x23, 0x0a, 0x04, 0x68, 0x65, 0x72, - 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x42, 0x5f, - 0x48, 0x65, 0x72, 0x6f, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x42, 0x06, - 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x72, 0x6f, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6f, 0x73, 0x74, + 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x6f, 0x73, + 0x74, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x22, 0x82, 0x01, 0x0a, 0x12, 0x48, 0x65, 0x72, 0x6f, 0x5f, + 0x47, 0x6f, 0x6e, 0x67, 0x6d, 0x69, 0x6e, 0x67, 0x5f, 0x52, 0x65, 0x73, 0x70, 0x12, 0x23, 0x0a, + 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, + 0x2e, 0x44, 0x42, 0x5f, 0x48, 0x65, 0x72, 0x6f, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x68, 0x65, + 0x72, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x06, 0x65, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x12, 0x2f, 0x0a, 0x0a, 0x75, 0x70, + 0x53, 0x74, 0x61, 0x72, 0x43, 0x61, 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, + 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x42, 0x5f, 0x48, 0x65, 0x72, 0x6f, 0x44, 0x61, 0x74, 0x61, 0x52, + 0x0a, 0x75, 0x70, 0x53, 0x74, 0x61, 0x72, 0x43, 0x61, 0x72, 0x64, 0x22, 0x36, 0x0a, 0x16, 0x48, + 0x65, 0x72, 0x6f, 0x5f, 0x47, 0x6f, 0x6e, 0x67, 0x6d, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x65, + 0x74, 0x5f, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x68, 0x65, 0x72, 0x6f, 0x4f, 0x62, 0x6a, + 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x68, 0x65, 0x72, 0x6f, 0x4f, 0x62, + 0x6a, 0x49, 0x44, 0x22, 0x56, 0x0a, 0x17, 0x48, 0x65, 0x72, 0x6f, 0x5f, 0x47, 0x6f, 0x6e, 0x67, + 0x6d, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x65, 0x74, 0x5f, 0x52, 0x65, 0x73, 0x70, 0x12, 0x23, + 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, + 0x62, 0x2e, 0x44, 0x42, 0x5f, 0x48, 0x65, 0x72, 0x6f, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x68, + 0x65, 0x72, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x06, 0x65, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x22, 0x72, 0x0a, 0x1a, 0x48, + 0x65, 0x72, 0x6f, 0x5f, 0x47, 0x6f, 0x6e, 0x67, 0x6d, 0x69, 0x6e, 0x67, 0x55, 0x73, 0x65, 0x45, + 0x6e, 0x65, 0x72, 0x67, 0x79, 0x5f, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x68, 0x65, 0x72, + 0x6f, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x68, 0x65, + 0x72, 0x6f, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x75, 0x73, 0x65, 0x45, 0x6e, + 0x65, 0x72, 0x67, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x75, 0x73, 0x65, 0x45, + 0x6e, 0x65, 0x72, 0x67, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x54, 0x79, 0x70, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x75, 0x73, 0x65, 0x54, 0x79, 0x70, 0x65, 0x22, + 0x42, 0x0a, 0x1b, 0x48, 0x65, 0x72, 0x6f, 0x5f, 0x47, 0x6f, 0x6e, 0x67, 0x6d, 0x69, 0x6e, 0x67, + 0x55, 0x73, 0x65, 0x45, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x5f, 0x52, 0x65, 0x73, 0x70, 0x12, 0x23, + 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, + 0x62, 0x2e, 0x44, 0x42, 0x5f, 0x48, 0x65, 0x72, 0x6f, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x68, + 0x65, 0x72, 0x6f, 0x22, 0x5c, 0x0a, 0x10, 0x48, 0x65, 0x72, 0x6f, 0x5f, 0x4a, 0x75, 0x65, 0x78, + 0x69, 0x6e, 0x67, 0x5f, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x68, 0x65, 0x72, 0x6f, 0x4f, + 0x62, 0x6a, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x68, 0x65, 0x72, 0x6f, + 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x12, 0x2a, 0x0a, 0x09, 0x63, 0x6f, 0x73, 0x74, 0x49, 0x74, 0x6d, + 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x74, + 0x65, 0x6d, 0x44, 0x61, 0x74, 0x61, 0x52, 0x09, 0x63, 0x6f, 0x73, 0x74, 0x49, 0x74, 0x6d, 0x65, + 0x73, 0x22, 0x38, 0x0a, 0x11, 0x48, 0x65, 0x72, 0x6f, 0x5f, 0x4a, 0x75, 0x65, 0x78, 0x69, 0x6e, + 0x67, 0x5f, 0x52, 0x65, 0x73, 0x70, 0x12, 0x23, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x42, 0x5f, 0x48, 0x65, 0x72, + 0x6f, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x42, 0x06, 0x5a, 0x04, 0x2e, + 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1221,21 +1232,22 @@ var file_hero_hero_msg_proto_depIdxs = []int32{ 20, // 0: pb.Hero_Info_Rsp.base:type_name -> pb.DB_HeroData 20, // 1: pb.Hero_List_Rsp.list:type_name -> pb.DB_HeroData 20, // 2: pb.Hero_StrengthenUplv_Resp.hero:type_name -> pb.DB_HeroData - 7, // 3: pb.Hero_StrengthenUpStar_Req.items:type_name -> pb.CostCardData - 20, // 4: pb.Hero_StrengthenUpStar_Resp.hero:type_name -> pb.DB_HeroData - 7, // 5: pb.Hero_StrengthenUpSkill_Req.items:type_name -> pb.CostCardData - 20, // 6: pb.Hero_StrengthenUpSkill_Resp.hero:type_name -> pb.DB_HeroData - 20, // 7: pb.Hero_Gongming_Resp.hero:type_name -> pb.DB_HeroData - 20, // 8: pb.Hero_Gongming_Resp.upStarCard:type_name -> pb.DB_HeroData - 20, // 9: pb.Hero_GongmingReset_Resp.hero:type_name -> pb.DB_HeroData - 20, // 10: pb.Hero_GongmingUseEnergy_Resp.hero:type_name -> pb.DB_HeroData - 4, // 11: pb.Hero_Juexing_Req.costItmes:type_name -> pb.ItemData - 20, // 12: pb.Hero_Juexing_Resp.hero:type_name -> pb.DB_HeroData - 13, // [13:13] is the sub-list for method output_type - 13, // [13:13] is the sub-list for method input_type - 13, // [13:13] is the sub-list for extension type_name - 13, // [13:13] is the sub-list for extension extendee - 0, // [0:13] is the sub-list for field type_name + 7, // 3: pb.Hero_StrengthenUpStar_Req.hero:type_name -> pb.CostCardData + 7, // 4: pb.Hero_StrengthenUpStar_Req.heroRace:type_name -> pb.CostCardData + 20, // 5: pb.Hero_StrengthenUpStar_Resp.hero:type_name -> pb.DB_HeroData + 7, // 6: pb.Hero_StrengthenUpSkill_Req.items:type_name -> pb.CostCardData + 20, // 7: pb.Hero_StrengthenUpSkill_Resp.hero:type_name -> pb.DB_HeroData + 20, // 8: pb.Hero_Gongming_Resp.hero:type_name -> pb.DB_HeroData + 20, // 9: pb.Hero_Gongming_Resp.upStarCard:type_name -> pb.DB_HeroData + 20, // 10: pb.Hero_GongmingReset_Resp.hero:type_name -> pb.DB_HeroData + 20, // 11: pb.Hero_GongmingUseEnergy_Resp.hero:type_name -> pb.DB_HeroData + 4, // 12: pb.Hero_Juexing_Req.costItmes:type_name -> pb.ItemData + 20, // 13: pb.Hero_Juexing_Resp.hero:type_name -> pb.DB_HeroData + 14, // [14:14] is the sub-list for method output_type + 14, // [14:14] is the sub-list for method input_type + 14, // [14:14] is the sub-list for extension type_name + 14, // [14:14] is the sub-list for extension extendee + 0, // [0:14] is the sub-list for field type_name } func init() { file_hero_hero_msg_proto_init() } diff --git a/pb/proto/comm.proto b/pb/proto/comm.proto index 69696ae52..41e4797e2 100644 --- a/pb/proto/comm.proto +++ b/pb/proto/comm.proto @@ -67,7 +67,7 @@ message BroadCastMessageReq { message AgentCloseeReq { string UserSessionId = 1; } //通知用户离线 -message NoticeUserCloseReq { string UserId = 1; } +message NoticeUserCloseReq {string UserSessionId = 1; string UserId = 2; } //英雄属性类型 enum HeroAttributesType{ diff --git a/services/comp_gateroute.go b/services/comp_gateroute.go index 170e64012..4d92f5495 100644 --- a/services/comp_gateroute.go +++ b/services/comp_gateroute.go @@ -42,9 +42,11 @@ type msghandle struct { //服务网关组件 type SCompGateRoute struct { cbase.ServiceCompBase - service base.IRPCXService //rpc服务对象 通过这个对象可以发布服务和调用其他服务的接口 - mrlock sync.RWMutex //msghandles 对象的锁 - msghandles map[string]*msghandle //处理函数的管理对象 + service base.IRPCXService //rpc服务对象 通过这个对象可以发布服务和调用其他服务的接口 + mrlock sync.RWMutex //msghandles 对象的锁 + msghandles map[string]*msghandle //处理函数的管理对象 + sessionslock sync.RWMutex //msghandles 对象的锁 + sessions map[string]comm.IUserSession //用户会话管理 避免频繁创建 } //设置服务组件名称 方便业务模块中获取此组件对象 @@ -106,8 +108,17 @@ func (this *SCompGateRoute) ReceiveMsg(ctx context.Context, args *pb.AgentMessag msghandle, ok := this.msghandles[method] this.mrlock.RUnlock() if ok { - //封装用户会话 - session := comm.NewUserSession(this.service, args.Ip, args.UserSessionId, args.GatewayServiceId, args.UserId) + //读取会话对象 + this.sessionslock.RLock() + session, ok := this.sessions[args.UserSessionId] + this.sessionslock.RUnlock() + if !ok { //没有 创建会话 + //封装用户会话 + session = comm.NewUserSession(this.service, args.Ip, args.UserSessionId, args.GatewayServiceId, args.UserId) + this.sessionslock.Lock() + this.sessions[args.UserSessionId] = session + this.sessionslock.Unlock() + } //序列化用户消息对象 msg := reflect.New(msghandle.msgType.Elem()).Interface() if err := ptypes.UnmarshalAny(args.Message, msg.(proto.Message)); err != nil { @@ -155,6 +166,8 @@ func (this *SCompGateRoute) ReceiveMsg(ctx context.Context, args *pb.AgentMessag //RPC_NoticeUserClose 接收用户离线通知 func (this *SCompGateRoute) NoticeUserClose(ctx context.Context, args *pb.NoticeUserCloseReq, reply *pb.RPCMessageReply) error { event.TriggerEvent(comm.Event_UserOffline, args.UserId) - + this.sessionslock.Lock() + delete(this.sessions, args.UserSessionId) + this.sessionslock.Unlock() return nil }