From 406c1a6775ef7dde34ba379843322bd2d5ca23d2 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 02 十二月 2025 16:29:24 +0800
Subject: [PATCH] 320 【付费内容】商城-服务端(xssg充值回调接口;游戏服务器兑换充值商品逻辑修改;)

---
 /dev/null                                                                                                |   44 -------
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/GameWorldEvent.py     |    5 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py                   |    2 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py                 |   30 +++-
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py                         |    4 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyGameData.py                        |    2 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyMongoDB/LogicProcess/UserCtrlDB.py |  251 +++++++++++++++++++++++++++--------------
 7 files changed, 195 insertions(+), 143 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py
index 46527c9..634940b 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py
@@ -1445,6 +1445,10 @@
     paInfoList = infoList[:-2]
     platformAccID = Def_AccID_Split_Sign.join(paInfoList)
     return platformAccID
+def GetAppIDByAccID(gameAccID):
+    ## 根据账号获取appID
+    infoList = gameAccID.split(Def_AccID_Split_Sign)
+    return infoList[-2]
 
 def GetSessionID(curPlayer):
     return md5.md5(curPlayer.GetAccID() + curPlayer.GetAccountData().GetLastLoginTime() +'mobile').hexdigest()
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/GameWorldEvent.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/GameWorldEvent.py
index 5f661d2..b907893 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/GameWorldEvent.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/GameWorldEvent.py
@@ -17,6 +17,7 @@
 
 import DBDataMgr
 import GameWorld
+import PyMongoMain
 import PlayerFamily
 import IpyGameDataPY
 import IPY_GameWorld
@@ -69,7 +70,7 @@
 #调用该函数时,C++已经设置好区服,如果改变区服需重启
 def StartDB(tick):
     #初始化数据库, 恢复备档(按区服记录), 加载静态表
-    from PyMongoDB import PyMongoMain
+    #from PyMongoDB import PyMongoMain
     PyMongoMain.StartDB()
     InitGameWorld(tick)
     return
@@ -256,6 +257,8 @@
         CheckCloseMapOK()
         return
     
+    PyMongoMain.GetUserCtrlDB().onSecondProcess()
+    
     OnMinute(tick)
     
     # 其他逻辑
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
index 64d44b9..6fe71fd 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
@@ -735,7 +735,7 @@
         PlayerTravel.OnPlayerLogin(curPlayer)
         
         # 上线查询一次充值订单
-        curPlayer.SendDBQueryRecharge()
+        # curPlayer.SendDBQueryRecharge() 不查了,由在线轮询触发即可
         
     # 通知GameServer地图最终登录成功了
     isMixServerFirstLogin = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_MixServerFirstLogin)
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 b44dfb8..ddfddca 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py
@@ -238,11 +238,11 @@
 #    tagHead        Head;
 #};
 def OnQueryRecharge(index, packData, tick):
-    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
-    if tick - curPlayer.GetDictByKey("QRtick") < 10000:
-        return
-    curPlayer.SetDict("QRtick", tick)
-    curPlayer.SendDBQueryRecharge()
+    #curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
+    #if tick - curPlayer.GetDictByKey("QRtick") < 10000:
+    #    return
+    #curPlayer.SetDict("QRtick", tick)
+    #curPlayer.SendDBQueryRecharge() 不查了,由在线轮询触发即可
     return
 
 #// A1 23 查询充值次数 #tagCMQueryCoinToGoldCount
@@ -409,6 +409,15 @@
     cPlayerCoin.isAddBourseMoney = isAddBourseMoney
     return PlayerCoinToGold(curPlayer, cPlayerCoin, eventName)
 
+def OnDBPushRecharge(curPlayer, orderID, orderInfo, orderAmount):
+    cPlayerCoin = CPY_PlayerCoinToGold()
+    cPlayerCoin.useCoin = orderAmount
+    cPlayerCoin.orderID = orderID
+    cPlayerCoin.orderInfo = orderInfo
+    cPlayerCoin.isAddBourseMoney = True
+    GameWorld.Log("OnDBPushRecharge: useCoin=%s,orderInfo=%s,orderID=%s" % (cPlayerCoin.useCoin, cPlayerCoin.orderInfo, cPlayerCoin.orderID), curPlayer.GetPlayerID())
+    return PlayerCoinToGold(curPlayer, cPlayerCoin, ChConfig.Def_GiveMoney_CoinToGold)
+
 ##特别说明:充值赠送点券都要计算到各个活动中
 ##玩家点卷兑换元宝.
 # @param curPlayer 玩家实例
