From dcbbaede4c8cea55aff1b6857be10ec8de8568b2 Mon Sep 17 00:00:00 2001 From: zhx Date: Fri, 26 Jun 2026 10:14:56 +0800 Subject: [PATCH] =?UTF-8?q?aslan=E5=85=85=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/api.js | 4 +--- recharge/index.html | 44 ++++++++++++++++++++++++++++++++++---------- 2 files changed, 35 insertions(+), 13 deletions(-) diff --git a/common/api.js b/common/api.js index 1ecc373..521661d 100644 --- a/common/api.js +++ b/common/api.js @@ -1116,9 +1116,7 @@ var default_api = 'https://api.global-interaction.com/'; channelCode: payload && payload.channel_code, returnUrl: payload && payload.return_url, commandId: payload && payload.command_id, - type: - (activeAppConfig && activeAppConfig.type) || - 'GOLD', + type: configuredCommodityType(payload), language: readLanguageQuery() || 'en', }, } diff --git a/recharge/index.html b/recharge/index.html index 0236d62..cca6196 100644 --- a/recharge/index.html +++ b/recharge/index.html @@ -1346,10 +1346,9 @@ account.display_user_id || t('recharge.accountConfirmed', 'Confirmed account'); nodes.accountMeta.textContent = accountMetaText(account); - nodes.accountRole.textContent = - account.audience_type === 'coin_seller' - ? t('recharge.coinSeller', 'Coin seller') - : t('recharge.ordinaryUser', 'User'); + nodes.accountRole.textContent = isFreightAccount(account) + ? t('recharge.coinSeller', 'Coin seller') + : t('recharge.ordinaryUser', 'User'); setStatus( nodes.accountStatus, t('recharge.accountConfirmed', 'Account confirmed') @@ -1657,6 +1656,7 @@ display_user_id: targetDisplayUserID(), product_id: createOrderProductID(product), user_id: currentAccountUserID(), + commodity_type: currentAccountCommodityType(), pay_country_id: method.payCountryID || state.selectedPayCountryID, @@ -2168,16 +2168,40 @@ ); } + function isTrueFlag(value) { + return ( + value === true || + value === 1 || + String(value || '').toLowerCase() === 'true' + ); + } + + function isFreightAccount(account) { + account = account || {}; + var audienceType = String( + account.audience_type || account.audienceType || '' + ).toLowerCase(); + return ( + audienceType === 'coin_seller' || + audienceType === 'super_freight_agent' || + isTrueFlag(account.freight_agent) || + isTrueFlag(account.freightAgent) || + isTrueFlag(account.super_freight_agent) || + isTrueFlag(account.superFreightAgent) + ); + } + function currentAccountCommodityType() { if (!state.context) return ''; - return ( + var account = state.context.account || {}; + var explicitType = state.context.commodity_type || state.context.commodityType || - (state.context.account && - (state.context.account.commodity_type || - state.context.account.commodityType)) || - '' - ); + account.commodity_type || + account.commodityType || + ''; + if (explicitType) return explicitType; + return isFreightAccount(account) ? 'FREIGHT_GOLD' : ''; } function orderStatusUserID() {