feat: 添加商户规则支持和用户实体扩展

- 在 `UserEntity` 中添加 `canteenId` 字段以支持离线模式
- 新增 `ServiceMchRule` 模型和相关 API 方法用于获取商户规则
- 更新 `CanteenExtraPriceSetting` 模型以包含商户规则列表
- 在 `CanteenProductController` 中添加获取商户规则的逻辑
- 更新数据库表结构以支持 `canteenId` 字段
This commit is contained in:
dzc committed 2025-05-15 10:28:43 +08:00
1 parent 47ad782e9a
commit cf9f8da767
10 files changed
+104 -4

No files matched your search

@@ -35,6 +35,9 @@ class UserEntity extends Equatable {
/// 钱包余额
int? walletBalance;
/// 用户所属的商户id(主要用于机器的离线模式)
int? canteenId;
/// 创建时间
DateTime? createTime;
@@ -51,6 +54,7 @@ class UserEntity extends Equatable {
this.walletId,
this.walletTypeId,
this.walletBalance,
this.canteenId,
this.createTime,
this.updateTime,
});
@@ -16,6 +16,7 @@ UserEntity _$UserEntityFromJson(Map<String, dynamic> json) => UserEntity(
walletId: json['walletId'] as String?,
walletTypeId: json['walletTypeId'] as String?,
walletBalance: (json['walletBalance'] as num?)?.toInt(),
canteenId: (json['canteenId'] as num?)?.toInt(),
createTime: json['createTime'] == null
? null
: DateTime.parse(json['createTime'] as String),
@@ -35,6 +36,7 @@ Map<String, dynamic> _$UserEntityToJson(UserEntity instance) =>
'walletId': instance.walletId,
'walletTypeId': instance.walletTypeId,
'walletBalance': instance.walletBalance,
'canteenId': instance.canteenId,
'createTime': instance.createTime?.toIso8601String(),
'updateTime': instance.updateTime?.toIso8601String(),
};