app-starlock/lib/tools/seletKeyCyclicDate/seletKeyCyclicDate_logic.dart

34 lines
1.3 KiB
Dart
Raw Permalink Normal View History

import 'package:get/get.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import '../dateTool.dart';
import 'seletKeyCyclicDate_state.dart';
class SeletKeyCyclicDateLogic extends BaseGetXController {
SeletKeyCyclicDateState state = SeletKeyCyclicDateState();
void subBtnAction(){
2024-08-19 15:24:14 +08:00
final String starDateTimestamp = DateTool().dateToTimestamp(state.starDate.value, 1).toString();
final String endDateTimestamp = DateTool().dateToTimestamp(state.endDate.value, 1).toString();
final String starTimeTimestamp = DateTool().dateToTimestamp(state.starTime.value, 0).toString();
final String endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 0).toString();
2024-05-10 09:19:38 +08:00
if (int.parse(starDateTimestamp) > int.parse(endDateTimestamp)) {
2024-08-27 11:08:44 +08:00
showToast('失效日期需晚于生效日期'.tr);
return;
}
if (int.parse(starTimeTimestamp) >= int.parse(endTimeTimestamp)) {
2024-08-27 11:08:44 +08:00
showToast('失效时间需晚于生效时间'.tr);
return;
}
2024-08-19 15:24:14 +08:00
final Map<String, dynamic> resultMap = {};
resultMap['starDate'] = state.starDate.value;
resultMap['endDate'] = state.endDate.value;
resultMap['starTime'] = state.starTime.value;
resultMap['endTime'] = state.endTime.value;
resultMap['validityValue'] = state.weekDay.value;
Get.back(result: resultMap);
}
}