From fc5fd9311176af2e5a8ea21f51c44df45e87cabf Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 04 十二月 2018 19:53:48 +0800
Subject: [PATCH] 4806 【后端】【1.3.100】每个档位首充双倍新增开启开关

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py |   62 ++++++++++++++++++++----------
 1 files changed, 41 insertions(+), 21 deletions(-)

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 4ecf0bd..954cf21 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py
@@ -49,6 +49,8 @@
 import OpenServerCampaign
 import ItemCommon
 
+import time
+
 #---------------------------------------------------------------------
 #注意: GetChangeCoinPointTotal 充值点和赠送点总和
 #     GetPrizeCoinPointTotal  赠送点总和
@@ -57,30 +59,48 @@
 def GetCoinRate(): return IpyGameDataPY.GetFuncCfg("PayRMB")
 
 def OnLogin(curPlayer):
-    
-    # 重置充值次数
-    if not GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_VersionFix, ChConfig.Def_VerFix_CTGDoublePrize):
-        GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_VersionFix, ChConfig.Def_VerFix_CTGDoublePrize, 1)
-        ipyDataMgr = IpyGameDataPY.IPY_Data()
-        for i in xrange(ipyDataMgr.GetCTGCount()):
-            ipyData = ipyDataMgr.GetCTGByIndex(i)
-            recordID = ipyData.GetRecordID()
-            totalBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CTGGoodsBuyCount % recordID)
-            todayBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TodayCTGCount % recordID)
-            if not totalBuyCount and not todayBuyCount:
-                continue
-            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CTGGoodsBuyCount % recordID, 0)
-            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TodayCTGCount % recordID, 0)
-            drDict = {"PlayerID":curPlayer.GetPlayerID(),"AccID":curPlayer.GetAccID(), "totalBuyCount":totalBuyCount, "todayBuyCount":todayBuyCount, "recordID":recordID}
-            DataRecordPack.SendEventPack("ResetCTGCount", drDict, curPlayer)
-            GameWorld.Log("重置充值次数: recordID=%s,totalBuyCount=%s,todayBuyCount=%s" 
-                          % (recordID, totalBuyCount, todayBuyCount), curPlayer.GetPlayerID())
-    else:
-        GameWorld.DebugLog("已经重置过充值次数!")
-            
+    DoResetCTGCount(curPlayer) 
     Sync_CoinToGoldCountInfo(curPlayer)
     return
 
+def DoResetCTGCount(curPlayer):
+    # 重置充值次数
+    ctgResetTimeYMD = IpyGameDataPY.GetFuncCfg("CTG", 1)
+    if not ctgResetTimeYMD:
+        return
+    if not isinstance(ctgResetTimeYMD, int):
+        GameWorld.ErrLog("充值重置时间配置必须是数值格式,不能包含符号!")
+        return
+    curTime = int(time.time())
+    playerID = curPlayer.GetPlayerID()
+    resetTime = GameWorld.ChangeTimeStrToNum(str(ctgResetTimeYMD), "%Y%m%d")
+    if curTime < resetTime:
+        #GameWorld.DebugLog("还未到达充值充值次数时间!curTime=%s < resetTime=%s" % (curTime, resetTime), playerID)
+        return
+    playerResetTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CTGCountResetTime)
+    if playerResetTime == resetTime:
+        #GameWorld.DebugLog("已经重置过充值次数!resetTime=%s" % resetTime, playerID)
+        return
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CTGCountResetTime, resetTime)
+    
+    ipyDataMgr = IpyGameDataPY.IPY_Data()
+    for i in xrange(ipyDataMgr.GetCTGCount()):
+        ipyData = ipyDataMgr.GetCTGByIndex(i)
+        recordID = ipyData.GetRecordID()
+        totalBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CTGGoodsBuyCount % recordID)
+        todayBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TodayCTGCount % recordID)
+        if not totalBuyCount and not todayBuyCount:
+            continue
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CTGGoodsBuyCount % recordID, 0)
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TodayCTGCount % recordID, 0)
+        drDict = {"PlayerID":curPlayer.GetPlayerID(),"AccID":curPlayer.GetAccID(), "ResetTimeYMD":ctgResetTimeYMD,
+                  "totalBuyCount":totalBuyCount, "todayBuyCount":todayBuyCount, "recordID":recordID}
+        DataRecordPack.SendEventPack("ResetCTGCount", drDict, curPlayer)
+        GameWorld.Log("重置充值次数: ResetTimeYMD=%s,recordID=%s,totalBuyCount=%s,todayBuyCount=%s" 
+                      % (ctgResetTimeYMD, recordID, totalBuyCount, todayBuyCount), playerID)
+    return
+
+
 def OnDay(curPlayer):
     syncRecordIDList = []
     ipyDataMgr = IpyGameDataPY.IPY_Data()

--
Gitblit v1.8.0