You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.2 KiB
55 lines
1.2 KiB
|
|
import 'package:json_annotation/json_annotation.dart';
|
|
import 'package:new_recook/utils/text_utils.dart';
|
|
import '../base_model.dart';
|
|
|
|
part 'promotion_list_model.g.dart';
|
|
|
|
|
|
@JsonSerializable()
|
|
class PromotionListModel extends BaseModel {
|
|
|
|
List<Promotion> data;
|
|
|
|
PromotionListModel(code,this.data,msg,):super(code,msg);
|
|
|
|
factory PromotionListModel.fromJson(Map<String, dynamic> srcJson) => _$PromotionListModelFromJson(srcJson);
|
|
|
|
Map<String, dynamic> toJson() => _$PromotionListModelToJson(this);
|
|
|
|
}
|
|
|
|
|
|
@JsonSerializable()
|
|
class Promotion extends Object {
|
|
|
|
int id;
|
|
String promotionName;
|
|
String startTime;
|
|
String endTime;
|
|
String showName;
|
|
int isProcessing;
|
|
|
|
String? trueEndTime;
|
|
|
|
Promotion(this.id,this.promotionName,this.startTime, this.endTime, this.showName, this.isProcessing,{this.trueEndTime});
|
|
|
|
String? getTrueEndTime(){
|
|
if (TextUtils.isEmpty(trueEndTime)) {
|
|
if (TextUtils.isEmpty(startTime)){
|
|
return null;
|
|
}else{
|
|
trueEndTime = DateTime.parse(startTime).add(Duration(hours: 2)).toString();
|
|
}
|
|
}
|
|
return trueEndTime;
|
|
}
|
|
|
|
factory Promotion.fromJson(Map<String, dynamic> srcJson) => _$PromotionFromJson(srcJson);
|
|
|
|
Map<String, dynamic> toJson() => _$PromotionToJson(this);
|
|
|
|
}
|
|
|
|
|