重构和优化http接口支持切换端口

This commit is contained in:
2026-09-18 09:43:32 +08:00
parent ab75e8c5b0
commit fb2f32f423
8 changed files with 32 additions and 21 deletions

View File

@@ -1,7 +1,8 @@
import '../env/env_config.dart';
class HttpApiConsts {
// static const String baseUrl = "http://8.159.134.0:8012"; // 旧地址
// static const String baseUrl = "http://1.95.137.212:59015"; // 测试地址
static const String baseUrl = "http://1.95.137.212:8081"; // 生产地址
// 环境地址统一由 EnvConfig 按 ENV 切换:prod=8081 / test=59015
static const String baseUrl = EnvConfig.baseUrl;
/// 账号相关
// 登录
@@ -65,7 +66,7 @@ class HttpApiConsts {
static const String flightTaskCommand = "$baseUrl/iot/UAV/flightTaskCommand";
/// 告警相关
static const String alarmBaseUrl = "http://1.95.137.212:8081";
static const String alarmBaseUrl = baseUrl;
// 获取告警工单配置列表
static const String alarmOrderConfigList =
"$alarmBaseUrl/iot/alarmOrderConfig/list";

View File

@@ -14,6 +14,12 @@ class EnvConfig {
static bool get isProduction => environment == 'prod';
/// HTTP 主后端地址(编译期常量,随 ENV 切换)
/// 生产: 8081 测试: 59015
static const String baseUrl = environment == 'prod'
? 'http://1.95.137.212:8081'
: 'http://1.95.137.212:59015';
/// TCP 服务器配置
static String get tcpIp => '1.95.137.212';