128 lines
2.6 KiB
Dart
128 lines
2.6 KiB
Dart
import 'package:json_annotation/json_annotation.dart';
|
|
|
|
import 'package:pj_supermarket_cloud/common/index.dart';
|
|
|
|
part 'mq_models.g.dart';
|
|
|
|
@JsonSerializable()
|
|
class MqBaseMsg {
|
|
// 动作
|
|
MqtActionEnum? action;
|
|
|
|
MqBaseMsg({
|
|
this.action,
|
|
});
|
|
|
|
factory MqBaseMsg.fromJson(Map<String, dynamic> json) =>
|
|
_$MqBaseMsgFromJson(json);
|
|
|
|
Map<String, dynamic> toJson() => _$MqBaseMsgToJson(this);
|
|
}
|
|
|
|
@JsonSerializable()
|
|
class MqttInvoiceMsg {
|
|
// 动作
|
|
MqtActionEnum? action;
|
|
|
|
// 记录id
|
|
@JsonKey(fromJson: JsonTool.anyToString, toJson: JsonTool.stringToInt)
|
|
final String? historyId;
|
|
|
|
// 用户id
|
|
@JsonKey(fromJson: JsonTool.anyToString, toJson: JsonTool.stringToInt)
|
|
final String? userId;
|
|
|
|
// 订单id
|
|
@JsonKey(fromJson: JsonTool.anyToString, toJson: JsonTool.stringToInt)
|
|
final String? orderId;
|
|
|
|
// 安卓订单id
|
|
@JsonKey(fromJson: JsonTool.anyToString, toJson: JsonTool.stringToInt)
|
|
final String? androidOrderCode;
|
|
|
|
// 图片地址url
|
|
final String? pic;
|
|
|
|
// 是否设置为全局人脸
|
|
final bool? isGlobalFace;
|
|
|
|
MqttInvoiceMsg({
|
|
this.action,
|
|
this.historyId,
|
|
this.userId,
|
|
this.orderId,
|
|
this.androidOrderCode,
|
|
this.pic,
|
|
this.isGlobalFace,
|
|
});
|
|
|
|
factory MqttInvoiceMsg.fromJson(Map<String, dynamic> json) =>
|
|
_$MqttInvoiceMsgFromJson(json);
|
|
|
|
Map<String, dynamic> toJson() => _$MqttInvoiceMsgToJson(this);
|
|
}
|
|
|
|
@JsonSerializable()
|
|
class MqttTakeFoodBroadcastMsg {
|
|
/// 发送硬件的topic
|
|
String topic;
|
|
|
|
/// 用户id
|
|
String userId;
|
|
|
|
/// 用户id
|
|
String username;
|
|
|
|
/// 用户id
|
|
String userMobile;
|
|
|
|
/// 广播id
|
|
String id;
|
|
|
|
/// 订单id
|
|
String orderId;
|
|
|
|
/// 预定标题
|
|
String title;
|
|
|
|
/// 广播内容
|
|
String content;
|
|
|
|
/// 最大广播次数
|
|
int broadcastMaxCount;
|
|
|
|
/// 商品介绍
|
|
String productDesc;
|
|
|
|
/// 支付价格
|
|
int payPrice;
|
|
|
|
/// 时间段类型
|
|
String hourType;
|
|
|
|
/// 是否完成订单
|
|
@JsonKey(fromJson: JsonTool.stringToBoolean, toJson: JsonTool.booleanToString)
|
|
bool isDone;
|
|
|
|
MqttTakeFoodBroadcastMsg({
|
|
required this.topic,
|
|
required this.userId,
|
|
required this.username,
|
|
required this.userMobile,
|
|
required this.id,
|
|
required this.orderId,
|
|
required this.title,
|
|
required this.content,
|
|
required this.broadcastMaxCount,
|
|
required this.productDesc,
|
|
required this.payPrice,
|
|
required this.hourType,
|
|
required this.isDone,
|
|
});
|
|
|
|
factory MqttTakeFoodBroadcastMsg.fromJson(Map<String, dynamic> json) =>
|
|
_$MqttTakeFoodBroadcastMsgFromJson(json);
|
|
|
|
Map<String, dynamic> toJson() => _$MqttTakeFoodBroadcastMsgToJson(this);
|
|
}
|