From 160e97a034e1b9fad4052d449da0eeecc9540e97 Mon Sep 17 00:00:00 2001
From: yeg <1347747024@qq.com>
Date: 星期二, 29 九月 2026 14:09:59 +0800
Subject: [PATCH] feat(miniprogram): 人才端与商户端切到 staging,指向攀枝花测试环境

---
 rencaika/config/api.uts           |    6 ++++--
 rencaika_merchant/config/api.uts  |    6 ++++--
 .scratch/server-testenv/README.md |   16 ++++++++++++++++
 3 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/.scratch/server-testenv/README.md b/.scratch/server-testenv/README.md
index c12aee7..7e72492 100644
--- a/.scratch/server-testenv/README.md
+++ b/.scratch/server-testenv/README.md
@@ -86,6 +86,22 @@
   在那之前它仍是唯一的明文入口。
 - `CORS_ALLOWED_ORIGINS` 里没有 `http://www.dqrcfwpt.com`(80 那条)——**已无关紧要**,因为 80 现在 301 到 https。
 
+## 小程序体验版接入测试环境(2026-09-29)
+
+**三处必须同时对,任一处不一致都表现为「请求失败」**:
+
+| 位置 | 值 |
+|---|---|
+| 代码 | `rencaika/config/api.uts` 与 `rencaika_merchant/config/api.uts`:`apiEnvironment = 'staging'` + `stagingBaseUrl = 'https://www.dqrcfwpt.com:8081'` |
+| 微信后台 → 开发管理 → 服务器域名 | request / uploadFile / downloadFile **都填** `https://www.dqrcfwpt.com:8081`;socket / udp / tcp **留空**(两个小程序零 WebSocket 用法,已 grep 确认) |
+| 体验成员 | 「成员管理」里逐个加微信号;配额以后台实时提示为准 |
+
+- **两个 appid 各配一遍**:人才端 `wxcfee477acb54d179`(后端 `app.wechat.mini-program.app-id` 与它一致)、商户端 `wx550e520ad19458ea`。
+  ⚠️ `rencaika/manifest.json` 顶层还有一个 `wx6ae2cadae28fce1`,与 `mp-weixin` 段不一致 —— **要确认开发者工具里实际用的是哪个**;用错则与后端 appid 对不上,登录必失败。
+- **已验证的服务端前提**:后端 → `api.weixin.qq.com:443` 可达;后端那对 appid/secret **有效**(已向微信换到 token);微信 IP 白名单**未挡**本机(否则会报 40164)。
+- **切回 / 切生产**:本机联调把 `apiEnvironment` 改回 `'development'`;生产上线改 `'production'` 并填 `productionBaseUrl`,**且那时微信白名单要去掉端口**(微信规则:不配端口时请求 URL 也不能带端口)。
+- **副带效果**:切到 `staging` 后,所有 `apiEnvironment == 'development'` 的开发期便利(假 talentId、演示数据、预览模式、跳过登录)自动关闭 —— 体验版必须真登录。
+
 ## 已知边界
 
 - **收不到汇付回调**:非公网环境的既定事实与既定设计(`docs/adr/0004-active-query-is-authoritative.md`、
diff --git a/rencaika/config/api.uts b/rencaika/config/api.uts
index 985b70e..0f03b30 100644
--- a/rencaika/config/api.uts
+++ b/rencaika/config/api.uts
@@ -3,14 +3,16 @@
 // 开发环境地址在运行时解析(见 config/development-server.uts),所以这里必须是 import。
 import { developmentApiBaseUrl } from './development-server.uts'
 
-export const apiEnvironment: ApiEnvironment = 'development'
+// 2026-09-29:体验版指向攀枝花测试环境。本机联调改回 'development';生产上线改 'production'。
+export const apiEnvironment: ApiEnvironment = 'staging'
 // Separate from demo-data controls; only development builds request a test session.
 export const developmentLoginBypassEnabled: boolean = false 
 
 // 后台提供合法域名后仅在此处填写,业务页面不得硬编码域名。
 // 开发环境地址由 development-server.uts 在启动时自动探测本机局域网 IP,换网后不需要改代码;
 // 本机 IP 会变(见过 192.168.110.26 与 192.168.110.15),写死会表现成"登录不上"。
-const stagingBaseUrl = ''
+// 必须与微信后台「开发管理 → 服务器域名」里配的完全一致(含端口)。
+const stagingBaseUrl = 'https://www.dqrcfwpt.com:8081'
 const productionBaseUrl = ''
 
 export const getApiBaseUrl = (): string => {
diff --git a/rencaika_merchant/config/api.uts b/rencaika_merchant/config/api.uts
index b896017..a9da1f6 100644
--- a/rencaika_merchant/config/api.uts
+++ b/rencaika_merchant/config/api.uts
@@ -4,7 +4,8 @@
 import { developmentApiBaseUrl } from './development-server.uts'
 
 // 切换环境时只修改这里;页面和业务服务不得自行拼接后台域名。
-export const apiEnvironment: ApiEnvironment = 'development'
+// 2026-09-29:体验版指向攀枝花测试环境。本机联调改回 'development';生产上线改 'production'。
+export const apiEnvironment: ApiEnvironment = 'staging'
 
 // Keep the business pages accessible while merchant APIs are still being integrated.
 // This flag is ignored outside the development environment.
@@ -20,7 +21,8 @@
 // 后台提供微信小程序合法 HTTPS 域名后,在对应环境填写完整基础地址。
 // 开发环境地址由 development-server.uts 在启动时自动探测本机局域网 IP,换网后不需要改代码;
 // 本机 IP 会变(见过 192.168.110.26 与 192.168.110.15),写死会表现成"登录不上"。
-const stagingBaseUrl = ''
+// 必须与微信后台「开发管理 → 服务器域名」里配的完全一致(含端口)。
+const stagingBaseUrl = 'https://www.dqrcfwpt.com:8081'
 const productionBaseUrl = ''
 
 export const getApiBaseUrl = (): string => {

--
Gitblit v1.7.1