@@ -422,12 +431,15 @@
     orderInfo = chargeInfo.GetOrderInfo() # 商品编号
     orderID = chargeInfo.GetOrderID() #订单号,兑换成功后清除
     isAddBourseMoney = chargeInfo.GetIsAddBourseMoney()
-    if orderID:
-        curPlayer.SendDBFinishRecharge(orderID)
-        
+    #if orderID:
+    #    curPlayer.SendDBFinishRecharge(orderID)
+    
     appID = chargeInfo.GetAppID()
     if not appID:
         appID = GameWorld.GetPlayerPlatform(curPlayer)
+    if not appID:
+        appID = GameWorld.GetAppIDByAccID(curPlayer.GetAccID())
+        GameWorld.DebugLog("GetAppIDByAccID appID=%s" % appID)
     addDRDict = {"orderCoin":orderCoin, "orderInfo":orderInfo, "orderID":orderID, 
                  "isAddBourseMoney":isAddBourseMoney, "eventName":eventName, "appID":appID}
     
@@ -506,7 +518,7 @@
     recordID = ctgIpyData.GetRecordID() if ctgIpyData else 0
     Sync_CoinToGoldReport(curPlayer, orderID, orderCoin, recordID, orderInfo)
     
-    curPlayer.SendDBQueryRecharge()
+    #curPlayer.SendDBQueryRecharge() 不查了,由在线轮询触发即可
     return True
 
 def __GetCTGInfoByID(curPlayer, recordID, addDRDict):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GetCoinReq.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GetCoinReq.py
deleted file mode 100644
index 4aea7fb..0000000
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GetCoinReq.py
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/usr/bin/python
-# -*- coding: GBK -*-
-#-------------------------------------------------------------------------------
-#
-#-------------------------------------------------------------------------------
-#
-##@package Player.RemoteQuery.GY_Query_GetCoinReq
-#
-# @todo:请求点券
-# @author hxp
-# @date 2015-5-27
-# @version 1.1
-#
-# @change: "2016-08-22 16:30" hxp 返回玩家名及等级
-#
-# 详细描述: 请求点券
-#
-#---------------------------------------------------------------------
-"""Version = 2016-08-22 16:30"""
-#---------------------------------------------------------------------
-
-import GameWorld
-#---------------------------------------------------------------------
-
-## 请求逻辑
-#  @param query_Type 请求类型
-#  @param query_ID 请求的玩家ID
-#  @param packCMDList 发包命令 [ ]
-#  @param tick 当前时间
-#  @return resultDisc
-#  @remarks 函数详细说明.
-def DoLogic(query_Type, query_ID, packCMDList, tick):
-    curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(query_ID)
-    
-    if not curPlayer or curPlayer.IsEmpty():
-        return ''
-    
-    if not curPlayer.GetMapLoadOK():
-        return ''
-    
-    #查询当前玩家点券数目
-    curPlayer.SendDBQueryRecharge()
-    
-    playerInfoDict = {
-                      'Name':curPlayer.GetPlayerName(),  # 玩家名
-                      'LV':curPlayer.GetLV(),  #玩家等级
-                      }
-    GameWorld.DebugLog("GY_Query_GetCoinReq playerInfoDict=%s" % playerInfoDict)
-    resultMsg = str([packCMDList[0], playerInfoDict, 'GMT_GetCoinReq'])
-    GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, 'GMToolResult', 
-                                                              resultMsg, len(resultMsg))
-    return ''
-    
-    
-    
-    
-    
\ No newline at end of file
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GetCoinReqs.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GetCoinReqs.py
deleted file mode 100644
index a6875b9..0000000
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GetCoinReqs.py
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/usr/bin/python
-# -*- coding: GBK -*-
-#-------------------------------------------------------------------------------
-#
-##@package Player.RemoteQuery.GY_Query_GetCoinReqs
-#
-# @todo:请求点券
-# @author hxp
-# @date 2025-02-11
-# @version 1.0
-#
-# 详细描述: 请求点券
-#
-#-------------------------------------------------------------------------------
-#"""Version = 2025-02-11 04:30"""
-#-------------------------------------------------------------------------------
-
-import GameWorld
-
-## 请求逻辑
-#  @param query_Type 请求类型
-#  @param query_ID 请求的玩家ID
-#  @param packCMDList 发包命令 [ ]
-#  @param tick 当前时间
-#  @return resultDisc
-#  @remarks 函数详细说明.
-def DoLogic(query_Type, query_ID, packCMDList, tick):
-    curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(query_ID)
-    
-    if not curPlayer or curPlayer.IsEmpty():
-        return ''
-    
-    if not curPlayer.GetMapLoadOK():
-        return ''
-    
-    #查询当前玩家点券数目
-    curPlayer.SendDBQueryRecharge()
-    GameWorld.DebugLog("GY_Query_GetCoinReqs %s" % query_ID, curPlayer.GetPlayerID())
-    return ''
-    
-    
-    
-    
-    
\ No newline at end of file
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyGameData.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyGameData.py
index 30ce84f..4365f84 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyGameData.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyGameData.py
@@ -30,6 +30,8 @@
 g_pyGameDataManager = None
 
 g_dbPlayerIDMap = {} # 本服DBPlayer玩家表ID映射关系 {playerID:accID, ...}
