xcAlarmMSGCalendar method
报警日历查询
deviceId 设备
monthDateTime 查询某个月份 可选
startTime 开始日期 可选
endTime 结束日期 可选
channel 通道号 可选
userId 设备的userId 可选
mUserid 分享的设备,其主账号的userId 可选
seq自定义值
要么只传monthDateTime,要么传startTime和endTime,两种方式选择一个
return '2023-06-17','2023-06-18'
Implementation
Future<List<String>> xcAlarmMSGCalendar(
{required String deviceId,
DateTime? monthDateTime,
DateTime? startTime,
DateTime? endTime,
int? channel,
String? userId,
String? mUserid}) async {
if (monthDateTime == null && startTime != null && endTime != null) {
assert(startTime.isBefore(endTime) || startTime == endTime,
'开始日期必须早于等于结束日期');
}
String jsonStr = paramConfig(
deviceId: deviceId,
type: CalendarType.alarmMessage,
monthDateTime: monthDateTime,
startTime: startTime,
endTime: endTime,
mUserid: mUserid);
final originResponse =
await _api.xcAlarmCalendar(deviceId, jsonStr, ApiSeq.instance.getSeq());
XCloudResponse<Map<String, dynamic>> response =
XCloudResponse.fromOriginResponse<Map<String, dynamic>>(originResponse);
if (response.code < 0) {
return Future.error(XCloudAPIException(
code: response.code, commandId: originResponse.commandId));
}
final dateMapList = response.data['dt'];
final List<String> result = [];
for (var dateMap in dateMapList) {
result.add(dateMap['tm']);
}
return Future.value(result);
}