feat(passport): 迁移并修复小程序支付页面访问 websopy API 问题
- 迁移 src/passport/pay 相关代码至当前项目,无需替换文件 - 新增环境变量 WEBSOPY_API_BASE_URL,提供 websopy API 基础地址 - 在 config/app.ts 导出 WebsopyBaseUrl,供代码引用 - 配置 env.d.ts 类型定义,消除 TypeScript 隐式 any 错误 - request 请求方法支持自定义 baseUrl 以调用不同接口地址 - passport/pay 页面调用订阅接口统一传入 WebsopyBaseUrl - 修正 tenantId 类型为 number,调整登录用户类型断言 - 确认编译成功,dist 目录生成对应文件及正确请求地址 - 说明 type-check 依赖库问题不影响正常构建和运行
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import { API_BASE_URL, SERVER_API_URL } from './env'
|
||||
import { API_BASE_URL, SERVER_API_URL, WEBSOPY_API_BASE_URL } from './env'
|
||||
|
||||
export const TenantId = '5'
|
||||
export const TenantName = '威硕开发助手'
|
||||
export const BaseUrl = API_BASE_URL
|
||||
export const ServerBaseUrl = SERVER_API_URL
|
||||
export const WebsopyBaseUrl = WEBSOPY_API_BASE_URL
|
||||
export const Version = 'v3.0.0'
|
||||
|
||||
30
config/env.d.ts
vendored
Normal file
30
config/env.d.ts
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
export const CURRENT_ENV: string
|
||||
export const ENV_CONFIG: {
|
||||
development: {
|
||||
API_BASE_URL: string
|
||||
SERVER_API_URL: string
|
||||
WEBSOPY_API_BASE_URL: string
|
||||
APP_NAME: string
|
||||
DEBUG: string
|
||||
}
|
||||
test: {
|
||||
API_BASE_URL: string
|
||||
SERVER_API_URL: string
|
||||
WEBSOPY_API_BASE_URL: string
|
||||
APP_NAME: string
|
||||
DEBUG: string
|
||||
}
|
||||
production: {
|
||||
API_BASE_URL: string
|
||||
SERVER_API_URL: string
|
||||
WEBSOPY_API_BASE_URL: string
|
||||
APP_NAME: string
|
||||
DEBUG: string
|
||||
}
|
||||
}
|
||||
export function getEnvConfig(): (typeof ENV_CONFIG)[keyof typeof ENV_CONFIG]
|
||||
export const API_BASE_URL: string
|
||||
export const SERVER_API_URL: string
|
||||
export const WEBSOPY_API_BASE_URL: string
|
||||
export const APP_NAME: string
|
||||
export const DEBUG: string
|
||||
@@ -4,18 +4,21 @@ export const ENV_CONFIG = {
|
||||
development: {
|
||||
API_BASE_URL: 'https://shop-api.websoft.top/api',
|
||||
SERVER_API_URL: 'https://server.websoft.top/api',
|
||||
WEBSOPY_API_BASE_URL: 'https://websopy-api.websoft.top/api',
|
||||
APP_NAME: '威硕谱软件',
|
||||
DEBUG: 'true',
|
||||
},
|
||||
test: {
|
||||
API_BASE_URL: 'https://shop-api.websoft.top/api',
|
||||
SERVER_API_URL: 'https://server.websoft.top/api',
|
||||
WEBSOPY_API_BASE_URL: 'https://websopy-api.websoft.top/api',
|
||||
APP_NAME: '威硕谱软件',
|
||||
DEBUG: 'true',
|
||||
},
|
||||
production: {
|
||||
API_BASE_URL: 'https://shop-api.websoft.top/api',
|
||||
SERVER_API_URL: 'https://server.websoft.top/api',
|
||||
WEBSOPY_API_BASE_URL: 'https://websopy-api.websoft.top/api',
|
||||
APP_NAME: '威硕谱软件',
|
||||
DEBUG: 'false',
|
||||
},
|
||||
@@ -25,4 +28,4 @@ export function getEnvConfig() {
|
||||
return ENV_CONFIG[CURRENT_ENV] || ENV_CONFIG.development
|
||||
}
|
||||
|
||||
export const { API_BASE_URL, SERVER_API_URL, APP_NAME, DEBUG } = getEnvConfig()
|
||||
export const { API_BASE_URL, SERVER_API_URL, WEBSOPY_API_BASE_URL, APP_NAME, DEBUG } = getEnvConfig()
|
||||
|
||||
Reference in New Issue
Block a user