feat: 重构服务支持双模式并接入 MongoDB 数据库
- 新增 MongoDB 存储层实现英雄、预设和版本数据的持久化 - 新增 push-meta 和 migrate-to-mongo 脚本支持数据同步迁移 - 支持开发版和线上设计版双模式运行 - 新增版本闸门机制,线上设计版落后时进入只读模式 - 优化前端 API 配置适配不同部署环境 - 新增线上设计版静态资源托管和路由回退
This commit is contained in:
@@ -1,12 +1,16 @@
|
||||
import axios from 'axios'
|
||||
|
||||
// 开发环境走 vite 代理(留空即可);部署静态站点时用 VITE_API_BASE 指向后端服务
|
||||
const baseURL = import.meta.env.VITE_API_BASE || ''
|
||||
const http = axios.create({ baseURL })
|
||||
|
||||
export const api = {
|
||||
meta: () => axios.get('/api/meta').then((r) => r.data),
|
||||
refresh: () => axios.post('/api/refresh').then((r) => r.data),
|
||||
fetchHeroes: () => axios.get('/api/heroes').then((r) => r.data),
|
||||
saveHeroes: (heroes) => axios.post('/api/heroes', { heroes }).then((r) => r.data),
|
||||
applyHeroes: (heroes) => axios.post('/api/apply', { heroes }).then((r) => r.data),
|
||||
exportCsv: (heroes) => axios.post('/api/export-csv', { heroes }).then((r) => r.data),
|
||||
fetchTemplates: () => axios.get('/api/templates').then((r) => r.data),
|
||||
saveTemplates: (templates) => axios.post('/api/templates', { templates }).then((r) => r.data),
|
||||
meta: () => http.get('/api/meta').then((r) => r.data),
|
||||
refresh: () => http.post('/api/refresh').then((r) => r.data),
|
||||
fetchHeroes: () => http.get('/api/heroes').then((r) => r.data),
|
||||
saveHeroes: (heroes) => http.post('/api/heroes', { heroes }).then((r) => r.data),
|
||||
applyHeroes: (heroes) => http.post('/api/apply', { heroes }).then((r) => r.data),
|
||||
exportCsv: (heroes) => http.post('/api/export-csv', { heroes }).then((r) => r.data),
|
||||
fetchTemplates: () => http.get('/api/templates').then((r) => r.data),
|
||||
saveTemplates: (templates) => http.post('/api/templates', { templates }).then((r) => r.data),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user