From 737fea1e236d38a3f51f7cedcbbc9649d90982ff Mon Sep 17 00:00:00 2001 From: sk <123456@qq.com> Date: Tue, 16 Apr 2024 17:31:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E4=BB=A3=E7=A0=81=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/DB_PropExchange.dat | 8 +- data/DB_Task.dat | Bin 583 -> 583 bytes etcd/keyconf.go | 1 + gamesrv/transact/trascate_gamesrv.go | 2 +- mgrsrv/api/webapi_gamesrv.go | 2 +- mgrsrv/api/webapi_worldsrv.go | 26 +- protocol/qpapi/qpapi.pb.go | 10 +- protocol/qpapi/qpapi.proto | 2 +- protocol/telegramapi/telegramapi.pb.go | 14 +- protocol/telegramapi/telegramapi.proto | 4 +- protocol/webapi/common.pb.go | 129 +++++++-- protocol/webapi/common.proto | 26 +- protocol/webapi/webapi.pb.go | 26 +- protocol/webapi/webapi.proto | 26 +- worldsrv/config-local.json | 2 +- worldsrv/config_18.json | 2 +- worldsrv/etcd.go | 64 +++-- worldsrv/etcdmgr.go | 2 +- worldsrv/trascate_webapi.go | 42 +-- worldsrv/welfmgr.go | 369 ++++++++++++++----------- 20 files changed, 448 insertions(+), 309 deletions(-) diff --git a/data/DB_PropExchange.dat b/data/DB_PropExchange.dat index ab684a7..da1436a 100644 --- a/data/DB_PropExchange.dat +++ b/data/DB_PropExchange.dat @@ -1,5 +1,5 @@ -6ֆ׆ӆԆՆ"= -.ۆ؆نچ"= -WچۆӆԆֆنՆ׆؆"  -]ֆ؆چۆ܆ӆԆՆ׆ن" \ No newline at end of file +6ԆՆֆ׆ӆ"= +.چۆ؆ن"= +Wӆ׆؆نۆԆՆֆچ"  +]ԆՆֆنچ܆ӆ׆؆ۆ" \ No newline at end of file diff --git a/data/DB_Task.dat b/data/DB_Task.dat index 39af72ee7325864ff254fc9d2b9394bebdb7ff50..5b677b1878712968d0ae3964a17d1836f685b50f 100644 GIT binary patch delta 35 qcmX@ka-3yCpdcH^l3q3eej^T!g+Tg38}r1Z+moj-3QqQ8{0RWUt_!XJ delta 49 zcmX@ka-3yCpdbgw!d^Ck3vJ9sY#d8~EdGf}w*}ca76F-DMi9vZEw+>W7=Ho)ZT1f8 diff --git a/etcd/keyconf.go b/etcd/keyconf.go index ffa0d23..7a832c6 100644 --- a/etcd/keyconf.go +++ b/etcd/keyconf.go @@ -45,6 +45,7 @@ const ( ETCDKEY_ACT_BLINDBOX = "/game/act_blindbox" ETCDKEY_ACT_FIRSTPAY = "/game/act_FirstPay" ETCDKEY_ACT_CONTINUOUSPAY = "/game/act_ContinuousPay" + ETCDKEY_ACT_Collect = "/game/act_collect" ETCDKEY_VIP_CFG = "/game/VIPcfg" ETCDKEY_WBCtrl_CFG = "/game/WBCtrlCfg" ETCDKEY_PACKAGE_ENTRYSWITCH = "/game/plt/entryswitch/" //界面入口开关 diff --git a/gamesrv/transact/trascate_gamesrv.go b/gamesrv/transact/trascate_gamesrv.go index 158c13b..6aa90b8 100644 --- a/gamesrv/transact/trascate_gamesrv.go +++ b/gamesrv/transact/trascate_gamesrv.go @@ -100,7 +100,7 @@ package transact // //func init() { // //单控 -// WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/mongo.games.com/game/SinglePlayerAdjust", WebAPIHandlerWrapper( +// WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/game/SinglePlayerAdjust", WebAPIHandlerWrapper( // func(tNode *transact.TransNode, params []byte) (int, proto.Message) { // pack := &webapi_proto.SASinglePlayerAdjust{} // msg := &webapi_proto.ASSinglePlayerAdjust{} diff --git a/mgrsrv/api/webapi_gamesrv.go b/mgrsrv/api/webapi_gamesrv.go index 5fb0d8d..7bc77f0 100644 --- a/mgrsrv/api/webapi_gamesrv.go +++ b/mgrsrv/api/webapi_gamesrv.go @@ -185,5 +185,5 @@ func init() { // //捕鱼渔场保留金币 // admin.MyAdminApp.Route("/api/CoinPool/GameFishsAllCoin", GameSrvWebAPI) // //单控数据 - //admin.MyAdminApp.Route("/api/mongo.games.com/game/SinglePlayerAdjust", GameSrvWebAPI) + //admin.MyAdminApp.Route("/api/game/SinglePlayerAdjust", GameSrvWebAPI) } diff --git a/mgrsrv/api/webapi_worldsrv.go b/mgrsrv/api/webapi_worldsrv.go index 159a929..d231af8 100644 --- a/mgrsrv/api/webapi_worldsrv.go +++ b/mgrsrv/api/webapi_worldsrv.go @@ -195,7 +195,7 @@ func init() { // 在线统计 admin.MyAdminApp.Route("/api/Report/OnlineReportTotal", WorldSrvApi) // 加减金币钻石 - admin.MyAdminApp.Route("/api/mongo.games.com/game/AddCoinByIdAndPT", WorldSrvApi) + admin.MyAdminApp.Route("/api/game/AddCoinByIdAndPT", WorldSrvApi) // 查询玩家信息 admin.MyAdminApp.Route("/api/Player/PlayerData", WorldSrvApi) // 查询多个玩家信息 @@ -210,17 +210,17 @@ func init() { admin.MyAdminApp.Route("/api/Cache/UpdatePlayerElement", WorldSrvApi) // 水池相关 - admin.MyAdminApp.Route("/api/mongo.games.com/game/QueryGamePoolByGameId", WorldSrvApi) - admin.MyAdminApp.Route("/api/mongo.games.com/game/QueryAllGamePool", WorldSrvApi) - admin.MyAdminApp.Route("/api/mongo.games.com/game/RefreshGamePool", WorldSrvApi) - admin.MyAdminApp.Route("/api/mongo.games.com/game/UpdateGamePool", WorldSrvApi) - admin.MyAdminApp.Route("/api/mongo.games.com/game/ResetGamePool", WorldSrvApi) + admin.MyAdminApp.Route("/api/game/QueryGamePoolByGameId", WorldSrvApi) + admin.MyAdminApp.Route("/api/game/QueryAllGamePool", WorldSrvApi) + admin.MyAdminApp.Route("/api/game/RefreshGamePool", WorldSrvApi) + admin.MyAdminApp.Route("/api/game/UpdateGamePool", WorldSrvApi) + admin.MyAdminApp.Route("/api/game/ResetGamePool", WorldSrvApi) // 邮箱相关 - admin.MyAdminApp.Route("/api/mongo.games.com/game/CreateShortMessage", WorldSrvApi) - admin.MyAdminApp.Route("/api/mongo.games.com/game/QueryShortMessageList", WorldSrvApi) - admin.MyAdminApp.Route("/api/mongo.games.com/game/DeleteShortMessage", WorldSrvApi) - admin.MyAdminApp.Route("/api/mongo.games.com/game/DeleteAllShortMessage", WorldSrvApi) + admin.MyAdminApp.Route("/api/game/CreateShortMessage", WorldSrvApi) + admin.MyAdminApp.Route("/api/game/QueryShortMessageList", WorldSrvApi) + admin.MyAdminApp.Route("/api/game/DeleteShortMessage", WorldSrvApi) + admin.MyAdminApp.Route("/api/game/DeleteAllShortMessage", WorldSrvApi) // 获取房间列表 admin.MyAdminApp.Route("/api/Cache/ListRoom", WorldSrvApi) @@ -233,12 +233,12 @@ func init() { // 3方平台 admin.MyAdminApp.Route("/api/thd/UpdatePlayerCoin", WorldSrvApi) // 兑换卷 - admin.MyAdminApp.Route("/api/mongo.games.com/game/CreateJYB", WorldSrvApi) - admin.MyAdminApp.Route("/api/mongo.games.com/game/UpdateJYB", WorldSrvApi) + admin.MyAdminApp.Route("/api/game/CreateJYB", WorldSrvApi) + admin.MyAdminApp.Route("/api/game/UpdateJYB", WorldSrvApi) // 支付回调 admin.MyAdminApp.Route("/api/pay/CallbackPayment", WorldSrvApi) // 资源变更(给所有玩家发送消息) - admin.MyAdminApp.Route("/api/mongo.games.com/game/resource", WorldSrvApi) + admin.MyAdminApp.Route("/api/game/resource", WorldSrvApi) // 修改手机号 admin.MyAdminApp.Route("/api/player/update_tel", WorldSrvApi) // 删除账号 diff --git a/protocol/qpapi/qpapi.pb.go b/protocol/qpapi/qpapi.pb.go index 5fc437a..393f2c5 100644 --- a/protocol/qpapi/qpapi.pb.go +++ b/protocol/qpapi/qpapi.pb.go @@ -82,7 +82,7 @@ func (TagCode) EnumDescriptor() ([]byte, []int) { return file_qpapi_proto_rawDescGZIP(), []int{0} } -//[action] /api/Member/QPAPIRegisterOrLogin +// [action] /api/Member/QPAPIRegisterOrLogin type ASLogin struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -225,8 +225,8 @@ func (x *SALogin) GetSnid() int32 { return 0 } -//加币 -// [action] /api/mongo.games.com/game/QPAPIAddSubCoinById +// 加币 +// [action] /api/game/QPAPIAddSubCoinById type ASAddCoinById struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -433,7 +433,7 @@ func (x *PlayerCoinData) GetBank() int64 { return 0 } -//查用户金币 /api/Member/QPGetMemberGoldById +// 查用户金币 /api/Member/QPGetMemberGoldById type ASMemberGold struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -760,7 +760,7 @@ func (x *PlayerHistoryInfo) GetUserName() string { return "" } -//获取用户注单记录游戏记录 /api/Member/QPGetGameHistory +// 获取用户注单记录游戏记录 /api/Member/QPGetGameHistory type SAPlayerHistory struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/protocol/qpapi/qpapi.proto b/protocol/qpapi/qpapi.proto index 3259c46..fc8b102 100644 --- a/protocol/qpapi/qpapi.proto +++ b/protocol/qpapi/qpapi.proto @@ -28,7 +28,7 @@ message SALogin{ } //加币 -// [action] /api/mongo.games.com/game/QPAPIAddSubCoinById +// [action] /api/game/QPAPIAddSubCoinById message ASAddCoinById{ string Username = 1; //用户名 //保证唯一性 int64 Gold = 2; //加币金额 diff --git a/protocol/telegramapi/telegramapi.pb.go b/protocol/telegramapi/telegramapi.pb.go index 5ae4525..ff5a124 100644 --- a/protocol/telegramapi/telegramapi.pb.go +++ b/protocol/telegramapi/telegramapi.pb.go @@ -82,7 +82,7 @@ func (TagCode) EnumDescriptor() ([]byte, []int) { return file_telegramapi_proto_rawDescGZIP(), []int{0} } -//[action] /api/Member/APIMemberRegisterOrLogin +// [action] /api/Member/APIMemberRegisterOrLogin type ASLogin struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -233,8 +233,8 @@ func (x *SALogin) GetSnid() int32 { return 0 } -//加币 -// [action] /api/mongo.games.com/game/APIAddCoinById +// 加币 +// [action] /api/game/APIAddCoinById type ASAddCoinById struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -481,7 +481,7 @@ func (x *PlayerCoinData) GetBank() int64 { return 0 } -//查用户金币 /api/Member/GetMemberGoldById +// 查用户金币 /api/Member/GetMemberGoldById type ASMemberGold struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -600,7 +600,7 @@ func (x *SAMemberGold) GetData() *PlayerCoinData { return nil } -//校验碰撞游戏Hash /api/mongo.games.com/game/CrashVerifier +// 校验碰撞游戏Hash /api/game/CrashVerifier type ASCrachHash struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -887,7 +887,7 @@ func (x *PlayerHistoryInfo) GetMultiple() int64 { return 0 } -//获取用户注单记录游戏记录 /api/Member/GetGameHistory +// 获取用户注单记录游戏记录 /api/Member/GetGameHistory type SAPlayerHistory struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -959,7 +959,7 @@ func (x *SAPlayerHistory) GetGameHistory() []*GameHistoryInfo { return nil } -//获取用户注单记录游戏记录 /api/Member/GetGameHistory +// 获取用户注单记录游戏记录 /api/Member/GetGameHistory type ASPlayerHistory struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/protocol/telegramapi/telegramapi.proto b/protocol/telegramapi/telegramapi.proto index cbfedfe..87d229f 100644 --- a/protocol/telegramapi/telegramapi.proto +++ b/protocol/telegramapi/telegramapi.proto @@ -29,7 +29,7 @@ message SALogin{ } //加币 -// [action] /api/mongo.games.com/game/APIAddCoinById +// [action] /api/game/APIAddCoinById message ASAddCoinById{ int32 ID = 1;//玩家id int64 Gold = 2;//加币金额 @@ -66,7 +66,7 @@ message SAMemberGold{ PlayerCoinData Data = 3; //用户金币 } -//校验碰撞游戏Hash /api/mongo.games.com/game/CrashVerifier +//校验碰撞游戏Hash /api/game/CrashVerifier message ASCrachHash{ string Hash = 1;//哈希值 int32 Wheel = 2;//第几轮 diff --git a/protocol/webapi/common.pb.go b/protocol/webapi/common.pb.go index 672e9ca..c3ace0e 100644 --- a/protocol/webapi/common.pb.go +++ b/protocol/webapi/common.pb.go @@ -7,9 +7,9 @@ package webapi import ( - "mongo.games.com/game/protocol/server" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + "mongo.games.com/game/protocol/server" reflect "reflect" sync "sync" ) @@ -3206,7 +3206,7 @@ func (x *ExchangeType) GetId() int32 { return 0 } -// etcd /mongo.games.com/game/exchange_shop +// etcd /game/exchange_shop type ExchangeShopList struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -3477,7 +3477,7 @@ func (x *ItemShop) GetFirstSwitch() bool { return false } -// etcd /mongo.games.com/game/item_shop +// etcd /game/item_shop type ItemShopList struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -3900,7 +3900,7 @@ func (x *GameMatchDate) GetOnChannelName() []string { return nil } -// etcd /mongo.games.com/game/game_match +// etcd /game/game_match type GameMatchDateList struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -4129,7 +4129,7 @@ func (x *WelfareTurnplateRate) GetRate() []int32 { return nil } -// etcd /mongo.games.com/game/act_turnplate 转盘 +// etcd /game/act_turnplate 转盘 type WelfareTurnplateDateList struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -4319,7 +4319,7 @@ func (x *Welfare7SignDate) GetAddUpDate() []*AddUpWelfareDate { return nil } -// etcd /mongo.games.com/game/act_7sign 7日签到 +// etcd /game/act_7sign 7日签到 type Welfare7SignDateList struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -4494,7 +4494,7 @@ func (x *BlindBoxData) GetItem_Id() int32 { return 0 } -// etcd /mongo.games.com/game/act_blindbox 盲盒 +// etcd /game/act_blindbox 盲盒 type WelfareBlindBoxDataList struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -4669,7 +4669,7 @@ func (x *WelfareSpree) GetDiscount() float64 { return 0 } -// etcd /mongo.games.com/game/act_FirstPay 首充 +// etcd /game/act_FirstPay 首充 type WelfareFirstPayDataList struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -4741,7 +4741,7 @@ func (x *WelfareFirstPayDataList) GetCycle() int32 { return 0 } -// etcd /mongo.games.com/game/act_ContinuousPay 连续充值 +// etcd /game/act_ContinuousPay 连续充值 type WelfareContinuousPayDataList struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -4988,7 +4988,7 @@ func (x *VIPcfg) GetShopId7() int32 { return 0 } -// etcd /mongo.games.com/game/VIPcfg VIP配置 +// etcd /game/VIPcfg VIP配置 type VIPcfgDataList struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -5559,7 +5559,7 @@ func (x *GameConfig) GetGoodFenCha() int32 { return 0 } -// etcd mongo.games.com/game/act_phoneLottery +// etcd /game/act_phoneLottery type WelfarePhoneLotteryStatus struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -5615,6 +5615,62 @@ func (x *WelfarePhoneLotteryStatus) GetSwitch() int32 { return 0 } +// etcd /game/act_collect +type WelfareCollectConfig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Platform string `protobuf:"bytes,1,opt,name=Platform,proto3" json:"Platform,omitempty"` + Switch int32 `protobuf:"varint,2,opt,name=Switch,proto3" json:"Switch,omitempty"` // 1.开启 2.关闭 +} + +func (x *WelfareCollectConfig) Reset() { + *x = WelfareCollectConfig{} + if protoimpl.UnsafeEnabled { + mi := &file_common_proto_msgTypes[54] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *WelfareCollectConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WelfareCollectConfig) ProtoMessage() {} + +func (x *WelfareCollectConfig) ProtoReflect() protoreflect.Message { + mi := &file_common_proto_msgTypes[54] + 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 WelfareCollectConfig.ProtoReflect.Descriptor instead. +func (*WelfareCollectConfig) Descriptor() ([]byte, []int) { + return file_common_proto_rawDescGZIP(), []int{54} +} + +func (x *WelfareCollectConfig) GetPlatform() string { + if x != nil { + return x.Platform + } + return "" +} + +func (x *WelfareCollectConfig) GetSwitch() int32 { + if x != nil { + return x.Switch + } + return 0 +} + var File_common_proto protoreflect.FileDescriptor var file_common_proto_rawDesc = []byte{ @@ -6517,8 +6573,12 @@ var file_common_proto_rawDesc = []byte{ 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, - 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x3b, 0x77, 0x65, 0x62, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x22, 0x4a, 0x0a, 0x14, 0x57, 0x65, 0x6c, 0x66, 0x61, 0x72, 0x65, 0x43, 0x6f, 0x6c, 0x6c, 0x65, + 0x63, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x74, + 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x50, 0x6c, 0x61, 0x74, + 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x42, 0x0a, 0x5a, 0x08, + 0x2e, 0x3b, 0x77, 0x65, 0x62, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -6533,7 +6593,7 @@ func file_common_proto_rawDescGZIP() []byte { return file_common_proto_rawDescData } -var file_common_proto_msgTypes = make([]protoimpl.MessageInfo, 59) +var file_common_proto_msgTypes = make([]protoimpl.MessageInfo, 60) var file_common_proto_goTypes = []interface{}{ (*MysqlDbSetting)(nil), // 0: pb.MysqlDbSetting (*MongoDbSetting)(nil), // 1: pb.MongoDbSetting @@ -6589,31 +6649,32 @@ var file_common_proto_goTypes = []interface{}{ (*PlayerPool)(nil), // 51: pb.PlayerPool (*GameConfig)(nil), // 52: pb.GameConfig (*WelfarePhoneLotteryStatus)(nil), // 53: pb.WelfarePhoneLotteryStatus - nil, // 54: pb.Platform.BindTelRewardEntry - nil, // 55: pb.PlayerData.RankScoreEntry - nil, // 56: pb.ItemShop.AwardEntry - nil, // 57: pb.VIPcfg.AwardEntry - nil, // 58: pb.VIPcfg.Privilege7Entry - (*server.DB_GameFree)(nil), // 59: pbdata.DB_GameFree + (*WelfareCollectConfig)(nil), // 54: pb.WelfareCollectConfig + nil, // 55: pb.Platform.BindTelRewardEntry + nil, // 56: pb.PlayerData.RankScoreEntry + nil, // 57: pb.ItemShop.AwardEntry + nil, // 58: pb.VIPcfg.AwardEntry + nil, // 59: pb.VIPcfg.Privilege7Entry + (*server.DB_GameFree)(nil), // 60: pbdata.DB_GameFree } var file_common_proto_depIdxs = []int32{ 2, // 0: pb.Platform.Leaderboard:type_name -> pb.RankSwitch 3, // 1: pb.Platform.ClubConfig:type_name -> pb.ClubConfig 4, // 2: pb.Platform.ThirdGameMerchant:type_name -> pb.ThirdGame - 54, // 3: pb.Platform.BindTelReward:type_name -> pb.Platform.BindTelRewardEntry + 55, // 3: pb.Platform.BindTelReward:type_name -> pb.Platform.BindTelRewardEntry 6, // 4: pb.GameConfigGlobal.GameStatus:type_name -> pb.GameStatus - 59, // 5: pb.GameFree.DbGameFree:type_name -> pbdata.DB_GameFree + 60, // 5: pb.GameFree.DbGameFree:type_name -> pbdata.DB_GameFree 8, // 6: pb.PlatformGameConfig.DbGameFrees:type_name -> pb.GameFree 0, // 7: pb.PlatformDbConfig.Mysql:type_name -> pb.MysqlDbSetting 1, // 8: pb.PlatformDbConfig.MongoDb:type_name -> pb.MongoDbSetting 1, // 9: pb.PlatformDbConfig.MongoDbLog:type_name -> pb.MongoDbSetting - 59, // 10: pb.GameConfigGroup.DbGameFree:type_name -> pbdata.DB_GameFree - 55, // 11: pb.PlayerData.RankScore:type_name -> pb.PlayerData.RankScoreEntry + 60, // 10: pb.GameConfigGroup.DbGameFree:type_name -> pbdata.DB_GameFree + 56, // 11: pb.PlayerData.RankScore:type_name -> pb.PlayerData.RankScoreEntry 20, // 12: pb.OnlineReport.GameCount:type_name -> pb.OnlineGameCnt 22, // 13: pb.CommonNoticeList.List:type_name -> pb.CommonNotice 25, // 14: pb.ExchangeShop.ExType:type_name -> pb.ExchangeType 24, // 15: pb.ExchangeShopList.List:type_name -> pb.ExchangeShop - 56, // 16: pb.ItemShop.Award:type_name -> pb.ItemShop.AwardEntry + 57, // 16: pb.ItemShop.Award:type_name -> pb.ItemShop.AwardEntry 27, // 17: pb.ItemShopList.List:type_name -> pb.ItemShop 29, // 18: pb.MatchInfoAward.ItemId:type_name -> pb.ItemInfo 30, // 19: pb.GameMatchDate.Award:type_name -> pb.MatchInfoAward @@ -6630,8 +6691,8 @@ var file_common_proto_depIdxs = []int32{ 33, // 30: pb.WelfareSpree.Item:type_name -> pb.WelfareDate 42, // 31: pb.WelfareFirstPayDataList.List:type_name -> pb.WelfareSpree 42, // 32: pb.WelfareContinuousPayDataList.List:type_name -> pb.WelfareSpree - 57, // 33: pb.VIPcfg.Award:type_name -> pb.VIPcfg.AwardEntry - 58, // 34: pb.VIPcfg.Privilege7:type_name -> pb.VIPcfg.Privilege7Entry + 58, // 33: pb.VIPcfg.Award:type_name -> pb.VIPcfg.AwardEntry + 59, // 34: pb.VIPcfg.Privilege7:type_name -> pb.VIPcfg.Privilege7Entry 45, // 35: pb.VIPcfgDataList.List:type_name -> pb.VIPcfg 33, // 36: pb.ChessRankConfig.Item:type_name -> pb.WelfareDate 49, // 37: pb.ChessRankcfgData.Datas:type_name -> pb.ChessRankConfig @@ -7297,6 +7358,18 @@ func file_common_proto_init() { return nil } } + file_common_proto_msgTypes[54].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WelfareCollectConfig); 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{ @@ -7304,7 +7377,7 @@ func file_common_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_common_proto_rawDesc, NumEnums: 0, - NumMessages: 59, + NumMessages: 60, NumExtensions: 0, NumServices: 0, }, diff --git a/protocol/webapi/common.proto b/protocol/webapi/common.proto index edeaacf..f1f79d1 100644 --- a/protocol/webapi/common.proto +++ b/protocol/webapi/common.proto @@ -362,7 +362,7 @@ message ExchangeType{ int32 Id = 4; //行数 } -// etcd /mongo.games.com/game/exchange_shop +// etcd /game/exchange_shop message ExchangeShopList{ repeated ExchangeShop List = 1; string Platform = 2; @@ -393,7 +393,7 @@ message ItemShop { bool FirstSwitch = 22; //首冲翻倍开关 } -// etcd /mongo.games.com/game/item_shop +// etcd /game/item_shop message ItemShopList{ repeated ItemShop List = 1; string Platform = 2; @@ -441,7 +441,7 @@ message GameMatchDate { repeated string OnChannelName = 23; // 开启的渠道名称 } -// etcd /mongo.games.com/game/game_match +// etcd /game/game_match message GameMatchDateList{ repeated GameMatchDate List = 1; string Platform = 2; @@ -464,7 +464,7 @@ message WelfareTurnplateRate { repeated int32 Rate = 1; // 转盘概率 } -// etcd /mongo.games.com/game/act_turnplate 转盘 +// etcd /game/act_turnplate 转盘 message WelfareTurnplateDateList{ repeated WelfareTurnplateDate List = 1; // 转盘奖励 repeated WelfareTurnplateRate RateList = 2; // 转盘概率 @@ -484,7 +484,7 @@ message Welfare7SignDate { } -// etcd /mongo.games.com/game/act_7sign 7日签到 +// etcd /game/act_7sign 7日签到 message Welfare7SignDateList{ repeated Welfare7SignDate List = 1; // 七日签到 string Platform = 2; @@ -503,7 +503,7 @@ message BlindBoxData { int32 Item_Id = 9; // 道具id } -// etcd /mongo.games.com/game/act_blindbox 盲盒 +// etcd /game/act_blindbox 盲盒 message WelfareBlindBoxDataList{ repeated BlindBoxData List = 1; // 盲盒 string Platform = 2; @@ -522,7 +522,7 @@ message WelfareSpree { double Discount = 8; // 折扣 } -// etcd /mongo.games.com/game/act_FirstPay 首充 +// etcd /game/act_FirstPay 首充 message WelfareFirstPayDataList{ repeated WelfareSpree List = 1; string Platform = 2; @@ -530,7 +530,7 @@ message WelfareFirstPayDataList{ int32 Cycle = 4; // 循环 1.开启 2.关闭 } -// etcd /mongo.games.com/game/act_ContinuousPay 连续充值 +// etcd /game/act_ContinuousPay 连续充值 message WelfareContinuousPayDataList{ repeated WelfareSpree List = 1; // 连续充值 string Platform = 2; @@ -558,7 +558,7 @@ message VIPcfg { int32 ShopId7 = 16; } -// etcd /mongo.games.com/game/VIPcfg VIP配置 +// etcd /game/VIPcfg VIP配置 message VIPcfgDataList{ repeated VIPcfg List = 1; // VIP配置 string Platform = 2; @@ -618,8 +618,14 @@ message GameConfig { int32 GoodFenCha = 7; // 好牌分差值 } -// etcd mongo.games.com/game/act_phoneLottery +// etcd /game/act_phoneLottery message WelfarePhoneLotteryStatus{ string Platform = 1; int32 Switch = 2; // 1.开启 2.关闭 +} + +// etcd /game/act_collect +message WelfareCollectConfig{ + string Platform = 1; + int32 Switch = 2; // 1.开启 2.关闭 } \ No newline at end of file diff --git a/protocol/webapi/webapi.pb.go b/protocol/webapi/webapi.pb.go index c3fa74b..738fd3d 100644 --- a/protocol/webapi/webapi.pb.go +++ b/protocol/webapi/webapi.pb.go @@ -1000,7 +1000,7 @@ func (x *SAUpdateGameConfigGroup) GetMsg() string { // ///////////////////////////////////////////////////////////////////////////////////// // 加币 -// [action] /api/mongo.games.com/game/AddCoinById +// [action] /api/game/AddCoinById type ASAddCoinById struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1185,7 +1185,7 @@ func (x *SAAddCoinById) GetMsg() string { } // 重置水池 -// [action] /api/mongo.games.com/game/ResetGamePool +// [action] /api/game/ResetGamePool type ASResetGamePool struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1329,7 +1329,7 @@ func (x *SAResetGamePool) GetMsg() string { } // 更新水池 -// [action] /api/mongo.games.com/game/UpdateGamePool +// [action] /api/game/UpdateGamePool type ASUpdateGamePool struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1492,7 +1492,7 @@ func (x *SAUpdateGamePool) GetMsg() string { // ResetTime // ////////////////////////////////////////////////// // 查询水池gameid -// [action] /api/mongo.games.com/game/QueryGamePoolByGameId +// [action] /api/game/QueryGamePoolByGameId type ASQueryGamePoolByGameId struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1628,7 +1628,7 @@ func (x *SAQueryGamePoolByGameId) GetCoinPoolSetting() []*CoinPoolSetting { } // 查询水池 -// [action] /api/mongo.games.com/game/QueryAllGamePool +// [action] /api/game/QueryAllGamePool type ASQueryAllGamePool struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -2258,7 +2258,7 @@ func (x *SADestroyRoom) GetMsg() string { } // 单控 -// [action] /api/mongo.games.com/game/SinglePlayerAdjust +// [action] /api/game/SinglePlayerAdjust // PACKET_WG_SINGLEADJUST type ASSinglePlayerAdjust struct { state protoimpl.MessageState @@ -3861,7 +3861,7 @@ func (x *SABlackBySnId) GetMsg() string { } // 邮件 -// [action] /api/mongo.games.com/game/CreateShortMessage +// [action] /api/game/CreateShortMessage type ASCreateShortMessage struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -4036,7 +4036,7 @@ func (x *SACreateShortMessage) GetMsg() string { return "" } -// [action] /api/mongo.games.com/game/QueryShortMessageList +// [action] /api/game/QueryShortMessageList type ASQueryShortMessageList struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -4203,7 +4203,7 @@ func (x *SAQueryShortMessageList) GetMessageInfo() []*MessageInfo { return nil } -// [action] /api/mongo.games.com/game/DeleteShortMessage +// [action] /api/game/DeleteShortMessage type ASDeleteShortMessage struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -5290,7 +5290,7 @@ func (x *SAOnlineReportTotal) GetOnlineReport() *OnlineReport { // ///////////////////////////////////////////////////////////////////////////////////// // 加币 -// [action] /api/mongo.games.com/game/AddCoinByIdAndPT +// [action] /api/game/AddCoinByIdAndPT type ASAddCoinByIdAndPT struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -5522,7 +5522,7 @@ func (x *JybInfoAward) GetDiamond() int64 { } // 生成兑换码 -// [action] /api/mongo.games.com/game/CreateJYB +// [action] /api/game/CreateJYB type ASCreateJYB struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -5707,7 +5707,7 @@ func (x *SACreateJYB) GetMsg() string { } // 操作兑换码 删除 修改 -// [action] /api/mongo.games.com/game/UpdateJYB +// [action] /api/game/UpdateJYB type ASUpdateJYB struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -7618,7 +7618,7 @@ func (x *SACallbackPayment) GetMsg() string { return "" } -// 资源更新通知 [/api/mongo.games.com/game/resource] +// 资源更新通知 [/api/game/resource] type ASResource struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/protocol/webapi/webapi.proto b/protocol/webapi/webapi.proto index 39a1476..fef2255 100644 --- a/protocol/webapi/webapi.proto +++ b/protocol/webapi/webapi.proto @@ -163,7 +163,7 @@ message SAUpdateGameConfigGroup { } /////////////////////////////////////////////////////////////////////////////////////// //加币 -// [action] /api/mongo.games.com/game/AddCoinById +// [action] /api/game/AddCoinById message ASAddCoinById{ int32 ID = 1;//玩家id int64 Gold = 2;//加币金额 @@ -183,7 +183,7 @@ message SAAddCoinById { string Msg = 2; //错误信息(选填) } //重置水池 -// [action] /api/mongo.games.com/game/ResetGamePool +// [action] /api/game/ResetGamePool message ASResetGamePool{ int32 GameFreeId = 1; string Platform = 2; @@ -197,7 +197,7 @@ message SAResetGamePool{ string Msg = 2; //错误信息(选填) } //更新水池 -// [action] /api/mongo.games.com/game/UpdateGamePool +// [action] /api/game/UpdateGamePool message ASUpdateGamePool{ int32 GameFreeId = 1; string Platform = 2; @@ -237,7 +237,7 @@ message SAUpdateGamePool{ //ResetTime //////////////////////////////////////////////////// //查询水池gameid -// [action] /api/mongo.games.com/game/QueryGamePoolByGameId +// [action] /api/game/QueryGamePoolByGameId message ASQueryGamePoolByGameId{ int32 GameId = 1; int32 GameMode = 2; @@ -250,7 +250,7 @@ message SAQueryGamePoolByGameId{ repeated pb.CoinPoolSetting CoinPoolSetting = 3; } //查询水池 -// [action] /api/mongo.games.com/game/QueryAllGamePool +// [action] /api/game/QueryAllGamePool message ASQueryAllGamePool{ int32 PageNo = 1; int32 PageSize = 2; @@ -309,7 +309,7 @@ message SADestroyRoom{ string Msg = 2; //错误信息(选填) } //单控 -// [action] /api/mongo.games.com/game/SinglePlayerAdjust +// [action] /api/game/SinglePlayerAdjust //PACKET_WG_SINGLEADJUST message ASSinglePlayerAdjust{ int32 Opration = 1;//1.add 2.edit 3.del 4.查询最新的 @@ -455,7 +455,7 @@ message SABlackBySnId{ string Msg = 2; //错误信息(选填) } //邮件 -// [action] /api/mongo.games.com/game/CreateShortMessage +// [action] /api/game/CreateShortMessage message ASCreateShortMessage{ string NoticeTitle = 1; string NoticeContent = 2; @@ -472,7 +472,7 @@ message SACreateShortMessage{ TagCode Tag = 1; //错误码 string Msg = 2; //错误信息(选填) } -// [action] /api/mongo.games.com/game/QueryShortMessageList +// [action] /api/game/QueryShortMessageList message ASQueryShortMessageList{ int64 StartTime = 1; int64 EndTime = 2; @@ -488,7 +488,7 @@ message SAQueryShortMessageList{ int32 Count = 3; repeated pb.MessageInfo MessageInfo = 4; } -// [action] /api/mongo.games.com/game/DeleteShortMessage +// [action] /api/game/DeleteShortMessage message ASDeleteShortMessage{ string Id = 1; string Platform = 2; @@ -589,7 +589,7 @@ message SAOnlineReportTotal{ } /////////////////////////////////////////////////////////////////////////////////////// //加币 -// [action] /api/mongo.games.com/game/AddCoinByIdAndPT +// [action] /api/game/AddCoinByIdAndPT message ASAddCoinByIdAndPT{ int32 ID = 1;//玩家id string Platform = 2;//平台号 @@ -615,7 +615,7 @@ message JybInfoAward { } //生成兑换码 -// [action] /api/mongo.games.com/game/CreateJYB +// [action] /api/game/CreateJYB message ASCreateJYB { string Platform = 1; // 平台 string Name = 2; // 礼包名称 @@ -636,7 +636,7 @@ message SACreateJYB { } //操作兑换码 删除 修改 -// [action] /api/mongo.games.com/game/UpdateJYB +// [action] /api/game/UpdateJYB message ASUpdateJYB { string Platform = 1; // 平台 string JYBID = 2; // 礼包ID @@ -824,7 +824,7 @@ message SACallbackPayment{ string Msg = 2; //错误信息(选填) } -//资源更新通知 [/api/mongo.games.com/game/resource] +//资源更新通知 [/api/game/resource] message ASResource{ string Msg = 1; //信息 } diff --git a/worldsrv/config-local.json b/worldsrv/config-local.json index be3d4b9..774af20 100644 --- a/worldsrv/config-local.json +++ b/worldsrv/config-local.json @@ -116,7 +116,7 @@ "IsDevMode":true }, "costum":{ - "PromotersUrl":"http://192.168.0.65/jxjy/tg/mongo.games.com/game/push_order", + "PromotersUrl":"http://192.168.0.65/jxjy/tg/game/push_order", "etcdurl":["127.0.0.1:2379"], "etcduser":"root", "etcdpwd":"win88", diff --git a/worldsrv/config_18.json b/worldsrv/config_18.json index f2cc7e7..faf98e5 100644 --- a/worldsrv/config_18.json +++ b/worldsrv/config_18.json @@ -116,7 +116,7 @@ "IsDevMode":true }, "costum":{ - "PromotersUrl":"http://192.168.0.65/jxjy/tg/mongo.games.com/game/push_order", + "PromotersUrl":"http://192.168.0.65/jxjy/tg/game/push_order", "etcdurl":["192.168.31.18:2379"], "etcduser":"root", "etcdpwd":"win88", diff --git a/worldsrv/etcd.go b/worldsrv/etcd.go index a95b531..09a7c37 100644 --- a/worldsrv/etcd.go +++ b/worldsrv/etcd.go @@ -12,29 +12,37 @@ func init() { // 个人水池配置 etcd.Register(etcd.ETCDKEY_PLAYERPOOL, webapi.PlayerPool{}, PlatformConfigEtcd) // 商品兑换 - etcd.Register(etcd.ETCDKEY_SHOP_EXCHANGE, webapi.ExchangeShopList{}, func(completeKey string, isInit bool, event *clientv3.Event, data interface{}) { - if event.Type == clientv3.EventTypeDelete { - return - } - config, ok := data.(*webapi.ExchangeShopList) - if !ok { - logger.Logger.Errorf("etcd completeKey:%s, data type error", completeKey) - return - } - ShopMgrSington.UpExShop(config) - }) + etcd.Register(etcd.ETCDKEY_SHOP_EXCHANGE, webapi.ExchangeShopList{}, ExchangeShopList) // 商城商品 - etcd.Register(etcd.ETCDKEY_SHOP_ITEM, webapi.ItemShopList{}, func(completeKey string, isInit bool, event *clientv3.Event, data interface{}) { - if event.Type == clientv3.EventTypeDelete { - return - } - config, ok := data.(*webapi.ItemShopList) - if !ok { - logger.Logger.Errorf("etcd completeKey:%s, data type error", completeKey) - return - } - ShopMgrSington.UpdateItemShop(config) - }) + etcd.Register(etcd.ETCDKEY_SHOP_ITEM, webapi.ItemShopList{}, ItemShopList) + // 集卡活动 + etcd.Register(etcd.ETCDKEY_ACT_Collect, webapi.WelfareCollectConfig{}, WelfareCollectConfig) +} + +//func ExchangeShopList(completeKey string, isInit bool, event *clientv3.Event, data interface{}) {} + +func WelfareCollectConfig(completeKey string, isInit bool, event *clientv3.Event, data interface{}) { + if event.Type == clientv3.EventTypeDelete { + return + } + config, ok := data.(*webapi.WelfareCollectConfig) + if !ok { + logger.Logger.Errorf("etcd completeKey:%s, data type error", completeKey) + return + } + WelfareMgrSington.UpdateCollectConfig(config) +} + +func ItemShopList(completeKey string, isInit bool, event *clientv3.Event, data interface{}) { + if event.Type == clientv3.EventTypeDelete { + return + } + config, ok := data.(*webapi.ItemShopList) + if !ok { + logger.Logger.Errorf("etcd completeKey:%s, data type error", completeKey) + return + } + ShopMgrSington.UpdateItemShop(config) } func PlatformConfigEtcd(completeKey string, isInit bool, event *clientv3.Event, data interface{}) { @@ -43,3 +51,15 @@ func PlatformConfigEtcd(completeKey string, isInit bool, event *clientv3.Event, } PlatformMgrSingleton.UpdateConfig(data) } + +func ExchangeShopList(completeKey string, isInit bool, event *clientv3.Event, data interface{}) { + if event.Type == clientv3.EventTypeDelete { + return + } + config, ok := data.(*webapi.ExchangeShopList) + if !ok { + logger.Logger.Errorf("etcd completeKey:%s, data type error", completeKey) + return + } + ShopMgrSington.UpExShop(config) +} diff --git a/worldsrv/etcdmgr.go b/worldsrv/etcdmgr.go index 445de97..6827742 100644 --- a/worldsrv/etcdmgr.go +++ b/worldsrv/etcdmgr.go @@ -276,7 +276,7 @@ func (this *EtcdMgr) InitPlatformPackage() { //} //if value.AppStore != 1 { // uptCnt := PlayerMgrSington.UpdateAllPlayerPackageTag(value.Tag, strPlatorm, strChannel, strPromoter, int32(value.PromoterTree), value.TagKey) - // logger.Logger.Infof("/api/mongo.games.com/game/UpsertPackageTag update(tag:%v, platform:%v, channel:%v, promoter:%v), updated cnt=%v", value.Tag, strPlatorm, strChannel, strPromoter, uptCnt) + // logger.Logger.Infof("/api/game/UpsertPackageTag update(tag:%v, platform:%v, channel:%v, promoter:%v), updated cnt=%v", value.Tag, strPlatorm, strChannel, strPromoter, uptCnt) // task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { // return model.UpdateAllPlayerPackageTag(value.Tag, strPlatorm, strChannel, strPromoter, int32(value.PromoterTree), value.TagKey) // }), nil, "UpdateAllPlayerPackageTag").Start() diff --git a/worldsrv/trascate_webapi.go b/worldsrv/trascate_webapi.go index 4811acc..a3ecad9 100644 --- a/worldsrv/trascate_webapi.go +++ b/worldsrv/trascate_webapi.go @@ -290,7 +290,7 @@ func init() { // })) //API用户加减币 - //WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/mongo.games.com/game/APIAddSubCoinById", WebAPIHandlerWrapper( + //WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/game/APIAddSubCoinById", WebAPIHandlerWrapper( // func(tNode *transact.TransNode, params []byte) (int, proto.Message) { // pack := &webapi.SAAddCoinById{} // msg := &webapi.ASAddCoinById{} @@ -787,7 +787,7 @@ func init() { // })) //API用户加减币 - WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/mongo.games.com/game/QPAPIAddSubCoinById", WebAPIHandlerWrapper( + WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/game/QPAPIAddSubCoinById", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { pack := &qpapi.SAAddCoinById{} msg := &qpapi.ASAddCoinById{} @@ -1390,9 +1390,9 @@ func init() { })) //Cresh游戏Hash校验 - WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/mongo.games.com/game/CrashVerifier", WebAPIHandlerWrapper( + WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/game/CrashVerifier", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { - logger.Logger.Trace("WebAPIHandler:/api/mongo.games.com/game/CrashVerifier", params) + logger.Logger.Trace("WebAPIHandler:/api/game/CrashVerifier", params) resp := &webapi.SACrachHash{} msg := &webapi.ASCrachHash{} err := proto.Unmarshal(params, msg) @@ -1610,7 +1610,7 @@ func init() { //---------------------------------------------------------------------------------------------------------- //加币加钻石 - WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/mongo.games.com/game/AddCoinByIdAndPT", WebAPIHandlerWrapper( + WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/game/AddCoinByIdAndPT", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { pack := &webapi_proto.SAAddCoinByIdAndPT{} msg := &webapi_proto.ASAddCoinByIdAndPT{} @@ -1794,7 +1794,7 @@ func init() { // //------------------------------------------------------------------------------------------------------- // //钱包操作接口 - WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/mongo.games.com/game/AddCoinById", WebAPIHandlerWrapper( + WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/game/AddCoinById", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { pack := &webapi_proto.SAAddCoinById{} msg := &webapi_proto.ASAddCoinById{} @@ -2062,7 +2062,7 @@ func init() { } })) //重置水池 - WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/mongo.games.com/game/ResetGamePool", WebAPIHandlerWrapper( + WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/game/ResetGamePool", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { pack := &webapi_proto.SAResetGamePool{} msg := &webapi_proto.ASResetGamePool{} @@ -2100,7 +2100,7 @@ func init() { })) // 水池开关 - //WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/mongo.games.com/game/GamePoolSwitch", WebAPIHandlerWrapper( + //WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/game/GamePoolSwitch", WebAPIHandlerWrapper( // func(tNode *transact.TransNode, params []byte) (int, proto.Message) { // pack := &webapi_proto.SAGamePoolSwitch{} // msg := &webapi_proto.ASGamePoolSwitch{} @@ -2137,7 +2137,7 @@ func init() { //更新水池 // 修改本地缓存,修改数据库,同步到gamesrv - WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/mongo.games.com/game/UpdateGamePool", WebAPIHandlerWrapper( + WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/game/UpdateGamePool", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { pack := &webapi_proto.SAUpdateGamePool{} msg := &webapi_proto.ASUpdateGamePool{} @@ -2211,7 +2211,7 @@ func init() { })) //查询水池gameid - WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/mongo.games.com/game/QueryGamePoolByGameId", WebAPIHandlerWrapper( + WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/game/QueryGamePoolByGameId", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { pack := &webapi_proto.SAQueryGamePoolByGameId{} msg := &webapi_proto.ASQueryGamePoolByGameId{} @@ -2226,7 +2226,7 @@ func init() { })) //查询水池 - //WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/mongo.games.com/game/QueryAllGamePool", WebAPIHandlerWrapper( + //WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/game/QueryAllGamePool", WebAPIHandlerWrapper( // func(tNode *transact.TransNode, params []byte) (int, proto.Message) { // pack := &webapi_proto.SAQueryAllGamePool{} // msg := &webapi_proto.ASQueryAllGamePool{} @@ -3188,7 +3188,7 @@ func init() { return common.ResponseTag_Ok, pack })) //邮件 - WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/mongo.games.com/game/CreateShortMessage", WebAPIHandlerWrapper( + WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/game/CreateShortMessage", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { pack := &webapi_proto.SACreateShortMessage{} msg := &webapi_proto.ASCreateShortMessage{} @@ -3250,7 +3250,7 @@ func init() { err := model.InsertMessage(platform, newMsg) if err != nil { code = login_proto.OpResultCode_OPRC_Error - logger.Logger.Errorf("/api/mongo.games.com/game/CreateShortMessage,InsertMessage err:%v title:%v content:%v platform:%v srcSnid:%v destSnid:%v messageType:%v ", err, title, content, platform, srcSnid, destSnid, messageType) + logger.Logger.Errorf("/api/game/CreateShortMessage,InsertMessage err:%v title:%v content:%v platform:%v srcSnid:%v destSnid:%v messageType:%v ", err, title, content, platform, srcSnid, destSnid, messageType) return code } } @@ -3266,7 +3266,7 @@ func init() { if len(dbMsgs) > 0 { err := model.InsertMessage(platform, dbMsgs...) if err != nil { - logger.Logger.Errorf("/api/mongo.games.com/game/CreateShortMessage,InsertMessage err:%v title:%v content:%v platform:%v srcSnid:%v destSnid:%v messageType:%v ", err, title, content, platform, srcSnid, destSnid, messageType) + logger.Logger.Errorf("/api/game/CreateShortMessage,InsertMessage err:%v title:%v content:%v platform:%v srcSnid:%v destSnid:%v messageType:%v ", err, title, content, platform, srcSnid, destSnid, messageType) } } } @@ -3318,7 +3318,7 @@ func init() { return common.ResponseTag_TransactYield, pack })) //查询邮件 - WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/mongo.games.com/game/QueryShortMessageList", WebAPIHandlerWrapper( + WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/game/QueryShortMessageList", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { pack := &webapi_proto.SAQueryShortMessageList{} msg := &webapi_proto.ASQueryShortMessageList{} @@ -3390,7 +3390,7 @@ func init() { return common.ResponseTag_TransactYield, pack })) //删除邮件 - WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/mongo.games.com/game/DeleteShortMessage", WebAPIHandlerWrapper( + WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/game/DeleteShortMessage", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { pack := &webapi_proto.SADeleteShortMessage{} msg := &webapi_proto.ASDeleteShortMessage{} @@ -3452,7 +3452,7 @@ func init() { return common.ResponseTag_TransactYield, pack })) //删除玩家已经删除的邮件 - WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/mongo.games.com/game/DeleteAllShortMessage", WebAPIHandlerWrapper( + WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/game/DeleteAllShortMessage", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { pack := &webapi_proto.SADeleteShortMessage{} msg := &webapi_proto.ASDeleteShortMessage{} @@ -3812,7 +3812,7 @@ func init() { pack.Msg = "Etcd Reset success" return common.ResponseTag_Ok, nil })) - //WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/mongo.games.com/game/SinglePlayerAdjust", WebAPIHandlerWrapper( + //WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/game/SinglePlayerAdjust", WebAPIHandlerWrapper( // func(tNode *transact.TransNode, params []byte) (int, proto.Message) { // pack := &webapi_proto.SASinglePlayerAdjust{} // msg := &webapi_proto.ASSinglePlayerAdjust{} @@ -3858,7 +3858,7 @@ func init() { // return common.ResponseTag_Ok, pack // })) // CreateJYB 创建礼包码 - WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/mongo.games.com/game/CreateJYB", WebAPIHandlerWrapper( + WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/game/CreateJYB", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { pack := &webapi_proto.SACreateJYB{} msg := &webapi_proto.ASCreateJYB{} @@ -3926,7 +3926,7 @@ func init() { }), "webCreateJybInfo").Start() return common.ResponseTag_TransactYield, pack })) - WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/mongo.games.com/game/UpdateJYB", WebAPIHandlerWrapper( + WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/game/UpdateJYB", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { pack := &webapi_proto.SAUpdateJYB{} msg := &webapi_proto.ASUpdateJYB{} @@ -4354,7 +4354,7 @@ func init() { })) //======= 资源更新通知 ======= - WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/mongo.games.com/game/resource", WebAPIHandlerWrapper( + WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/game/resource", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { pack := &webapi_proto.SAResource{} msg := &webapi_proto.ASResource{} diff --git a/worldsrv/welfmgr.go b/worldsrv/welfmgr.go index f9b7a53..9cc7477 100644 --- a/worldsrv/welfmgr.go +++ b/worldsrv/welfmgr.go @@ -2,18 +2,19 @@ package main import ( "fmt" - "mongo.games.com/game/protocol/shop" "time" + "mongo.games.com/goserver/core/logger" + "mongo.games.com/goserver/core/module" + "mongo.games.com/game/common" "mongo.games.com/game/model" hall_proto "mongo.games.com/game/protocol/gamehall" player_proto "mongo.games.com/game/protocol/player" + "mongo.games.com/game/protocol/shop" webapi_proto "mongo.games.com/game/protocol/webapi" "mongo.games.com/game/protocol/welfare" "mongo.games.com/game/srvdata" - "mongo.games.com/goserver/core/logger" - "mongo.games.com/goserver/core/module" ) const ( @@ -23,6 +24,7 @@ const ( OpFirstPay = 3 OpContinuousPay = 4 OpPhoneLottery = 5 + OpCollect = 6 ) const ( @@ -36,51 +38,64 @@ const ( ) var WelfareMgrSington = &WelfareMgr{ - Sign7: make(map[string]*webapi_proto.Welfare7SignDateList), - Turnplate: make(map[string]*webapi_proto.WelfareTurnplateDateList), - BlindBox: make(map[string]*webapi_proto.WelfareBlindBoxDataList), - BlindBoxCycle: make(map[string]int32), - FirstPay: make(map[string]*webapi_proto.WelfareFirstPayDataList), - FirstPayCycle: make(map[string]int32), - ContinuousPay: make(map[string]*webapi_proto.WelfareContinuousPayDataList), - ContinuousPayCycle: make(map[string]int32), - PhoneLotteryStatus: make(map[string]*webapi_proto.WelfarePhoneLotteryStatus), + Activity: make(map[string]*ActivityInfos), +} + +type ActivityInfos struct { + *webapi_proto.Welfare7SignDateList + *webapi_proto.WelfareTurnplateDateList + *webapi_proto.WelfareBlindBoxDataList + *webapi_proto.WelfareFirstPayDataList + *webapi_proto.WelfareContinuousPayDataList + *webapi_proto.WelfarePhoneLotteryStatus + *webapi_proto.WelfareCollectConfig + BlindBoxCycle int32 + FirstPayCycle int32 + ContinuousPayCycle int32 } type WelfareMgr struct { BaseClockSinker - Sign7 map[string]*webapi_proto.Welfare7SignDateList - Turnplate map[string]*webapi_proto.WelfareTurnplateDateList - BlindBox map[string]*webapi_proto.WelfareBlindBoxDataList - BlindBoxCycle map[string]int32 - FirstPay map[string]*webapi_proto.WelfareFirstPayDataList - FirstPayCycle map[string]int32 - ContinuousPay map[string]*webapi_proto.WelfareContinuousPayDataList - ContinuousPayCycle map[string]int32 - PhoneLotteryStatus map[string]*webapi_proto.WelfarePhoneLotteryStatus + Activity map[string]*ActivityInfos +} + +func (this *WelfareMgr) Init() { + EtcdMgrSington.InitSign7() + EtcdMgrSington.InitTurnplate() + EtcdMgrSington.InitBlindBox() + EtcdMgrSington.InitFirstPay() + EtcdMgrSington.InitContinuousPay() + EtcdMgrSington.InitPhoneLottery() } func (this *WelfareMgr) ModuleName() string { return "WelfareMgr" } -// 设置 rnums 救济金领取次数 -func (this *WelfareMgr) SetWelfData(p *Player, rnums int32) { - // this.MonitorWelfData(p) - if rnums > 0 { - p.WelfData.ReliefFundTimes += rnums +func (this *WelfareMgr) getConfig(plt string) *ActivityInfos { + info, ok := this.Activity[plt] + if !ok { + info = new(ActivityInfos) + this.Activity[plt] = info + } + return info +} + +// SetWelfData 设置救济金领取次数 +func (this *WelfareMgr) SetWelfData(p *Player, n int32) { + if n > 0 { + p.WelfData.ReliefFundTimes += n } p.dirty = true } +// GetReliefFund 获取救济金 func (this *WelfareMgr) GetReliefFund(p *Player, isVideo bool) { sdata := srvdata.PBDB_GameSubsidyMgr.GetData(GameSubsidyid) - // this.MonitorWelfData(p) pack := &welfare.SCGetReliefFund{ OpRetCode: welfare.OpResultCode_OPRC_Error, } if sdata != nil { - if p.WelfData.ReliefFundTimes >= sdata.Times { pack.OpRetCode = welfare.OpResultCode_OPRC_NoTimes @@ -141,137 +156,147 @@ func (this *WelfareMgr) GetReliefFund(p *Player, isVideo bool) { p.SendToClient(int(welfare.SPacketID_PACKET_SC_WELF_GETRELIEFFUND), pack) } -func (this *WelfareMgr) Init() { - if !model.GameParamData.UseEtcd { - // 后台说现在没有不走ETCD情况~ - } else { - - EtcdMgrSington.InitSign7() - - EtcdMgrSington.InitTurnplate() - - EtcdMgrSington.InitBlindBox() - - EtcdMgrSington.InitFirstPay() - - EtcdMgrSington.InitContinuousPay() - - EtcdMgrSington.InitPhoneLottery() - - } -} - func (this *WelfareMgr) UpdateSign7(cfg *webapi_proto.Welfare7SignDateList) { - this.Sign7[cfg.Platform] = cfg + this.getConfig(cfg.Platform).Welfare7SignDateList = cfg } func (this *WelfareMgr) UpdateTurnplate(cfg *webapi_proto.WelfareTurnplateDateList) { s := int32(0) - if turnplate := this.Turnplate[cfg.Platform]; turnplate != nil { - s = this.Turnplate[cfg.Platform].Switch + info := this.getConfig(cfg.Platform) + if info.WelfareTurnplateDateList != nil { + s = info.WelfareTurnplateDateList.Switch } - this.Turnplate[cfg.Platform] = cfg - if s != 0 && s != cfg.Switch { // 打开关闭要广播给客户端 - this.WelfareClues(nil, cfg.Platform, OpTurnplate) + info.WelfareTurnplateDateList = cfg + + // 打开关闭要广播给客户端 + if s != 0 && s != cfg.Switch { + this.WelfareSwitch(nil, cfg.Platform, OpTurnplate) } } func (this *WelfareMgr) UpdateBlindBox(cfg *webapi_proto.WelfareBlindBoxDataList) { s := int32(0) - if blindBox := this.BlindBox[cfg.Platform]; blindBox != nil { - s = this.BlindBox[cfg.Platform].Switch + info := this.getConfig(cfg.Platform) + if info.WelfareBlindBoxDataList != nil { + s = info.WelfareBlindBoxDataList.Switch } - this.BlindBox[cfg.Platform] = cfg + info.WelfareBlindBoxDataList = cfg if cfg.Cycle == WelfareOpen { - this.BlindBoxCycle[cfg.Platform] = 1 + info.BlindBoxCycle = 1 } - if s != 0 && s != cfg.Switch { // 打开关闭要广播给客户端 - this.WelfareClues(nil, cfg.Platform, OpBlindBox) + // 打开关闭要广播给客户端 + if s != 0 && s != cfg.Switch { + this.WelfareSwitch(nil, cfg.Platform, OpBlindBox) } } func (this *WelfareMgr) UpdateFirstPay(cfg *webapi_proto.WelfareFirstPayDataList) { s := int32(0) - if firstPay := this.FirstPay[cfg.Platform]; firstPay != nil { - s = this.FirstPay[cfg.Platform].Switch + info := this.getConfig(cfg.Platform) + if info.WelfareFirstPayDataList != nil { + s = info.WelfareFirstPayDataList.Switch } - this.FirstPay[cfg.Platform] = cfg + info.WelfareFirstPayDataList = cfg if cfg.Cycle == WelfareOpen { - this.FirstPayCycle[cfg.Platform] = 1 + info.FirstPayCycle = 1 } - if s != 0 && s != cfg.Switch { // 打开关闭要广播给客户端 - this.WelfareClues(nil, cfg.Platform, OpFirstPay) + // 打开关闭要广播给客户端 + if s != 0 && s != cfg.Switch { + this.WelfareSwitch(nil, cfg.Platform, OpFirstPay) } } func (this *WelfareMgr) UpdateContinuousPay(cfg *webapi_proto.WelfareContinuousPayDataList) { s := int32(0) - if continuousPay := this.ContinuousPay[cfg.Platform]; continuousPay != nil { - s = this.ContinuousPay[cfg.Platform].Switch + info := this.getConfig(cfg.Platform) + if info.WelfareContinuousPayDataList != nil { + s = info.WelfareContinuousPayDataList.Switch } - this.ContinuousPay[cfg.Platform] = cfg + info.WelfareContinuousPayDataList = cfg if cfg.Cycle == WelfareOpen { - this.ContinuousPayCycle[cfg.Platform] = 1 + info.ContinuousPayCycle = 1 } - if s != 0 && s != cfg.Switch { // 打开关闭要广播给客户端 - this.WelfareClues(nil, cfg.Platform, OpContinuousPay) + // 打开关闭要广播给客户端 + if s != 0 && s != cfg.Switch { + this.WelfareSwitch(nil, cfg.Platform, OpContinuousPay) } } func (this *WelfareMgr) UpdatePhoneLotteryStatus(cfg *webapi_proto.WelfarePhoneLotteryStatus) { - this.PhoneLotteryStatus[cfg.Platform] = cfg s := int32(0) - if phoneLotteryStatus := this.PhoneLotteryStatus[cfg.Platform]; phoneLotteryStatus != nil { - s = this.PhoneLotteryStatus[cfg.Platform].Switch + info := this.getConfig(cfg.Platform) + if info.WelfarePhoneLotteryStatus != nil { + s = info.WelfarePhoneLotteryStatus.Switch } - this.PhoneLotteryStatus[cfg.Platform] = cfg - if s != 0 && s != cfg.Switch { // 打开关闭要广播给客户端 - this.WelfareClues(nil, cfg.Platform, OpPhoneLottery) + info.WelfarePhoneLotteryStatus = cfg + // 打开关闭要广播给客户端 + if s != 0 && s != cfg.Switch { + this.WelfareSwitch(nil, cfg.Platform, OpPhoneLottery) } - } + func (this *WelfareMgr) GetPhoneLotteryStatus(platform string) int32 { - if this.PhoneLotteryStatus[platform] != nil { - return this.PhoneLotteryStatus[platform].GetSwitch() + info := this.getConfig(platform) + if info.WelfarePhoneLotteryStatus != nil { + return info.WelfarePhoneLotteryStatus.Switch } - //测试代码 return WelfareClose } -func (this *WelfareMgr) OnDayChanged(player *Player) error { - if player.WelfData != nil { - player.WelfData.ReliefFundTimes = 0 - blindBox := this.BlindBox[player.Platform] - //continuousPay := this.ContinuousPay[player.Platform] - if blindBox != nil { // 关闭循环重置为-1 - if blindBox.Cycle == WelfareClose && player.WelfData.BlindBoxId != 0 { - player.WelfData.BlindBoxId = -1 - } else { // 循环 - player.WelfData.BlindBoxId = 0 - } - } - //this.WelfareShowRed(player) // - if !this.Welfareturnplate(player, 0) { - player.SendShowRed(hall_proto.ShowRedCode_Welfare, 0, 1) // 0 轮盘红点 - } - // 同步救济金次数 - pack := &welfare.SCGetReliefFund{ - OpRetCode: welfare.OpResultCode_OPRC_Sucess, - Times: player.WelfData.ReliefFundTimes, - Coin: -1, // 更新剩余次数 - } - player.SendToClient(int(welfare.SPacketID_PACKET_SC_WELF_GETRELIEFFUND), pack) - logger.Logger.Tracef("OnDayChanged SCGetReliefFund snid: %v pack: %v", player.SnId, pack) +func (this *WelfareMgr) UpdateCollectConfig(cfg *webapi_proto.WelfareCollectConfig) { + s := int32(0) + info := this.getConfig(cfg.Platform) + if info.WelfareCollectConfig != nil { + s = info.WelfareCollectConfig.Switch } + info.WelfareCollectConfig = cfg + // 打开关闭要广播给客户端 + if s != 0 && s != cfg.Switch { + this.WelfareSwitch(nil, cfg.Platform, OpCollect) + } +} + +func (this *WelfareMgr) GetCollectSwitch(platform string) int32 { + info := this.getConfig(platform) + if info.WelfareCollectConfig != nil { + return info.WelfareCollectConfig.Switch + } + return WelfareClose +} + +func (this *WelfareMgr) OnDayChanged(player *Player) error { + if player.WelfData == nil { + return nil + } + + player.WelfData.ReliefFundTimes = 0 + blindBox := this.getConfig(player.Platform).WelfareBlindBoxDataList + if blindBox != nil { // 关闭循环重置为-1 + if blindBox.Cycle == WelfareClose && player.WelfData.BlindBoxId != 0 { + player.WelfData.BlindBoxId = -1 + } else { // 循环 + player.WelfData.BlindBoxId = 0 + } + } + + if !this.Welfareturnplate(player, 0) { + player.SendShowRed(hall_proto.ShowRedCode_Welfare, 0, 1) // 0 轮盘红点 + } + + // 同步救济金次数 + pack := &welfare.SCGetReliefFund{ + OpRetCode: welfare.OpResultCode_OPRC_Sucess, + Times: player.WelfData.ReliefFundTimes, + Coin: -1, // 更新剩余次数 + } + player.SendToClient(int(welfare.SPacketID_PACKET_SC_WELF_GETRELIEFFUND), pack) + logger.Logger.Tracef("OnDayChanged SCGetReliefFund snid: %v pack: %v", player.SnId, pack) + return nil } func (this *WelfareMgr) MonitorWelfData(player *Player) { - if player.WelfData == nil { - player.WelfData = &model.WelfareData{ - Sign7: &model.NewSignData{}, - VIPBag: make(map[int32]map[int32]int32), - } + player.WelfData = model.NewWelfareData() } else if player.WelfData.Sign7 == nil { player.WelfData.Sign7 = &model.NewSignData{} } else if player.WelfData.VIPBag == nil { @@ -279,13 +304,14 @@ func (this *WelfareMgr) MonitorWelfData(player *Player) { } } +// GetTurnplate 获取转盘奖励 func (this *WelfareMgr) GetTurnplate(p *Player) { - // this.MonitorWelfData(p) pack := &welfare.SCGetTurnplate{ OpRetCode: welfare.OpResultCode_OPRC_Error, } - turnplate := this.Turnplate[p.Platform] - sign7 := this.Sign7[p.Platform] + info := this.getConfig(p.Platform) + turnplate := info.WelfareTurnplateDateList + sign7 := info.Welfare7SignDateList if turnplate != nil && sign7 != nil { if turnplate.Switch != WelfareOpen { logger.Logger.Tracef("GetTurnplate Switch err p.SnId = %v %v", p.SnId, turnplate.Switch) @@ -377,6 +403,7 @@ func (this *WelfareMgr) GetTurnplate(p *Player) { p.SendToClient(int(welfare.SPacketID_PACKET_SC_WELF_GETTURNPLATE), pack) } +// GetTurnplteVideo 转盘视频奖励 func (this *WelfareMgr) GetTurnplteVideo(p *Player) { pack := &welfare.SCGetTurnplate{ OpRetCode: welfare.OpResultCode_OPRC_Error, @@ -388,8 +415,9 @@ func (this *WelfareMgr) GetTurnplteVideo(p *Player) { p.SendToClient(int(welfare.SPacketID_PACKET_SC_WELF_GETTURNPLATE), pack) } - turn := this.Turnplate[p.Platform] // 转盘 - sign7 := this.Sign7[p.Platform] // 签到 + info := this.getConfig(p.Platform) + turn := info.WelfareTurnplateDateList // 转盘 + sign7 := info.Welfare7SignDateList // 签到 if turn == nil || sign7 == nil { send() return @@ -557,13 +585,14 @@ func DrawWelfareDate(dates []*webapi_proto.WelfareDate, p *Player, gainWay int32 } } +// GetAddupSign 累计签到 func (this *WelfareMgr) GetAddupSign(p *Player, addupday int32) { - // this.MonitorWelfData(p) pack := &welfare.SCGetAddupSign{ OpRetCode: welfare.OpResultCode_OPRC_Error, } - turnplate := this.Turnplate[p.Platform] - sign7 := this.Sign7[p.Platform] + info := this.getConfig(p.Platform) + turnplate := info.WelfareTurnplateDateList + sign7 := info.Welfare7SignDateList if turnplate != nil && sign7 != nil { if turnplate.Switch != WelfareOpen { logger.Logger.Tracef("Get7Sign Switch err p.SnId = %v %v", p.SnId, turnplate.Switch) @@ -622,13 +651,14 @@ func (this *WelfareMgr) GetAddupSign(p *Player, addupday int32) { p.SendToClient(int(welfare.SPacketID_PACKET_SC_WELF_GETADDUPSIGN), pack) } +// WelfaredInfo 转盘签到活动信息 func (this *WelfareMgr) WelfaredInfo(p *Player) { - // this.MonitorWelfData(p) pack := &welfare.SCWelfaredInfo{} diff := 0 ts := time.Now().Unix() - turnplate := this.Turnplate[p.Platform] - sign7 := this.Sign7[p.Platform] + info := this.getConfig(p.Platform) + turnplate := info.WelfareTurnplateDateList + sign7 := info.Welfare7SignDateList if turnplate != nil && sign7 != nil { pack.Switch = turnplate.Switch if turnplate.Switch != WelfareClose { @@ -656,7 +686,6 @@ func (this *WelfareMgr) WelfaredInfo(p *Player) { } for _, v := range sign7.List { - data := &welfare.Welfare7SignDate{ Day: v.Day, } @@ -699,11 +728,14 @@ func (this *WelfareMgr) WelfaredInfo(p *Player) { p.SendToClient(int(welfare.SPacketID_PACKET_SC_WELF_WELFAREINFO), pack) } -func (this *WelfareMgr) WelfareClues(p *Player, platform string, op int) { - +// WelfareSwitch 通知活动开关状态 +func (this *WelfareMgr) WelfareSwitch(p *Player, platform string, op int) { pack := &player_proto.SCEasyWelfaredInfo{} // 0转盘1盲盒2首冲3连续充值 - turnplate := this.Turnplate[platform] + info := this.getConfig(platform) + + // 转盘 + turnplate := info.WelfareTurnplateDateList if turnplate != nil { if op == OpAll || op == OpTurnplate { if turnplate.Switch == WelfareOpen && p != nil && this.Welfareturnplate(p, 1) { // 没有关闭且所有奖励已经领取 @@ -717,8 +749,8 @@ func (this *WelfareMgr) WelfareClues(p *Player, platform string, op int) { } else { pack.WelfareSwitch = append(pack.WelfareSwitch, WelfareClose) // 配置nil就是关闭 } - - blindBox := this.BlindBox[platform] + // 盲盒 + blindBox := info.WelfareBlindBoxDataList if blindBox != nil { if op == OpAll || op == OpBlindBox { if blindBox.Switch == WelfareOpen && blindBox.Cycle == WelfareClose && p != nil && p.WelfData.BlindBoxId != 0 { // 没有关闭且所有奖励已经领取 @@ -732,8 +764,8 @@ func (this *WelfareMgr) WelfareClues(p *Player, platform string, op int) { } else { pack.WelfareSwitch = append(pack.WelfareSwitch, WelfareClose) // 配置nil就是关闭 } - - firstPay := this.FirstPay[platform] + // 首充 + firstPay := info.WelfareFirstPayDataList if firstPay != nil { if op == OpAll || op == OpFirstPay { ln := len(firstPay.List) @@ -749,8 +781,8 @@ func (this *WelfareMgr) WelfareClues(p *Player, platform string, op int) { } else { pack.WelfareSwitch = append(pack.WelfareSwitch, WelfareClose) // 配置nil就是关闭 } - - continuousPay := this.ContinuousPay[platform] + // 连充 + continuousPay := info.WelfareContinuousPayDataList if continuousPay != nil { if op == OpAll || op == OpContinuousPay { ln := len(continuousPay.List) @@ -766,26 +798,36 @@ func (this *WelfareMgr) WelfareClues(p *Player, platform string, op int) { } else { pack.WelfareSwitch = append(pack.WelfareSwitch, WelfareClose) // 配置nil就是关闭 } - //抽手机活动开关 - if this.PhoneLotteryStatus[platform] != nil { - phoneLotterySwitch := this.PhoneLotteryStatus[platform].Switch - pack.WelfareSwitch = append(pack.WelfareSwitch, phoneLotterySwitch) //抽手机活动开关 + // 抽手机活动开关 + phoneConfig := info.WelfarePhoneLotteryStatus + if phoneConfig != nil { + pack.WelfareSwitch = append(pack.WelfareSwitch, phoneConfig.Switch) //抽手机活动开关 } else { pack.WelfareSwitch = append(pack.WelfareSwitch, WelfareClose) } + // 集卡活动 + collectConfig := info.WelfareCollectConfig + if collectConfig != nil { + pack.WelfareSwitch = append(pack.WelfareSwitch, collectConfig.Switch) //集卡活动开关 + } else { + pack.WelfareSwitch = append(pack.WelfareSwitch, WelfareClose) + } + if p != nil { - logger.Logger.Tracef("WelfareClues snid: %v pack: %v", p.SnId, pack) + logger.Logger.Tracef("WelfareSwitch snid: %v pack: %v", p.SnId, pack) p.SendToClient(int(player_proto.PlayerPacketID_PACKET_SC_SWELFAREINFO), pack) } else { - logger.Logger.Tracef("WelfareClues to Platform pack: %v", pack) + logger.Logger.Tracef("WelfareSwitch to Platform pack: %v", pack) PlayerMgrSington.BroadcastMessageToPlatform(platform, int(player_proto.PlayerPacketID_PACKET_SC_SWELFAREINFO), pack) } } +// Welfareturnplate 转盘红点 func (this *WelfareMgr) Welfareturnplate(p *Player, op int32) bool { // 0 红点提示 1全部领取 var isShow bool - turnplate := this.Turnplate[p.Platform] - sign7 := this.Sign7[p.Platform] + info := this.getConfig(p.Platform) + turnplate := info.WelfareTurnplateDateList + sign7 := info.Welfare7SignDateList if turnplate != nil && sign7 != nil { if turnplate.Switch == WelfareClose { return true @@ -805,7 +847,6 @@ func (this *WelfareMgr) Welfareturnplate(p *Player, op int32) bool { // 0 红点 if isShow { // 当日已经领取 查看累计奖励是否领取 var addUpDate []int32 for _, v := range sign7.List { - for _, d := range v.AddUpDate { // 累计奖励 addUpDate = append(addUpDate, d.AddUpDay) } @@ -838,20 +879,19 @@ func (this *WelfareMgr) WelfareShowRed(p *Player) { return } this.MonitorWelfData(p) // 登录检测 - this.WelfareClues(p, p.Platform, OpAll) + this.WelfareSwitch(p, p.Platform, OpAll) if !this.Welfareturnplate(p, 0) { p.SendShowRed(hall_proto.ShowRedCode_Welfare, 0, 1) // 0 轮盘红点 } - } func (this *WelfareMgr) BlindBoxInfo(p *Player, bid int32) { - // this.MonitorWelfData(p) pack := &welfare.SCBlindBoxInfo{ OpRetCode: welfare.OpResultCode_OPRC_Error, } - blindBox := this.BlindBox[p.Platform] + info := this.getConfig(p.Platform) + blindBox := info.WelfareBlindBoxDataList if blindBox != nil { if blindBox.Switch != WelfareOpen { logger.Logger.Tracef("BlindBoxInfo Switch err p.SnId = %v %v", p.SnId, blindBox.Switch) @@ -867,7 +907,7 @@ func (this *WelfareMgr) BlindBoxInfo(p *Player, bid int32) { pack.MinId = blindBox.MinId pack.Draw = 1 - cyc := this.BlindBoxCycle[p.Platform] + cyc := info.BlindBoxCycle if p.WelfData.BlindBoxId == -1 { if cyc == 1 || blindBox.Cycle == WelfareOpen { p.WelfData.BlindBoxId = 0 @@ -926,7 +966,7 @@ func (this *WelfareMgr) BuyBlindBox(p *Player, buyid, ConfigPayId int32) { pack := &shop.SCPayInfo{ RetCode: shop.OpResultCode_OPRC_Error, } - blindBox := this.BlindBox[p.Platform] + blindBox := this.getConfig(p.Platform).WelfareBlindBoxDataList if blindBox == nil { logger.Logger.Tracef("BuyBlindBox blindBox==nil snid: %v pack: %v", p.SnId, pack) p.SendToClient(int(shop.SPacketID_PACKET_SCPAYINFO), pack) @@ -1025,11 +1065,11 @@ func (this *WelfareMgr) BuyBlindBox(p *Player, buyid, ConfigPayId int32) { } func (this *WelfareMgr) FirstPayInfo(p *Player) { - // this.MonitorWelfData(p) pack := &welfare.SCWelfareFirstPayData{ OpRetCode: welfare.OpResultCode_OPRC_Error, } - firstPay := this.FirstPay[p.Platform] + info := this.getConfig(p.Platform) + firstPay := info.WelfareFirstPayDataList if firstPay != nil { pack.Switch = firstPay.Switch if firstPay.Switch != WelfareClose { @@ -1051,7 +1091,7 @@ func (this *WelfareMgr) FirstPayInfo(p *Player) { } max := firstPay.List[ln-1].Day // 正序 - cyc := this.FirstPayCycle[p.Platform] + cyc := info.FirstPayCycle if pack.Draw == 2 { // 当天未领取判断 if day >= max { if firstPay.Cycle != WelfareOpen && cyc != 1 { // 全部领取完就发最后一天 @@ -1112,7 +1152,8 @@ func (this *WelfareMgr) BuyFirstPay(p *Player, ConfigPayId int32) { pack := &shop.SCPayInfo{ RetCode: shop.OpResultCode_OPRC_Error, } - firstPay := this.FirstPay[p.Platform] + info := this.getConfig(p.Platform) + firstPay := info.WelfareFirstPayDataList if firstPay == nil { logger.Logger.Errorf("BuyFirstPay firstPay == nil snid: %v pack: %v", p.SnId, pack) p.SendToClient(int(shop.SPacketID_PACKET_SCPAYINFO), pack) @@ -1139,7 +1180,7 @@ func (this *WelfareMgr) BuyFirstPay(p *Player, ConfigPayId int32) { max := firstPay.List[ln-1].Day // 正序 if p.WelfData.FirstPayDay >= max { - cyc := this.FirstPayCycle[p.Platform] + cyc := info.FirstPayCycle if firstPay.Cycle != WelfareOpen && cyc != 1 { // 全部领取完 //pack.OpRetCode = welfare.OpResultCode_OPRC_NoTimes logger.Logger.Tracef("BuyFirstPay Cycle p.WelfData.FirstPayDay max p.SnId = %v %v", p.SnId, firstPay.Cycle, p.WelfData.FirstPayDay, max) @@ -1236,7 +1277,8 @@ func (this *WelfareMgr) ContinuousPayInfo(p *Player) { pack := &welfare.SCWelfareContinuousPayData{ OpRetCode: welfare.OpResultCode_OPRC_Error, } - continuousPay := this.ContinuousPay[p.Platform] + info := this.getConfig(p.Platform) + continuousPay := info.WelfareContinuousPayDataList if continuousPay != nil { pack.Switch = continuousPay.Switch if continuousPay.Switch != WelfareClose { @@ -1261,7 +1303,7 @@ func (this *WelfareMgr) ContinuousPayInfo(p *Player) { } if pack.Draw == 2 { // 当天未领取判断 - cyc := this.ContinuousPayCycle[p.Platform] + cyc := info.ContinuousPayCycle for i, v := range continuousPay.List { if v.Day == day || day == 0 || day >= max { if day != 0 { // 为0领取第一个 day不为0代表已经领取到该礼包 需要领取下一个 @@ -1316,14 +1358,11 @@ func (this *WelfareMgr) ContinuousPayInfo(p *Player) { // 默认已经成功 func (this *WelfareMgr) BuyContinuousPay(p *Player, ConfigPayId int32) { - // this.MonitorWelfData(p) - //pack := &welfare.SCWelfareContinuousPay{ - // OpRetCode: welfare.OpResultCode_OPRC_Error, - //} pack := &shop.SCPayInfo{ RetCode: shop.OpResultCode_OPRC_Error, } - continuousPay := this.ContinuousPay[p.Platform] + info := this.getConfig(p.Platform) + continuousPay := info.WelfareContinuousPayDataList if continuousPay == nil { logger.Logger.Tracef("BuyContinuousPay continuousPay == nil snid: %v pack: %v", p.SnId, pack) p.SendToClient(int(shop.SPacketID_PACKET_SCPAYINFO), pack) @@ -1352,7 +1391,7 @@ func (this *WelfareMgr) BuyContinuousPay(p *Player, ConfigPayId int32) { } if p.WelfData.ContinuousPayDay >= max { - cyc := this.ContinuousPayCycle[p.Platform] + cyc := info.ContinuousPayCycle if continuousPay.Cycle != WelfareOpen && cyc != 1 { // 全部领取完 //pack.OpRetCode = welfare.OpResultCode_OPRC_NoTimes logger.Logger.Tracef("BuyContinuousPay Cycle p.WelfData.FirstPayDay max p.SnId = %v %v", p.SnId, continuousPay.Cycle, p.WelfData.ContinuousPayDay, max) @@ -1450,14 +1489,14 @@ func (this *WelfareMgr) Shutdown() { } func (this *WelfareMgr) OnDayTimer() { - //logger.Logger.Tracef("WelfareMgr OnDayTimer") - this.BlindBoxCycle = make(map[string]int32) - this.FirstPayCycle = make(map[string]int32) - this.ContinuousPayCycle = make(map[string]int32) + for _, v := range this.Activity { + v.BlindBoxCycle = 0 + v.FirstPayCycle = 0 + v.ContinuousPayCycle = 0 + } } func (this *WelfareMgr) InterestClockEvent() int { - return (1 << CLOCK_EVENT_MAX) - 1 }