| 1234567891011121314151617181920212223242526272829303132333435363738 |
- import 'package:chicken_farm/core/api/api_service.dart';
- import 'package:chicken_farm/modes/device/inspection_rule/checkin_log.dart';
- import 'package:chicken_farm/modes/device/inspection_rule/inspection_rule.dart';
- class InspectionRuleApi {
- static final InspectionRuleApi _instance = InspectionRuleApi._internal();
- factory InspectionRuleApi() => _instance;
- InspectionRuleApi._internal();
- Future<InspectionRuleModel?> queryRule(String id) async {
- final response = await ApiService().get('/device/inspectionRule/$id');
- if (response == null) return null;
- return InspectionRuleModel.fromJson(response);
- }
- Future<List<CheckinLogModel>> queryCheckinList(String id) async {
- final response = await ApiService().get(
- '/device/inspectionRule/queryCheckinList/$id',
- );
- if (response == null) return List.empty();
- return response
- .map<CheckinLogModel>((e) => CheckinLogModel.fromJson(e))
- .toList();
- }
- Future<dynamic> checkIn(String id) async {
- return await ApiService().post('/device/inspectionRule/checkIn/$id');
- }
- Future<dynamic> checkInWithPhoto(String id, dynamic data) async {
- return await ApiService().post(
- '/device/inspectionRule/checkInWithPhoto/$id',
- data: data,
- );
- }
- }
|