+g_onlineAccIDList = [] # 在线玩家账号列表 [accID, ...]
+g_ctgOrderIDList = [] # 正在兑换商品中的充值订单ID [orderID, ...]
 
 g_onlineMgr = None
 
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyMongoDB/LogicProcess/UserCtrlDB.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyMongoDB/LogicProcess/UserCtrlDB.py
index 2605dea..4f0250d 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyMongoDB/LogicProcess/UserCtrlDB.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyMongoDB/LogicProcess/UserCtrlDB.py
@@ -19,6 +19,7 @@
 from ServerClientShareDefine import *
 import ConfigParser
 import IpyGameDataPY
+import PlayerCoin
 #import IPY_GameWorld
 #from Config import (DBConfig,)
 DBConfig = __import__('Config.DBConfig')
@@ -402,6 +403,16 @@
             CheckGameVersion()
             self.loadDBPlayerIDMap()
             
+        return
+    
+    def onSecondProcess(self):
+        '''子类实现 - 每秒处理'''
+        if not self.Connected:
+            return
+        if self.IsMergeServer():
+            pass
+        else:
+            self.OnQueryRechargeByLoop()
         return
     
     def loadDBPlayerIDMap(self):
@@ -1226,86 +1237,147 @@
     def OnFinishRecharge(self, db, pack):
         # map完成兑换,假设此处没有回复,则此单变成丢单,暂由人工维护
         # 若真频繁发生则改为上线恢复
