refactor: 统一接口调用为单前缀写法,去除 19 处页面内写死的 /mp-api(API_BASE 已含),并新增 check:api-prefix 防回归脚本

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
jacobxu666
2026-09-04 16:58:01 +08:00
co-authored by Claude Fable 5
parent 6e88f6b09d
commit bba2571f25
15 changed files with 30 additions and 20 deletions
+9
View File
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
# xuchao: 防止页面调用写死 /mp-api 前缀(request.ts 的 API_BASE 已含该前缀,重复会形成双前缀,
# 依赖 chaos 路由全局剥离才能工作,属错误写法)。命中即失败。
set -e
if grep -rn --include='*.vue' --include='*.ts' -e "('/mp-api/" -e '("/mp-api/' src; then
echo "❌ 发现页面写死 /mp-api 前缀,请去掉(API_BASE 会自动拼接)"
exit 1
fi
echo "✅ api 前缀检查通过"