From c6799597c326e59733897bb29ebcaeae636e36c4 Mon Sep 17 00:00:00 2001 From: sk <123456@qq.com> Date: Wed, 17 Apr 2024 09:56:09 +0800 Subject: [PATCH] rename --- dbproxy/config.json | 2 +- gamesrv/config.json | 2 +- mgrsrv/config.json | 2 +- ranksrv/config.json | 2 +- schedulesrv/config.json | 2 +- worldsrv/config-local.json | 2 +- worldsrv/config.json | 2 +- worldsrv/config_18.json | 2 +- worldsrv/trascate_webapi.go | 600 ++++++++++++++++++------------------ 9 files changed, 306 insertions(+), 310 deletions(-) diff --git a/dbproxy/config.json b/dbproxy/config.json index 3c242e4..4860ed2 100644 --- a/dbproxy/config.json +++ b/dbproxy/config.json @@ -1,6 +1,6 @@ { "tx": { - "TxSkeletonName": "mongo.games.com/goserver/srvlib/txcommskeleton" + "TxSkeletonName": "github.com/idealeak/goserver/srvlib/txcommskeleton" }, "module": { "Options": { diff --git a/gamesrv/config.json b/gamesrv/config.json index 03b8858..f4f44b4 100644 --- a/gamesrv/config.json +++ b/gamesrv/config.json @@ -104,7 +104,7 @@ ] }, "tx": { - "TxSkeletonName": "mongo.games.com/goserver/srvlib/txcommskeleton" + "TxSkeletonName": "github.com/idealeak/goserver/srvlib/txcommskeleton" }, "module": { "Options": { diff --git a/mgrsrv/config.json b/mgrsrv/config.json index 15c323d..3dc0363 100644 --- a/mgrsrv/config.json +++ b/mgrsrv/config.json @@ -42,7 +42,7 @@ ] }, "tx": { - "TxSkeletonName": "mongo.games.com/goserver/srvlib/txcommskeleton" + "TxSkeletonName": "github.com/idealeak/goserver/srvlib/txcommskeleton" }, "module": { "Options": { diff --git a/ranksrv/config.json b/ranksrv/config.json index f1871d1..d3c323c 100644 --- a/ranksrv/config.json +++ b/ranksrv/config.json @@ -121,7 +121,7 @@ }, "tx": { - "TxSkeletonName": "mongo.games.com/goserver/srvlib/txcommskeleton" + "TxSkeletonName": "github.com/idealeak/goserver/srvlib/txcommskeleton" }, "core": { diff --git a/schedulesrv/config.json b/schedulesrv/config.json index 44fc1d2..734f6b3 100644 --- a/schedulesrv/config.json +++ b/schedulesrv/config.json @@ -8,7 +8,7 @@ } }, "tx":{ - "TxSkeletonName":"mongo.games.com/goserver/srvlib/txcommskeleton" + "TxSkeletonName":"github.com/idealeak/goserver/srvlib/txcommskeleton" }, "executor":{ "Options":{ diff --git a/worldsrv/config-local.json b/worldsrv/config-local.json index 774af20..11ea932 100644 --- a/worldsrv/config-local.json +++ b/worldsrv/config-local.json @@ -78,7 +78,7 @@ } }, "tx":{ - "TxSkeletonName":"mongo.games.com/goserver/srvlib/txcommskeleton" + "TxSkeletonName":"github.com/idealeak/goserver/srvlib/txcommskeleton" }, "executor":{ "Options":{ diff --git a/worldsrv/config.json b/worldsrv/config.json index 2ace58f..53a19d0 100644 --- a/worldsrv/config.json +++ b/worldsrv/config.json @@ -78,7 +78,7 @@ } }, "tx": { - "TxSkeletonName": "mongo.games.com/goserver/srvlib/txcommskeleton" + "TxSkeletonName": "github.com/idealeak/goserver/srvlib/txcommskeleton" }, "executor": { "Options": { diff --git a/worldsrv/config_18.json b/worldsrv/config_18.json index faf98e5..a2f7799 100644 --- a/worldsrv/config_18.json +++ b/worldsrv/config_18.json @@ -78,7 +78,7 @@ } }, "tx":{ - "TxSkeletonName":"mongo.games.com/goserver/srvlib/txcommskeleton" + "TxSkeletonName":"github.com/idealeak/goserver/srvlib/txcommskeleton" }, "executor":{ "Options":{ diff --git a/worldsrv/trascate_webapi.go b/worldsrv/trascate_webapi.go index a3ecad9..bb3518c 100644 --- a/worldsrv/trascate_webapi.go +++ b/worldsrv/trascate_webapi.go @@ -4,41 +4,37 @@ import ( "crypto/md5" "encoding/hex" "encoding/json" - "io" - "slices" - "sort" - - player_proto "mongo.games.com/game/protocol/player" - - "github.com/globalsign/mgo/bson" - "mongo.games.com/game/gamerule/crash" - "mongo.games.com/game/protocol/bag" - "mongo.games.com/game/protocol/gamehall" - "mongo.games.com/game/protocol/qpapi" - "mongo.games.com/game/protocol/server" - webapi "mongo.games.com/game/protocol/telegramapi" - "mongo.games.com/game/srvdata" - win88webapi "mongo.games.com/game/webapi" - - //"encoding/json" "errors" "fmt" + "io" "reflect" + "slices" + "sort" "strconv" "sync" "time" - login_proto "mongo.games.com/game/protocol/login" + "github.com/globalsign/mgo/bson" "mongo.games.com/goserver/core/basic" - "mongo.games.com/goserver/core/task" - - "mongo.games.com/game/common" - "mongo.games.com/game/model" - "mongo.games.com/game/proto" - webapi_proto "mongo.games.com/game/protocol/webapi" "mongo.games.com/goserver/core/logger" "mongo.games.com/goserver/core/netlib" + "mongo.games.com/goserver/core/task" "mongo.games.com/goserver/core/transact" + + "mongo.games.com/game/common" + "mongo.games.com/game/gamerule/crash" + "mongo.games.com/game/model" + "mongo.games.com/game/proto" + "mongo.games.com/game/protocol/bag" + "mongo.games.com/game/protocol/gamehall" + loginproto "mongo.games.com/game/protocol/login" + playerproto "mongo.games.com/game/protocol/player" + "mongo.games.com/game/protocol/qpapi" + "mongo.games.com/game/protocol/server" + "mongo.games.com/game/protocol/telegramapi" + webapiproto "mongo.games.com/game/protocol/webapi" + "mongo.games.com/game/srvdata" + "mongo.games.com/game/webapi" ) const ( @@ -290,7 +286,7 @@ func init() { // })) //API用户加减币 - //WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/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 +783,7 @@ func init() { // })) //API用户加减币 - WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/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,14 +1386,14 @@ func init() { })) //Cresh游戏Hash校验 - WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/game/CrashVerifier", WebAPIHandlerWrapper( + WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/Game/CrashVerifier", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { - logger.Logger.Trace("WebAPIHandler:/api/game/CrashVerifier", params) - resp := &webapi.SACrachHash{} - msg := &webapi.ASCrachHash{} + logger.Logger.Trace("WebAPIHandler:/api/Game/CrashVerifier", params) + resp := &telegramapi.SACrachHash{} + msg := &telegramapi.ASCrachHash{} err := proto.Unmarshal(params, msg) if err != nil { - resp.Tag = webapi.TagCode_FAILED + resp.Tag = telegramapi.TagCode_FAILED resp.Msg = "数据序列化失败" return common.ResponseTag_ParamError, resp } @@ -1406,12 +1402,12 @@ func init() { wheel := msg.GetWheel() if hash != "" { result := crash.HashToMultiple(hash, int(wheel)) - resp.Tag = webapi.TagCode_SUCCESS + resp.Tag = telegramapi.TagCode_SUCCESS resp.Msg = "" resp.Multiple = result return common.ResponseTag_Ok, resp } else { - resp.Tag = webapi.TagCode_FAILED + resp.Tag = telegramapi.TagCode_FAILED resp.Msg = "Hash错误" return common.ResponseTag_ParamError, resp } @@ -1421,11 +1417,11 @@ func init() { //后台修改平台数据后推送给游服 WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/game_srv/platform_config", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { - resp := &webapi_proto.SAUpdatePlatform{} - msg := &webapi_proto.ASUpdatePlatform{} + resp := &webapiproto.SAUpdatePlatform{} + msg := &webapiproto.ASUpdatePlatform{} err := proto.Unmarshal(params, msg) if err != nil { - resp.Tag = webapi_proto.TagCode_FAILED + resp.Tag = webapiproto.TagCode_FAILED resp.Msg = "数据序列化失败" return common.ResponseTag_ParamError, resp } @@ -1433,7 +1429,7 @@ func init() { platforms := msg.GetPlatforms() if platforms == nil { logger.Logger.Error("Get platform data error") - resp.Tag = webapi_proto.TagCode_FAILED + resp.Tag = webapiproto.TagCode_FAILED resp.Msg = "Get platform data error!" return common.ResponseTag_ParamError, resp } else { @@ -1492,9 +1488,9 @@ func init() { if platform != nil { //通知客户端 - scPlatForm := &login_proto.SCPlatFormConfig{ + scPlatForm := &loginproto.SCPlatFormConfig{ Platform: platform.IdStr, - OpRetCode: login_proto.OpResultCode_OPRC_Sucess, + OpRetCode: loginproto.OpResultCode_OPRC_Sucess, UpgradeAccountGiveCoin: upgradeAccountGiveCoin, ExchangeMin: exchangeMin, ExchangeLimit: exchangeLimit, @@ -1509,11 +1505,11 @@ func init() { } proto.SetDefaults(scPlatForm) - PlayerMgrSington.BroadcastMessageToPlatform(platform.IdStr, int(login_proto.LoginPacketID_PACKET_SC_PLATFORMCFG), scPlatForm) + PlayerMgrSington.BroadcastMessageToPlatform(platform.IdStr, int(loginproto.LoginPacketID_PACKET_SC_PLATFORMCFG), scPlatForm) } } - resp.Tag = webapi_proto.TagCode_SUCCESS + resp.Tag = webapiproto.TagCode_SUCCESS resp.Msg = "" return common.ResponseTag_Ok, resp } @@ -1522,11 +1518,11 @@ func init() { //======= 全局游戏开关 ======= WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/game_srv/update_global_game_status", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { - pack := &webapi_proto.SAUpdateGameConfigGlobal{} - msg := &webapi_proto.ASUpdateGameConfigGlobal{} + pack := &webapiproto.SAUpdateGameConfigGlobal{} + msg := &webapiproto.ASUpdateGameConfigGlobal{} err := proto.Unmarshal(params, msg) if err != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = fmt.Sprintf("err:%v", err.Error()) return common.ResponseTag_ParamError, pack } @@ -1534,7 +1530,7 @@ func init() { gcGlobal := msg.GetGameStatus() gameStatus := gcGlobal.GetGameStatus() if len(gameStatus) == 0 { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "Get game status data error" return common.ResponseTag_ParamError, pack } else { @@ -1544,7 +1540,7 @@ func init() { status := s.GetStatus() PlatformMgrSingleton.GameStatus[gameId] = status } - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS pack.Msg = "" return common.ResponseTag_Ok, pack } @@ -1555,11 +1551,11 @@ func init() { //======= 更新游戏配置 ======= WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/game_srv/update_game_configs", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { - pack := &webapi_proto.SAUpdateGameConfig{} - msg := &webapi_proto.ASUpdateGameConfig{} + pack := &webapiproto.SAUpdateGameConfig{} + msg := &webapiproto.ASUpdateGameConfig{} err := proto.Unmarshal(params, msg) if err != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = fmt.Sprintf("err:%v", err.Error()) return common.ResponseTag_ParamError, pack } @@ -1569,7 +1565,7 @@ func init() { platform := PlatformMgrSingleton.GetPlatform(strconv.Itoa(platformId)) dbGameFrees := platformConfig.GetDbGameFrees() if len(dbGameFrees) == 0 { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "Not have DbGameFrees" return common.ResponseTag_ParamError, pack } else { @@ -1580,7 +1576,7 @@ func init() { platform.PltGameCfg.games[logicId] = v } platform.PltGameCfg.RecreateCache() - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS pack.Msg = "" return common.ResponseTag_Ok, pack } @@ -1591,11 +1587,11 @@ func init() { //======= 更新游戏分组配置 ======= WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/game_srv/game_config_group", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { - pack := &webapi_proto.SAUpdateGameConfigGroup{} - msg := &webapi_proto.ASUpdateGameConfigGroup{} + pack := &webapiproto.SAUpdateGameConfigGroup{} + msg := &webapiproto.ASUpdateGameConfigGroup{} err := proto.Unmarshal(params, msg) if err != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = fmt.Sprintf("err:%v", err.Error()) return common.ResponseTag_ParamError, pack } @@ -1603,20 +1599,20 @@ func init() { value := msg.GetGameConfigGroup() PlatformGameGroupMgrSington.UpsertGameGroup(value) logger.Logger.Trace("PlatformGameGroup data:", value) - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS pack.Msg = "" return common.ResponseTag_Ok, pack })) //---------------------------------------------------------------------------------------------------------- //加币加钻石 - WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/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{} + pack := &webapiproto.SAAddCoinByIdAndPT{} + msg := &webapiproto.ASAddCoinByIdAndPT{} err1 := proto.Unmarshal(params, msg) if err1 != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "数据序列化失败" + err1.Error() return common.ResponseTag_ParamError, pack } @@ -1625,7 +1621,7 @@ func init() { platform := msg.GetPlatform() if CacheDataMgr.CacheBillCheck(billNo, platform) { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "Bill number repeated!" return common.ResponseTag_ParamError, pack } @@ -1646,19 +1642,19 @@ func init() { //玩家在游戏内 if player.scene != nil { CacheDataMgr.ClearCacheBill(billNo, platform) - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "Unsupported!!! because player in scene!" return common.ResponseTag_ParamError, pack } if len(platform) > 0 && player.Platform != platform { CacheDataMgr.ClearCacheBill(billNo, platform) - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "player platform forbit!" return common.ResponseTag_ParamError, pack } if player.Coin+addcoin < 0 || player.Diamond+diamond < 0 { CacheDataMgr.ClearCacheBill(billNo, platform) - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "coin not enough!" return common.ResponseTag_ParamError, pack } @@ -1688,10 +1684,10 @@ func init() { return nil }), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) { CacheDataMgr.ClearCacheBill(billNo, platform) - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS pack.Msg = "success." if data != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = data.(error).Error() } else { player.Coin += addcoin @@ -1775,12 +1771,12 @@ func init() { return findPlayer }), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) { if data == nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED if pack.Msg == "" { pack.Msg = "Player not find." } } else { - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS pack.Msg = "success." } tNode.TransRep.RetFiels = pack @@ -1794,13 +1790,13 @@ func init() { // //------------------------------------------------------------------------------------------------------- // //钱包操作接口 - WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/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{} + pack := &webapiproto.SAAddCoinById{} + msg := &webapiproto.ASAddCoinById{} err1 := proto.Unmarshal(params, msg) if err1 != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "数据序列化失败" + err1.Error() return common.ResponseTag_ParamError, pack } @@ -1818,7 +1814,7 @@ func init() { needGiveFlowRate := msg.GetNeedGiveFlowRate() if CacheDataMgr.CacheBillCheck(billNo, platform) { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "Bill number repeated!" return common.ResponseTag_ParamError, pack } @@ -1832,14 +1828,14 @@ func init() { if player != nil { //在线玩家处理 if player.scene != nil { CacheDataMgr.ClearCacheBill(billNo, platform) - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "Unsupported!!! because player in scene!" return common.ResponseTag_ParamError, pack } pd = player.PlayerData if len(platform) > 0 && player.Platform != platform { CacheDataMgr.ClearCacheBill(billNo, platform) - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "player platform forbit!" return common.ResponseTag_ParamError, pack } @@ -1847,7 +1843,7 @@ func init() { if coin < 0 { if player.Coin+coin < 0 { CacheDataMgr.ClearCacheBill(billNo, platform) - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "coin not enough!" return common.ResponseTag_ParamError, pack } @@ -1895,7 +1891,7 @@ func init() { }), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) { CacheDataMgr.ClearCacheBill(billNo, platform) if data != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = data.(error).Error() } else { //player.Coin += coin + coinEx @@ -1948,7 +1944,7 @@ func init() { player.SendDiffData() } player.SendPlayerRechargeAnswer(coin) - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS pack.Msg = "" } tNode.TransRep.RetFiels = pack @@ -2012,10 +2008,10 @@ func init() { }), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) { CacheDataMgr.ClearCacheBill(billNo, platform) if data != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = data.(error).Error() } else { - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS pack.Msg = "" if isAccTodayRecharge && coin >= 0 { OnPlayerPay(pd, coin) @@ -2062,18 +2058,18 @@ func init() { } })) //重置水池 - WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/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{} + pack := &webapiproto.SAResetGamePool{} + msg := &webapiproto.ASResetGamePool{} err := proto.Unmarshal(params, msg) if err != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "数据序列化失败" + err.Error() return common.ResponseTag_ParamError, pack } if msg.GameFreeId == 0 { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "GameFreeId id zero" return common.ResponseTag_ParamError, pack } @@ -2090,17 +2086,17 @@ func init() { proto.SetDefaults(msg) gs.Send(int(server.SSPacketID_PACKET_WG_RESETCOINPOOL), msg) } else { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "no find srvId" return common.ResponseTag_ParamError, pack } - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS pack.Msg = "reset game pool success" return common.ResponseTag_Ok, pack })) // 水池开关 - //WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/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,26 +2133,26 @@ func init() { //更新水池 // 修改本地缓存,修改数据库,同步到gamesrv - WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/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{} + pack := &webapiproto.SAUpdateGamePool{} + msg := &webapiproto.ASUpdateGamePool{} err := proto.Unmarshal(params, msg) if err != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "数据序列化失败" + err.Error() return common.ResponseTag_ParamError, pack } coinPoolSetting := msg.GetCoinPoolSetting() if coinPoolSetting == nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "GetCoinPoolSetting is nil" return common.ResponseTag_ParamError, pack } var old *model.CoinPoolSetting cps := model.GetCoinPoolSetting(msg.GetGameFreeId(), msg.GetServerId(), msg.GetGroupId(), msg.GetPlatform()) if cps == nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "CoinPoolSettingDatas is nil" return common.ResponseTag_NoData, pack } @@ -2185,7 +2181,7 @@ func init() { // 水池配置同步到gamesrv gs := GameSessMgrSington.GetGameSess(int(cps.ServerId)) if gs != nil { - var msg = &webapi_proto.CoinPoolSetting{ + var msg = &webapiproto.CoinPoolSetting{ Platform: cps.Platform, GameFreeId: cps.GameFreeId, ServerId: cps.ServerId, @@ -2205,19 +2201,19 @@ func init() { proto.SetDefaults(msg) gs.Send(int(server.SSPacketID_PACKET_WG_COINPOOLSETTING), msg) } - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS pack.Msg = "update game pool success" return common.ResponseTag_Ok, pack })) //查询水池gameid - WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/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{} + pack := &webapiproto.SAQueryGamePoolByGameId{} + msg := &webapiproto.ASQueryGamePoolByGameId{} err := proto.Unmarshal(params, msg) if err != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "数据序列化失败" + err.Error() return common.ResponseTag_ParamError, pack } @@ -2226,7 +2222,7 @@ func init() { })) //查询水池 - //WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/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{} @@ -2244,17 +2240,17 @@ func init() { //////////////////////////房间////////////////////////// WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/Cache/GetRoom", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { - pack := &webapi_proto.SAGetRoom{} - msg := &webapi_proto.ASGetRoom{} + pack := &webapiproto.SAGetRoom{} + msg := &webapiproto.ASGetRoom{} err := proto.Unmarshal(params, msg) if err != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "数据序列化失败" + err.Error() return common.ResponseTag_ParamError, pack } roomId := int(msg.GetSceneId()) snid := msg.GetSnId() - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS if roomId == 0 { if snid != 0 { p := PlayerMgrSington.GetPlayerBySnId(snid) @@ -2268,7 +2264,7 @@ func init() { pack.Msg = "no found" return common.ResponseTag_NoData, pack } else { - si := &webapi_proto.RoomInfo{ + si := &webapiproto.RoomInfo{ Platform: s.limitPlatform.Name, SceneId: int32(s.sceneId), GameId: int32(s.gameId), @@ -2327,11 +2323,11 @@ func init() { })) WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/Cache/ListRoom", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { - pack := &webapi_proto.SAListRoom{} - msg := &webapi_proto.ASListRoom{} + pack := &webapiproto.SAListRoom{} + msg := &webapiproto.ASListRoom{} err := proto.Unmarshal(params, msg) if err != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "数据序列化失败" + err.Error() return common.ResponseTag_ParamError, pack } @@ -2345,7 +2341,7 @@ func init() { if pageSize == 0 { pageSize = 20 } - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS start := (pageNo - 1) * pageSize end := pageNo * pageSize roomList, count, roomSum := SceneMgrSingleton.MarshalAllRoom(msg.GetPlatform(), int(msg.GetGroupId()), int(msg.GetGameId()), @@ -2361,18 +2357,18 @@ func init() { })) WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/Cache/DestroyRoom", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { - pack := &webapi_proto.SADestroyRoom{} - msg := &webapi_proto.ASDestroyRoom{} + pack := &webapiproto.SADestroyRoom{} + msg := &webapiproto.ASDestroyRoom{} err := proto.Unmarshal(params, msg) if err != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "数据序列化失败" + err.Error() return common.ResponseTag_ParamError, pack } - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS platform := msg.GetPlatform() if len(platform) == 0 { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "the platform is nil" return common.ResponseTag_ParamError, pack } @@ -2401,19 +2397,19 @@ func init() { } default: //删除指定房间 if len(msg.SceneIds) == 0 { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "the sceneid is nil" return common.ResponseTag_NoFindRoom, pack } for _, sceneId := range msg.GetSceneIds() { s := SceneMgrSingleton.GetScene(int(sceneId)) if s == nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "the sceneid is nil" return common.ResponseTag_NoFindRoom, pack } if !s.isPlatform(platform) { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "the sceneid is not ower platform" return common.ResponseTag_NoFindRoom, pack } @@ -2427,11 +2423,11 @@ func init() { ///////////////////////////玩家信息/////////////////////////// WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/Player/PlayerData", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { - pack := &webapi_proto.SAGetPlayerData{} - msg := &webapi_proto.ASGetPlayerData{} + pack := &webapiproto.SAGetPlayerData{} + msg := &webapiproto.ASGetPlayerData{} err := proto.Unmarshal(params, msg) if err != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "数据序列化失败" + err.Error() return common.ResponseTag_ParamError, pack } @@ -2457,9 +2453,9 @@ func init() { playerData, ok := data.(*model.PlayerData) if !ok || playerData == nil { pack.Msg = "no find player" - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED } else { - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS pdfw := model.ConvertPlayerDataToWebData(getPlayerDataParam(playerData, playerRankScore)) pdfw.Online = false @@ -2472,7 +2468,7 @@ func init() { return common.ResponseTag_TransactYield, pack } else { if len(platform) > 0 && player.Platform == platform { - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS pwdf := model.ConvertPlayerDataToWebData(getPlayerDataParam(player.PlayerData, nil)) pwdf.Online = player.IsOnLine() if pwdf != nil { @@ -2482,7 +2478,7 @@ func init() { } pack.PlayerData = pwdf } else { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "no find player" } logger.Logger.Trace("PlayerData==>", pack) @@ -2492,10 +2488,10 @@ func init() { //多个玩家数据 WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/Player/MorePlayerData", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { - pack := &webapi_proto.SAMorePlayerData{} - msg := &webapi_proto.ASMorePlayerData{} + pack := &webapiproto.SAMorePlayerData{} + msg := &webapiproto.ASMorePlayerData{} err := proto.Unmarshal(params, msg) - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED if err != nil { pack.Msg = "数据序列化失败" + err.Error() return common.ResponseTag_ParamError, pack @@ -2508,7 +2504,7 @@ func init() { pack.Msg = "IDs too more error!" return common.ResponseTag_ParamError, pack } - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS var leavePlayer []int32 var playerRankScore = map[int32]*model.PlayerRankSeason{} for _, snid := range msg.GetSnIds() { @@ -2557,10 +2553,10 @@ func init() { //更新玩家数据 WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/Cache/UpdatePlayerElement", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { - pack := &webapi_proto.SAUpdatePlayerElement{} - msg := &webapi_proto.ASUpdatePlayerElement{} + pack := &webapiproto.SAUpdatePlayerElement{} + msg := &webapiproto.ASUpdatePlayerElement{} uerr := proto.Unmarshal(params, msg) - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED if uerr != nil { pack.Msg = "数据序列化失败" + uerr.Error() return common.ResponseTag_ParamError, pack @@ -2585,11 +2581,11 @@ func init() { pack.Msg = "no any data" return common.ResponseTag_Ok, pack } - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS player := PlayerMgrSington.GetPlayerBySnId(msg.SnId) if player != nil { if len(msg.Platform) > 0 && player.Platform != msg.Platform { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "Platform error." return common.ResponseTag_NoFindUser, pack } else { @@ -2711,7 +2707,7 @@ func init() { if data == nil { pack.Msg = "success" } else { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = fmt.Sprintf("%v", data) } tNode.TransRep.RetFiels = pack @@ -2722,10 +2718,10 @@ func init() { })) WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/Player/KickPlayer", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { - pack := &webapi_proto.SAKickPlayer{} - msg := &webapi_proto.ASKickPlayer{} + pack := &webapiproto.SAKickPlayer{} + msg := &webapiproto.ASKickPlayer{} err := proto.Unmarshal(params, msg) - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED if err != nil { pack.Msg = "数据序列化失败" + err.Error() return common.ResponseTag_ParamError, pack @@ -2752,7 +2748,7 @@ func init() { return model.FreezeAccount(msg.Platform, player.AccountId, int(msg.Minute)) }), nil, "FreezeAccount").Start() player.Kickout(common.KickReason_Freeze) - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS pack.Msg = "success" } else { pack.Msg = "the player not online or no player." @@ -2762,16 +2758,16 @@ func init() { //获取在线统计 WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/Report/OnlineReportTotal", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { - pack := &webapi_proto.SAOnlineReportTotal{} - msg := &webapi_proto.ASOnlineReportTotal{} + pack := &webapiproto.SAOnlineReportTotal{} + msg := &webapiproto.ASOnlineReportTotal{} err := proto.Unmarshal(params, msg) if err != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "数据序列化失败" + err.Error() return common.ResponseTag_ParamError, pack } //inGameCnt := make(map[int]int32) - pack.OnlineReport = &webapi_proto.OnlineReport{} + pack.OnlineReport = &webapiproto.OnlineReport{} tNow := time.Now() for _, p := range PlayerMgrSington.players { if !p.IsOnLine() { @@ -2813,17 +2809,17 @@ func init() { // Cnt: cnt}, // ) //} - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS //pack.OnlineReport.GameCount = onlineGameCnt return common.ResponseTag_Ok, pack })) WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/Report/QueryOnlineReportList", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { - pack := &webapi_proto.SAQueryOnlineReportList{} - msg := &webapi_proto.ASQueryOnlineReportList{} + pack := &webapiproto.SAQueryOnlineReportList{} + msg := &webapiproto.ASQueryOnlineReportList{} err := proto.Unmarshal(params, msg) if err != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "数据序列化失败" + err.Error() return common.ResponseTag_ParamError, pack } @@ -2838,7 +2834,7 @@ func init() { end := pageNo * pageSize count := len(PlayerMgrSington.players) if count < int(start) || count == 0 { - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS return common.ResponseTag_Ok, pack } var players []*Player @@ -2971,7 +2967,7 @@ func init() { pack.PlayerData = append(pack.PlayerData, pb) } } - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS pack.PageCount = int32(count) pack.PageNo = pageNo pack.PageSize = pageSize @@ -3075,10 +3071,10 @@ func init() { //黑白名单 WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/Player/WhiteBlackControl", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { - pack := &webapi_proto.SAWhiteBlackControl{} - msg := &webapi_proto.ASWhiteBlackControl{} + pack := &webapiproto.SAWhiteBlackControl{} + msg := &webapiproto.ASWhiteBlackControl{} err := proto.Unmarshal(params, msg) - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED if err != nil { pack.Msg = "数据序列化失败" + err.Error() return common.ResponseTag_ParamError, pack @@ -3162,10 +3158,10 @@ func init() { task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { wg.Wait() if errMsg != nil || len(idMap) > 0 { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = fmt.Sprintf("数据库写入错误:%v , 玩家id:%v", errMsg, idMap) } else { - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS } tNode.TransRep.RetFiels = pack tNode.Resume() @@ -3175,26 +3171,26 @@ func init() { })) WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/Ctrl/ListServerStates", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { - pack := &webapi_proto.SAListServerStates{} - msg := &webapi_proto.ASListServerStates{} + pack := &webapiproto.SAListServerStates{} + msg := &webapiproto.ASListServerStates{} err := proto.Unmarshal(params, msg) if err != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "数据序列化失败" + err.Error() return common.ResponseTag_ParamError, pack } - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS pack.ServerInfo = GameSessMgrSington.ListServerState(int(msg.SrvId), int(msg.SrvType)) return common.ResponseTag_Ok, pack })) //邮件 - WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/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{} + pack := &webapiproto.SACreateShortMessage{} + msg := &webapiproto.ASCreateShortMessage{} err1 := proto.Unmarshal(params, msg) if err1 != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "数据序列化失败" + err1.Error() return common.ResponseTag_ParamError, pack } @@ -3211,7 +3207,7 @@ func init() { showId := msg.GetShowId() if messageType == model.MSGTYPE_ITEM && len(otherParams) != 0 && len(otherParams)%2 != 0 { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "otherParams is err" return common.ResponseTag_ParamError, pack } @@ -3233,12 +3229,12 @@ func init() { var dbMsgs []*model.Message var err error task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { - code := login_proto.OpResultCode_OPRC_Sucess + code := loginproto.OpResultCode_OPRC_Sucess //如果不是群发则检查一下该用户snid是不是存在,不存在就返回,在这里不关心玩家帐变是否正确,不做校正 if destSnid != 0 { playerData, _ := model.GetPlayerDataBySnId(platform, destSnid, true, false) if playerData == nil { - code = login_proto.OpResultCode_OPRC_Error + code = loginproto.OpResultCode_OPRC_Error return code } } @@ -3249,8 +3245,8 @@ func init() { if newMsg != nil { err := model.InsertMessage(platform, newMsg) if err != nil { - code = login_proto.OpResultCode_OPRC_Error - 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) + code = loginproto.OpResultCode_OPRC_Error + 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,15 +3262,15 @@ func init() { if len(dbMsgs) > 0 { err := model.InsertMessage(platform, dbMsgs...) if err != nil { - 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) + 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 }), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) { - if code, ok := data.(login_proto.OpResultCode); ok { - if code != login_proto.OpResultCode_OPRC_Sucess { - pack.Tag = webapi_proto.TagCode_SUCCESS + if code, ok := data.(loginproto.OpResultCode); ok { + if code != loginproto.OpResultCode_OPRC_Sucess { + pack.Tag = webapiproto.TagCode_SUCCESS pack.Msg = "" } else { pp := PlayerMgrSington.GetPlayerBySnId(int32(destSnid)) @@ -3302,7 +3298,7 @@ func init() { } } } - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS pack.Msg = "" } tNode.TransRep.RetFiels = pack @@ -3318,13 +3314,13 @@ func init() { return common.ResponseTag_TransactYield, pack })) //查询邮件 - WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/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{} + pack := &webapiproto.SAQueryShortMessageList{} + msg := &webapiproto.ASQueryShortMessageList{} err := proto.Unmarshal(params, msg) if err != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "数据序列化失败" + err.Error() return common.ResponseTag_ParamError, pack } @@ -3359,15 +3355,15 @@ func init() { return err }), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) { if data != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "" } else { - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS pack.Msg = "" pack.Count = int32(count) for i := 0; i < len(msgs); i++ { giftState := int32(0) - mi := &webapi_proto.MessageInfo{ + mi := &webapiproto.MessageInfo{ Id: msgs[i].Id.Hex(), MType: msgs[i].MType, Title: msgs[i].Title, @@ -3390,20 +3386,20 @@ func init() { return common.ResponseTag_TransactYield, pack })) //删除邮件 - WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/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{} + pack := &webapiproto.SADeleteShortMessage{} + msg := &webapiproto.ASDeleteShortMessage{} err1 := proto.Unmarshal(params, msg) if err1 != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "数据序列化失败" + err1.Error() return common.ResponseTag_ParamError, pack } msgId := msg.GetId() platform := msg.GetPlatform() if len(msgId) == 0 { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "not find msg id" return common.ResponseTag_ParamError, pack } @@ -3424,7 +3420,7 @@ func init() { return err }), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) { if data != nil || delMsg == nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "not find msg id" tNode.TransRep.RetFiels = pack tNode.Resume() @@ -3444,7 +3440,7 @@ func init() { MsgMgrSington.RemoveMsg(delMsg) } - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS pack.Msg = "" tNode.TransRep.RetFiels = pack tNode.Resume() @@ -3452,19 +3448,19 @@ func init() { return common.ResponseTag_TransactYield, pack })) //删除玩家已经删除的邮件 - WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/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{} + pack := &webapiproto.SADeleteShortMessage{} + msg := &webapiproto.ASDeleteShortMessage{} err1 := proto.Unmarshal(params, msg) if err1 != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "数据序列化失败" + err1.Error() return common.ResponseTag_ParamError, pack } platform := msg.GetPlatform() if len(platform) == 0 { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "platform is nil" return common.ResponseTag_ParamError, pack } @@ -3472,13 +3468,13 @@ func init() { return model.DelAllMessage(&model.DelAllMsgArgs{Platform: platform}) }), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) { if data != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "del err:" + data.(error).Error() tNode.TransRep.RetFiels = pack tNode.Resume() return } - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS pack.Msg = "del success." tNode.TransRep.RetFiels = pack tNode.Resume() @@ -3488,29 +3484,29 @@ func init() { //黑名单 WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/Player/BlackBySnId", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { - pack := &webapi_proto.SABlackBySnId{} - msg := &webapi_proto.ASBlackBySnId{} + pack := &webapiproto.SABlackBySnId{} + msg := &webapiproto.ASBlackBySnId{} err := proto.Unmarshal(params, msg) if err != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "数据序列化失败" + err.Error() return common.ResponseTag_ParamError, pack } player := PlayerMgrSington.GetPlayerBySnId(msg.SnId) if player != nil { if player.Platform != msg.Platform { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "Platform is dif" return common.ResponseTag_ParamError, pack } - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS player.BlacklistType = msg.BlacklistType player.dirty = true player.Time2Save() //在线需要踢掉玩家 if uint(msg.BlacklistType)&BlackState_Login != 0 { logger.Logger.Infof("found platform:%v player:%d snid in blacklist", msg.Platform, player.SnId) - player.Kickout(int32(login_proto.SSDisconnectTypeCode_SSDTC_BlackList)) + player.Kickout(int32(loginproto.SSDisconnectTypeCode_SSDTC_BlackList)) } return common.ResponseTag_Ok, pack } else { @@ -3524,9 +3520,9 @@ func init() { playerData, ok := data.(*model.PlayerData) if !ok || playerData == nil { pack.Msg = "no find player" - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED } else { - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS pack.Msg = "success" } tNode.TransRep.RetFiels = pack @@ -3537,11 +3533,11 @@ func init() { })) WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/Message/QueryHorseRaceLampList", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { - pack := &webapi_proto.SAQueryHorseRaceLampList{} - msg := &webapi_proto.ASQueryHorseRaceLampList{} + pack := &webapiproto.SAQueryHorseRaceLampList{} + msg := &webapiproto.ASQueryHorseRaceLampList{} err := proto.Unmarshal(params, msg) if err != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "数据序列化失败" + err.Error() return common.ResponseTag_ParamError, pack } @@ -3556,14 +3552,14 @@ func init() { return ret }), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) { if data == nil { - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS pack.Msg = "no these msg" } else { noticesRet := data.(*model.QueryHorseRaceLampRet) if noticesRet != nil { - var apiNoticMsgList []*webapi_proto.HorseRaceLamp + var apiNoticMsgList []*webapiproto.HorseRaceLamp for _, notice := range noticesRet.Data { - apiNoticeMsg := &webapi_proto.HorseRaceLamp{ + apiNoticeMsg := &webapiproto.HorseRaceLamp{ Id: notice.Id.Hex(), Platform: notice.Platform, Title: notice.Title, @@ -3584,7 +3580,7 @@ func init() { pack.PageCount = int32(noticesRet.Count) pack.HorseRaceLamp = apiNoticMsgList } - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS } tNode.TransRep.RetFiels = pack tNode.Resume() @@ -3596,11 +3592,11 @@ func init() { })) WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/Message/CreateHorseRaceLamp", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { - pack := &webapi_proto.SACreateHorseRaceLamp{} - msg := &webapi_proto.ASCreateHorseRaceLamp{} + pack := &webapiproto.SACreateHorseRaceLamp{} + msg := &webapiproto.ASCreateHorseRaceLamp{} err := proto.Unmarshal(params, msg) if err != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "数据序列化失败" + err.Error() return common.ResponseTag_ParamError, pack } @@ -3622,7 +3618,7 @@ func init() { return model.InsertHorseRaceLamp(platform, horseRaceLamp) }), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) { if data != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = data.(error).Error() tNode.TransRep.RetFiels = pack tNode.Resume() @@ -3630,7 +3626,7 @@ func init() { } HorseRaceLampMgrSington.AddHorseRaceLampMsg(horseRaceLamp.Id.Hex(), "", platform, title, content, footer, startTime, standSec, count, msgType, state, priority, horseRaceLamp.CreateTime, target, standSec) - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS tNode.TransRep.RetFiels = pack tNode.Resume() }), "CreateHorseRaceLamp").Start() @@ -3638,11 +3634,11 @@ func init() { })) WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/Message/GetHorseRaceLampById", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { - pack := &webapi_proto.SAGetHorseRaceLampById{} - msg := &webapi_proto.ASGetHorseRaceLampById{} + pack := &webapiproto.SAGetHorseRaceLampById{} + msg := &webapiproto.ASGetHorseRaceLampById{} err := proto.Unmarshal(params, msg) if err != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "数据序列化失败" + err.Error() return common.ResponseTag_ParamError, pack } @@ -3650,10 +3646,10 @@ func init() { platform := msg.Platform horseRaceLamp := HorseRaceLampMgrSington.HorseRaceLampMsgList[noticeKey] if horseRaceLamp == nil || (len(platform) > 0 && horseRaceLamp.Platform != platform) { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "not find data" } else { - pack.HorseRaceLamp = &webapi_proto.HorseRaceLamp{ + pack.HorseRaceLamp = &webapiproto.HorseRaceLamp{ Id: noticeKey, Title: horseRaceLamp.Title, Content: horseRaceLamp.Content, @@ -3666,23 +3662,23 @@ func init() { Priority: horseRaceLamp.Priority, MsgType: horseRaceLamp.MsgType, } - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS } return common.ResponseTag_Ok, pack })) WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/Message/EditHorseRaceLamp", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { - pack := &webapi_proto.SAEditHorseRaceLamp{} - msg := &webapi_proto.ASEditHorseRaceLamp{} + pack := &webapiproto.SAEditHorseRaceLamp{} + msg := &webapiproto.ASEditHorseRaceLamp{} err := proto.Unmarshal(params, msg) if err != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "数据序列化失败" + err.Error() return common.ResponseTag_ParamError, pack } noticeKey := msg.HorseRaceLamp.Id if len(noticeKey) == 0 { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "NoticeMsg id is nil" return common.ResponseTag_ParamError, pack } @@ -3713,7 +3709,7 @@ func init() { return notice }), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) { if data == nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "api GetNotice is error" tNode.TransRep.RetFiels = pack tNode.Resume() @@ -3740,14 +3736,14 @@ func init() { StandSec: hrl.StandSec, }) if !cache { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "api EditNoticeMsg is error" tNode.TransRep.RetFiels = pack tNode.Resume() return } } - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS tNode.TransRep.RetFiels = pack tNode.Resume() if err != nil { @@ -3759,11 +3755,11 @@ func init() { })) WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/Message/RemoveHorseRaceLampById", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { - pack := &webapi_proto.SARemoveHorseRaceLampById{} - msg := &webapi_proto.ASRemoveHorseRaceLampById{} + pack := &webapiproto.SARemoveHorseRaceLampById{} + msg := &webapiproto.ASRemoveHorseRaceLampById{} err := proto.Unmarshal(params, msg) if err != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "数据序列化失败" + err.Error() return common.ResponseTag_ParamError, pack } @@ -3771,12 +3767,12 @@ func init() { platform := msg.GetPlatform() notice := HorseRaceLampMgrSington.HorseRaceLampMsgList[noticeKey] if notice == nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "not find data" return common.ResponseTag_Ok, pack } if len(platform) > 0 && notice.Platform != notice.Platform { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "not find data" return common.ResponseTag_Ok, pack } @@ -3784,14 +3780,14 @@ func init() { return model.RemoveHorseRaceLamp(platform, noticeKey) }), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) { if data != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "RemoveNotice is error" + data.(error).Error() tNode.TransRep.RetFiels = pack tNode.Resume() return } HorseRaceLampMgrSington.DelHorseRaceLampMsg(noticeKey) - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS tNode.TransRep.RetFiels = pack tNode.Resume() }), "ResponseTag_TransactYield").Start() @@ -3799,20 +3795,20 @@ func init() { })) WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/Ctrl/ResetEtcdData", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { - pack := &webapi_proto.SAResetEtcdData{} - msg := &webapi_proto.ASResetEtcdData{} + pack := &webapiproto.SAResetEtcdData{} + msg := &webapiproto.ASResetEtcdData{} err := proto.Unmarshal(params, msg) if err != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "数据序列化失败" + err.Error() return common.ResponseTag_ParamError, pack } EtcdMgrSington.Reset() - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS pack.Msg = "Etcd Reset success" return common.ResponseTag_Ok, nil })) - //WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/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,19 +3854,19 @@ func init() { // return common.ResponseTag_Ok, pack // })) // CreateJYB 创建礼包码 - WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/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{} + pack := &webapiproto.SACreateJYB{} + msg := &webapiproto.ASCreateJYB{} err := proto.Unmarshal(params, msg) if err != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "数据序列化失败" + err.Error() return common.ResponseTag_ParamError, pack } if msg.CodeType == 1 && (msg.Code == "" || len(msg.Code) > 11) { - pack.Tag = webapi_proto.TagCode_JYB_DATA_ERROR + pack.Tag = webapiproto.TagCode_JYB_DATA_ERROR pack.Msg = "CreateJYB Code failed" return common.ResponseTag_Ok, pack } @@ -3883,7 +3879,7 @@ func init() { for _, item := range msg.GetAward().ItemId { if v := srvdata.PBDB_GameItemMgr.GetData(item.ItemId); item != nil { if item.ItemNum == 0 { - pack.Tag = webapi_proto.TagCode_JYB_DATA_ERROR + pack.Tag = webapiproto.TagCode_JYB_DATA_ERROR pack.Msg = "ItemNum failed" return common.ResponseTag_Ok, pack } @@ -3893,7 +3889,7 @@ func init() { ObtainTime: time.Now().Unix(), }) } else { - pack.Tag = webapi_proto.TagCode_JYB_DATA_ERROR + pack.Tag = webapiproto.TagCode_JYB_DATA_ERROR pack.Msg = "ItemId failed" return common.ResponseTag_Ok, pack } @@ -3910,14 +3906,14 @@ func init() { return model.CreateJybInfo(args) }), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) { if data == nil { - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS pack.Msg = "CreateJYB success" } else { logger.Logger.Trace("err: ", data.(error)) if data.(error) == model.ErrJYBCode { - pack.Tag = webapi_proto.TagCode_JYB_CODE_EXIST + pack.Tag = webapiproto.TagCode_JYB_CODE_EXIST } else { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED } pack.Msg = "CreateJYB failed" } @@ -3926,13 +3922,13 @@ func init() { }), "webCreateJybInfo").Start() return common.ResponseTag_TransactYield, pack })) - WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/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{} + pack := &webapiproto.SAUpdateJYB{} + msg := &webapiproto.ASUpdateJYB{} err := proto.Unmarshal(params, msg) if err != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "数据序列化失败" + err.Error() return common.ResponseTag_ParamError, pack } @@ -3946,11 +3942,11 @@ func init() { return model.DelJybInfo(args) }), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) { if data == nil { - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS pack.Msg = "UpdateJYB success" } else { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "UpdateJYB failed" } tNode.TransRep.RetFiels = pack @@ -3963,11 +3959,11 @@ func init() { })) WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/Customer/UpExchangeStatus", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { - pack := &webapi_proto.SAUpExchangeStatus{} - msg := &webapi_proto.ASUpExchangeStatus{} + pack := &webapiproto.SAUpExchangeStatus{} + msg := &webapiproto.ASUpExchangeStatus{} err := proto.Unmarshal(params, msg) if err != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "数据序列化失败" + err.Error() return common.ResponseTag_ParamError, pack } @@ -3975,14 +3971,14 @@ func init() { platform := msg.Platform player := PlayerMgrSington.GetPlayerBySnId(snid) if msg.Status != Shop_Status_Revoke { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "Status is Revoke" return common.ResponseTag_ParamError, pack } //cdata := ShopMgrSington.GetExchangeData(msg.GoodsId) item := srvdata.PBDB_GameItemMgr.GetData(VCard) if item == nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "item is nil" return common.ResponseTag_ParamError, pack } @@ -4005,7 +4001,7 @@ func init() { pack.Msg = "AddJybBagInfo err" return common.ResponseTag_ParamError, pack } - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS pack.Msg = "UpExchange success" BagMgrSingleton.RecordItemLog(player.Platform, player.SnId, ItemObtain, VCard, item.Name, int64(addvcoin), remark) return common.ResponseTag_Ok, pack @@ -4014,7 +4010,7 @@ func init() { task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { findPlayer = model.GetPlayerBaseInfo(platform, snid) if findPlayer == nil { - pack.Tag = webapi_proto.TagCode_Play_NotEXIST + pack.Tag = webapiproto.TagCode_Play_NotEXIST pack.Msg = fmt.Sprintf("player is not exist %v", snid) return errors.New("player is not exist") } @@ -4033,11 +4029,11 @@ func init() { return model.SaveDBBagItem(newBagInfo) }), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) { if data == nil && findPlayer != nil { - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS pack.Msg = "UpExchange success" BagMgrSingleton.RecordItemLog(findPlayer.Platform, findPlayer.SnId, ItemObtain, VCard, item.Name, int64(addvcoin), remark) } else { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "UpExchange failed:" + data.(error).Error() } tNode.TransRep.RetFiels = pack @@ -4049,11 +4045,11 @@ func init() { //更新用户三方的金币到游戏服务器 WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/thd/UpdatePlayerCoin", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { - msg := &webapi_proto.ASThdUpdatePlayerCoin{} - pack := &webapi_proto.SAThdUpdatePlayerCoin{} + msg := &webapiproto.ASThdUpdatePlayerCoin{} + pack := &webapiproto.SAThdUpdatePlayerCoin{} err := proto.Unmarshal(params, msg) if err != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "数据序列化失败" + err.Error() return common.ResponseTag_ParamError, pack } @@ -4061,9 +4057,9 @@ func init() { BaseGameId := int(msg.BaseGameID) platform := msg.Platform - plt := win88webapi.ThridPlatformMgrSington.FindPlatformByPlatformBaseGameId(BaseGameId) + plt := webapi.ThridPlatformMgrSington.FindPlatformByPlatformBaseGameId(BaseGameId) if plt == nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "三方不存在" return common.ResponseTag_ParamError, pack } @@ -4072,13 +4068,13 @@ func init() { if p != nil { if len(platform) > 0 && p.Platform != platform { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "Platform is err." return common.ResponseTag_ParamError, pack } //请求太快,不做处理,给API减轻一些压力 if p.thridBalanceRefreshReqing { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "刷新频率太高,稍等" return common.ResponseTag_ParamError, pack } @@ -4179,7 +4175,7 @@ func init() { amount := data.(int64) statePack := &gamehall.SCThridGameBalanceUpdateState{} if amount < 0 { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED // return common.ResponseTag_ParamError, pack pack.Msg = "刷新金币失败" if amount == -3 { @@ -4190,7 +4186,7 @@ func init() { //isSucces = false logger.Logger.Tracef("player snid=%v at platform=%v CSThridBalanceRefreshHandler third->system transfer fail", p.SnId, plt.GetPlatformBase().Name) } else if amount > 0 { - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS pack.Msg = "刷新金币成功" statePack.OpRetCode = gamehall.OpResultCode_Game_OPRC_Sucess_Game p.thridBalanceReqIsSucces = true @@ -4235,7 +4231,7 @@ func init() { }), "ThrUpdatePlayerCoin").Start() } else { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "暂不支持用户不在线刷新" return common.ResponseTag_ParamError, pack } @@ -4244,16 +4240,16 @@ func init() { //支付回调 WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/pay/CallbackPayment", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { - msg := &webapi_proto.ASCallbackPayment{} - pack := &webapi_proto.SACallbackPayment{} + msg := &webapiproto.ASCallbackPayment{} + pack := &webapiproto.SACallbackPayment{} err := proto.Unmarshal(params, msg) if err != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "数据序列化失败" + err.Error() return common.ResponseTag_ParamError, pack } if msg.OrderId == "" || msg.Platform == "" { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "OrderId == nil || msg.Platform == nil" return common.ResponseTag_ParamError, pack } @@ -4277,12 +4273,12 @@ func init() { player.SendDiffData() info.Amount[2] = player.GetVIPExpByPay(info.ConsumeNum) - var itemInfo []*player_proto.PayItem + var itemInfo []*playerproto.PayItem var items []*Item if info.ItemInfo != nil { for _, v := range info.ItemInfo { items = append(items, &Item{ItemId: v.ItemId, ItemNum: v.ItemNum}) - itemInfo = append(itemInfo, &player_proto.PayItem{ + itemInfo = append(itemInfo, &playerproto.PayItem{ ItemId: v.ItemId, ItemNum: v.ItemNum, }) @@ -4316,12 +4312,12 @@ func init() { player.UpdatePlayerVipBag(info.ShopId) player.UpdateShopID(info.ShopId) - PayGoodsInfo := &player_proto.SCPayGoodsInfo{ + PayGoodsInfo := &playerproto.SCPayGoodsInfo{ Gold: info.Amount, Item: itemInfo, } proto.SetDefaults(PayGoodsInfo) - player.SendToClient(int(player_proto.PlayerPacketID_PACKET_SC_PAYGOODSINFO), PayGoodsInfo) + player.SendToClient(int(playerproto.PlayerPacketID_PACKET_SC_PAYGOODSINFO), PayGoodsInfo) TaskSubjectSingleton.Touch(common.TaskTypePay, &TaskData{ SnId: player.SnId, @@ -4341,10 +4337,10 @@ func init() { }), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) { if data != nil && data.(error) != nil { info := data.(error) - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = fmt.Sprintf("%v", info) } else { - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS pack.Msg = "success" } tNode.TransRep.RetFiels = pack @@ -4356,35 +4352,35 @@ func init() { //======= 资源更新通知 ======= WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/game/resource", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { - pack := &webapi_proto.SAResource{} - msg := &webapi_proto.ASResource{} + pack := &webapiproto.SAResource{} + msg := &webapiproto.ASResource{} err := proto.Unmarshal(params, msg) if err != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = fmt.Sprintf("err:%v", err.Error()) return common.ResponseTag_ParamError, pack } // 通知所有玩家 - playerMsg := &player_proto.SCResource{ + playerMsg := &playerproto.SCResource{ Msg: msg.GetMsg(), } - PlayerMgrSington.BroadcastMessage(int(player_proto.PlayerPacketID_PACKET_SC_RESOURCE), playerMsg) + PlayerMgrSington.BroadcastMessage(int(playerproto.PlayerPacketID_PACKET_SC_RESOURCE), playerMsg) - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS pack.Msg = "" return common.ResponseTag_Ok, pack })) WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/player/update_tel", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { - pack := &webapi_proto.SAUpdateTel{} - msg := &webapi_proto.ASUpdateTel{} + pack := &webapiproto.SAUpdateTel{} + msg := &webapiproto.ASUpdateTel{} var err error err = proto.Unmarshal(params, msg) if err != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "参数错误" return common.ResponseTag_ParamError, pack } @@ -4393,7 +4389,7 @@ func init() { p := PlayerMgrSington.GetPlayerBySnId(msg.GetSnid()) if p != nil { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "玩家在线,只能离线修改" return common.ResponseTag_ParamError, pack } @@ -4430,22 +4426,22 @@ func init() { if err != nil { // 修改错误 logger.Logger.Errorf("update tel %v err: %v", msg.GetSnid(), err) - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "修改失败" } else if snid != 0 { // 手机号已经绑定 - pack.Tag = webapi_proto.TagCode_TelExist + pack.Tag = webapiproto.TagCode_TelExist pack.Msg = "手机号已使用" } else if a == nil { // 手机号已经绑定 - pack.Tag = webapi_proto.TagCode_AccountNotFound + pack.Tag = webapiproto.TagCode_AccountNotFound pack.Msg = "账号没找到" } else if a.Tel == "" { // 没有绑定手机号 - pack.Tag = webapi_proto.TagCode_TelNotBind + pack.Tag = webapiproto.TagCode_TelNotBind pack.Msg = "原账号没有绑定手机号,请自行绑定" } else { - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS pack.Msg = "修改成功" } tNode.TransRep.RetFiels = pack @@ -4457,13 +4453,13 @@ func init() { WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/player/delete", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { - pack := &webapi_proto.SAPlayerDelete{} - msg := &webapi_proto.ASPlayerDelete{} + pack := &webapiproto.SAPlayerDelete{} + msg := &webapiproto.ASPlayerDelete{} var err error err = proto.Unmarshal(params, msg) if err != nil || msg.Snid <= 0 { - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "参数错误" return common.ResponseTag_ParamError, pack } @@ -4522,10 +4518,10 @@ func init() { }), task.CompleteNotifyWrapper(func(i interface{}, t task.Task) { if err != nil { logger.Logger.Errorf("player delete %v err: %v", msg, err) - pack.Tag = webapi_proto.TagCode_FAILED + pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "删除失败" } else { - pack.Tag = webapi_proto.TagCode_SUCCESS + pack.Tag = webapiproto.TagCode_SUCCESS pack.Msg = "删除成功" } tNode.TransRep.RetFiels = pack