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

@@ -222,17 +222,22 @@ class CanteenExtraPriceSetting extends Equatable {
/// 超过的倍数
double payAmountMealTimes;
// 商户支付规则列表
List<ServiceMchRule>? mchRoleList;
CanteenExtraPriceSetting({
required this.payAmountEnable,
required this.payAmountMealLimit,
required this.payAmountMealTimes,
this.mchRoleList,
});
@override
List<Object> get props => [
List<Object?> get props => [
payAmountEnable,
payAmountMealLimit,
payAmountMealTimes,
mchRoleList,
];
factory CanteenExtraPriceSetting.fromJson(Map<String, dynamic> json) =>
@@ -161,6 +161,9 @@ CanteenExtraPriceSetting _$CanteenExtraPriceSettingFromJson(
payAmountEnable: json['payAmountEnable'] as bool,
payAmountMealLimit: (json['payAmountMealLimit'] as num).toInt(),
payAmountMealTimes: (json['payAmountMealTimes'] as num).toDouble(),
mchRoleList: (json['mchRoleList'] as List<dynamic>?)
?.map((e) => ServiceMchRule.fromJson(e as Map<String, dynamic>))
.toList(),
);
Map<String, dynamic> _$CanteenExtraPriceSettingToJson(
@@ -169,4 +172,5 @@ Map<String, dynamic> _$CanteenExtraPriceSettingToJson(
'payAmountEnable': instance.payAmountEnable,
'payAmountMealLimit': instance.payAmountMealLimit,
'payAmountMealTimes': instance.payAmountMealTimes,
'mchRoleList': instance.mchRoleList,
};