fix: switch miniprogram channel by env version

This commit is contained in:
kdletters
2026-06-04 23:52:59 +08:00
parent dd5861d5f5
commit b19a3e4231
4 changed files with 132 additions and 9 deletions

View File

@@ -2,15 +2,17 @@
// 示例https://game.example.com/
// 注意:必须是 https 域名,不能是 localhost、IP 地址或未备案域名。
const WEB_VIEW_ENTRY_URL = 'https://www.genarrative.world';
const DEV_WEB_VIEW_ENTRY_URL = 'https://dev.genarrative.world';
// 中文注释:这里填写 Rust api-server 的公网 HTTPS 域名,必须在“小程序后台-开发设置-request 合法域名”中配置。
// 如果 H5 和 API 同域,可保持和 WEB_VIEW_ENTRY_URL 同一个域名;请求路径会固定走 /api/auth/wechat/miniprogram-login。
const API_BASE_URL = 'https://www.genarrative.world';
const DEV_API_BASE_URL = 'https://dev.genarrative.world';
// 中文注释:这里填写微信小程序 AppID用于后端记录会话来源project.config.json 里的 appid 也要保持一致。
const MINI_PROGRAM_APP_ID = 'wx3da23ea14ca66b65';
// 中文注释:按当前上传版本填写 develop / trial / release后端会写入会话来源快照
// 中文注释:仅作为运行时环境识别失败时的兜底;正常情况下由 wx.getAccountInfoSync 自动判断
const MINI_PROGRAM_ENV = 'release';
// 中文注释:给 H5 加一个来源标记,便于后续前端或后端识别这是微信小程序 web-view 宿主。
@@ -21,6 +23,8 @@ const WEB_VIEW_SOURCE_QUERY = {
module.exports = {
API_BASE_URL,
DEV_API_BASE_URL,
DEV_WEB_VIEW_ENTRY_URL,
MINI_PROGRAM_APP_ID,
MINI_PROGRAM_ENV,
WEB_VIEW_ENTRY_URL,