From fc3f828885c48fba313a920beb9ea9000cfd9016 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期五, 10 八月 2018 22:47:40 +0800
Subject: [PATCH] fix:混服支持,影响限购活动,充值,后台事件记录,在线人数
---
ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldProcess.py | 36 +++++++++--------
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/EventReport.py | 7 ++-
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py | 2
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFlashGiftbag.py | 18 +++++---
ServerPython/CoreServerGroup/GameServer/Script/EventReport.py | 11 ++---
5 files changed, 40 insertions(+), 34 deletions(-)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/EventReport.py b/ServerPython/CoreServerGroup/GameServer/Script/EventReport.py
index 9a92af3..2f9e7f2 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/EventReport.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/EventReport.py
@@ -84,12 +84,11 @@
# @param eventParam 事件参数
# @param curPlayer
# @return None
-def EventReport(eventActionID, eventParam, curPlayer=None):
+def EventReport(eventActionID, eventParam, curPlayer=None, OperatorID=""):
# 组成例子 eventParam 的格式必须是 xx=yy&zz=cc
# "http://192.168.0.249:12000/event_receiver?EventID=3099&OperatorID=test&PlayerCount=102&Time=2018-02-08 18:30:30&ProductID=snxxz&RegionName=s1"
- OperatorID = GameWorld.GetPlatform()
- if not OperatorID:
+ if not curPlayer and not OperatorID:
return
ProductID = ReadChConfig.GetPyMongoConfig("EventReport", "ProductID")
@@ -107,7 +106,7 @@
# "IP": curPlayer.GetIP(),
# "Level": curPlayer.GetLV()})
#=======================================================================
-
+ OperatorID = GameWorld.GetPlayerPlatform(curPlayer.GetAccID())
getUrl = "%s?ProductID=%s&OperatorID=%s&RegionName=%s&EventID=%s%s&Time=%s&%s"%(\
ReportUrl, ProductID, OperatorID, RegionName, eventActionID, playerInfo,
@@ -312,11 +311,11 @@
## =================================================================================================
## 在线
-def WriteEvent_concurrency(activePlayerCount, tjgOnlineCnt):
+def WriteEvent_concurrency(activePlayerCount, tjgOnlineCnt, OperatorID):
# 只传真实玩家,让后台显示真实在线玩家
realPlayer = activePlayerCount-tjgOnlineCnt
EventReport(ShareDefine.Def_UserAction_KeepOnline,
- "PlayerCount=%s&TotalPlayerCount=%s"%(realPlayer, realPlayer))
+ "PlayerCount=%s&TotalPlayerCount=%s"%(realPlayer, realPlayer), None, OperatorID)
return
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldProcess.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldProcess.py
index 1071626..b280963 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldProcess.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldProcess.py
@@ -561,7 +561,7 @@
return
# 全服在线人数平台明细
- #platformOLDict = {} # 平台在线人数 {平台:人数, ...}
+ platformOLDict = {} # 平台在线人数 {平台:人数, ...}
#mapPlatformOLDict = {} # 地图平台在线人数 {mapID:{平台:人数, ...}, ...}
tjgOnlineCnt = 0 # 脱机挂在线玩家
playerManager = GameWorld.GetPlayerManager()
@@ -575,8 +575,8 @@
tjgOnlineCnt += 1
continue
- #platform = GameWorld.GetPlayerPlatform(player.GetAccID())
- #platformOLDict[platform] = platformOLDict.get(platform, 0) + 1 # 累计平台在线人数
+ platform = GameWorld.GetPlayerPlatform(player.GetAccID())
+ platformOLDict[platform] = platformOLDict.get(platform, 0) + 1 # 累计平台在线人数
# mapID = player.GetMapID()
# mapOLDict = mapPlatformOLDict.get(mapID, {})
@@ -590,15 +590,15 @@
#activePlayerCount = GameWorld.GetPlayerManager().GetActivePlayerCount()
#DataRecordPack.DR_OnLinePlayerCount(activePlayerCount, platformOLDict, tjgOnlineCnt)
#===========================================================================
- # for platform, playerCnt in platformOLDict.items():
- # concurrency = EventReport.concurrency()
- # concurrency.SetEventAgentInfo(platform)
- # concurrency.concurrency = playerCnt
- # EventReport.WriteEvent(concurrency)
+ for platform, playerCnt in platformOLDict.items():
+ DataRecordPack.DR_OnLinePlayerCount(playerCnt, platform, tjgOnlineCnt) # 单平台
+ EventReport.WriteEvent_concurrency(playerCnt, 0, platform) # 单平台 此处不能传脱机挂玩家总数
+
+
#===========================================================================
- DataRecordPack.DR_OnLinePlayerCount(activePlayerCount, {}, tjgOnlineCnt)
- EventReport.WriteEvent_concurrency(activePlayerCount, tjgOnlineCnt)
+ DataRecordPack.DR_OnLinePlayerCount(activePlayerCount, {}, tjgOnlineCnt) # 总在线
+ #EventReport.WriteEvent_concurrency(activePlayerCount, tjgOnlineCnt)
#刷新当前地图服务器
#===========================================================================
# custom_concurrencyMapList = ReadChConfig.GetEvalChConfig("EventReportMapID")
@@ -1235,13 +1235,15 @@
#GameWorldBoss.CheckResetBossKilledCntOnServerInit()
#GameWorldActionTeHui.OnGameServerInitOK() # 特惠活动初始化
#子服启动成功告知跨服主服
- serverGroupID = GameWorld.GetServerGroupID()
- if GameWorld.IsMergeOpen() and not GameWorld.IsMergeServer():
- GameWorld.Log("通知跨服主服务器启动成功, 可接收最新跨服活动状态及数据...")
- dataMsg = {"Platform":GameWorld.GetPlatform(), "ServerID":GameWorld.GetServerSID(), "ServerGroupID":serverGroupID}
- MergeChildMsg.SendMergerChildToCenterStringData(ChConfig.Def_ClientServerInitOK, dataMsg)
-
- GameWorld.Log("服务器启动成功: ServerGroupID=%s" % serverGroupID)
+ #===========================================================================
+ # serverGroupID = GameWorld.GetServerGroupID()
+ # if GameWorld.IsMergeOpen() and not GameWorld.IsMergeServer():
+ # GameWorld.Log("通知跨服主服务器启动成功, 可接收最新跨服活动状态及数据...")
+ # dataMsg = {"Platform":GameWorld.GetPlatform(), "ServerID":GameWorld.GetServerSID(), "ServerGroupID":serverGroupID}
+ # MergeChildMsg.SendMergerChildToCenterStringData(ChConfig.Def_ClientServerInitOK, dataMsg)
+ #
+ # GameWorld.Log("服务器启动成功: ServerGroupID=%s" % serverGroupID)
+ #===========================================================================
return
def DoCheckNewServerOpen(tick):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/EventReport.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/EventReport.py
index 155d427..d27f7b7 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/EventReport.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/EventReport.py
@@ -105,12 +105,11 @@
# @param eventParam 事件参数
# @param curPlayer
# @return None
-def EventReport(eventActionID, eventParam, curPlayer=None):
+def EventReport(eventActionID, eventParam, curPlayer=None, OperatorID=""):
# 组成例子 eventParam 的格式必须是 xx=yy&zz=cc
# "http://192.168.0.249:12000/event_receiver?EventID=3099&OperatorID=test&PlayerCount=102&Time=2018-02-08 18:30:30&ProductID=snxxz&RegionName=s1"
- OperatorID = GameWorld.GetPlatform()
- if not OperatorID:
+ if not curPlayer and not OperatorID:
return
ProductID = ReadChConfig.GetPyMongoConfig("EventReport", "ProductID")
@@ -124,6 +123,8 @@
"AccountID": GameWorld.GetPlatformAccID(curPlayer.GetAccID()),
"IP": curPlayer.GetIP(),
"Level": curPlayer.GetLV()})
+
+ OperatorID = GameWorld.GetPlayerPlatform(curPlayer.GetAccID())
if eventParam:
eventParam = "&%s"%eventParam
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py
index 36395d7..c7d0e94 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py
@@ -124,7 +124,7 @@
isAddBourseMoney = chargeInfo.GetIsAddBourseMoney()
appID = chargeInfo.GetAppID()
if not appID:
- appID = GameWorld.GetPlatform()
+ appID = GameWorld.GetPlayerPlatform(curPlayer.GetAccID())
addDRDict = {"orderCoin":orderCoin, "orderInfo":orderInfo, "orderID":orderID,
"isAddBourseMoney":isAddBourseMoney, "eventName":eventName, "appID":appID}
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFlashGiftbag.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFlashGiftbag.py
index 3a704b3..ec36323 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFlashGiftbag.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFlashGiftbag.py
@@ -149,10 +149,12 @@
for itemID, itemCount, isBind in giftItemList:
ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, isBind, [IPY_GameWorld.rptItem],
event=[ChConfig.ItemGive_CTG, True, addDRDict])
-
+
+ # 取玩家APPID,混服使用
+ appID = GameWorld.GetPlayerPlatform(curPlayer.GetAccID())
notifyKey = giftbagIpyData.GetNotifyKey()
if notifyKey:
- orderIpyData = GetFlashGiftbagIDOrderInfoIpyData(giftbagID)
+ orderIpyData = GetFlashGiftbagIDOrderInfoIpyData(giftbagID, appID)
rmb = 0 if not orderIpyData else int(orderIpyData.GetPayRMBNum())
PlayerControl.WorldNotify(0, notifyKey, [curPlayer.GetPlayerName(), rmb, giftbagIpyData.GetMainItemID()])
@@ -215,6 +217,9 @@
GameWorld.ErrLog("限时礼包开关时间时分配置错误!cfgID=%s" % cfgID)
return
+ # 取玩家APPID,混服使用
+ appID = GameWorld.GetPlayerPlatform(curPlayer.GetAccID())
+
packInfo = ChPyNetSendPack.tagMCFlashGiftbagInfo()
packInfo.StartDate = flashGiftbagIpyData.GetStartDate()
packInfo.EndtDate = flashGiftbagIpyData.GetEndDate()
@@ -239,7 +244,7 @@
for giftIpyData in giftbagIpyDataList:
giftbagID = giftIpyData.GetGiftbagID()
- orderIpyData = GetFlashGiftbagIDOrderInfoIpyData(giftbagID)
+ orderIpyData = GetFlashGiftbagIDOrderInfoIpyData(giftbagID, appID)
giftBag = ChPyNetSendPack.tagMCFlashGiftbag()
giftBag.GiftID = giftbagID
giftBag.OrderInfo = "" if not orderIpyData else orderIpyData.GetOrderInfo()
@@ -265,13 +270,12 @@
NetPackCommon.SendFakePack(curPlayer, packInfo)
return
-def GetFlashGiftbagIDOrderInfoIpyData(giftbagID):
+def GetFlashGiftbagIDOrderInfoIpyData(giftbagID, appID):
## 获取礼包ID对应实际售价
key = "FlashGiftbagIDRMB"
FlashGiftbagIDRMBDict = IpyGameDataPY.GetConfigEx(key)
if not FlashGiftbagIDRMBDict:
FlashGiftbagIDRMBDict = {}
- appID = GameWorld.GetPlatform()
ipyDataMgr = IpyGameDataPY.IPY_Data()
for i in xrange(ipyDataMgr.GetOrderInfoCount()):
ipyData = ipyDataMgr.GetOrderInfoByIndex(i)
@@ -279,7 +283,7 @@
continue
if not ipyData.GetGiftbagID():
continue
- FlashGiftbagIDRMBDict[ipyData.GetGiftbagID()] = ipyData
+ FlashGiftbagIDRMBDict[(ipyData.GetGiftbagID(), appID)] = ipyData
IpyGameDataPY.SetConfigEx(key, FlashGiftbagIDRMBDict)
- return FlashGiftbagIDRMBDict.get(giftbagID)
+ return FlashGiftbagIDRMBDict.get((giftbagID, appID))
--
Gitblit v1.8.0