-        try:
-            buf = pack.getBuffer()
-            packLen = pack.getLength()
-            recvPack = RecvPackProtocol.tagMDFinishRecharge()
-            pos = 0
-            recvPack.ReadData(buf, pos)
-            orderID = recvPack.OrderID.strip(chr(0))
-            mylog.debug('OnFinishRecharge ...%s'%orderID)
-        
-            col = db[UCN_PayInfo]
-            result = col.find({"OrderID":orderID})
+        return
+#        try:
+#            buf = pack.getBuffer()
+#            packLen = pack.getLength()
+#            recvPack = RecvPackProtocol.tagMDFinishRecharge()
+#            pos = 0
+#            recvPack.ReadData(buf, pos)
+#            orderID = recvPack.OrderID.strip(chr(0))
+#            mylog.debug('OnFinishRecharge ...%s'%orderID)
+#        
+#            col = db[UCN_PayInfo]
+#            result = col.find({"OrderID":orderID})
+#            
+#            if not result or result.count() == 0:
+#                # 没有充值订单
+#                return
+#            
+#            curTime = datetime.datetime.today()
+#            curTimeStr = str(curTime)
+#            curTimeStr = curTimeStr.split(".")[0]
+#            col.update({"OrderID":orderID}, {"$set":{"IsProcess":1, 'EndOrderTime':curTimeStr}})
+#            
+#            mylog.debug('OnFinishRecharge OrderID = %s'%(orderID))
+#
+#            return
+#        except Exception, e:
+#            msg = error.formatMsg('error', error.ERROR_NO_170, "OnFinishRecharge error %s!pack = %s"%(e, binascii.b2a_hex(buf)))
+#            mylog.error(msg)
+#        except:
+#            msg = error.formatMsg('error', error.ERROR_NO_170, "OnFinishRecharge error!pack = %s"%(binascii.b2a_hex(buf)))
+#            mylog.error(msg)
+#        return
+    
+    def OnQueryRechargeByLoop(self):
+        '''定时处理充值订单兑换' 每秒处理一次
+            充值流程
+            客户端支付商品 -> 平台回调游戏中心服务器 -> 游戏服务器插入订单tagPayInfo
+            商品兑换旧流程:
+            curPlayer.SendDBQueryRecharge() -> gstQueryRecharge -> OnQueryRecharge -> 【GameServerRefresh.PushRecharge】 -> PlayerCoin.PlayerCoinToGold ->
+                -> curPlayer.SendDBFinishRecharge(orderID) -> gstFinishRecharge -> OnFinishRecharge
+            发起方式:
+            1. 游戏服务器每秒轮询未处理的订单进行兑换商品 -> MT_GetCoinReqs -> curPlayer.SendDBQueryRecharge()
+            2. A8 06 查询充值结果 #tagCMQueryRecharge -> curPlayer.SendDBQueryRecharge()
             
-            if not result or result.count() == 0:
-                # 没有充值订单
+            商品兑换新流程:
+            1. 游戏服务器每秒轮询未处理的订单进行兑换商品 -> 直接调用 PlayerCoin.OnDBPushRecharge -> 直接更新订单 IsProcess
+            2. 废弃, A8 06 查询充值结果 #tagCMQueryRecharge,只使用后端轮询即可,后续有问题再补充优化
+        '''
+        PayRechargeCount = 5 # 单次处理条数
+        if PayRechargeCount <= 0:
+            return
+        if not PyGameData.g_onlineAccIDList:
+            return
+        if PyGameData.g_ctgOrderIDList:
+            GameWorld.DebugLog("还有正在处理兑换商品的充值订单! %s" % PyGameData.g_ctgOrderIDList)
+            return
+        try:
+            col = self.db[UCN_PayInfo]
+            spec = {'AccID':{'$in':PyGameData.g_onlineAccIDList}, 'IsProcess':0}
+            fields = {"_id":0, "AccID":1, "OrderID":1, "OrderInfo":1, "OrderAmount":1}
+            result = col.find(spec, fields).limit(PayRechargeCount)
+            if not result or not result.count():
+                # 没有在线玩家未兑换的充值订单
                 return
             
             curTime = datetime.datetime.today()
             curTimeStr = str(curTime)
             curTimeStr = curTimeStr.split(".")[0]
-            col.update({"OrderID":orderID}, {"$set":{"IsProcess":1, 'EndOrderTime':curTimeStr}})
             
-            mylog.debug('OnFinishRecharge OrderID = %s'%(orderID))
-
-            return
-        except Exception, e:
-            msg = error.formatMsg('error', error.ERROR_NO_170, "OnFinishRecharge error %s!pack = %s"%(e, binascii.b2a_hex(buf)))
-            mylog.error(msg)
+            for billInfo in result:
+                accID = fix_outgoingText(billInfo['AccID'])
+                orderID = fix_outgoingText(billInfo['OrderID'])
+                orderInfo = fix_outgoingText(billInfo['OrderInfo'])
+                orderAmount = billInfo['OrderAmount']
+                curPlayer = GameWorld.GetPlayerManager().FindPlayerByAccID(accID)
+                if not curPlayer or curPlayer.IsEmpty():
+                    GameWorld.Log("充值兑换商品时玩家不在线! accID=%s,orderAmount=%s,orderInfo=%s,orderID=%s" % (accID, orderAmount, orderInfo, orderID))
+                    continue
+                if orderID in PyGameData.g_ctgOrderIDList:
+                    continue
+                PyGameData.g_ctgOrderIDList.append(orderID)
+                # 直接设置为已处理,订单如果实际异常未到账的情况由人工补偿处理
+                col.update({"OrderID":orderID}, {"$set":{"IsProcess":1, 'EndOrderTime':curTimeStr}})
+                PlayerCoin.OnDBPushRecharge(curPlayer, orderID, orderInfo, orderAmount)
+                
         except:
