// // NetworkConfig.h // AICity // // Created by API Versioning Implementation on 2025/10/10. // Copyright © 2025 TogetherWatch. All rights reserved. // #import /** * API版本配置 * * 定义API版本常量和版本化URL构建逻辑 */ // API版本号 #define API_VERSION @"v1" // 基础URL(根据编译配置区分Debug和Release) #ifdef DEBUG #ifndef BASE_API_URL // 自动区分模拟器和真机 #if TARGET_IPHONE_SIMULATOR #define BASE_API_URL @"http://localhost:8888/" #else #define BASE_API_URL @"http://192.168.110.66:8888/" #endif #endif #else #ifndef BASE_API_URL #define BASE_API_URL @"https://backend.jsnoopyay.com/" #endif #endif // 版本化基础URL宏 #define VERSIONED_BASE_URL [NSString stringWithFormat:@"%@api/%@/", BASE_API_URL, API_VERSION] /** * 网络配置类 * * 提供API版本管理的工具方法 */ @interface NetworkConfig : NSObject /** * 获取版本化的基础URL * * @return 包含API版本前缀的完整基础URL * * 示例: * - Debug: http://192.168.110.66:8888/api/v1/ * - Release: https://backend.jsnoopyay.com/api/v1/ */ + (NSString *)versionedBaseURL; /** * 获取当前API版本 * * @return 版本标识符(如"v1") */ + (NSString *)currentAPIVersion; /** * 获取原始基础URL(不含版本前缀) * * @return 基础URL */ + (NSString *)baseURL; /** * 检查是否启用了API版本化 * * @return YES表示启用版本化 */ + (BOOL)isVersioningEnabled; @end