From 82671ac68b8f6e6902b067e4aad8705812be2393 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 25 十二月 2023 14:45:10 +0800
Subject: [PATCH] 3191 删除推送
---
ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossActionControl.py | 43 ++++++++++++++++++++++++++++++++++---------
1 files changed, 34 insertions(+), 9 deletions(-)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossActionControl.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossActionControl.py
index be85cb0..c402b90 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossActionControl.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossActionControl.py
@@ -275,6 +275,11 @@
endDateStr = curDateStr
GameWorld.Log(" 结束日期为空,默认每天,今日为: endDateStr=%s" % endDateStr)
+ actByWeek = (startDateStr.startswith("W") and endDateStr.startswith("W")) # 按周x开
+ if actByWeek:
+ startDateStr, endDateStr = GameWorld.GetOperationActionDateStr(ipyData)
+ GameWorld.Log(" 星期X转化为日期: %s ~ %s" % (startDateStr, endDateStr))
+
if hasattr(ipyData, "GetStartTimeList") and hasattr(ipyData, "GetEndTimeList"):
startHMStrList = ipyData.GetStartTimeList()
endHMStrList = ipyData.GetEndTimeList()
@@ -484,6 +489,7 @@
curDateTime = datetime.datetime.strptime("%d-%d-%d %d:%d:00" % (curDateTime.year, curDateTime.month, curDateTime.day,
curDateTime.hour, curDateTime.minute), ChConfig.TYPE_Time_Format)
actChangeList = []
+ actStateChangeList = []
sysnCrossActInfoDict = {}
for actName in ShareDefine.CrossActNameList:
if actName not in actTimeInfoDict or actName not in crossActInfoDict or actName not in actCfgIDInfoDict:
@@ -498,6 +504,7 @@
continue
ipyData, startList, endList, notifyDict = timeInfoDict[cfgID]
+ isEnd = True
state = 0 # 默认关闭
cfgID = ipyData.GetCfgID()
groupName = ipyData.GetActGroupName()
@@ -514,7 +521,9 @@
if startDateTime <= curDateTime < endDateTime:
state = dIndex + 1 # 也是代表第几个时间段
break
-
+ if endList:
+ isEnd = (curDateTime >= endList[-1])
+
serverIDRangeList = actInfoDict.get(ShareDefine.ActKey_ServerIDRangeList)
# 全服广播提示信息
if curDateTime in notifyDict:
@@ -542,8 +551,8 @@
if not isReload and dbState == state and dbActID == actID and not forceReset:
#已经是这个状态了
continue
- GameWorld.Log("跨服运营活动状态: actName=%s,cfgID=%s,groupName=%s,zoneID=%s,dbState=%s -> state=%s, dbActID=%s -> actID=%s,forceReset=%s"
- % (actName, cfgID, groupName, zoneID, dbState, state, dbActID, actID, forceReset))
+ GameWorld.Log("跨服运营活动状态: actName=%s,cfgID=%s,groupName=%s,zoneID=%s,dbState=%s -> state=%s,isEnd=%s, dbActID=%s -> actID=%s,forceReset=%s"
+ % (actName, cfgID, groupName, zoneID, dbState, state, isEnd, dbActID, actID, forceReset))
# 更新状态
actInfoDict[ShareDefine.ActKey_State] = state
@@ -565,12 +574,22 @@
else:
actChangeList.append([actName, ipyData, state, cfgID, groupName, zoneID, dbActID, actID, forceReset, dbTemplateID])
+ # 活动ID变更强制视为状态变更,防止维护前后状态一样,但其实活动ID已经不同的情况会导致无法触发状态变更
+ actIDChange = True
+ actStateChangeList.append([actName, ipyData, dbState, state, cfgID, groupName, zoneID, actIDChange, dbTemplateID])
+
+ elif dbState != state:
+ actIDChange = False
+ GameWorld.Log(" 活动状态变更: actName=%s,cfgID=%s,groupName=%s,zoneID=%s,dbState=%s -> state=%s,actIDChange=%s,dbTemplateID=%s"
+ % (actName, cfgID, groupName, zoneID, dbState, state, actIDChange, dbTemplateID))
+ actStateChangeList.append([actName, ipyData, dbState, state, cfgID, groupName, zoneID, actIDChange, dbTemplateID])
+
# 非活动中的处理完关闭后,最后删除
- if not state:
+ if not state and isEnd:
del crossActInfoDict[actName][cfgID]
if not crossActInfoDict[actName]:
del crossActInfoDict[actName]
- #GameWorld.Log(" 移除结束的活动: actName=%s,cfgID=%s,crossActInfoDict=%s" % (actName, cfgID, crossActInfoDict))
+ GameWorld.Log(" 移除结束的活动: actName=%s,cfgID=%s,crossActInfoDict=%s" % (actName, cfgID, crossActInfoDict))
# 同步子服务器
if sysnCrossActInfoDict:
@@ -583,13 +602,19 @@
GameWorld.Log(" 活动ID变更: actName=%s,cfgID=%s,groupName=%s,zoneID=%s,dbActID=%s -> actID=%s,forceReset=%s,dbTemplateID=%s"
% (actName, cfgID, groupName, zoneID, dbActID, actID, forceReset, dbTemplateID))
- if actName == ShareDefine.CrossActName_LuckyCloudBuy:
- import CrossLuckyCloudBuy
- CrossLuckyCloudBuy.OnLuckyCloudBuyReset(ipyData, state)
- elif actName == ShareDefine.CrossActName_AllRecharge:
+ if actName == ShareDefine.CrossActName_AllRecharge:
import CrossActAllRecharge
CrossActAllRecharge.OnActIDChange(ipyData, state)
+ for changeInfo in actStateChangeList:
+ actName, ipyData, dbState, state, cfgID, groupName, zoneID, actIDChange, dbTemplateID = changeInfo
+ GameWorld.Log(" 活动状态变更: actName=%s,cfgID=%s,groupName=%s,zoneID=%s,dbState=%s -> state=%s,actIDChange=%s,dbTemplateID=%s"
+ % (actName, cfgID, groupName, zoneID, dbState, state, actIDChange, dbTemplateID))
+
+ if actName == ShareDefine.CrossActName_LuckyCloudBuy:
+ import CrossLuckyCloudBuy
+ CrossLuckyCloudBuy.OnLuckyCloudBuyStateChange(ipyData, actIDChange, state)
+
return
def Sync_CrossActInfoToClientServer(serverGroupID=0):
--
Gitblit v1.8.0