上传pvp战斗结束推送
This commit is contained in:
parent
451c53aaf7
commit
2339f26196
@ -202,7 +202,6 @@ func (this *ModuleBase) SendMsgToUsers(mainType, subType string, msg proto.Messa
|
||||
data, _ := anypb.New(msg)
|
||||
for k, v := range gateways {
|
||||
for k1, v1 := range v {
|
||||
|
||||
ctx, _ := context.WithTimeout(context.Background(), time.Second*5) //
|
||||
if _, err = this.service.AcrossClusterRpcGo(ctx, k, fmt.Sprintf("%s/%s", comm.Service_Gateway, k1), string(comm.Rpc_GatewaySendBatchMsg), &pb.BatchMessageReq{
|
||||
UserSessionIds: v1,
|
||||
|
@ -189,6 +189,7 @@ func (this *Pvp) PvpOutCmdPush(out *pb.PvpOutCmdPush) {
|
||||
func (this *Pvp) PvpFinishPush(out *pb.BattleFinishPush) {
|
||||
var (
|
||||
battle *BattleItem
|
||||
err error
|
||||
ok bool
|
||||
)
|
||||
this.lock.RLock()
|
||||
@ -204,6 +205,13 @@ func (this *Pvp) PvpFinishPush(out *pb.BattleFinishPush) {
|
||||
break
|
||||
}
|
||||
this.modelPvpComp.delpvp(out.Battleid)
|
||||
this.PutUserSession(battle.RedSession)
|
||||
this.PutUserSession(battle.BlueSession)
|
||||
if err = this.SendMsgToUsers(string(comm.ModulePvp), "finish", &pb.PvpFinishPush{
|
||||
Battleid: battle.Id,
|
||||
}, battle.Red.Uid, battle.Blue.Uid); err != nil {
|
||||
this.Errorln(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
109
pb/pvp_msg.pb.go
109
pb/pvp_msg.pb.go
@ -785,6 +785,54 @@ func (x *PvpInCmdResp) GetCmd() *BattleCmd {
|
||||
return nil
|
||||
}
|
||||
|
||||
//实时Pvp 战斗结束推送
|
||||
type PvpFinishPush struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Battleid string `protobuf:"bytes,1,opt,name=battleid,proto3" json:"battleid"`
|
||||
}
|
||||
|
||||
func (x *PvpFinishPush) Reset() {
|
||||
*x = PvpFinishPush{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_pvp_pvp_msg_proto_msgTypes[14]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PvpFinishPush) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*PvpFinishPush) ProtoMessage() {}
|
||||
|
||||
func (x *PvpFinishPush) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_pvp_pvp_msg_proto_msgTypes[14]
|
||||
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 PvpFinishPush.ProtoReflect.Descriptor instead.
|
||||
func (*PvpFinishPush) Descriptor() ([]byte, []int) {
|
||||
return file_pvp_pvp_msg_proto_rawDescGZIP(), []int{14}
|
||||
}
|
||||
|
||||
func (x *PvpFinishPush) GetBattleid() string {
|
||||
if x != nil {
|
||||
return x.Battleid
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_pvp_pvp_msg_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_pvp_pvp_msg_proto_rawDesc = []byte{
|
||||
@ -858,8 +906,10 @@ var file_pvp_pvp_msg_proto_rawDesc = []byte{
|
||||
0x6c, 0x65, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x62, 0x61, 0x74, 0x74,
|
||||
0x6c, 0x65, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x03, 0x63, 0x6d, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28,
|
||||
0x0b, 0x32, 0x0a, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x43, 0x6d, 0x64, 0x52, 0x03, 0x63,
|
||||
0x6d, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x33,
|
||||
0x6d, 0x64, 0x22, 0x2b, 0x0a, 0x0d, 0x50, 0x76, 0x70, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x50,
|
||||
0x75, 0x73, 0x68, 0x12, 0x1a, 0x0a, 0x08, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x69, 0x64, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x69, 0x64, 0x42,
|
||||
0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@ -874,7 +924,7 @@ func file_pvp_pvp_msg_proto_rawDescGZIP() []byte {
|
||||
return file_pvp_pvp_msg_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_pvp_pvp_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 14)
|
||||
var file_pvp_pvp_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 15)
|
||||
var file_pvp_pvp_msg_proto_goTypes = []interface{}{
|
||||
(*PvpListReq)(nil), // 0: PvpListReq
|
||||
(*PvpListResp)(nil), // 1: PvpListResp
|
||||
@ -890,27 +940,28 @@ var file_pvp_pvp_msg_proto_goTypes = []interface{}{
|
||||
(*PvpOutCmdPush)(nil), // 11: PvpOutCmdPush
|
||||
(*PvpInCmdReq)(nil), // 12: PvpInCmdReq
|
||||
(*PvpInCmdResp)(nil), // 13: PvpInCmdResp
|
||||
(*DBPvpBattle)(nil), // 14: DBPvpBattle
|
||||
(ErrorCode)(0), // 15: ErrorCode
|
||||
(*BattleStateInfo)(nil), // 16: BattleStateInfo
|
||||
(*PvpUserInfo)(nil), // 17: PvpUserInfo
|
||||
(*BattleFormation)(nil), // 18: BattleFormation
|
||||
(*BattleInfo)(nil), // 19: BattleInfo
|
||||
(*BattleCmd)(nil), // 20: BattleCmd
|
||||
(*PvpFinishPush)(nil), // 14: PvpFinishPush
|
||||
(*DBPvpBattle)(nil), // 15: DBPvpBattle
|
||||
(ErrorCode)(0), // 16: ErrorCode
|
||||
(*BattleStateInfo)(nil), // 17: BattleStateInfo
|
||||
(*PvpUserInfo)(nil), // 18: PvpUserInfo
|
||||
(*BattleFormation)(nil), // 19: BattleFormation
|
||||
(*BattleInfo)(nil), // 20: BattleInfo
|
||||
(*BattleCmd)(nil), // 21: BattleCmd
|
||||
}
|
||||
var file_pvp_pvp_msg_proto_depIdxs = []int32{
|
||||
14, // 0: PvpListResp.list:type_name -> DBPvpBattle
|
||||
15, // 1: PvpIntoResp.code:type_name -> ErrorCode
|
||||
16, // 2: PvpIntoResp.info:type_name -> BattleStateInfo
|
||||
17, // 3: PvpReadyPush.red:type_name -> PvpUserInfo
|
||||
17, // 4: PvpReadyPush.blue:type_name -> PvpUserInfo
|
||||
18, // 5: PvpFormationReq.formation:type_name -> BattleFormation
|
||||
15, // 6: PvpStartPush.code:type_name -> ErrorCode
|
||||
19, // 7: PvpStartPush.info:type_name -> BattleInfo
|
||||
20, // 8: PvpOutCmdPush.cmd:type_name -> BattleCmd
|
||||
20, // 9: PvpInCmdReq.cmd:type_name -> BattleCmd
|
||||
15, // 10: PvpInCmdResp.code:type_name -> ErrorCode
|
||||
20, // 11: PvpInCmdResp.cmd:type_name -> BattleCmd
|
||||
15, // 0: PvpListResp.list:type_name -> DBPvpBattle
|
||||
16, // 1: PvpIntoResp.code:type_name -> ErrorCode
|
||||
17, // 2: PvpIntoResp.info:type_name -> BattleStateInfo
|
||||
18, // 3: PvpReadyPush.red:type_name -> PvpUserInfo
|
||||
18, // 4: PvpReadyPush.blue:type_name -> PvpUserInfo
|
||||
19, // 5: PvpFormationReq.formation:type_name -> BattleFormation
|
||||
16, // 6: PvpStartPush.code:type_name -> ErrorCode
|
||||
20, // 7: PvpStartPush.info:type_name -> BattleInfo
|
||||
21, // 8: PvpOutCmdPush.cmd:type_name -> BattleCmd
|
||||
21, // 9: PvpInCmdReq.cmd:type_name -> BattleCmd
|
||||
16, // 10: PvpInCmdResp.code:type_name -> ErrorCode
|
||||
21, // 11: PvpInCmdResp.cmd:type_name -> BattleCmd
|
||||
12, // [12:12] is the sub-list for method output_type
|
||||
12, // [12:12] is the sub-list for method input_type
|
||||
12, // [12:12] is the sub-list for extension type_name
|
||||
@ -1095,6 +1146,18 @@ func file_pvp_pvp_msg_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_pvp_pvp_msg_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*PvpFinishPush); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
@ -1102,7 +1165,7 @@ func file_pvp_pvp_msg_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_pvp_pvp_msg_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 14,
|
||||
NumMessages: 15,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user