From 9e850c5e25ea52b4a7cf7e82ca6ce519483a672d Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期三, 20 一月 2021 16:36:20 +0800
Subject: [PATCH] 8706 【主干】【后端】1元:10仙玉的设定废除(增加充值转化经验配置,VIP等级经验获取修改);

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/CTG.py                    |   16 +++++---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/GMShell.py                         |    2 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py                      |    7 ++-
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py                  |   47 +++++++++++++++++------
 PySysDB/PySysDBPY.h                                                                                       |    1 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py                          |   15 +++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTCTG.py |   27 +++++++++----
 7 files changed, 84 insertions(+), 31 deletions(-)

diff --git a/PySysDB/PySysDBPY.h b/PySysDB/PySysDBPY.h
index 5b0eae0..583d346 100644
--- a/PySysDB/PySysDBPY.h
+++ b/PySysDB/PySysDBPY.h
@@ -1229,6 +1229,7 @@
 	float		PayRMBNum;	//付费额度,元
 	DWORD		CTGID;	//对应充值ID
 	DWORD		GiftbagID;	//对应限时礼包编号
+	DWORD		CoinExp;	//对应转化经验
 };
 
 //充值表
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/CTG.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/CTG.py
index 87218f0..ac11d2e 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/CTG.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/CTG.py
@@ -46,17 +46,21 @@
         value2 = str(msgList[1])
         orderInfoIpyData = IpyGameDataPY.GetIpyGameDataNotLog("OrderInfo", ctgValue, value2)
         
-    if not orderInfoIpyData and ctgValue.isdigit():
-        orderRMB = int(ctgValue)
+    orderRMB = GameWorld.ToNumDef(ctgValue, None)
+    if not orderInfoIpyData and orderRMB != None:
         isAddBourseMoney = msgList[1] if len(msgList) > 1 else 1
-        PlayerCoin.PlayerCoinToGoldEx(curPlayer, orderRMB, ChConfig.Def_GiveMoney_CTG, isAddBourseMoney)
+        if not PlayerCoin.PlayerCoinToGoldEx(curPlayer, orderRMB, ChConfig.Def_GiveMoney_CTG, isAddBourseMoney):
+            GameWorld.DebugAnswer(curPlayer, "充值失败!请查看服务端日志!")
+            return
     else:
         orderInfo = ctgValue
         appID = str(msgList[1]) if len(msgList) > 1 else ""
         isAddBourseMoney = msgList[2] if len(msgList) > 2 else 1
-        if not appID:
-            GameWorld.DebugAnswer(curPlayer, "需要指定商品编号所属AppID!")
-            return
+        if not appID or appID == "0":
+            appID = GameWorld.GetPlayerPlatform(curPlayer)
+            if not appID:
+                GameWorld.DebugAnswer(curPlayer, "需要指定商品编号所属AppID!")
+                return
         isOK = PlayerCoin.DoGMCTG(curPlayer, orderInfo, appID, isAddBourseMoney, ChConfig.Def_GiveMoney_CTG)
         if not isOK:
             GameWorld.DebugAnswer(curPlayer, "充值失败!请查看服务端日志!")
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/GMShell.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/GMShell.py
index 928baf0..aae6430 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/GMShell.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/GMShell.py
@@ -104,7 +104,7 @@
             del inputList[0]
             #把剩余参数转换为整型
             for i in range(0, len(inputList)):
-                value = GameWorld.ToIntDef(inputList[i], None)
+                value = GameWorld.ToNumDef(inputList[i], None)
                 if value == None:
                     #GameWorld.DebugAnswer(curPlayer, "参数错误, 必须为纯数字!")
                     continue
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py
index 624c85e..1fe80c9 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py
@@ -400,7 +400,20 @@
         return result
     except ValueError:
         return defValue
-
+    
+def ToNumDef(inputStr, defValue = 0):
+    ## 转为数字,int or float
+    try:
+        if type(inputStr) in [int, float]:
+            return inputStr
+        if inputStr.isdigit():
+            result = int(inputStr)
+        else:
+            result = float(inputStr)
+        return result
+    except ValueError:
+        return defValue
+    
 ##将数字限制在某个范围
 # @param input 输入值
 # @param minNum 最小值
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
index eed5e8a..25eaf1c 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
@@ -988,6 +988,7 @@
                         ("float", "PayRMBNum", 0),
                         ("DWORD", "CTGID", 0),
                         ("DWORD", "GiftbagID", 0),
