1,接收tcp推送消息和和接收tcp推送机器的状态推送消息。
2,集成选择作业列表中的一项接口。
This commit is contained in:
@@ -6,7 +6,7 @@ import '../models/device_add_path_point_model.dart';
|
||||
import '../models/device_work_area_param_model.dart';
|
||||
|
||||
class PathRepositoryImpl implements PathRepository {
|
||||
final String baseUrl = 'https://your-backend-api.com'; // 后端接口地址
|
||||
final String baseUrl = 'https://serviceri.satabot.com'; // 后端接口地址
|
||||
// 生成路径
|
||||
@override
|
||||
Future<List<DeviceAddPathPointModel>> generatePath({
|
||||
@@ -115,6 +115,35 @@ class PathRepositoryImpl implements PathRepository {
|
||||
throw Exception('Network error in deleteWorkRecord: $e');
|
||||
}
|
||||
}
|
||||
/// 选择工作记录
|
||||
@override
|
||||
Future<List<Map<String, dynamic>>> selectWorkRecordByName({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(), // 防缓存
|
||||
});
|
||||
|
||||
try {
|
||||
final response = await http.get(url);
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
final data = jsonDecode(response.body) as Map<String, dynamic>;
|
||||
|
||||
if (data['code'] == 200 && data.containsKey('data')) {
|
||||
final List<dynamic> records = data['data'];
|
||||
return List<Map<String, dynamic>>.from(records);
|
||||
} else {
|
||||
throw Exception('API error: ${data['msg'] ?? 'Unknown'}');
|
||||
}
|
||||
} else {
|
||||
throw Exception('HTTP ${response.statusCode}: ${response.reasonPhrase}');
|
||||
}
|
||||
} catch (e) {
|
||||
throw Exception('Network error in selectWorkRecordByName: $e');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user