fix:关闭广布bug

This commit is contained in:
dzc committed 2025-05-13 18:13:43 +08:00
1 parent 273759a549
commit d309b9fcbc
7 files changed
+60 -20

No files matched your search

+1 -1
View File
@@ -22,7 +22,7 @@ class SyncCheckTool {
Duration printInterval = const Duration(seconds: 60 * 10);
Duration broadcastInterval = const Duration(seconds: 60 * 3);
Duration broadcastInterval = const Duration(seconds: 60 * 2);
Timer? mqTimer;
@@ -76,7 +76,7 @@ abstract class SyncTakeFoodBroadcastTool {
}
String msg = "请手机尾号";
for (final content in uniqueContents) {
msg += "$content,";
msg += "${TtsManage.numberToChineseReading(content)},";
}
// 逗号会影响语音播报断句
msg = msg.substring(0, msg.length - 1);
@@ -143,16 +143,23 @@ abstract class SyncTakeFoodBroadcastTool {
}
return false;
}
// final serviceCodes =
// serviceList.records?.map((e) => e.id.toString()).toList();
// if (ObjectUtil.isEmptyList(serviceCodes)) {
// return result;
// }
// 根据服务码查询本地数据库
await broadcastDao.delAll();
// 转化为 BroadcastEntity
final saveList = serviceList.records!
.map((e) => _convertServiceBroadcastTodayToBroadcastEntity(e))
.toList();
// 查询全部本地数据
final localList = await broadcastDao.findAllPage("-1", 999, 0);
final localServiceCode = localList.map((i) => i.serviceCode).toList();
for (final i in saveList) {
if (localServiceCode.contains(i.serviceCode)) {
final target =
localList.firstWhereOrNull((j) => j.serviceCode == i.serviceCode);
if (target != null) {
i.enable = target.enable;
}
}
}
await broadcastDao.delAll();
await broadcastDao.batchSave(saveList);
return result;
}