fix: 仅保留 Waffo,并修复调试包年误用永久 Product

调试不再把兼容字段 product_id 覆盖到包年;包年禁止回落永久商品;下单强制走 Waffo。
This commit is contained in:
Logan.Li committed 2026-08-13 00:04:22 +08:00
1 parent d94da2129c
commit 2b44e8dcb3
5 files changed
+53 -49

No files matched your search

+19 -16
View File
@@ -157,18 +157,14 @@ import { getWaffoSettings, updateWaffoSettings, testWaffoConnection } from '@/ap
const planKeyOptions = ['trial', 'yearly', 'perpetual', 'monthly', 'lifetime']
// OpsXshell 线上商品(与 pancake 购买链接一致) // Logan.Li
const OPSXSHELL_PRODUCTS = [
{
plan_key: 'yearly',
label: 'OpsXshell Yearly',
product_id: 'PROD_5PqVJyEiCM4nDgVoA0RKjN',
},
{
plan_key: 'perpetual',
label: 'OpsXshell Perpetual',
product_id: 'PROD_3BSJqDRkVBoYNgO78NsTAU',
},
// OpsXshell 商品:测试 / 生产各一套 // Logan.Li
const OPSXSHELL_PRODUCTS_LIVE = [
{ plan_key: 'yearly', label: 'OpsXshell Yearly', product_id: 'PROD_5PqVJyEiCM4nDgVoA0RKjN' },
{ plan_key: 'perpetual', label: 'OpsXshell Perpetual', product_id: 'PROD_3BSJqDRkVBoYNgO78NsTAU' },
]
const OPSXSHELL_PRODUCTS_TEST = [
{ plan_key: 'yearly', label: 'OpsXshell Yearly', product_id: 'PROD_1BIezCi932IbgCzRIV8hcJ' },
{ plan_key: 'perpetual', label: 'OpsXshell Perpetual', product_id: 'PROD_0pcnzzT4nalEkkcdyIUoD5' },
]
const loading = ref(false)
@@ -300,8 +296,9 @@ function removeMapping(index) {
}
function fillOpsxshellProducts() {
const catalog = isLive.value ? OPSXSHELL_PRODUCTS_LIVE : OPSXSHELL_PRODUCTS_TEST
const byKey = Object.fromEntries(productMappings.value.map((r) => [r.plan_key, r]))
for (const item of OPSXSHELL_PRODUCTS) {
for (const item of catalog) {
if (byKey[item.plan_key]) {
byKey[item.plan_key].product_id = item.product_id
byKey[item.plan_key].label = item.label
@@ -422,20 +419,26 @@ async function testConnection() {
debugResult.value = ''
try {
const compat = mappingsToCompatFields(productMappings.value)
// 勿传通用 product_id(多为永久商品),否则测包年会被覆盖 // Logan.Li
const { product_id: _ignoredProductID, ...rest } = compat
const res = await testWaffoConnection({
merchant_id: waffo.merchant_id,
store_id: waffo.store_id,
store_slug: waffo.store_slug,
environment: waffo.environment,
plan_type: debugPlan.value,
...compat,
...rest,
})
debugResult.value = JSON.stringify(res.data ?? res, null, 2)
ElMessage.success('调试请求已完成(未写库;映射请手动保存)')
if (res.data?.ok === false) {
ElMessage.error(res.data?.error_summary || res.message || '调试失败')
}
} catch (err) {
const body = err?.response?.data
debugResult.value = JSON.stringify({
error: err?.response?.data || err?.message || String(err),
error: body || err?.message || String(err),
}, null, 2)
ElMessage.error(body?.message || body?.data?.error_summary || '调试失败')
} finally {
debugging.value = false
}