解决生效时间和失效时间无法比较判断生效问题
This commit is contained in:
parent
f0a90edb6e
commit
4950c8d8fe
@ -271,16 +271,27 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
btnName: TranslationLoader.lanKeys!.send!.tr,
|
||||
onClick: () {
|
||||
if (isDemoMode == false) {
|
||||
DateTime startDateTime = DateTime(
|
||||
state.effectiveDateTime.value.year,
|
||||
state.effectiveDateTime.value.month,
|
||||
state.effectiveDateTime.value.day,
|
||||
state.effectiveDateTime.value.hour,
|
||||
state.effectiveDateTime.value.minute);
|
||||
DateTime endDateTime = DateTime(
|
||||
state.failureDateTime.value.year,
|
||||
state.failureDateTime.value.month,
|
||||
state.failureDateTime.value.day,
|
||||
state.failureDateTime.value.hour,
|
||||
state.failureDateTime.value.minute);
|
||||
//发送钥匙请求
|
||||
if (state.emailOrPhoneController.text.isNotEmpty &&
|
||||
state.keyNameController.text.isNotEmpty) {
|
||||
if (int.parse(widget.type) == 0) {
|
||||
//失效时间大于生效时间
|
||||
if (state.effectiveDateTime.value
|
||||
.isBefore(state.failureDateTime.value)) {
|
||||
logic.sendElectronicKeyRequest(context);
|
||||
} else {
|
||||
if (!startDateTime.isBefore(endDateTime) ||
|
||||
startDateTime.isAtSameMomentAs(endDateTime)) {
|
||||
Toast.show(msg: '失效时间需大于生效时间');
|
||||
} else {
|
||||
logic.sendElectronicKeyRequest(context);
|
||||
}
|
||||
} else {
|
||||
logic.sendElectronicKeyRequest(context);
|
||||
|
||||
@ -404,6 +404,17 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if (isDemoMode == false) {
|
||||
int getWidgetNumber = int.parse(widget.type);
|
||||
DateTime startDateTime = DateTime(
|
||||
state.effectiveDateTime.value.year,
|
||||
state.effectiveDateTime.value.month,
|
||||
state.effectiveDateTime.value.day,
|
||||
state.effectiveDateTime.value.hour);
|
||||
DateTime endDateTime = DateTime(
|
||||
state.failureDateTime.value.year,
|
||||
state.failureDateTime.value.month,
|
||||
state.failureDateTime.value.day,
|
||||
state.failureDateTime.value.hour);
|
||||
|
||||
//自定义密码
|
||||
if (getWidgetNumber == 3) {
|
||||
logic.getStartDate(state.effectiveDateTime.value);
|
||||
@ -417,11 +428,8 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
||||
}
|
||||
//非永久 须有时限
|
||||
if (state.isPermanent.value == false) {
|
||||
print('自定义密码输出********有时限');
|
||||
if (!state.effectiveDateTime.value
|
||||
.isBefore(state.failureDateTime.value) ||
|
||||
state.effectiveDateTime.value
|
||||
.isAtSameMomentAs(state.failureDateTime.value)) {
|
||||
if (!startDateTime.isBefore(endDateTime) ||
|
||||
startDateTime.isAtSameMomentAs(endDateTime)) {
|
||||
Toast.show(msg: '失效时间需大于生效时间');
|
||||
return;
|
||||
}
|
||||
@ -436,18 +444,16 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
||||
|
||||
//限时
|
||||
if (getWidgetNumber == 1) {
|
||||
if (!state.effectiveDateTime.value
|
||||
.isBefore(state.failureDateTime.value) ||
|
||||
state.effectiveDateTime.value
|
||||
.isAtSameMomentAs(state.failureDateTime.value)) {
|
||||
if (!startDateTime.isBefore(endDateTime) ||
|
||||
startDateTime.isAtSameMomentAs(endDateTime)) {
|
||||
Toast.show(msg: '失效时间需大于生效时间');
|
||||
return;
|
||||
}
|
||||
}
|
||||
//循环密码
|
||||
if (getWidgetNumber == 4) {
|
||||
if (!state.effectiveDateTime.value
|
||||
.isBefore(state.failureDateTime.value)) {
|
||||
if (!startDateTime.isBefore(endDateTime) ||
|
||||
startDateTime.isAtSameMomentAs(endDateTime)) {
|
||||
Toast.show(msg: '结束时间需大于当前时间');
|
||||
return;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user