-            msg = error.formatMsg('error', error.ERROR_NO_170, "OnFinishRecharge error!pack = %s"%(binascii.b2a_hex(buf)))
+            msg = error.formatMsg('error', error.ERROR_NO_170, "traceback = %s" % (traceback.format_exc()))
             mylog.error(msg)
+            
+        PyGameData.g_ctgOrderIDList = []
         return
-    
     
     def OnQueryRecharge(self, db, pack):
         # map查询新的充值订单, 查询充值表
-        try:
-            buf = pack.getBuffer()
-            packLen = pack.getLength()
-            recvPack = RecvPackProtocol.tagMDQueryRecharge()
-            pos = 0
-            recvPack.ReadData(buf, pos)
-            account = recvPack.Account.strip(chr(0))
-            mylog.debug('OnQueryRecharge ...%s'%account)
-        
-            col = db[UCN_PayInfo]
-            result = col.find({'AccID':account, 'IsProcess':0, 'EndOrderTime':0})
-            
-            if not result or result.count() == 0:
-                # 没有充值订单
-                return
-            
-            # 一单一单发
-            # 先设置IsProcess为1兑换中,等回复结果在真正完成订单
-            billInfo = result[0]
-            
-            sendPack = SendPackProtocol.tagDMRechargePush()
-            sendPack.Type = CommonDefine.dgDBToMapServer
-            sendPack.SubType = CommonDefine.gmReChargePush
-            sendPack.OrderID = fix_outgoingText(billInfo['OrderID'])
-            sendPack.OrderIDLen = len(sendPack.OrderID)
-            sendPack.OrderInfo = fix_outgoingText(billInfo['OrderInfo'])
-            sendPack.OrderInfoLen = len(sendPack.OrderInfo)
-            sendPack.Money = int(billInfo['OrderAmount'])
-            sendPack.Extras = fix_outgoingText(billInfo['Extras'])
-            sendPack.ExtrasLen = len(sendPack.Extras)
-            
-            col.update({"OrderID":sendPack.OrderID}, {"$set":{"IsProcess":1}})
-            
-            self.sendString(pack, sendPack.GetBuffer())
-            mylog.debug('OnQueryRecharge OrderID = %s'%(sendPack.OrderID))
-            #mylog.debug('send %s'%sendPack.OutputString())
-            return
-        except Exception, e:
-            msg = error.formatMsg('error', error.ERROR_NO_170, "OnQueryRecharge error %s!pack = %s"%(e, binascii.b2a_hex(buf)))
-            mylog.error(msg)
-        except:
-            msg = error.formatMsg('error', error.ERROR_NO_170, "OnQueryRecharge error!pack = %s"%(binascii.b2a_hex(buf)))
-            mylog.error(msg)
-        
+        # 暂废弃
         return
+#        try:
+#            buf = pack.getBuffer()
+#            packLen = pack.getLength()
+#            recvPack = RecvPackProtocol.tagMDQueryRecharge()
+#            pos = 0
+#            recvPack.ReadData(buf, pos)
+#            account = recvPack.Account.strip(chr(0))
+#            mylog.debug('OnQueryRecharge ...%s'%account)
+#        
+#            col = db[UCN_PayInfo]
+#            result = col.find({'AccID':account, 'IsProcess':0, 'EndOrderTime':0})
+#            
+#            if not result or result.count() == 0:
+#                # 没有充值订单
+#                return
+#            
+#            # 一单一单发
+#            # 先设置IsProcess为1兑换中,等回复结果在真正完成订单
+#            billInfo = result[0]
+#            
+#            sendPack = SendPackProtocol.tagDMRechargePush()
+#            sendPack.Type = CommonDefine.dgDBToMapServer
+#            sendPack.SubType = CommonDefine.gmReChargePush
+#            sendPack.OrderID = fix_outgoingText(billInfo['OrderID'])
+#            sendPack.OrderIDLen = len(sendPack.OrderID)
+#            sendPack.OrderInfo = fix_outgoingText(billInfo['OrderInfo'])
+#            sendPack.OrderInfoLen = len(sendPack.OrderInfo)
+#            sendPack.Money = int(billInfo['OrderAmount'])
+#            sendPack.Extras = fix_outgoingText(billInfo['Extras'])
+#            sendPack.ExtrasLen = len(sendPack.Extras)
+#            
+#            col.update({"OrderID":sendPack.OrderID}, {"$set":{"IsProcess":1}})
+#            
+#            self.sendString(pack, sendPack.GetBuffer())
+#            mylog.debug('OnQueryRecharge OrderID = %s'%(sendPack.OrderID))
+#            #mylog.debug('send %s'%sendPack.OutputString())
+#            return
+#        except Exception, e:
+#            msg = error.formatMsg('error', error.ERROR_NO_170, "OnQueryRecharge error %s!pack = %s"%(e, binascii.b2a_hex(buf)))
+#            mylog.error(msg)
+#        except:
+#            msg = error.formatMsg('error', error.ERROR_NO_170, "OnQueryRecharge error!pack = %s"%(binascii.b2a_hex(buf)))
+#            mylog.error(msg)
+#        
+#        return
     
     def OnQueryNewGuyCardState(self, db, pack):
         try:
