fix: 验收包写入公司内网地址,避免 Windows 空 VITE 与 Android 假域名
Windows 补 .env.production 与 endpoints 兜底;Android 默认 host/端口改为内网,启动后重写 HttpUtil/ApiService,Urls 改为 getter。 Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
co-authored by
Cursor
multica-agent
parent
18d890ae7f
commit
bbc4dce0b6
@@ -39,7 +39,12 @@ class HttpUtil {
|
||||
dio.options.receiveTimeout = const Duration(seconds: 30);
|
||||
}
|
||||
|
||||
static String get operationID => DateTime.now().millisecondsSinceEpoch.toString();
|
||||
static void setBaseUrl(String url) {
|
||||
dio.options.baseUrl = url;
|
||||
}
|
||||
|
||||
static String get operationID =>
|
||||
DateTime.now().millisecondsSinceEpoch.toString();
|
||||
|
||||
static Future post(
|
||||
String path, {
|
||||
@@ -103,8 +108,11 @@ class HttpUtil {
|
||||
final bytes = await File(compressPath ?? path).readAsBytes();
|
||||
final mf = MultipartFile.fromBytes(bytes, filename: fileName);
|
||||
|
||||
var formData =
|
||||
FormData.fromMap({'operationID': '${DateTime.now().millisecondsSinceEpoch}', 'fileType': 1, 'file': mf});
|
||||
var formData = FormData.fromMap({
|
||||
'operationID': '${DateTime.now().millisecondsSinceEpoch}',
|
||||
'fileType': 1,
|
||||
'file': mf
|
||||
});
|
||||
|
||||
var resp = await dio.post<Map<String, dynamic>>(
|
||||
"${Config.imApiUrl}/third/minio_upload",
|
||||
@@ -151,12 +159,14 @@ class HttpUtil {
|
||||
onCompletion?.call();
|
||||
intervalDo.drop(
|
||||
fun: () async {
|
||||
saveFileToGallerySaver(File(cachePath), showTaost: EasyLoading.isShow);
|
||||
saveFileToGallerySaver(File(cachePath),
|
||||
showTaost: EasyLoading.isShow);
|
||||
},
|
||||
milliseconds: 1500);
|
||||
}
|
||||
if (count == total) {
|
||||
saveFileToGallerySaver(File(cachePath), showTaost: EasyLoading.isShow);
|
||||
saveFileToGallerySaver(File(cachePath),
|
||||
showTaost: EasyLoading.isShow);
|
||||
}
|
||||
},
|
||||
);
|
||||
@@ -166,7 +176,8 @@ class HttpUtil {
|
||||
var byteData = await image.toByteData(format: ImageByteFormat.png);
|
||||
if (byteData != null) {
|
||||
Uint8List uint8list = byteData.buffer.asUint8List();
|
||||
var result = await ImageGallerySaverPlus.saveImage(Uint8List.fromList(uint8list));
|
||||
var result =
|
||||
await ImageGallerySaverPlus.saveImage(Uint8List.fromList(uint8list));
|
||||
if (result != null) {
|
||||
var tips = StrRes.saveSuccessfully;
|
||||
if (Platform.isAndroid) {
|
||||
@@ -214,13 +225,15 @@ class HttpUtil {
|
||||
);
|
||||
}
|
||||
|
||||
static Future saveFileToGallerySaver(File file, {String? name, bool showTaost = true}) async {
|
||||
static Future saveFileToGallerySaver(File file,
|
||||
{String? name, bool showTaost = true}) async {
|
||||
Permissions.storage(() async {
|
||||
var tips = StrRes.saveSuccessfully;
|
||||
Logger.print('saveFileToGallerySaver: ${file.path}');
|
||||
final imageBytes = await file.readAsBytes();
|
||||
|
||||
final result = await ImageGallerySaverPlus.saveImage(imageBytes, name: name);
|
||||
final result =
|
||||
await ImageGallerySaverPlus.saveImage(imageBytes, name: name);
|
||||
if (result != null && showTaost) {
|
||||
if (Platform.isAndroid) {
|
||||
final filePath = result['filePath'].split('//').last;
|
||||
|
||||
Reference in New Issue
Block a user