修复部分bug

This commit is contained in:
Daisy 2024-02-28 18:22:55 +08:00
parent 872ae68c1c
commit 0a855c6af2
6 changed files with 81 additions and 80 deletions

View File

@ -32,17 +32,15 @@ class ElectronicKeyDetailChangeDateLogic extends BaseGetXController {
}
}
//
//
Future<void> updateKeyDateRequest() async {
KeyOperationRecordEntity entity = await ApiRepository.to.updateKeyDate(
state.itemData.value.keyId.toString(),
state.itemData.value.lockId.toString(),
state.failureDateTime.millisecondsSinceEpoch.toString(),
state.endDay.value,
'',
state.effectiveDateTime.millisecondsSinceEpoch.toString(),
state.startDay.value,
state.weekDays.value);
state.weekDays.value,
state.itemData.value.keyType! == 1 ? 2 : state.itemData.value.keyType!);
if (entity.errorCode!.codeIsSuccessful) {
showToast("修改成功", something: () {
eventBus.fire(ElectronicKeyListRefreshUI());

View File

@ -20,8 +20,6 @@ class ElectronicKeyDetailChangeDateState {
final selectFailureDate = ''.obs; //
DateTime effectiveDateTime = DateTime.now();
DateTime failureDateTime = DateTime.now();
final endDay = ''.obs;
final startDay = ''.obs;
final weekDays = [].obs;
ElectronicKeyDetailChangeDateState() {

View File

@ -14,40 +14,56 @@ class SendElectronicKeyLogic extends BaseGetXController {
//
Future<void> sendElectronicKeyRequest() async {
if(state.emailOrPhoneController.text.isEmpty){
if (state.emailOrPhoneController.text.isEmpty) {
showToast("请输入接收者账号");
return;
}
if(state.keyNameController.text.isEmpty){
showToast("请输入接收者姓名");
return;
}
//
// if(state.keyNameController.text.isEmpty){
// showToast("请输入接收者姓名");
// return;
// }
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);
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.type.value == "0" || state.type.value == "3") {
print("startDateTime:$startDateTime endDateTime:$endDateTime DateTime.now():${DateTime.now()} startDateTime.isBefore(endDateTime):${startDateTime.isBefore(endDateTime)}");
if (!startDateTime.isBefore(endDateTime) || startDateTime.isAtSameMomentAs(endDateTime)) {
showToast("失效时间需大于生效时间");
return;
}
if (!startDateTime.isBefore(DateTime.now()) || startDateTime.isAtSameMomentAs(DateTime.now())) {
showToast("生效时间需大于当前时间");
return;
}
if (state.type.value == "0" || state.type.value == "3") {
print(
"startDateTime:$startDateTime endDateTime:$endDateTime DateTime.now():${DateTime.now()} startDateTime.isBefore(endDateTime):${startDateTime.isBefore(endDateTime)}");
if (!startDateTime.isBefore(endDateTime) ||
startDateTime.isAtSameMomentAs(endDateTime)) {
showToast("失效时间需大于生效时间");
return;
}
if (!startDateTime.isBefore(DateTime.now()) ||
startDateTime.isAtSameMomentAs(DateTime.now())) {
showToast("生效时间需大于当前时间");
return;
}
}
String lockID = state.keyInfo.value.lockId.toString();
int typeValue = int.parse(state.type.value);
switch (typeValue) {
case 0:
{
typeValue = XSConstantMacro.keyTypeTime;
state.failureTimestamp.value = state.failureDateTime.value.millisecondsSinceEpoch;
state.effectiveTimestamp.value = state.effectiveDateTime.value.millisecondsSinceEpoch;
state.failureTimestamp.value =
state.failureDateTime.value.millisecondsSinceEpoch;
state.effectiveTimestamp.value =
state.effectiveDateTime.value.millisecondsSinceEpoch;
}
break;
case 1:
@ -191,10 +207,14 @@ class SendElectronicKeyLogic extends BaseGetXController {
);
}
void resetData(){
void resetData() {
state.emailOrPhoneController.text = "";
state.keyNameController.text = "";
state.selectEffectiveDate = '${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'.obs; //
state.selectFailureDate = '${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'.obs; //
state.selectEffectiveDate =
'${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'
.obs; //
state.selectFailureDate =
'${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'
.obs; //
}
}

View File

@ -102,10 +102,9 @@ class _ExpireLockChangeDatePageState extends State<ExpireLockChangeDatePage> {
itemData.keyId.toString(),
itemData.lockId.toString(),
_failureDateTime.millisecondsSinceEpoch.toString(),
'',
'',
_effectiveDateTime.millisecondsSinceEpoch.toString(),
'', []);
[],
itemData.keyType!);
if (entity.errorCode!.codeIsSuccessful) {
print("修改要是名称成功啦啦啦啦啦");
EasyLoading.showToast('修改成功', duration: 2000.milliseconds);

View File

@ -17,20 +17,22 @@ class ApiProvider extends BaseProvider {
}));
Future<Response> register(
int receiverType,
int countryCode,
String account,
String password,
String verificationCode,
) =>
post(registerUrl.toUrl, jsonEncode({
'receiverType': receiverType,
'countryCode': countryCode,
"account": account,
'password': password,
'verificationCode': verificationCode,
'platId': "2",
}));
int receiverType,
int countryCode,
String account,
String password,
String verificationCode,
) =>
post(
registerUrl.toUrl,
jsonEncode({
'receiverType': receiverType,
'countryCode': countryCode,
"account": account,
'password': password,
'verificationCode': verificationCode,
'platId': "2",
}));
// post(
// registerUrl.toUrl,
@ -97,16 +99,16 @@ class ApiProvider extends BaseProvider {
post(getCountryRegionURL.toUrl, jsonEncode({'type': type}));
Future<Response> electronicKeyList(
String endDate,
String keyId,
String keyStatus,
String keyRight,
String lockId,
String pageNo,
String pageSize,
String startDate,
String searchStr,
) =>
String endDate,
String keyId,
String keyStatus,
String keyRight,
String lockId,
String pageNo,
String pageSize,
String startDate,
String searchStr,
) =>
post(
electronicKeyListURL.toUrl,
jsonEncode({
@ -196,26 +198,17 @@ class ApiProvider extends BaseProvider {
'operatorUid': operatorUid,
}));
Future<Response> updateKeyDate(
String keyId,
String lockId,
String endDate,
String endDay,
String operatorUid,
String startDate,
String startDay,
List weekDays) =>
Future<Response> updateKeyDate(String keyId, String lockId, String endDate,
String startDate, List weekDays, int keyType) =>
post(
updateKeyDateURL.toUrl,
jsonEncode({
'keyId': keyId,
'lockId': lockId,
'endDate': endDate,
'endDay': endDay,
'operatorUid': operatorUid,
'startDate': startDate,
'startDay': startDay,
'weekDays': weekDays,
'keyType': keyType
}));
Future<Response> resetElectronicKey(String lockId, String operatorUid) =>

View File

@ -325,17 +325,10 @@ class ApiRepository {
}
//
Future<KeyOperationRecordEntity> updateKeyDate(
String keyId,
String lockId,
String endDate,
String endDay,
String operatorUid,
String startDate,
String startDay,
List weekDays) async {
final res = await apiProvider.updateKeyDate(keyId, lockId, endDate, endDay,
operatorUid, startDate, startDay, weekDays);
Future<KeyOperationRecordEntity> updateKeyDate(String keyId, String lockId,
String endDate, String startDate, List weekDays, int keyType) async {
final res = await apiProvider.updateKeyDate(
keyId, lockId, endDate, startDate, weekDays, keyType);
return KeyOperationRecordEntity.fromJson(res.body);
}