@@ -1501,8 +1573,11 @@
             DataDumper.DumpData(GlobalFunctions.getAppPath(), 'UserLogs\\SaveFailDump', '%s.mdat'%playerID, saveData)      
 
             
+        if accID in PyGameData.g_onlineAccIDList:
+            PyGameData.g_onlineAccIDList.remove(accID)
+            
         # 玩家下线恢复充值兑换中的订单,IsProcee为1,但endtime为空的情况
-        self.RevoverBillProcess(db, accID)
+        #self.RevoverBillProcess(db, accID)
         mylog.info("onSaveMapServerPlayerData result = %s, playerID = %s"%(result, playerID))
         
         # 下线成功入库后同步移动玩家备档备份文件夹
@@ -1610,26 +1685,24 @@
         return
     
     # 玩家下线恢复充值兑换中的订单,IsProcee为1,但endtime为空的情况
-    def RevoverBillProcess(self, db, accID):
-        try:
-            if not accID:
-                return
-            account = accID.strip(chr(0))
-            col = db[UCN_PayInfo]
-            result = col.find({'AccID':account, 'IsProcess':1, 'EndOrderTime':0})
-            
-            if not result or result.count() == 0:
-                # 没有充值订单
-                return
-            
-            # 一单一单 恢复
-            billInfo = result[0]
-            orderID = billInfo['OrderID']
-            col.update({"OrderID":orderID}, {"$set":{"IsProcess":0}})
-
-            mylog.debug('RevoverBillProcess success...%s'%orderID)
-        except:
-            mylog.error("RevoverBillProcess error %s"%traceback.format_exc())
+#    def RevoverBillProcess(self, db, accID):
+#        try:
+#            if not accID:
+#                return
+#            account = accID.strip(chr(0))
+#            col = db[UCN_PayInfo]
+#            result = col.find({'AccID':account, 'IsProcess':1, 'EndOrderTime':0})
+#            
+#            if not result or result.count() == 0:
+#                # 没有充值订单
+#                return
+#            
+#            for billInfo in result:
+#                orderID = billInfo['OrderID']
+#                col.update({"OrderID":orderID}, {"$set":{"IsProcess":0}})
+#                mylog.debug('RevoverBillProcess success...%s'%orderID)
+#        except:
+#            mylog.error("RevoverBillProcess error %s"%traceback.format_exc())
     
     def SavePlayerMapServerData(self, db, saveData):
         playerRec = DataServerPlayerData.tagDBPlayer()
@@ -3291,7 +3364,9 @@
                     sendPack.MapID = GameWorld.GetGameWorld().GetMapID()
                     mylog.info('gstPlayerDetail Send OnCreate accid = %s'%(accountRec.ACCID))
                     NetPackCommon.SendPyPackToMapServerSelf(sendPack.GetBuffer(), sendPack.GetLength())
-
+                    
+        if authAccID not in PyGameData.g_onlineAccIDList:
+            PyGameData.g_onlineAccIDList.append(authAccID)
         return True
     
     def sendOKString(self, type, fromPacket, buf):

--
Gitblit v1.8.0