| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- /*
- * API URLs 配置文件
- * 统一管理项目中所有的API地址,方便调试和切换环境
- */
- /**
- * API 服务器基础URL
- * 手动修改这个值来切换不同的服务器环境
- * https://tc4ug8.cc
- */
- export const API_BASE_URL = `https://api.${import.meta.env.VITE_API_DOMAIN}`;
- /**
- * API端点配置
- */
- export const API_ENDPOINTS = {
- // Fish API 相关端点
- FISH: {
- CREATE: '/api/fish/create',
- UPDATE: '/api/fish/update',
- DELETE: '/api/fish/delete',
- GET: '/api/fish/get'
- },
- // Fish Friends API 相关端点
- FISH_FRIENDS: {
- BATCH: '/api/fish-friends/batch',
- CREATE: '/api/fish-friends/create',
- UPDATE: '/api/fish-friends/update',
- DELETE: '/api/fish-friends/delete'
- },
- // 聊天记录相关端点
- RECORDS: {
- UPLOAD: '/api/records/upload',
- DOWNLOAD: '/api/records/download',
- LIST: '/api/records/list'
- },
- // 用户信息相关端点
- USER_INFO: {
- GET: '/api/user/info',
- UPDATE: '/api/user/update'
- },
- // 消息相关端点
- MESSAGES: {
- CREATE: '/api/messages/',
- BATCH: '/api/messages/batch'
- }
- } as const;
- /**
- * 构建完整的API URL
- * @param endpoint API端点
- */
- export function buildApiUrl(endpoint: string): string {
- return `${API_BASE_URL}${endpoint}`;
- }
- /**
- * 获取API基础URL
- */
- export function getApiBaseUrl(): string {
- return API_BASE_URL;
- }
- // 导出默认的API基础URL,保持向后兼容
- export const DEFAULT_API_BASE_URL = API_BASE_URL;
|