diff --git a/assets/game-api.js b/assets/game-api.js index 267fdec..58e8669 100644 --- a/assets/game-api.js +++ b/assets/game-api.js @@ -17,16 +17,14 @@ const _isDevPort = (port) => (port === 80 && (location.port === '' || location.port === '80')); const API_CONFIG = { - // 本地开发一律跨域直连 Odoo 8069(python http.server 无代理能力); - // 仅 8080 dev-server(自带反向代理到 Odoo)才走同源空 base。 base: _isLocalDev() - ? (_isDevPort(8080) ? '' : `http://${location.hostname}:8069`) - : '', - db: _isLocalDev() ? 'game_a' : 'game', + ? ((_isDevPort(8080) || _isDevPort(8888)) ? '' : `http://${location.hostname}:8080`) + : '', + db: _isLocalDev() ? 'study' : 'game', }; -// 世界(yt_world)所在库:与 API_CONFIG.db 保持一致(本地均为 game_a),避免跨库导致 auth 失败。 -const WORLD_DB = API_CONFIG.db; +// 世界(yt_world)所在库:本地 Odoo 钉 yt_game;线上游戏库名为 game。按域名自适应,git 同步不冲突。 +const WORLD_DB = _isLocalDev() ? 'yt_game' : 'game'; // Odoo 后端基础 URL(世界 API 专用,兼容本地跨域 / 生产同域) const WORLD_BASE = API_CONFIG.base || '';