Files
Main/Assets/GameAssets/Resources/Lua/Logic/PaySystem/ServerData.lua
2025-01-25 04:38:09 +08:00

127 lines
4.3 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

------------------------------------------------
--作者: dhq
--日期: 2019-05-13
--文件: ServerData.lua
--模块: ServerData
--描述: 充值系统数据表的数据由服务器下发了,这个数据是服务器下发的数据
------------------------------------------------
local RuntimePlatform = CS.UnityEngine.RuntimePlatform
local ServerData =
{
--商品ID
Id = 0,
--配置表ID
CfgId = 0,
--商品名字描述主要用于BI后台数据
Desc = "",
--SDK需要的支付类型
GoodsDealType = 0,
--充值类型 1正常充值,2每日礼包充值...等等具体看配置表
RechargeType = 0,
--只针对Type=1正常充值的情况使用
RechargeSubType = 0,
--充值次数
RechargeTime = 0,
--显示的Icon
Icon = 0,
--充值档位对应消耗的真实货币(单位:分)
Money = 0,
--传给SDK的充值金额
SDKPrice = 0,
--对应奖励 物品类型_数量_绑定_职业
Reward = 0,
--充值倍数倍数_次数3_2表示前2次充值都是3倍奖励-1代表无限次
MultipleTime = 0,
--充值额外奖励
ExtraReward = 0,
--额外奖励可领取次数-1代表无限次
ExtraRewardTime = 0,
--商品扩展字段
GoodsExt = "",
CurPlatform = nil,
}
function ServerData:New(sData)
local _m = Utils.DeepCopy(self)
_m.CurPlatform = LogicAdaptor.GetRuntimePlatform()
_m:RefeshData(sData)
return _m
end
function ServerData:RefeshData(sData)
--传给SDK的ID
self.Id = sData.goods_id
--配置表ID
self.CfgId = sData.goods_system_cfg_id
--商品名字描述主要用于BI后台数据
self.Desc = sData.goods_name
--交易类型
self.GoodsDealType = sData.goods_pay_channel
-- * 充值类型
-- * 1正常充值
-- * 2每日礼包充值
-- * 3畅游月卡
-- * 4尊享月卡
-- * 5终身卡
-- * 6成长基金
-- * 7神秘商店
-- * 80元购
-- * 9直购礼包超值折扣
-- * 10狂欢周
-- * 11运营活动类后台配置
self.RechargeType = tonumber(sData.goods_type)
-- * 只针对Type=1正常充值的情况使用其他类型不能使用
-- * 1=正常充值
-- * 2=新手礼包(一生一次)
-- * 3=周礼包(一周一刷新)
-- * 4=日礼包(一日一刷新)
self.RechargeSubType = sData.goods_subtype
-- * 充值次数(当前轮每个挡位对应充值的次数)
-- * -1=无次数限制
self.RechargeTime = sData.goods_limit
-- * 显示的图标的IDhide
self.Icon = sData.goods_icon
-- * 充值档位对应消耗的真实货币(单位:分)
-- * 1android
-- * 2ios
-- * (不需要区分大小写)
local _price = sData.goods_price
if CS.UnityEngine.Application.platform == RuntimePlatform.Android then
local _priceDict = Dictionary:New(_price.android)
if _priceDict:ContainsKey(GameCenter.PaySystem.SdkPlatCfg.MoneyCode) then
local _priceByMoneyCode = tonumber(_priceDict[GameCenter.PaySystem.SdkPlatCfg.MoneyCode])
self.Money = tonumber(_priceByMoneyCode / 100)
self.SDKPrice = tonumber(_priceByMoneyCode)
end
else
local _priceDict = Dictionary:New(_price.ios)
if _priceDict:ContainsKey(GameCenter.PaySystem.SdkPlatCfg.MoneyCode) then
local _priceByMoneyCode = tonumber(_priceDict[GameCenter.PaySystem.SdkPlatCfg.MoneyCode])
self.Money = tonumber(_priceByMoneyCode / 100)
self.SDKPrice = tonumber(_priceByMoneyCode)
end
end
-- * 对应奖励
-- * 物品类型_数量_绑定_职业
-- * 绑定 0未绑定 1绑定
-- * 也只 0男剑 1女枪 9通用
self.Reward = sData.goods_reward
-- * 充值倍数
-- * 倍数_次数3_2表示前2次充值都是3倍奖励
-- * -1代表无限次
self.MultipleTime = sData.goods_multiple
-- * 额外赠送
-- * 物品类型_数量_绑定_职业
-- * 绑定 0未绑定 1绑定
-- * 也只 0男剑 1女枪 9通用
self.ExtraReward = sData.goods_extra_reward
-- * 额外奖励可领取次数 -1代表无限次
self.ExtraRewardTime = sData.goods_extra_reward_limit
--商品扩展字段
self.GoodsExt = sData.goods_ext
end
return ServerData