From 421eadc84191ded11ddb126eb92cffb6f6edf7ee Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期六, 20 一月 2024 11:40:10 +0800
Subject: [PATCH] 10076 越南sdk接入(充值改美元验证)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py |   17 ++++++++++++-----
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/CommFunc.py          |    7 +++----
 ServerPython/CoreServerGroup/GameServer/Script/CommFunc.py                               |    4 ++--
 3 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/CommFunc.py b/ServerPython/CoreServerGroup/GameServer/Script/CommFunc.py
index 428a919..698833f 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/CommFunc.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/CommFunc.py
@@ -559,12 +559,12 @@
         
     return ""
 
-def RMBToCoin(floatRMB):
+def RMBToCoin(floatRMB, rate=1):
     ''' 元转为coin,统一函数,方便修改及搜索
     @param floatRMB: 单位元,float 类型,支持 RMB 或 美元
+    @param rate: 转化比例,越南版本配表及coin均使用越南盾原值,即比例为1:1,故默认值改1
     @return: 转化为coin数值
     '''
     # 由于float会有不精确的现象出现xxx.9999999或xxx.0000000000001的问题,所以这里计算出的结果向上取整
-    rate = 1 # 越南版本配表及coin均使用越南盾原值,即比例为1:1
     return int(math.ceil(round(floatRMB * rate)))
 
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/CommFunc.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/CommFunc.py
index ac67dc6..497d008 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/CommFunc.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/CommFunc.py
@@ -592,21 +592,20 @@
         
     return ""
 
-def CoinToYuan(orderCoin):
+def CoinToYuan(orderCoin, rate=1):
     '''coin转化为元
     '''
-    rate = 1
     yuan = orderCoin / float(rate)
     if str(yuan).endswith(".0"):
         return int(yuan)
     return yuan
 
-def RMBToCoin(floatRMB):
+def RMBToCoin(floatRMB, rate=1):
     ''' 元转为coin,统一函数,方便修改及搜索
     @param floatRMB: 单位元,float 类型,支持 RMB 或 美元
+    @param rate: 转化比例,越南版本配表及coin均使用越南盾原值,即比例为1:1,故默认值改1
     @return: 转化为coin数值
     '''
     # 由于float会有不精确的现象出现xxx.9999999或xxx.0000000000001的问题,所以这里计算出的结果向上取整
-    rate = 1 # 越南版本配表及coin均使用越南盾原值,即比例为1:1
     return int(math.ceil(round(floatRMB * rate)))
 
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 89c096e..dae9168 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py
@@ -270,7 +270,7 @@
     if not ipyData:
         return
     cPlayerCoin = CPY_PlayerCoinToGold()
-    cPlayerCoin.useCoin = CommFunc.RMBToCoin(ipyData.GetPayRMBNum())
+    cPlayerCoin.useCoin = CommFunc.RMBToCoin(ipyData.GetUsdMoney(), 100)
     cPlayerCoin.orderInfo = orderInfo
     cPlayerCoin.appID = appID
     cPlayerCoin.orderID = ""
@@ -367,7 +367,7 @@
         return
     
     cPlayerCoin = CPY_PlayerCoinToGold()
-    cPlayerCoin.useCoin = CommFunc.RMBToCoin(ipyData.GetPayRMBNum())
+    cPlayerCoin.useCoin = CommFunc.RMBToCoin(ipyData.GetUsdMoney(), 100)
     cPlayerCoin.orderInfo = orderInfo
     cPlayerCoin.appID = appID
     cPlayerCoin.isAddBourseMoney = isAddBourseMoney
@@ -404,9 +404,16 @@
         DataRecordPack.DR_CTGError(curPlayer, "Can not found the orderInfo.", addDRDict)
         return
     
-    payRMBNum = ipyData.GetPayRMBNum() # 越南版本配表及coin均使用越南盾原值
-    if orderCoin != CommFunc.RMBToCoin(payRMBNum):
-        DataRecordPack.DR_CTGError(curPlayer, "The orderCoin is not equal to the ipyData's RMB(%s)!" % payRMBNum, addDRDict)
+    # 越南版本配表及coin均使用越南盾原值,但是验证用美元验证
+    GameWorld.Log("越南充值验证美元: orderInfo=%s,orderCoin=%s,orderID=%s" % (orderInfo, orderCoin, orderID), curPlayer.GetPlayerID())
+    orderCoinUsd = orderCoin # 入库的是美元分
+    orderCoin = CommFunc.RMBToCoin(ipyData.GetPayRMBNum()) # 游戏内orderCoin转化为越南盾
+    usdMoney = ipyData.GetUsdMoney()
+    GameWorld.Log("    转化后: orderInfo=%s,orderCoin=%s,orderCoinUsd=%s" % (orderInfo, orderCoin, orderCoinUsd), curPlayer.GetPlayerID())
+    addDRDict["orderCoin"] = orderCoin
+    addDRDict["orderCoinUsd"] = orderCoinUsd
+    if orderCoinUsd != CommFunc.RMBToCoin(usdMoney, 100):
+        DataRecordPack.DR_CTGError(curPlayer, "The orderCoinUsd is not equal to the ipyData's UsdMoney(%s)!" % usdMoney, addDRDict)
         return
     
     if payOrderType == PayOrderType_PayCoin:

--
Gitblit v1.8.0