fix:调整猫眼设置返回的数据类型不一致导致锁设置无法加载的问题

This commit is contained in:
liyi 2025-03-03 09:20:41 +08:00
parent 30864b5b2f
commit 2fb2731011
5 changed files with 32 additions and 32 deletions

View File

@ -824,8 +824,8 @@ class LockDetailLogic extends BaseGetXController {
recordEndTime: 0, recordEndTime: 0,
recordMode: 0, recordMode: 0,
recordStartTime: 0, recordStartTime: 0,
recordTime: 0, recordTime: '0',
detectionDistance: 0))); detectionDistance: '0')));
} }
state.keyInfos.value.lockSetting!.catEyeConfig![0].catEyeMode = event state.keyInfos.value.lockSetting!.catEyeConfig![0].catEyeMode = event
.lockSetInfoData.lockSettingInfo!.catEyeConfig![0].catEyeMode ?? .lockSetInfoData.lockSettingInfo!.catEyeConfig![0].catEyeMode ??

View File

@ -250,8 +250,8 @@ class CatEyeSetLogic extends BaseGetXController {
recordEndTime: 0, recordEndTime: 0,
recordMode: 0, recordMode: 0,
recordStartTime: 0, recordStartTime: 0,
recordTime: 0, recordTime: '0',
detectionDistance: 0))); detectionDistance: '0')));
} }
state.lockSetInfoData.value.lockSettingInfo!.catEyeConfig![0].catEyeMode = state.lockSetInfoData.value.lockSettingInfo!.catEyeConfig![0].catEyeMode =
state.catEyeConfig.value.catEyeMode; state.catEyeConfig.value.catEyeMode;
@ -271,15 +271,16 @@ class CatEyeSetLogic extends BaseGetXController {
.catEyeConfig![0] .catEyeConfig![0]
.catEyeModeConfig .catEyeModeConfig
?.recordEndTime = state.catEyeConfig.value.recordEndTime; ?.recordEndTime = state.catEyeConfig.value.recordEndTime;
state.lockSetInfoData.value.lockSettingInfo!.catEyeConfig![0]
.catEyeModeConfig?.recordTime = state.catEyeConfig.value.recordTime;
state state
.lockSetInfoData .lockSetInfoData
.value .value
.lockSettingInfo! .lockSettingInfo!
.catEyeConfig![0] .catEyeConfig![0]
.catEyeModeConfig .catEyeModeConfig
?.detectionDistance = state.catEyeConfig.value.detectionDistance; ?.recordTime = state.catEyeConfig.value.recordTime.toString();
state.lockSetInfoData.value.lockSettingInfo!.catEyeConfig![0]
.catEyeModeConfig?.detectionDistance =
state.catEyeConfig.value.detectionDistance.toString();
state state
.lockSetInfoData .lockSetInfoData
.value .value

View File

@ -88,13 +88,13 @@ class CatEyeSetState {
.catEyeConfig![0].catEyeModeConfig!.recordStartTime!); .catEyeConfig![0].catEyeModeConfig!.recordStartTime!);
recordEndTime = _handleTimeToM(lockSetInfoData.value.lockSettingInfo! recordEndTime = _handleTimeToM(lockSetInfoData.value.lockSettingInfo!
.catEyeConfig![0].catEyeModeConfig!.recordEndTime!); .catEyeConfig![0].catEyeModeConfig!.recordEndTime!);
recordTime = lockSetInfoData.value.lockSettingInfo!.catEyeConfig![0] recordTime = int.parse(lockSetInfoData.value.lockSettingInfo!
.catEyeModeConfig!.recordTime!; .catEyeConfig![0].catEyeModeConfig!.recordTime!);
if (lockSetInfoData.value.lockSettingInfo!.catEyeConfig![0]! if (lockSetInfoData.value.lockSettingInfo!.catEyeConfig![0]!
.catEyeModeConfig!.detectionDistance != .catEyeModeConfig!.detectionDistance !=
null) { null) {
detectionDistance = lockSetInfoData.value.lockSettingInfo! detectionDistance = int.parse(lockSetInfoData.value.lockSettingInfo!
.catEyeConfig![0].catEyeModeConfig!.detectionDistance!; .catEyeConfig![0].catEyeModeConfig!.detectionDistance!);
} }
realTimeMode = lockSetInfoData.value.lockSettingInfo!.catEyeConfig![0] realTimeMode = lockSetInfoData.value.lockSettingInfo!.catEyeConfig![0]
.catEyeModeConfig!.realTimeMode!; .catEyeModeConfig!.realTimeMode!;

