fix(后台本地预览): 补上会员档位 mock 接口

- scripts/admin-web-fake-api.mjs:新增 /admin/api/profile/membership-plans 的 GET 列表与 POST 回显,避免页面 response.entries 为 undefined

Co-authored-by: Junie <junie@jetbrains.com>
This commit is contained in:
2026-10-03 14:58:26 +08:00
parent 73b53a9dd1
commit 8cfa5a45a9
+32
View File
@@ -736,6 +736,38 @@ function route(pathname, method, url) {
scannedCount: orders.length,
};
}
if (pathname === '/admin/api/profile/membership-plans') {
const plan = (
planId,
title,
rank,
monthPriceCents,
yearPriceCents,
periodPoints,
modelAccess,
concurrentJobLimit,
enabled,
) => ({
plan: planId,
title,
rank,
monthPriceCents,
yearPriceCents,
periodPoints,
modelAccess,
concurrentJobLimit,
enabled,
});
const plans = [
plan('normal', '非会员', 0, 0, 0, 0, 'basic', 1, false),
plan('starter', '入门会员', 1, 3_900, 39_000, 400, 'basic', 1, true),
plan('plus', '轻享会员', 2, 9_900, 99_000, 1_150, 'full', 3, true),
plan('pro', '专业会员', 3, 29_900, 299_000, 3_650, 'full', 5, true),
plan('max', '旗舰会员', 4, 69_900, 699_000, 8_650, 'full', 128, true),
];
// 本地预览不解析请求体:POST 统一回显 starter,仅用于页面回填。
return method === 'POST' ? plans[1] : { entries: plans };
}
if (pathname === '/admin/api/profile/recharge-products') {
const product = (
productId,