yeg
2026-09-14 61e873aada7f8c55ccebb4c5fdf93ec21eb5fffe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
export type ApiEnvironment = 'development' | 'staging' | 'production'
 
// 切换环境时只修改这里;页面和业务服务不得自行拼接后台域名。
export const apiEnvironment: ApiEnvironment = 'development'
 
// Keep the business pages accessible while merchant APIs are still being integrated.
// This flag is ignored outside the development environment.
export const skipMerchantLoginInDevelopment = false
 
// Toggle homepage mock metrics independently from the login bypass.
// When disabled, the dashboard requests the authenticated merchant summary API.
export const useDashboardDemoDataInDevelopment = false
 
// Toggle merchant-center, product, and business-hour demo data independently from login bypass and dashboard demo data.
export const useMerchantManagementDemoDataInDevelopment = false
 
// 后台提供微信小程序合法 HTTPS 域名后,在对应环境填写完整基础地址。
// 真机(本机 WLAN 192.168.110.15)必须用局域网地址并放行 Windows 防火墙 8080;
// 原值 192.168.110.26 不是本机,请求会直接失败。
const developmentBaseUrl = 'http://192.168.110.26:8080'
const stagingBaseUrl = ''
const productionBaseUrl = ''
 
export const getApiBaseUrl = (): string => {
    if (apiEnvironment == 'production') return productionBaseUrl
    if (apiEnvironment == 'staging') return stagingBaseUrl
    return developmentBaseUrl
}
 
export const isApiConfigured = (): boolean => getApiBaseUrl().trim().length > 0
 
// 接口路径集中维护,后台路径调整时不需要修改页面。
export const getApiEndpoint = (name: string): string => {
    if (name == 'authLogin') return '/api/merchant/auth/login'
    if (name == 'authRefresh') return '/api/merchant/auth/refresh'
    if (name == 'authLogout') return '/api/merchant/auth/logout'
    if (name == 'merchantAgreement') return '/api/merchant/legal/agreements/'
    if (name == 'merchantDashboard') return '/api/merchant/dashboard/summary'
    if (name == 'merchantBusinessDate') return '/api/merchant/system/business-date'
 
    if (name == 'merchantProfile') return '/api/merchant/profile'
    if (name == 'merchantBusinessStatus') return '/api/merchant/business-status'
    if (name == 'merchantBusinessHours') return '/api/merchant/business-hours'
    if (name == 'merchantProducts') return '/api/merchant/products'
    if (name == 'merchantBenefits') return '/api/merchant/benefits'
    if (name == 'merchantUploadImage') return '/api/merchant/uploads/images'
    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/free-stay/confirm'
    if (name == 'verificationFreeStayConfirm') return '/api/merchant/verification/free-stay/confirm'
    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 == 'merchantBankCards') return '/api/merchant/bank-cards'
    if (name == 'merchantBankBranches') return '/api/merchant/bank-branches'
    return ''
}