export type ApiEnvironment = 'development' | 'staging' | 'production'
|
|
export const apiEnvironment: ApiEnvironment = 'development'
|
// Separate from demo-data controls; only development builds request a test session.
|
export const developmentLoginBypassEnabled: boolean = false
|
|
// 后台提供合法域名后仅在此处填写,业务页面不得硬编码域名。
|
// 开发者工具模拟器可用回环地址;真机必须用本机当前的局域网地址,并放行 Windows 防火墙的 8080。
|
// 本机以太网 IP 会随网络环境变化,换网后这里要跟着改(192.168.110.15 曾经写在这里但并非本机)。
|
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().length > 0
|
|
// 路径均由后台联调资料确认后填写;空值会被服务层明确拒绝,避免误请求。
|
export const getApiEndpoint = (name: string): string => {
|
if (name == 'appHome') return '/api/app/home'
|
if (name == 'appNews') return '/api/app/news'
|
if (name == 'appNewsDetail') return '/api/app/news/'
|
if (name == 'appPolicies') return '/api/app/policies'
|
if (name == 'appPolicyDetail') return '/api/app/policies/'
|
if (name == 'appMerchants') return '/api/app/merchants'
|
if (name == 'appMerchantDetail') return '/api/app/merchants/'
|
if (name == 'appProducts') return '/api/app/products'
|
if (name == 'appProductDetail') return '/api/app/products/'
|
if (name == 'appFoodTopic') return '/api/app/topics/food'
|
if (name == 'appFoodTopicMerchants') return '/api/app/topics/food/merchants'
|
if (name == 'appTravelTopic') return '/api/app/topics/travel'
|
if (name == 'appTravelTopicMerchants') return '/api/app/topics/travel/merchants'
|
if (name == 'appStayTopic') return '/api/app/topics/stay'
|
if (name == 'appStayTopicMerchants') return '/api/app/topics/stay/merchants'
|
if (name == 'appEntertainmentTopic') return '/api/app/topics/entertainment'
|
if (name == 'appEntertainmentTopicMerchants') return '/api/app/topics/entertainment/merchants'
|
if (name == 'appTransportTopic') return '/api/app/topics/transport'
|
if (name == 'appTransportTopicMerchants') return '/api/app/topics/transport/merchants'
|
if (name == 'appShoppingTopic') return '/api/app/topics/shopping'
|
if (name == 'appShoppingTopicMerchants') return '/api/app/topics/shopping/merchants'
|
if (name == 'appPremiumTopic') return '/api/app/topics/premium'
|
if (name == 'appPremiumTopicServices') return '/api/app/topics/premium/services'
|
if (name == 'appSpouseEmploymentBenefit') return '/api/app/spouse-employment-benefits/'
|
if (name == 'appAdminApprovalBenefit') return '/api/app/admin-approval-benefits/'
|
if (name == 'appFinanceMerchantDetail') return '/api/app/finance-merchants/'
|
if (name == 'appChildrenEntrustmentBenefit') return '/api/app/children-entrustment-benefits/'
|
if (name == 'appChildrenEntrustmentSchool') return '/api/app/children-entrustment-benefits/schools/'
|
if (name == 'appChildren') return '/api/app/children'
|
if (name == 'appMedicalMerchantPackages') return '/api/app/medical-merchants/'
|
if (name == 'appMedicalPackages') return '/api/app/medical-packages/'
|
if (name == 'appServiceAppointmentApplications') return '/api/app/service-appointment-applications'
|
if (name == 'appFuelMerchantDetail') return '/api/app/fuel-merchants/'
|
if (name == 'appParkingMerchantDetail') return '/api/app/parking-merchants/'
|
if (name == 'appParkingPlateSubmissions') return '/api/app/parking-plate-submissions'
|
if (name == 'appCarWashMerchantDetail') return '/api/app/car-wash-merchants/'
|
if (name == 'appShoppingMerchantDetail') return '/api/app/shopping-merchants/'
|
if (name == 'appCinemaMerchants') return '/api/app/cinemas/'
|
if (name == 'appCinemaCouponClaims') return '/api/app/cinema-coupon-claims/'
|
if (name == 'appTicketPackageClaims') return '/api/app/ticket-packages/claims/'
|
if (name == 'appOrderCoupons') return '/api/app/order-drafts/coupons'
|
if (name == 'appOrderCouponQuote') return '/api/app/order-drafts/coupon-quote'
|
if (name == 'appOrders') return '/api/app/orders'
|
if (name == 'appTalentCardProfile') return '/api/app/talent-cards/profile'
|
if (name == 'appFamilyCardAccess') return '/api/app/talent-cards/family-card-access'
|
if (name == 'appTalentDynamicCode') return '/api/app/talent-cards/'
|
if (name == 'appCardUpgrades') return '/api/app/card-upgrades'
|
if (name == 'appUsageRecords') return '/api/app/usage-records'
|
if (name == 'appPendingOrders') return '/api/app/pending-orders/'
|
if (name == 'appPendingUseOrders') return '/api/app/pending-use-orders/'
|
if (name == 'appCompletedOrders') return '/api/app/completed-orders/'
|
if (name == 'appCancelledOrders') return '/api/app/cancelled-orders/'
|
if (name == 'appProcessingApplications') return '/api/app/processing-applications/'
|
if (name == 'appFamilyCards') return '/api/app/family-cards/applications'
|
if (name == 'appTicketPackages') return '/api/app/ticket-packages'
|
if (name == 'appDisplayMerchantPolicies') return '/api/app/display-merchant-policies'
|
if (name == 'appFreeBenefits') return '/api/app/free-benefits'
|
if (name == 'appBenefitVerificationCodes') return '/api/app/benefit-verification-codes'
|
if (name == 'appAgreements') return '/api/app/agreements/'
|
if (name == 'appUploadImage') return '/api/app/uploads/images'
|
if (name == 'authLogin') return '/api/app/auth/login'
|
if (name == 'authDevelopmentSession') return '/api/app/auth/development-session'
|
if (name == 'authRefresh') return '/api/app/auth/refresh'
|
if (name == 'authLogout') return '/api/app/auth/logout'
|
if (name == 'orderCreate') return ''
|
if (name == 'orderPayment') return ''
|
if (name == 'orderPaymentResult') return ''
|
if (name == 'dynamicCode') return ''
|
if (name == 'couponClaim') return ''
|
if (name == 'couponDetail') return ''
|
if (name == 'fileUpload') return '/api/app/uploads/images'
|
if (name == 'recordDetail') return ''
|
if (name == 'businessSubmit') return ''
|
return ''
|
}
|