生成路径 对接
This commit is contained in:
@@ -28,6 +28,7 @@ class PathRepositoryImpl implements PathRepository {
|
||||
'holes': holes.map((hole) => hole.toJson()).toList(),
|
||||
'workType': workType,
|
||||
});
|
||||
print('请求体: $body'); // 调试输出请求体
|
||||
|
||||
try {
|
||||
final response = await http.post(url, headers: headers, body: body);
|
||||
@@ -134,14 +135,12 @@ class PathRepositoryImpl implements PathRepository {
|
||||
required String workName,
|
||||
}) async {
|
||||
final timestamp = DateTime.now().millisecondsSinceEpoch;
|
||||
final url = Uri.parse(
|
||||
'https://serviceri.satabot.com/iot/workRecord/selectByWorkName',
|
||||
).replace(
|
||||
queryParameters: {
|
||||
'workName': workName,
|
||||
'_t': timestamp.toString(),
|
||||
},
|
||||
);
|
||||
final url =
|
||||
Uri.parse(
|
||||
'https://serviceri.satabot.com/iot/workRecord/selectByWorkName',
|
||||
).replace(
|
||||
queryParameters: {'workName': workName, '_t': timestamp.toString()},
|
||||
);
|
||||
print('请求URL: $url');
|
||||
|
||||
try {
|
||||
@@ -167,20 +166,22 @@ class PathRepositoryImpl implements PathRepository {
|
||||
} else if (rawData is Map) {
|
||||
records = [Map<String, dynamic>.from(rawData)];
|
||||
} else {
|
||||
throw Exception('Unexpected data type for "data": ${rawData.runtimeType}');
|
||||
throw Exception(
|
||||
'Unexpected data type for "data": ${rawData.runtimeType}',
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
return records;
|
||||
} else {
|
||||
throw Exception('API error: ${data['msg'] ?? 'Unknown'}');
|
||||
}
|
||||
} else {
|
||||
throw Exception('HTTP ${response.statusCode}: ${response.reasonPhrase}');
|
||||
throw Exception(
|
||||
'HTTP ${response.statusCode}: ${response.reasonPhrase}',
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
throw Exception('Network error in selectWorkRecordByName: $e');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user