View File

@ -717,21 +717,21 @@ class CatEyeModeConfig {
// JSON // JSON
factory CatEyeModeConfig.fromJson(Map<String, dynamic> json) { factory CatEyeModeConfig.fromJson(Map<String, dynamic> json) {
return CatEyeModeConfig( return CatEyeModeConfig(
recordMode: json['recordMode']?.toInt(), recordMode: json['recordMode'] != null ? int.tryParse(json['recordMode'].toString()) : null,
recordTime: json['recordTime']?.toInt(), recordTime: json['recordTime'],
realTimeMode: json['realTimeMode']?.toInt(), realTimeMode: json['realTimeMode'] != null ? int.tryParse(json['realTimeMode'].toString()) : null,
recordEndTime: json['recordEndTime']?.toInt(), recordEndTime: json['recordEndTime'] != null ? int.tryParse(json['recordEndTime'].toString()) : null,
recordStartTime: json['recordStartTime']?.toInt(), recordStartTime: json['recordStartTime'] != null ? int.tryParse(json['recordStartTime'].toString()) : null,
detectionDistance: json['detectionDistance']?.toInt(), detectionDistance: json['detectionDistance'],
); );
} }
int? recordMode; int? recordMode;
int? recordTime; String? recordTime;
int? realTimeMode; int? realTimeMode;
int? recordEndTime; int? recordEndTime;
int? recordStartTime; int? recordStartTime;
int? detectionDistance; String? detectionDistance;
// JSON // JSON
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {

View File

@ -325,7 +325,6 @@ class NetworkInfo {
} }
} }
class Bluetooth { class Bluetooth {
Bluetooth( Bluetooth(
{this.bluetoothDeviceId, {this.bluetoothDeviceId,
@ -447,8 +446,8 @@ class LockSetting {
// catEyeConfig // catEyeConfig
catEyeConfig: json['catEyeConfig'] != null catEyeConfig: json['catEyeConfig'] != null
? (json['catEyeConfig'] as List) ? (json['catEyeConfig'] as List)
.map((item) => CatEyeConfig.fromJson(item)) .map((item) => CatEyeConfig.fromJson(item))
.toList() .toList()
: [], : [],
); );
} }
@ -473,7 +472,6 @@ class LockSetting {
} }
} }
// CatEyeConfig // CatEyeConfig
class CatEyeConfig { class CatEyeConfig {
CatEyeConfig({ CatEyeConfig({
@ -485,7 +483,8 @@ class CatEyeConfig {
factory CatEyeConfig.fromJson(Map<String, dynamic> json) { factory CatEyeConfig.fromJson(Map<String, dynamic> json) {
return CatEyeConfig( return CatEyeConfig(
catEyeMode: json['catEyeMode']?.toInt() ?? 0, catEyeMode: json['catEyeMode']?.toInt() ?? 0,
catEyeModeConfig: CatEyeModeConfig.fromJson(json['catEyeModeConfig'] ?? {}), catEyeModeConfig:
CatEyeModeConfig.fromJson(json['catEyeModeConfig'] ?? {}),
); );
} }
@ -515,21 +514,21 @@ class CatEyeModeConfig {
// JSON // JSON
factory CatEyeModeConfig.fromJson(Map<String, dynamic> json) { factory CatEyeModeConfig.fromJson(Map<String, dynamic> json) {
return CatEyeModeConfig( return CatEyeModeConfig(
recordMode: json['recordMode']?.toInt(), recordMode: json['recordMode'] != null ? int.tryParse(json['recordMode'].toString()) : null,
recordTime: json['recordTime']?.toInt(), recordTime: json['recordTime'],
realTimeMode: json['realTimeMode']?.toInt(), realTimeMode: json['realTimeMode'] != null ? int.tryParse(json['realTimeMode'].toString()) : null,
recordEndTime: json['recordEndTime']?.toInt(), recordEndTime: json['recordEndTime'] != null ? int.tryParse(json['recordEndTime'].toString()) : null,
recordStartTime: json['recordStartTime']?.toInt(), recordStartTime: json['recordStartTime'] != null ? int.tryParse(json['recordStartTime'].toString()) : null,
detectionDistance: json['detectionDistance']?.toInt(), detectionDistance: json['detectionDistance'],
); );
} }
int? recordMode; int? recordMode;
int? recordTime; String? recordTime;
int? realTimeMode; int? realTimeMode;
int? recordEndTime; int? recordEndTime;
int? recordStartTime; int? recordStartTime;
int? detectionDistance; String? detectionDistance;
// JSON // JSON
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {