|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import time | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 充值点券处理类型 | 
|---|
|  |  |  | ( | 
|---|
|  |  |  | CoinType_Gold, # 直接充仙玉 | 
|---|
|  |  |  | CoinType_Buy, # 直购,非直接充仙玉的,如RMB直接购买某个物品或激活某个功能 | 
|---|
|  |  |  | CoinType_Item, # 使用物品,类充值仙玉效果,但是有某些功能上的限制,一般是bt版本赠送 | 
|---|
|  |  |  | ) = range(3) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #--------------------------------------------------------------------- | 
|---|
|  |  |  | #注意: GetChangeCoinPointTotal 充值点和赠送点总和 | 
|---|
|  |  |  | #     GetPrizeCoinPointTotal  赠送点总和 | 
|---|
|  |  |  | 
|---|
|  |  |  | orderCoin = orderRMB * 100 | 
|---|
|  |  |  | addGold = orderRMB * GetCoinRate() | 
|---|
|  |  |  | addDRDict = {"orderCoin":orderCoin, "isAddBourseMoney":isAddBourseMoney, "eventName":eventName} | 
|---|
|  |  |  | DoCTGLogic(curPlayer, orderCoin, addGold, prizeGold, giveItemList, isAddBourseMoney, eventName, addDRDict) | 
|---|
|  |  |  | DoCTGLogic(curPlayer, CoinType_Gold, orderCoin, addGold, prizeGold, giveItemList, isAddBourseMoney, eventName, addDRDict) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def PlayerItemCTG(curPlayer, orderRMB, eventName, isAddBourseMoney): | 
|---|
|  |  |  | ## 使用赠送的物品兑换点券,一般用于bt版 | 
|---|
|  |  |  | prizeGold = 0 | 
|---|
|  |  |  | giveItemList = [] | 
|---|
|  |  |  | orderCoin = orderRMB * 100 # 单位,分 | 
|---|
|  |  |  | 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 orderCoin is not equal to the ipyData's RMB(%s)!" % payRMBNum, addDRDict) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | addGold, prizeGold, giveItemList, notifyMark = 0, 0, [], '' | 
|---|
|  |  |  | addGold, prizeGold, giveItemList, ctgIpyData = 0, 0, [], None | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if ipyData.GetCTGID(): | 
|---|
|  |  |  | ctgResultInfo = __GetCTGInfoByID(curPlayer, chargeInfo, ipyData.GetCTGID(), eventName, addDRDict, isAddBourseMoney) | 
|---|
|  |  |  | ctgResultInfo = __GetCTGInfoByID(curPlayer, ipyData.GetCTGID(), addDRDict) | 
|---|
|  |  |  | if not ctgResultInfo: | 
|---|
|  |  |  | return | 
|---|
|  |  |  | addGold, prizeGold, giveItemList, notifyMark = ctgResultInfo | 
|---|
|  |  |  | addGold, prizeGold, giveItemList, ctgIpyData = ctgResultInfo | 
|---|
|  |  |  |  | 
|---|
|  |  |  | elif ipyData.GetGiftbagID(): | 
|---|
|  |  |  | giftbagID = ipyData.GetGiftbagID() | 
|---|
|  |  |  | 
|---|
|  |  |  | DataRecordPack.DR_CTGError(curPlayer, "The orderInfo is useless!", addDRDict) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | DoCTGLogic(curPlayer, orderCoin, addGold, prizeGold, giveItemList, isAddBourseMoney, eventName, addDRDict, notifyMark, ipyData) | 
|---|
|  |  |  | 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) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #充值成功主动查询一次,无充值数量就不会继续查询 | 
|---|
|  |  |  | if orderID: | 
|---|
|  |  |  | 
|---|
|  |  |  | curPlayer.SendDBQueryRecharge() | 
|---|
|  |  |  | return True | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def __GetCTGInfoByID(curPlayer, chargeInfo, recordID, eventName, addDRDict, isAddBourseMoney): | 
|---|
|  |  |  | def __GetCTGInfoByID(curPlayer, recordID, addDRDict): | 
|---|
|  |  |  | ## 根据充值数据ID获取充值信息 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ipyData = IpyGameDataPY.GetIpyGameData("CTG", recordID) | 
|---|
|  |  |  | 
|---|
|  |  |  | addGold = ipyData.GetGainGold() # 获得仙玉数 | 
|---|
|  |  |  | gainGoldPrize = ipyData.GetGainGoldPrize() # 赠送仙玉数,首次充值赠送仙玉时,此仙玉不给 | 
|---|
|  |  |  | firstGoldPrize = ipyData.GetFirstGoldPrize() # 首次充值赠送的仙玉 | 
|---|
|  |  |  | notifyMark = ipyData.GetNotifyMark() | 
|---|
|  |  |  | prizeGold = firstGoldPrize if (not totalBuyCount and firstGoldPrize) else gainGoldPrize | 
|---|
|  |  |  | actPrizeGold = PlayerActRechargePrize.DoAddPlayerActRechargePrizeCount(curPlayer, recordID) | 
|---|
|  |  |  | if actPrizeGold: | 
|---|
|  |  |  | 
|---|
|  |  |  | addDRDict.update({"actRechargePrize":1}) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Sync_CoinToGoldCountInfo(curPlayer, [recordID]) | 
|---|
|  |  |  | return addGold, prizeGold, giveItemList, notifyMark | 
|---|
|  |  |  | return addGold, prizeGold, giveItemList, ipyData | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def DoCTGLogic(curPlayer, orderCoin, addGold, prizeGold, giveItemList, isAddBourseMoney, eventName, addDRDict, notifyMark='', ipyData=None): | 
|---|
|  |  |  | def DoCTGLogic(curPlayer, coinType, orderCoin, addGold, prizeGold, giveItemList, isAddBourseMoney, eventName, addDRDict, ctgIpyData=None): | 
|---|
|  |  |  | notifyMark = ctgIpyData.GetNotifyMark() if ctgIpyData else "" | 
|---|
|  |  |  | goldBefore = curPlayer.GetGold() | 
|---|
|  |  |  | bourseMoneyBefore = PlayerControl.GetMoney(curPlayer, ShareDefine.TYPE_Price_BourseMoney) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | 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}) | 
|---|
|  |  |  | "bourseMoney":[bourseMoneyBefore, bourseMoneyAfter], "addGold":addGold, "prizeGold":prizeGold, "giveItemList":giveItemList, "coinType":coinType}) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | DataRecordPack.DR_CTGOK(curPlayer, addDRDict) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | #OpenServerCampaign.AddOpenServerCampaignRecordData(curPlayer, ShareDefine.Def_Campaign_Type_Recharge, orderCoin) | 
|---|
|  |  |  | PlayerWeekParty.AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_Recharge, addVIPExp) | 
|---|
|  |  |  | #投资 | 
|---|
|  |  |  | if ipyData: | 
|---|
|  |  |  | PlayerGoldInvest.InvestByCTG(curPlayer, ipyData.GetCTGID()) | 
|---|
|  |  |  | GameWorld.Log("Billing: eventName=%s, %s" % (eventName, addDRDict), curPlayer.GetPlayerID()) | 
|---|
|  |  |  | if ctgIpyData: | 
|---|
|  |  |  | PlayerGoldInvest.InvestByCTG(curPlayer, ctgIpyData.GetRecordID()) | 
|---|
|  |  |  | GameWorld.Log("Billing: coinType=%s,eventName=%s, %s" % (coinType, eventName, addDRDict), curPlayer.GetPlayerID()) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #=============================================================================== | 
|---|