feat(game): 更新游戏规则并优化充值提现界面
- 在 api.type.ts 中为支付渠道、存款配置和取款字段添加新的接口属性 - 替换桌面端规则模态框中的纯文本内容为支持 Markdown 格式的组件 - 重构桌面端充值组件的 UI 结构,使用自定义按钮替代原生选择器 - 为取款组件添加最低最高金额验证及支付方式选择功能 - 更新英文本地化文件中的游戏规则内容,提供详细的玩法指南
This commit is contained in:
@@ -59,6 +59,26 @@ function toFiniteNumber(value: string | number | null | undefined) {
|
||||
return Number.isFinite(numericValue) ? numericValue : 0
|
||||
}
|
||||
|
||||
const FINANCE_ASSET_BASE_URL = 'https://zihua-api.h55555game.top'
|
||||
|
||||
function normalizeFinanceAssetUrl(value: string | null | undefined) {
|
||||
const assetPath = value?.trim()
|
||||
|
||||
if (!assetPath) {
|
||||
return ''
|
||||
}
|
||||
|
||||
if (/^https?:\/\//i.test(assetPath)) {
|
||||
return assetPath
|
||||
}
|
||||
|
||||
if (assetPath.startsWith('/')) {
|
||||
return `${FINANCE_ASSET_BASE_URL}${assetPath}`
|
||||
}
|
||||
|
||||
return assetPath
|
||||
}
|
||||
|
||||
function normalizeCurrency(dto: FinanceCurrencyConfigDto) {
|
||||
return {
|
||||
code: dto.code,
|
||||
@@ -80,10 +100,19 @@ function normalizeRate(dto: FinanceRateConfigDto) {
|
||||
|
||||
function normalizePayChannel(dto: FinancePayChannelDto) {
|
||||
return {
|
||||
banks: (dto.banks ?? []).map(normalizeWithdrawBank),
|
||||
code: dto.code,
|
||||
currencyCodes: Array.isArray(dto.currency_codes) ? dto.currency_codes : [],
|
||||
depositBanks: (dto.deposit_banks ?? []).map(normalizeWithdrawBank),
|
||||
feeNote: dto.fee_note ?? '',
|
||||
methods: (dto.methods ?? []).map(normalizeDepositMethod),
|
||||
minBank: dto.min_bank ?? '',
|
||||
minEwallet: dto.min_ewallet ?? '',
|
||||
name: dto.name,
|
||||
processingNote: dto.processing_note ?? '',
|
||||
rateHint: dto.rate_hint ?? '',
|
||||
rateMode: dto.rate_mode ?? '',
|
||||
reviewThresholdCoin: dto.review_threshold_coin ?? '0',
|
||||
sort: Number.isFinite(dto.sort) ? dto.sort : 0,
|
||||
status: typeof dto.status === 'number' ? dto.status : 1,
|
||||
tierIds: Array.isArray(dto.tier_ids) ? dto.tier_ids : [],
|
||||
@@ -99,6 +128,8 @@ function normalizeWithdrawBank(dto: FinanceWithdrawBankDto, index: number) {
|
||||
currencyCode: dto.currency_code ?? null,
|
||||
gatewayCode: dto.gateway_code ?? null,
|
||||
label,
|
||||
logo: normalizeFinanceAssetUrl(dto.logo),
|
||||
paymentTypes: Array.isArray(dto.payment_types) ? dto.payment_types : [],
|
||||
sort:
|
||||
typeof dto.sort === 'number' && Number.isFinite(dto.sort)
|
||||
? dto.sort
|
||||
@@ -112,6 +143,8 @@ function normalizeDepositMethod(dto: FinanceDepositMethodDto) {
|
||||
code: dto.code,
|
||||
currencyCode: dto.currency_code,
|
||||
gatewayCode: dto.gateway_code,
|
||||
maximumAmount: dto.maximum_amount ?? '',
|
||||
minimumAmount: dto.minimum_amount ?? '',
|
||||
name: dto.name,
|
||||
requiresBank: dto.requires_bank,
|
||||
requiresBankAccount: dto.requires_bank_account,
|
||||
@@ -122,6 +155,7 @@ function normalizeDepositMethod(dto: FinanceDepositMethodDto) {
|
||||
|
||||
function normalizeDepositFields(dto: FinanceDepositFieldsDto | undefined = {}) {
|
||||
return {
|
||||
channelCodeParam: dto.channel_code_param ?? 'channel_code',
|
||||
depositBankAccountParam:
|
||||
dto.deposit_bank_account_param ?? 'deposit_bank_account',
|
||||
depositBankParam: dto.deposit_bank_param ?? 'deposit_bank',
|
||||
@@ -146,20 +180,24 @@ function normalizeDepositConfig(
|
||||
|
||||
return {
|
||||
banks: (dto?.banks ?? []).map(normalizeWithdrawBank),
|
||||
dadapayPendingExpireSeconds: dto?.dadapay_pending_expire_seconds ?? 0,
|
||||
defaultChannelCode: dto?.default_channel_code ?? '',
|
||||
defaultChannelByCurrency: dto?.default_channel_by_currency ?? {},
|
||||
fields: normalizeDepositFields(dto?.fields),
|
||||
methods: (dto?.methods ?? []).map(normalizeDepositMethod),
|
||||
payChannels: payChannels.map(normalizePayChannel),
|
||||
pendingExpireSeconds: dto?.pending_expire_seconds ?? 0,
|
||||
}
|
||||
}
|
||||
|
||||
function normalizeWithdrawFields(dto: FinanceWithdrawConfigDto['fields'] = {}) {
|
||||
return {
|
||||
paymentTypeParam: dto.payment_type_param ?? 'payment_type',
|
||||
receiveTypeBankOnly: dto.receive_type_bank_only ?? true,
|
||||
requireBankBranch: dto.require_bank_branch ?? false,
|
||||
requireBankCode: dto.require_bank_code ?? true,
|
||||
requireChannelCode: dto.require_channel_code ?? true,
|
||||
requirePaymentType: dto.require_payment_type ?? false,
|
||||
requireReceiveAccount: dto.require_receive_account ?? true,
|
||||
requireReceiverEmail: dto.require_receiver_email ?? true,
|
||||
requireReceiverMobile: dto.require_receiver_mobile ?? true,
|
||||
@@ -172,6 +210,7 @@ function normalizeWithdrawConfig(dto: FinanceWithdrawConfigDto) {
|
||||
banks: (dto.banks ?? []).map(normalizeWithdrawBank),
|
||||
feeNote: dto.fee_note,
|
||||
fields: normalizeWithdrawFields(dto.fields),
|
||||
methods: (dto.methods ?? []).map(normalizeDepositMethod),
|
||||
minBank: dto.min_bank,
|
||||
minEwallet: dto.min_ewallet,
|
||||
payChannels: (dto.pay_channels ?? []).map(normalizePayChannel),
|
||||
|
||||
Reference in New Issue
Block a user