添加房屋时使用租客角色数据传输格式变更

hmxc
小赖 4 years ago
parent fd3952c811
commit c1f261c626

@ -0,0 +1,37 @@
import 'package:flustars/flustars.dart';
class HouseModel {
int id;
String roomName;
int status;
String effectiveTimeStart;
String effectiveTimeEnd;
DateTime get effectiveStartDate => DateUtil.getDateTime(effectiveTimeStart);
DateTime get effectiveEndDate => DateUtil.getDateTime(effectiveTimeEnd);
HouseModel(
{this.id,
this.roomName,
this.status,
this.effectiveTimeStart,
this.effectiveTimeEnd});
HouseModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
roomName = json['roomName'];
status = json['status'];
effectiveTimeStart = json['effectiveTimeStart'];
effectiveTimeEnd = json['effectiveTimeEnd'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['roomName'] = this.roomName;
data['status'] = this.status;
data['effectiveTimeStart'] = this.effectiveTimeStart;
data['effectiveTimeEnd'] = this.effectiveTimeEnd;
return data;
}
}

@ -268,20 +268,20 @@ class _AddHousePageState extends State<AddHousePage> {
if (_roleType == 3) { if (_roleType == 3) {
params.putIfAbsent( params.putIfAbsent(
'effectiveTimeStart', 'effectiveTimeStart',
() => DateUtil.formatDate(_range.start, format: 'yyyy-MM-dd HH:mm'), () => DateUtil.formatDate(_range.start, format: 'yyyy-MM-dd HH:mm:ss'),
); );
params.putIfAbsent( params.putIfAbsent(
'effectiveTimeEnd', 'effectiveTimeEnd',
() => DateUtil.formatDate(_range.end, format: 'yyyy-MM-dd HH:mm'), () => DateUtil.formatDate(_range.end, format: 'yyyy-MM-dd HH:mm:ss'),
); );
} }
VoidCallback cancel = BotToast.showLoading(); VoidCallback cancel = BotToast.showLoading();
await NetUtil().post( BaseModel model = await NetUtil().post(
API.user.authHouse, API.user.authHouse,
params: params, params: params,
showMessage: true, showMessage: true,
); );
cancel(); cancel();
Get.back(); if (model.status) Get.back();
} }
} }

Loading…
Cancel
Save