+                        ("DWORD", "CoinExp", 0),
                         ),
 
                 "CTG":(
@@ -3679,14 +3680,16 @@
         self.AppID = ""
         self.PayRMBNum = 0.0
         self.CTGID = 0
-        self.GiftbagID = 0
+        self.GiftbagID = 0
+        self.CoinExp = 0
         return
         
     def GetOrderInfo(self): return self.OrderInfo # 商品编号
     def GetAppID(self): return self.AppID # appID
     def GetPayRMBNum(self): return self.PayRMBNum # 付费额度,元
     def GetCTGID(self): return self.CTGID # 对应充值ID
-    def GetGiftbagID(self): return self.GiftbagID # 对应限时礼包编号
+    def GetGiftbagID(self): return self.GiftbagID # 对应限时礼包编号
+    def GetCoinExp(self): return self.CoinExp # 对应转化经验
 
 # 充值表
 class IPY_CTG():
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 345a2ac..2004165 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py
@@ -170,22 +170,41 @@
 
 def PlayerCoinToGoldEx(curPlayer, orderRMB, eventName, isAddBourseMoney):
     ## 直接充值自定义金额
+    
+    appID = GameWorld.GetPlayerPlatform(curPlayer)
+    payRMBNum = 1
+    oneRMBIpyData = None # 默认取单位1货币对应充值配置
+    ipyDataMgr = IpyGameDataPY.IPY_Data()
+    for i in xrange(ipyDataMgr.GetOrderInfoCount()):
+        ipyData = ipyDataMgr.GetOrderInfoByIndex(i)
+        # 单位1元配置,不关联充值ID、礼包ID
+        if appID == ipyData.GetAppID() and ipyData.GetPayRMBNum() == payRMBNum and not ipyData.GetCTGID() and not ipyData.GetGiftbagID():
+            oneRMBIpyData = ipyData
+            break
+    if not oneRMBIpyData:
+        GameWorld.ErrLog("Can not found one RMB pay num orderInfo! appID=%s,payRMBNum=%s" % (appID, payRMBNum), curPlayer.GetPlayerID())
+        return
+    
+    oneRMBCoinExp = oneRMBIpyData.GetCoinExp()
+    
     prizeGold = 0
     giveItemList = []
     orderCoin = CommFunc.RMBToCoin(orderRMB)
-    addGold = orderRMB * GetCoinRate()
+    coinExp = int(orderRMB * oneRMBCoinExp)
+    addGold = coinExp # 此方式增加的仙玉 = 直充经验
     addDRDict = {"orderCoin":orderCoin, "isAddBourseMoney":isAddBourseMoney, "eventName":eventName}
-    DoCTGLogic(curPlayer, CoinType_Gold, orderCoin, addGold, prizeGold, giveItemList, isAddBourseMoney, eventName, addDRDict)
-    return
+    DoCTGLogic(curPlayer, CoinType_Gold, orderCoin, addGold, prizeGold, giveItemList, isAddBourseMoney, eventName, addDRDict, coinExp=coinExp)
+    return True
 
 def PlayerItemCTG(curPlayer, orderRMB, eventName, isAddBourseMoney):
     ## 使用赠送的物品兑换点券,一般用于bt版
-    prizeGold = 0
-    giveItemList = []
-    orderCoin = CommFunc.RMBToCoin(orderRMB) # 单位,分
-    addGold = orderRMB * GetCoinRate()
-    addDRDict = {"orderCoin":orderCoin, "eventName":eventName}
-    DoCTGLogic(curPlayer, CoinType_Item, orderCoin, addGold, prizeGold, giveItemList, isAddBourseMoney, eventName, addDRDict)
+    # 20210120 港台主干版暂废弃
+#    prizeGold = 0
+#    giveItemList = []
+#    orderCoin = CommFunc.RMBToCoin(orderRMB) # 单位,分
+#    addGold = orderRMB * GetCoinRate()
+#    addDRDict = {"orderCoin":orderCoin, "eventName":eventName}
+#    DoCTGLogic(curPlayer, CoinType_Item, orderCoin, addGold, prizeGold, giveItemList, isAddBourseMoney, eventName, addDRDict)
     return
 
 def DoGMCTG(curPlayer, orderInfo, appID, isAddBourseMoney, eventName):
@@ -257,8 +276,9 @@
         DataRecordPack.DR_CTGError(curPlayer, "The orderInfo is useless!", addDRDict)
         return
     
+    coinExp = ipyData.GetCoinExp()
     coinType = CoinType_Gold if (ctgIpyData and ctgIpyData.GetPayType() in [2, 3]) else CoinType_Buy # 规定2为直充,其他为直购
-    DoCTGLogic(curPlayer, coinType, orderCoin, addGold, prizeGold, giveItemList, isAddBourseMoney, eventName, addDRDict, ctgIpyData)
+    DoCTGLogic(curPlayer, coinType, orderCoin, addGold, prizeGold, giveItemList, isAddBourseMoney, eventName, addDRDict, ctgIpyData, coinExp)
     
     #充值成功主动查询一次,无充值数量就不会继续查询
     if orderID:
@@ -320,7 +340,7 @@
     Sync_CoinToGoldCountInfo(curPlayer, [recordID])
     return addGold, prizeGold, giveItemList, ipyData
 
-def DoCTGLogic(curPlayer, coinType, orderCoin, addGold, prizeGold, giveItemList, isAddBourseMoney, eventName, addDRDict, ctgIpyData=None):
+def DoCTGLogic(curPlayer, coinType, orderCoin, addGold, prizeGold, giveItemList, isAddBourseMoney, eventName, addDRDict, ctgIpyData=None, coinExp=0):
     notifyMark = ctgIpyData.GetNotifyMark() if ctgIpyData else ""
     goldBefore = curPlayer.GetGold()
     bourseMoneyBefore = PlayerControl.GetMoney(curPlayer, ShareDefine.TYPE_Price_BourseMoney)
@@ -340,7 +360,7 @@
         if notifyMark:
             PlayerControl.WorldNotify(0, notifyMark, [curPlayer.GetName()])
             
-    addVIPExp = int(orderCoin / 100 * GetCoinRate())
+    addVIPExp = coinExp
     PlayerVip.AddVIPExp(curPlayer, addVIPExp)
     
     changeCoinPointBefore = curPlayer.GetChangeCoinPointTotal()
@@ -354,7 +374,8 @@
     changeCoinPointAfter = curPlayer.GetChangeCoinPointTotal()
     bourseMoneyAfter = PlayerControl.GetMoney(curPlayer, ShareDefine.TYPE_Price_BourseMoney)
     addDRDict.update({"gold":[goldBefore, goldAfter], "changeCoinPoint":[changeCoinPointBefore, changeCoinPointAfter], "todayCTGCoinTotal":todayCTGCoinTotal,
-                      "bourseMoney":[bourseMoneyBefore, bourseMoneyAfter], "addGold":addGold, "prizeGold":prizeGold, "giveItemList":giveItemList, "coinType":coinType})
+                      "bourseMoney":[bourseMoneyBefore, bourseMoneyAfter], "addGold":addGold, "prizeGold":prizeGold, "giveItemList":giveItemList, "coinType":coinType,
+                      "coinExp":coinExp})
     
     DataRecordPack.DR_CTGOK(curPlayer, addDRDict)
     
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTCTG.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTCTG.py
index 6474a7f..f0d8ded 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTCTG.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTCTG.py
@@ -44,7 +44,7 @@
     if not curPlayer or curPlayer.IsEmpty():
         return
     
