From 0018357c8b680025d3c0fa5509cbc2ed06dc8603 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 22 七月 2022 15:43:33 +0800
Subject: [PATCH] 5422 【Bug】【后端】转盘活动重置可能导致额外增加登录次数的bug

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActTurntable.py |    9 ++++++---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py                 |    9 +++++++++
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py
index e40aa0a..47a18b2 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py
@@ -1738,6 +1738,15 @@
 def ChangeStrToDatetime(timeStr, timeFormat=ChConfig.TYPE_Time_Format):
     return datetime.datetime.strptime(timeStr, timeFormat)
 
+## 时间格式转换成数值时间
+# @param dateT: datetime.datetime
+# @return: timeNum
+def ChangeDatetimeToNum(dateT): return int(time.mktime(dateT.timetuple()))
+
+def GetTodayTime():
+    ## 获取当天0点时间戳
+    return ChangeTimeStrToNum(str(GetCurrentTime())[:10], ChConfig.TYPE_Time_Format_Day)
+
 def CheckTimeIsSameServerDayEx(checkTime):
     '''判断指定time值与当天时间对比是否为游戏内的同一天;特殊时间点过天后才算不同天
     该函数一般用于判断某个功能记录的版本天是否与当天时间是同一天的逻辑
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActTurntable.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActTurntable.py
index 9e0d8ea..109519a 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActTurntable.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActTurntable.py
@@ -59,7 +59,6 @@
             continue
         
         # 过天重置
-        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TurntableLoginState % actNum, 0)
         AddTurntableUseCountByLogin(curPlayer, actNum)
         Sync_TurntablePlayerInfo(curPlayer, actNum)
         
@@ -132,9 +131,13 @@
 
 def AddTurntableUseCountByLogin(curPlayer, actNum):
     ## 登录增加转盘次数
-    if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TurntableLoginState % actNum):
+    todayTime = GameWorld.GetTodayTime()
+    loginState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TurntableLoginState % actNum)
+    if loginState == todayTime:
+        GameWorld.DebugLog("登录增加转盘次数,已经增加过: actNum=%s,todayTime=%s" % (actNum, todayTime))
         return
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TurntableLoginState % actNum, 1)
+    GameWorld.DebugLog("登录增加转盘次数: actNum=%s,todayTime=%s" % (actNum, todayTime))
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TurntableLoginState % actNum, todayTime)
     AddTurntableUseCount(curPlayer, actNum, 1)
     return
 

--
Gitblit v1.8.0