From 39f9e02a9618ed7f4389d83847b21af6929976a9 Mon Sep 17 00:00:00 2001 From: zhx Date: Thu, 25 Jun 2026 23:35:55 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=A7=E8=BF=90=E4=BB=A3=E7=90=86=E5=B7=A5?= =?UTF-8?q?=E8=B5=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/api.js | 71 +++++++++++++++++++++++++++++++++++++++++---- recharge/index.html | 14 +++++++++ 2 files changed, 80 insertions(+), 5 deletions(-) diff --git a/common/api.js b/common/api.js index 77864ce..1ecc373 100644 --- a/common/api.js +++ b/common/api.js @@ -572,11 +572,29 @@ var default_api = 'https://api.global-interaction.com/'; ); } - function aslanUserQuery(displayUserID) { + function normalizeCommodityType(value) { + var type = String(value || '') + .trim() + .toUpperCase(); + return type === 'FREIGHT_GOLD' || type === 'FREIGHT_GOLD_SUPER' + ? type + : 'GOLD'; + } + + function configuredCommodityType(extra) { + return normalizeCommodityType( + (extra && + (extra.commodity_type || extra.commodityType || extra.type)) || + (activeAppConfig && activeAppConfig.type) || + 'GOLD' + ); + } + + function aslanUserQuery(displayUserID, extra) { var value = String(displayUserID || '').trim(); var query = { applicationId: activeAppConfig.application_id, - type: activeAppConfig.type || 'GOLD', + type: configuredCommodityType(extra), sysOrigin: activeAppConfig.sys_origin || 'ATYOU', }; if (value) { @@ -588,8 +606,8 @@ var default_api = 'https://api.global-interaction.com/'; return query; } - function configuredWebPayUserQuery(displayUserID) { - var query = Object.assign(aslanUserQuery(displayUserID), { + function configuredWebPayUserQuery(displayUserID, extra) { + var query = Object.assign(aslanUserQuery(displayUserID, extra), { sysOrigin: activeAppConfig.sys_origin || 'LIKEI', }); if (isYumiWebPay() && !query.userId && !query.account) { @@ -760,6 +778,14 @@ var default_api = 'https://api.global-interaction.com/'; return Math.round(normalizeAmountUsd(value) * 100); } + function booleanValue(value) { + if (value === true || value === 1) return true; + var text = String(value || '') + .trim() + .toLowerCase(); + return text === 'true' || text === '1' || text === 'yes'; + } + function mapYumiContext(context) { context = context || {}; var profile = context.userProfile || context.user_profile || {}; @@ -769,6 +795,20 @@ var default_api = 'https://api.global-interaction.com/'; var countryCode = normalizeCountryCode(profile.countryCode || profile.country_code) || countryCodeFromCountry(country); + var freightUser = booleanValue( + profile.freightUser || + profile.freight_user || + context.freightUser || + context.freight_user + ); + var commodityType = normalizeCommodityType( + profile.commodityType || + profile.commodity_type || + context.commodityType || + context.commodity_type || + (freightUser ? 'FREIGHT_GOLD' : 'GOLD') + ); + freightUser = freightUser || commodityType === 'FREIGHT_GOLD'; return { auth_mode: 'display_user_id', account: { @@ -788,6 +828,11 @@ var default_api = 'https://api.global-interaction.com/'; profile.countryName || profile.country_name || countryNameFromCountry(country), + audience_type: freightUser ? 'coin_seller' : 'ordinary_user', + freight_user: freightUser, + freightUser: freightUser, + commodity_type: commodityType, + commodityType: commodityType, }, country_list: countryList.map(function (item) { var itemCountry = item.country || {}; @@ -813,6 +858,10 @@ var default_api = 'https://api.global-interaction.com/'; country: itemCountry, }; }), + commodity_type: commodityType, + commodityType: commodityType, + freight_user: freightUser, + freightUser: freightUser, region_id: context.regionId || context.region_id || '', regionId: context.regionId || context.region_id || '', raw: context, @@ -850,6 +899,18 @@ var default_api = 'https://api.global-interaction.com/'; award_coin_amount: Number.isFinite(awardContent) ? awardContent : 0, + commodity_type: + item.type || + item.commodityType || + item.commodity_type || + options.type || + '', + commodityType: + item.type || + item.commodityType || + item.commodity_type || + options.type || + '', amount_usdt: amountUsd, amount_usdt_micro: Math.round(amountUsd * 1000000), amount_minor: decimalToMinor(amountUsd), @@ -999,7 +1060,7 @@ var default_api = 'https://api.global-interaction.com/'; }, options: function (displayUserID, extra) { if (isConfiguredWebPay()) { - var query = Object.assign(aslanUserQuery(displayUserID), { + var query = Object.assign(aslanUserQuery(displayUserID, extra), { payCountryId: extra && (extra.pay_country_id || extra.payCountryId), countryCode: diff --git a/recharge/index.html b/recharge/index.html index c06be85..0236d62 100644 --- a/recharge/index.html +++ b/recharge/index.html @@ -1269,6 +1269,8 @@ region_id: context.region_id || context.regionId, user_id: currentAccountUserID(), + commodity_type: + currentAccountCommodityType(), } ); }) @@ -2166,6 +2168,18 @@ ); } + function currentAccountCommodityType() { + if (!state.context) return ''; + return ( + state.context.commodity_type || + state.context.commodityType || + (state.context.account && + (state.context.account.commodity_type || + state.context.account.commodityType)) || + '' + ); + } + function orderStatusUserID() { return currentAccountUserID() || targetDisplayUserID(); }