上传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)
|
data, _ := anypb.New(msg)
|
||||||
for k, v := range gateways {
|
for k, v := range gateways {
|
||||||
for k1, v1 := range v {
|
for k1, v1 := range v {
|
||||||
|
|
||||||
ctx, _ := context.WithTimeout(context.Background(), time.Second*5) //
|
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{
|
if _, err = this.service.AcrossClusterRpcGo(ctx, k, fmt.Sprintf("%s/%s", comm.Service_Gateway, k1), string(comm.Rpc_GatewaySendBatchMsg), &pb.BatchMessageReq{
|
||||||
UserSessionIds: v1,
|
UserSessionIds: v1,
|
||||||
|
@ -189,6 +189,7 @@ func (this *Pvp) PvpOutCmdPush(out *pb.PvpOutCmdPush) {
|
|||||||
func (this *Pvp) PvpFinishPush(out *pb.BattleFinishPush) {
|
func (this *Pvp) PvpFinishPush(out *pb.BattleFinishPush) {
|
||||||
var (
|
var (
|
||||||
battle *BattleItem
|
battle *BattleItem
|
||||||
|
err error
|
||||||
ok bool
|
ok bool
|
||||||
)
|
)
|
||||||
this.lock.RLock()
|
this.lock.RLock()
|
||||||
@ -204,6 +205,13 @@ func (this *Pvp) PvpFinishPush(out *pb.BattleFinishPush) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
this.modelPvpComp.delpvp(out.Battleid)
|
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
|
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 protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_pvp_pvp_msg_proto_rawDesc = []byte{
|
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, 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,
|
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,
|
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,
|
0x6d, 0x64, 0x22, 0x2b, 0x0a, 0x0d, 0x50, 0x76, 0x70, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x50,
|
||||||
0x6f, 0x33,
|
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 (
|
var (
|
||||||
@ -874,7 +924,7 @@ func file_pvp_pvp_msg_proto_rawDescGZIP() []byte {
|
|||||||
return file_pvp_pvp_msg_proto_rawDescData
|
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{}{
|
var file_pvp_pvp_msg_proto_goTypes = []interface{}{
|
||||||
(*PvpListReq)(nil), // 0: PvpListReq
|
(*PvpListReq)(nil), // 0: PvpListReq
|
||||||
(*PvpListResp)(nil), // 1: PvpListResp
|
(*PvpListResp)(nil), // 1: PvpListResp
|
||||||
@ -890,27 +940,28 @@ var file_pvp_pvp_msg_proto_goTypes = []interface{}{
|
|||||||
(*PvpOutCmdPush)(nil), // 11: PvpOutCmdPush
|
(*PvpOutCmdPush)(nil), // 11: PvpOutCmdPush
|
||||||
(*PvpInCmdReq)(nil), // 12: PvpInCmdReq
|
(*PvpInCmdReq)(nil), // 12: PvpInCmdReq
|
||||||
(*PvpInCmdResp)(nil), // 13: PvpInCmdResp
|
(*PvpInCmdResp)(nil), // 13: PvpInCmdResp
|
||||||
(*DBPvpBattle)(nil), // 14: DBPvpBattle
|
(*PvpFinishPush)(nil), // 14: PvpFinishPush
|
||||||
(ErrorCode)(0), // 15: ErrorCode
|
(*DBPvpBattle)(nil), // 15: DBPvpBattle
|
||||||
(*BattleStateInfo)(nil), // 16: BattleStateInfo
|
(ErrorCode)(0), // 16: ErrorCode
|
||||||
(*PvpUserInfo)(nil), // 17: PvpUserInfo
|
(*BattleStateInfo)(nil), // 17: BattleStateInfo
|
||||||
(*BattleFormation)(nil), // 18: BattleFormation
|
(*PvpUserInfo)(nil), // 18: PvpUserInfo
|
||||||
(*BattleInfo)(nil), // 19: BattleInfo
|
(*BattleFormation)(nil), // 19: BattleFormation
|
||||||
(*BattleCmd)(nil), // 20: BattleCmd
|
(*BattleInfo)(nil), // 20: BattleInfo
|
||||||
|
(*BattleCmd)(nil), // 21: BattleCmd
|
||||||
}
|
}
|
||||||
var file_pvp_pvp_msg_proto_depIdxs = []int32{
|
var file_pvp_pvp_msg_proto_depIdxs = []int32{
|
||||||
14, // 0: PvpListResp.list:type_name -> DBPvpBattle
|
15, // 0: PvpListResp.list:type_name -> DBPvpBattle
|
||||||
15, // 1: PvpIntoResp.code:type_name -> ErrorCode
|
16, // 1: PvpIntoResp.code:type_name -> ErrorCode
|
||||||
16, // 2: PvpIntoResp.info:type_name -> BattleStateInfo
|
17, // 2: PvpIntoResp.info:type_name -> BattleStateInfo
|
||||||
17, // 3: PvpReadyPush.red:type_name -> PvpUserInfo
|
18, // 3: PvpReadyPush.red:type_name -> PvpUserInfo
|
||||||
17, // 4: PvpReadyPush.blue:type_name -> PvpUserInfo
|
18, // 4: PvpReadyPush.blue:type_name -> PvpUserInfo
|
||||||
18, // 5: PvpFormationReq.formation:type_name -> BattleFormation
|
19, // 5: PvpFormationReq.formation:type_name -> BattleFormation
|
||||||
15, // 6: PvpStartPush.code:type_name -> ErrorCode
|
16, // 6: PvpStartPush.code:type_name -> ErrorCode
|
||||||
19, // 7: PvpStartPush.info:type_name -> BattleInfo
|
20, // 7: PvpStartPush.info:type_name -> BattleInfo
|
||||||
20, // 8: PvpOutCmdPush.cmd:type_name -> BattleCmd
|
21, // 8: PvpOutCmdPush.cmd:type_name -> BattleCmd
|
||||||
20, // 9: PvpInCmdReq.cmd:type_name -> BattleCmd
|
21, // 9: PvpInCmdReq.cmd:type_name -> BattleCmd
|
||||||
15, // 10: PvpInCmdResp.code:type_name -> ErrorCode
|
16, // 10: PvpInCmdResp.code:type_name -> ErrorCode
|
||||||
20, // 11: PvpInCmdResp.cmd:type_name -> BattleCmd
|
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 output_type
|
||||||
12, // [12:12] is the sub-list for method input_type
|
12, // [12:12] is the sub-list for method input_type
|
||||||
12, // [12:12] is the sub-list for extension type_name
|
12, // [12:12] is the sub-list for extension type_name
|
||||||
@ -1095,6 +1146,18 @@ func file_pvp_pvp_msg_proto_init() {
|
|||||||
return nil
|
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{}
|
type x struct{}
|
||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
@ -1102,7 +1165,7 @@ func file_pvp_pvp_msg_proto_init() {
|
|||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_pvp_pvp_msg_proto_rawDesc,
|
RawDescriptor: file_pvp_pvp_msg_proto_rawDesc,
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 14,
|
NumMessages: 15,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 0,
|
NumServices: 0,
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user