8706 【主干】【后端】1元:10仙玉的设定废除(增加充值转化经验配置,VIP等级经验获取修改);
| | |
| | | float PayRMBNum; //付费额度,元
|
| | | DWORD CTGID; //对应充值ID
|
| | | DWORD GiftbagID; //对应限时礼包编号
|
| | | DWORD CoinExp; //对应转化经验
|
| | | };
|
| | |
|
| | | //充值表
|
| | |
| | | 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, "充值失败!请查看服务端日志!")
|
| | |
| | | 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
|
| | |
| | | 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 最小值
|
| | |
| | | ("float", "PayRMBNum", 0),
|
| | | ("DWORD", "CTGID", 0),
|
| | | ("DWORD", "GiftbagID", 0),
|
| | | ("DWORD", "CoinExp", 0),
|
| | | ),
|
| | |
|
| | | "CTG":(
|
| | |
| | | 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(): |
| | |
| | |
|
| | | 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):
|
| | |
| | | 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:
|
| | |
| | | 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)
|
| | |
| | | if notifyMark:
|
| | | PlayerControl.WorldNotify(0, notifyMark, [curPlayer.GetName()])
|
| | |
|
| | | addVIPExp = int(orderCoin / 100 * GetCoinRate())
|
| | | addVIPExp = coinExp
|
| | | PlayerVip.AddVIPExp(curPlayer, addVIPExp)
|
| | |
|
| | | changeCoinPointBefore = curPlayer.GetChangeCoinPointTotal()
|
| | |
| | | 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)
|
| | |
|
| | |
| | | if not curPlayer or curPlayer.IsEmpty():
|
| | | return
|
| | |
|
| | | Result = GMCommon.Def_Success
|
| | | Result = GMCommon.Def_Unknow
|
| | | orderId, value, appID, isAddBourseMoney, isResult = packCMDList
|
| | |
|
| | | goldBefore = curPlayer.GetGold()
|
| | |
| | | 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)
|
| | |
| | | "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)
|
| | |
|