| | |
| | | export type ApiEnvironment = 'development' | 'staging' | 'production' |
| | | |
| | | // 开发环境地址在运行时解析(见 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' |
| | | |
| | | // Keep the business pages accessible while merchant APIs are still being integrated. |
| | | // This flag is ignored outside the development environment. |
| | |
| | | |
| | | // Toggle homepage mock metrics independently from the login bypass. |
| | | // When disabled, the dashboard requests the authenticated merchant summary API. |
| | | export const useDashboardDemoDataInDevelopment = true |
| | | export const useDashboardDemoDataInDevelopment = false |
| | | |
| | | // 商户中心、商品与营业时间的演示数据开关,与登录跳过和首页经营数据开关相互独立。 |
| | | export const useMerchantManagementDemoDataInDevelopment = true |
| | | // Toggle merchant-center, product, and business-hour demo data independently from login bypass and dashboard demo data. |
| | | export const useMerchantManagementDemoDataInDevelopment = false |
| | | |
| | | // 后台提供微信小程序合法 HTTPS 域名后,在对应环境填写完整基础地址。 |
| | | const developmentBaseUrl = 'http://192.168.110.13:8080' |
| | | const stagingBaseUrl = '' |
| | | // 开发环境地址由 development-server.uts 在启动时自动探测本机局域网 IP,换网后不需要改代码; |
| | | // 本机 IP 会变(见过 192.168.110.26 与 192.168.110.15),写死会表现成"登录不上"。 |
| | | // 必须与微信后台「开发管理 → 服务器域名」里配的完全一致(不带端口时,请求 URL 也不能带端口)。 |
| | | const stagingBaseUrl = 'https://rencaika.dqrcfwpt.com' |
| | | const productionBaseUrl = '' |
| | | |
| | | export const getApiBaseUrl = (): string => { |
| | | if (apiEnvironment == 'production') return productionBaseUrl |
| | | if (apiEnvironment == 'staging') return stagingBaseUrl |
| | | return developmentBaseUrl |
| | | // 每次都现取值:探测是异步完成的,提前取会把启动瞬间的兜底值固化住。 |
| | | return developmentApiBaseUrl() |
| | | } |
| | | |
| | | export const isApiConfigured = (): boolean => getApiBaseUrl().trim().length > 0 |
| | |
| | | if (name == 'merchantOrders') return '/api/merchant/orders' |
| | | if (name == 'merchantOrderDetail') return '/api/merchant/orders/' |
| | | if (name == 'merchantOrderVerify') return '/api/merchant/orders/' |
| | | if (name == 'merchantSettlementStatistics') return '/api/merchant/settlement-statistics' |
| | | if (name == 'verificationScan') return '/api/merchant/verification/scan' |
| | | if (name == 'verificationConfirm') return '/api/merchant/verification/confirm' |
| | | if (name == 'verificationNumericConfirm') return '/api/merchant/verification/numeric/confirm' |
| | | if (name == 'verificationConfirm') return '/api/merchant/verification/free-stay/confirm' |
| | | if (name == 'verificationFreeStayConfirm') return '/api/merchant/verification/free-stay/confirm' |
| | | if (name == 'benefitVerificationVerify') return '/api/merchant/benefit-verifications/verify' |
| | | if (name == 'manualConsumption') return '/api/merchant/manual-consumptions' |
| | | if (name == 'manualConsumptionQuote') return '/api/merchant/manual-consumptions/quote' |
| | | if (name == 'orderRevokeVerification') return '/api/merchant/orders/revoke-verification' |
| | | if (name == 'merchantOnboardingStatus') return '/api/merchant/onboarding/status' |
| | | if (name == 'merchantOnboarding') return '/api/merchant/onboarding' |
| | | if (name == 'merchantPaymentReadiness') return '/api/merchant/payment-readiness' |
| | | if (name == 'merchantPaymentReadinessVerify') return '/api/merchant/payment-readiness/verify' |
| | | if (name == 'merchantBankCards') return '/api/merchant/bank-cards' |
| | | if (name == 'merchantBankBranches') return '/api/merchant/bank-branches' |
| | | if (name == 'merchantWithdrawals') return '/api/merchant/withdrawals' |
| | | if (name == 'merchantWithdrawalSummary') return '/api/merchant/withdrawals/summary' |
| | | return '' |
| | | } |