feat(新内容格式化工具): 奖励内容格式化工具

This commit is contained in:
hzj 2026-01-16 20:24:18 +08:00
parent 2c38e6a0d7
commit 953db2ed3f

View File

@ -0,0 +1,22 @@
/**
* 奖励内容格式化工具
*/
/**
* 格式化奖励的展示信息
* @param {string} type - 奖励类型 (GOLD, DIAMOND, GIFT, FRAGMENTS, DOLLARS )
* @param {object} reward - 奖励对象
* @returns {string} 格式化后的奖励展示文本
*/
export const formatRewardDisplay = (type, reward) => {
const showAmountTypes = ['GOLD', 'DIAMOND', 'GIFT', 'FRAGMENTS', 'TICKET']
if (showAmountTypes.includes(type)) {
return reward.content || ''
} else if (type === 'DOLLARS') {
return `$${reward.content}`
} else {
// 默认返回数量加天数格式
return `${reward.quantity}Days`
}
}