refactor: 租户/模板解析收敛到 hjc-java 单一后端,移除 websopy/server 依赖

- appApiBase 指向 hjc-java(hjc.sitelnk.cn 域名→租户解析、模板映射、订阅检查)
- 删除死配置 NUXT_PUBLIC_SERVER_API_BASE(代码中零消费)
- fileServerBase 改从 APP_API_BASE 推导(原从 server.websoft.top 推导)
- preconnect/dns-prefetch 指向 hjc-api 与文件源站
- .env.example/README 同步

验证:本地 node .output 预览,Host=hjc.sitelnk.cn 的 /api/site/info
经 hjc-java 解析成功返回站点信息(code=0)——租户解析链不再依赖任何外部服务。
This commit is contained in:
2026-09-24 10:24:16 +08:00
parent d360998559
commit 1cbc913262
5 changed files with 20 additions and 32 deletions
+4 -7
View File
@@ -15,16 +15,13 @@ NUXT_PUBLIC_TEMPLATE_ID=template-07
NUXT_PUBLIC_FORCE_TEMPLATE_ID=
# ---------- 后端接口 ----------
# 本地后端(hjc-java)默认端口 9200。
# 若要联调远程环境,把下面两行注释掉即可,nuxt.config.ts 会自动回落到生产地址
# 本地后端(hjc-java)默认端口 9200,内容/租户解析/模板解析全部走它。
# 若要联调远程环境,把下面三行注释掉即可,nuxt.config.ts 会自动回落到生产地址
NUXT_PUBLIC_MODULES_API_BASE=http://127.0.0.1:9200/api
# 本地后端同时提供图片/文件时打开(默认走 https://server.websoft.top)
NUXT_PUBLIC_APP_API_BASE=http://127.0.0.1:9200
# 本地后端同时提供图片/文件时打开(默认走 https://file.wsdns.cn)
# NUXT_PUBLIC_FILE_SERVER_BASE=http://127.0.0.1:9200
# 其余接口本地开发直接走远程(一般无需修改)
NUXT_PUBLIC_SERVER_API_BASE=https://server.websoft.top/api
NUXT_PUBLIC_APP_API_BASE=https://websopy-api.websoft.top
# ---------- 站点 / 多租户域名 ----------
NUXT_PUBLIC_BASE_DOMAIN=shoplnk.cn
NUXT_PUBLIC_BASE_DOMAINS=shoplnk.cn,sitelink.cn,wsdns.cn
+2 -4
View File
@@ -25,11 +25,9 @@ NUXT_PUBLIC_FORCE_TEMPLATE_ID=
# ---------- 后端接口地址 ----------
# 内容/CMS 接口。生产为 https://hjc-api.websoft.top/api
NUXT_PUBLIC_MODULES_API_BASE=
# 主服务接口。生产为 https://server.websoft.top/api
NUXT_PUBLIC_SERVER_API_BASE=
# 应用/用户接口。生产为 https://websopy-api.websoft.top
# 租户/模板解析接口。生产为 https://hjc-api.websoft.top(无 /api 后缀)
NUXT_PUBLIC_APP_API_BASE=
# 图片/文件服务器。留空则从 SERVER_API_BASE 自动推导
# 图片/文件服务器。留空则从 APP_API_BASE 自动推导
NUXT_PUBLIC_FILE_SERVER_BASE=
# ---------- 多租户域名 ----------
+4 -5
View File
@@ -6,12 +6,11 @@
# ============================================================
# ---------- 接口(生产必须指向线上) ----------
# 内容/CMS 接口统一使用 hjc-api 域名(原 cms-api.websoft.top 的 /api/* 已返回 404)
# 单一后端:内容/CMS、租户解析、模板解析全部走 hjc-api
NUXT_PUBLIC_MODULES_API_BASE=https://hjc-api.websoft.top/api
NUXT_PUBLIC_SERVER_API_BASE=https://server.websoft.top/api
NUXT_PUBLIC_APP_API_BASE=https://websopy-api.websoft.top
# 图片/文件服务器。留空则由 nuxt.config.ts 从 SERVER_API_BASE 推导出
# https://server.websoft.top,无需手写
NUXT_PUBLIC_APP_API_BASE=https://hjc-api.websoft.top
# 图片/文件服务器。留空则由 nuxt.config.ts 从 APP_API_BASE 推导出
# https://hjc-api.websoft.top,无需手写
NUXT_PUBLIC_FILE_SERVER_BASE=
# ---------- 站点 / 多租户域名 ----------
+4 -6
View File
@@ -101,18 +101,16 @@ NUXT_PUBLIC_TENANT_ID=
NUXT_PUBLIC_APP_ID=website
NUXT_PUBLIC_TEMPLATE_ID=
# 接口地址
NUXT_PUBLIC_SERVER_API_BASE=https://server.websoft.top/api
# 接口地址(单一后端:内容/CMS、租户解析、模板解析全部走 hjc-api)
NUXT_PUBLIC_MODULES_API_BASE=https://hjc-api.websoft.top/api
NUXT_PUBLIC_APP_API_BASE=https://websopy-api.websoft.top
NUXT_PUBLIC_APP_API_BASE=https://hjc-api.websoft.top
# 多租户域名
NUXT_PUBLIC_BASE_DOMAINS=shoplnk.cn,sitelink.cn,wsdns.cn
```
> ℹ️ `nuxt.config.ts` 内置的 `NUXT_PUBLIC_MODULES_API_BASE` 默认值已统一为
> `https://hjc-api.websoft.top/api`(原 `cms-api.websoft.top` 域名 `/api/*` 已返回 404,
> 故全面切换到 `hjc-api`)。`.env.production` 中也显式指定同一地址。
> ℹ️ `nuxt.config.ts` 内置的接口默认值已统一为 `https://hjc-api.websoft.top`(单后端)。
> `.env.production` 中也显式指定同一地址。
> 若将来再次更换域名,请同步修改 `nuxt.config.ts`、`.env.production` 与 `.env.example`。
## 接口说明
+6 -10
View File
@@ -23,19 +23,16 @@ const forceTemplateId = process.env.NUXT_PUBLIC_FORCE_TEMPLATE_ID || ''
// 站点名称覆盖:设置后优先于后端 AppProduct / CMS 返回值(多用于本地调试或强制品牌名)
const siteName = process.env.NUXT_PUBLIC_SITE_NAME || ''
const serverApiBase =
process.env.NUXT_PUBLIC_SERVER_API_BASE ||
'https://server.websoft.top/api'
const modulesApiBase =
process.env.NUXT_PUBLIC_MODULES_API_BASE ||
'https://hjc-api.websoft.top/api'
const appApiBase =
process.env.NUXT_PUBLIC_APP_API_BASE ||
'https://websopy-api.websoft.top'
'https://hjc-api.websoft.top'
const fileServerBase =
process.env.NUXT_PUBLIC_FILE_SERVER_BASE ||
getOrigin(serverApiBase) ||
'https://server.websoft.top'
getOrigin(appApiBase) ||
'https://hjc-api.websoft.top'
const baseDomain =
process.env.NUXT_PUBLIC_BASE_DOMAIN || 'shoplnk.cn'
// 多主域清单:子域名租户解析支持的主域(逗号分隔)。
@@ -79,11 +76,11 @@ export default defineNuxtConfig({
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
// 提前与内容/接口源站建立连接,降低首字节与图片加载延迟
{ rel: 'preconnect', href: 'https://server.websoft.top', crossorigin: '' },
// 提前与接口/图片源站建立连接,降低首字节与图片加载延迟
{ rel: 'preconnect', href: 'https://hjc-api.websoft.top', crossorigin: '' },
{ rel: 'dns-prefetch', href: 'https://server.websoft.top' },
{ rel: 'dns-prefetch', href: 'https://hjc-api.websoft.top' },
{ rel: 'preconnect', href: 'https://file.wsdns.cn', crossorigin: '' },
{ rel: 'dns-prefetch', href: 'https://file.wsdns.cn' },
// 思源黑体(Noto Sans SC,SIL 开源许可,版权无忧)网页字体,全站统一字体
{ rel: 'preconnect', href: 'https://fonts.googleapis.cn' },
{ rel: 'preconnect', href: 'https://fonts.gstatic.cn', crossorigin: '' },
@@ -120,7 +117,6 @@ export default defineNuxtConfig({
templateId,
forceTemplateId,
siteName,
serverApiBase,
modulesApiBase,
appApiBase,
fileServerBase,