From d529ec2fed2a4a629007bba1295d2165bf4d87a9 Mon Sep 17 00:00:00 2001 From: sk <123456@qq.com> Date: Sat, 25 May 2024 17:55:15 +0800 Subject: [PATCH] update --- protocol/player/player.pb.go | 25 ++++++++++++++++++++++--- protocol/player/player.proto | 5 ++++- public | 2 +- worldsrv/action_player.go | 7 ++++--- worldsrv/etcd.go | 17 +++++++---------- 5 files changed, 38 insertions(+), 18 deletions(-) diff --git a/protocol/player/player.pb.go b/protocol/player/player.pb.go index 401ff1c..9afddae 100644 --- a/protocol/player/player.pb.go +++ b/protocol/player/player.pb.go @@ -9408,6 +9408,8 @@ type CSExchangeChannel struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + Tp int32 `protobuf:"varint,1,opt,name=Tp,proto3" json:"Tp,omitempty"` // 开关类型 1:兑换 2:v卡掉落 } func (x *CSExchangeChannel) Reset() { @@ -9442,6 +9444,13 @@ func (*CSExchangeChannel) Descriptor() ([]byte, []int) { return file_player_proto_rawDescGZIP(), []int{132} } +func (x *CSExchangeChannel) GetTp() int32 { + if x != nil { + return x.Tp + } + return 0 +} + // PACKET_SCExchangeChannel type SCExchangeChannel struct { state protoimpl.MessageState @@ -9449,6 +9458,7 @@ type SCExchangeChannel struct { unknownFields protoimpl.UnknownFields OnChannelName []string `protobuf:"bytes,1,rep,name=OnChannelName,proto3" json:"OnChannelName,omitempty"` // 开启渠道 + Tp int32 `protobuf:"varint,2,opt,name=Tp,proto3" json:"Tp,omitempty"` // 开关类型 1:兑换 2:v卡掉落 } func (x *SCExchangeChannel) Reset() { @@ -9490,6 +9500,13 @@ func (x *SCExchangeChannel) GetOnChannelName() []string { return nil } +func (x *SCExchangeChannel) GetTp() int32 { + if x != nil { + return x.Tp + } + return 0 +} + var File_player_proto protoreflect.FileDescriptor var file_player_proto_rawDesc = []byte{ @@ -10453,12 +10470,14 @@ var file_player_proto_rawDesc = []byte{ 0x4d, 0x61, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x42, 0x61, 0x6e, 0x6b, 0x43, 0x6f, 0x69, 0x6e, 0x4d, 0x61, 0x78, 0x12, 0x20, 0x0a, 0x0b, 0x41, 0x64, 0x64, 0x42, 0x61, 0x6e, 0x6b, 0x43, 0x6f, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x41, 0x64, 0x64, - 0x42, 0x61, 0x6e, 0x6b, 0x43, 0x6f, 0x69, 0x6e, 0x22, 0x13, 0x0a, 0x11, 0x43, 0x53, 0x45, 0x78, - 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x22, 0x39, 0x0a, + 0x42, 0x61, 0x6e, 0x6b, 0x43, 0x6f, 0x69, 0x6e, 0x22, 0x23, 0x0a, 0x11, 0x43, 0x53, 0x45, 0x78, + 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x0e, 0x0a, + 0x02, 0x54, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x54, 0x70, 0x22, 0x49, 0x0a, 0x11, 0x53, 0x43, 0x45, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x24, 0x0a, 0x0d, 0x4f, 0x6e, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0d, 0x4f, 0x6e, 0x43, 0x68, 0x61, - 0x6e, 0x6e, 0x65, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x2a, 0xef, 0x0d, 0x0a, 0x0c, 0x4f, 0x70, 0x52, + 0x6e, 0x6e, 0x65, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x54, 0x70, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x54, 0x70, 0x2a, 0xef, 0x0d, 0x0a, 0x0c, 0x4f, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x53, 0x75, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x10, 0x4f, 0x50, diff --git a/protocol/player/player.proto b/protocol/player/player.proto index 917efdb..c1e3816 100644 --- a/protocol/player/player.proto +++ b/protocol/player/player.proto @@ -1182,9 +1182,12 @@ message SCPigBankCoin { } // PACKET_CSExchangeChannel -message CSExchangeChannel{} +message CSExchangeChannel{ + int32 Tp = 1; // 开关类型 1:兑换 2:v卡掉落 +} // PACKET_SCExchangeChannel message SCExchangeChannel{ repeated string OnChannelName = 1; // 开启渠道 + int32 Tp = 2; // 开关类型 1:兑换 2:v卡掉落 } \ No newline at end of file diff --git a/public b/public index 8d7ca19..ecb4ff8 160000 --- a/public +++ b/public @@ -1 +1 @@ -Subproject commit 8d7ca1974d29e5d5c3100a7024e353c992505a7b +Subproject commit ecb4ff8c4ffa407111bf23f9523f3f7b5b6f7230 diff --git a/worldsrv/action_player.go b/worldsrv/action_player.go index 965d038..d491aec 100644 --- a/worldsrv/action_player.go +++ b/worldsrv/action_player.go @@ -1854,7 +1854,7 @@ func init() { func CSExchangeChannel(s *netlib.Session, packetid int, data interface{}, sid int64) error { logger.Logger.Trace("CSExchangeChannel Process recv ", data) - _, ok := data.(*player_proto.CSExchangeChannel) + msg, ok := data.(*player_proto.CSExchangeChannel) if !ok { return nil } @@ -1866,12 +1866,13 @@ func CSExchangeChannel(s *netlib.Session, packetid int, data interface{}, sid in } var onChannelName []string - conf := PlatformMgrSingleton.GetConfig(p.Platform).ChannelSwitch[common.ChannelSwitchExchange] + conf := PlatformMgrSingleton.GetConfig(p.Platform).ChannelSwitch[msg.GetTp()] if conf != nil { onChannelName = conf.OnChannelName } pack := &player_proto.SCExchangeChannel{ + Tp: msg.GetTp(), OnChannelName: onChannelName, } p.SendToClient(int(player_proto.PlayerPacketID_PACKET_SCExchangeChannel), pack) @@ -2840,6 +2841,6 @@ func init() { common.Register(int(player_proto.PlayerPacketID_PACKET_CSBillList), player_proto.CSBillList{}, CSBillList) // 看广告一次 common.Register(int(player_proto.PlayerPacketID_PACKET_CSADV), player_proto.CSADV{}, CSADV) - // 开启兑换的渠道 + // 渠道开关 common.Register(int(player_proto.PlayerPacketID_PACKET_CSExchangeChannel), player_proto.CSExchangeChannel{}, CSExchangeChannel) } diff --git a/worldsrv/etcd.go b/worldsrv/etcd.go index c852fed..667cab2 100644 --- a/worldsrv/etcd.go +++ b/worldsrv/etcd.go @@ -8,7 +8,6 @@ import ( "go.etcd.io/etcd/client/v3" "mongo.games.com/goserver/core/logger" - "mongo.games.com/game/common" "mongo.games.com/game/etcd" hallproto "mongo.games.com/game/protocol/gamehall" loginproto "mongo.games.com/game/protocol/login" @@ -158,15 +157,13 @@ func platformConfigEvent(ctx context.Context, completeKey string, isInit bool, e case *webapi.ChannelSwitchConfig: PlatformMgrSingleton.GetConfig(config.Platform).ChannelSwitch[config.GetTp()] = config if !isInit { - switch config.GetTp() { - case common.ChannelSwitchExchange: - // 通知变更 - for _, v := range PlayerMgrSington.playerOfPlatform[config.Platform] { - if v != nil && v.IsOnLine() { - v.SendToClient(int(playerproto.PlayerPacketID_PACKET_SCExchangeChannel), &playerproto.SCExchangeChannel{ - OnChannelName: config.OnChannelName, - }) - } + // 通知变更 + for _, v := range PlayerMgrSington.playerOfPlatform[config.Platform] { + if v != nil && v.IsOnLine() { + v.SendToClient(int(playerproto.PlayerPacketID_PACKET_SCExchangeChannel), &playerproto.SCExchangeChannel{ + Tp: config.Tp, + OnChannelName: config.OnChannelName, + }) } } }