feat:新版本读卡适配梦卡诺
This commit is contained in:
1 parent
82b73a8a03
commit
4c76840ae1
10 files changed
+285
-40
No files matched your search
@@ -639,6 +639,20 @@ abstract class AppSettingTool {
|
||||
sysJson[_serialCardConfigKey] = config.toJson();
|
||||
});
|
||||
|
||||
/// 仅保存本机可编辑项;保留并发同步得到的最新密码 B,避免页面旧快照覆盖认证密钥。
|
||||
static Future<void> setSerialCardLocalConfig(SerialCardConfig config) =>
|
||||
_patchSerialCardConfig(config.toJson()..remove('keyBHex'));
|
||||
|
||||
/// 在已有设置写入队列中合并读写卡配置,位置编辑与密钥同步互不覆盖。
|
||||
static Future<void> _patchSerialCardConfig(Map<String, dynamic> patch) =>
|
||||
_updateSysJson((sysJson) {
|
||||
final source = sysJson[_serialCardConfigKey];
|
||||
sysJson[_serialCardConfigKey] = <String, dynamic>{
|
||||
if (source is Map) ...Map<String, dynamic>.from(source),
|
||||
...patch,
|
||||
};
|
||||
});
|
||||
|
||||
/// 查询方式顺序和默认项属于页面交互配置,继续保存在 sysJson 中,不增加数据库字段。
|
||||
static Future<ReservationQueryPagePreferences>
|
||||
getReservationQueryPagePreferences() async {
|
||||
@@ -948,14 +962,11 @@ abstract class AppSettingTool {
|
||||
// 商户饭卡密码 B 单独保存在读写卡配置里;服务端未返回或值非法时不覆盖本机缓存,
|
||||
// 保证离线场景仍能用上一次同步成功的密钥。
|
||||
final cardKey = data.cardKey?.trim();
|
||||
if (cardKey != null &&
|
||||
RegExp(r'^[0-9a-fA-F]{12}$').hasMatch(cardKey)) {
|
||||
if (cardKey != null && RegExp(r'^[0-9a-fA-F]{12}$').hasMatch(cardKey)) {
|
||||
final cardConfig = await getSerialCardConfig();
|
||||
final normalizedKey = cardKey.toUpperCase();
|
||||
if (cardConfig.keyBHex != normalizedKey) {
|
||||
await setSerialCardConfig(
|
||||
cardConfig.copyWith(keyBHex: normalizedKey),
|
||||
);
|
||||
await _patchSerialCardConfig({'keyBHex': normalizedKey});
|
||||
logger.i('同步商户饭卡密码B成功');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user