-    Result = GMCommon.Def_Success
+    Result = GMCommon.Def_Unknow
     orderId, value, appID, isAddBourseMoney, isResult = packCMDList
     
     goldBefore = curPlayer.GetGold()
@@ -60,19 +60,30 @@
             errorMsg = "Can not found the orderInfo(%s) and appID(%s)!" % (value, appID)
             
     if errorMsg:
-        GameWorld.Log("GMT_CTG, errorMsg=%s" % errorMsg)
+        GameWorld.Log("GMT_CTG, errorMsg=%s" % errorMsg, query_ID)
         resultMsg = str([orderId, errorMsg, 'GMT_CTG', Result])
         GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, 'GMToolResult', resultMsg, len(resultMsg))
         return
     
-    if not orderInfoIpyData and value.isdigit():
-        orderRMB = int(value)
-        PlayerCoin.PlayerCoinToGoldEx(curPlayer, orderRMB, ChConfig.Def_GiveMoney_GMTCTG, isAddBourseMoney)
+    orderRMB = GameWorld.ToNumDef(value, None)
+    if not orderInfoIpyData and orderRMB != None:
+        if PlayerCoin.PlayerCoinToGoldEx(curPlayer, orderRMB, ChConfig.Def_GiveMoney_GMTCTG, isAddBourseMoney):
+            Result = GMCommon.Def_Success     
+        else:
+            errorMsg = "order error! value(%s)" % (value) 
     else:
         orderInfo = value
-        if not PlayerCoin.DoGMCTG(curPlayer, orderInfo, appID, isAddBourseMoney, ChConfig.Def_GiveMoney_GMTCTG):
-            Result = GMCommon.Def_Unknow
+        if PlayerCoin.DoGMCTG(curPlayer, orderInfo, appID, isAddBourseMoney, ChConfig.Def_GiveMoney_GMTCTG):
+            Result = GMCommon.Def_Success
+        else:
+            errorMsg = "orderInfo error! appID(%s), value(%s)" % (appID, value)
             
+    if Result != GMCommon.Def_Success:
+        GameWorld.Log("GMT_CTG, errorMsg=%s" % errorMsg, query_ID)
+        resultMsg = str([orderId, errorMsg, 'GMT_CTG', Result])
+        GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, 'GMToolResult', resultMsg, len(resultMsg))
+        return
+    
     goldAfter = curPlayer.GetGold()
     changeCoinPointAfter = curPlayer.GetChangeCoinPointTotal()
     bourseMoneyAfter = PlayerControl.GetMoney(curPlayer, ShareDefine.TYPE_Price_BourseMoney)
@@ -81,7 +92,7 @@
                   "gold":[goldBefore, goldAfter], "changeCoinPoint":[changeCoinPointBefore, changeCoinPointAfter], 
                   "bourseMoney":[bourseMoneyBefore, bourseMoneyAfter]}
     
-    GameWorld.Log("GMT_CTG, resultDict=%s" % resultDict)
+    GameWorld.Log("GMT_CTG, resultDict=%s" % resultDict, query_ID)
     #流向 增加金额记录
     DataRecordPack.DR_ToolGMOperate(query_ID, curPlayer.GetPlayerName(), curPlayer.GetAccID(), 'GMT_CTG', resultDict)
     

--
Gitblit v1.8.0