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

@@ -52,3 +52,37 @@ class ServicePaySetting {
Map<String, dynamic> toJson() => _$ServicePaySettingToJson(this);
}
@JsonSerializable()
class ServiceMchRule {
String id;
/// 源商户id
String sourceMchId;
/// 目标商户id
String targetMchId;
/// 规则配置id
int rulePriceConfigId;
/// 基础价格
int basePrice;
/// 额外需要支付的倍数
int multiple;
ServiceMchRule({
required this.id,
required this.sourceMchId,
required this.targetMchId,
required this.rulePriceConfigId,
required this.basePrice,
required this.multiple,
});
factory ServiceMchRule.fromJson(Map<String, dynamic> json) =>
_$ServiceMchRuleFromJson(json);
Map<String, dynamic> toJson() => _$ServiceMchRuleToJson(this);
}
@@ -36,3 +36,23 @@ Map<String, dynamic> _$ServicePaySettingToJson(ServicePaySetting instance) =>
'offLineOrderApplyEnable':
JsonTool.booleanToString(instance.offLineOrderApplyEnable),
};
ServiceMchRule _$ServiceMchRuleFromJson(Map<String, dynamic> json) =>
ServiceMchRule(
id: json['id'] as String,
sourceMchId: json['sourceMchId'] as String,
targetMchId: json['targetMchId'] as String,
rulePriceConfigId: (json['rulePriceConfigId'] as num).toInt(),
basePrice: (json['basePrice'] as num).toInt(),
multiple: (json['multiple'] as num).toInt(),
);
Map<String, dynamic> _$ServiceMchRuleToJson(ServiceMchRule instance) =>
<String, dynamic>{
'id': instance.id,
'sourceMchId': instance.sourceMchId,
'targetMchId': instance.targetMchId,
'rulePriceConfigId': instance.rulePriceConfigId,
'basePrice': instance.basePrice,
'multiple': instance.multiple,
};