1、开锁时间戳逻辑修改。2、基本信息去掉厂商型号
This commit is contained in:
parent
f8e7425873
commit
265886c791
@ -49,8 +49,8 @@ class _AddICCardPageState extends State<AddICCardPage> with RouteAware {
|
||||
SizedBox(height: 120.h),
|
||||
Container(
|
||||
width: 1.sw,
|
||||
height: 50.h,
|
||||
// padding: EdgeInsets.only(left: 30.w, right: 30.w, top: 10.h, bottom: 10.h),
|
||||
// height: 50.h,
|
||||
padding: EdgeInsets.all(10.w),
|
||||
margin: EdgeInsets.only(
|
||||
left: 15.w, right: 15.w, top: 10.h, bottom: 10.h),
|
||||
// color: AppColors.blackColor,
|
||||
|
||||
@ -108,7 +108,7 @@ class LockDetailLogic extends BaseGetXController {
|
||||
keyID: BlueManage().connectDeviceName,
|
||||
userID: await Storage.getUid(),
|
||||
openMode: state.openDoorModel,
|
||||
openTime: state.netTime,
|
||||
openTime: getNetTime(),
|
||||
onlineToken: state.lockNetToken,
|
||||
token: tokenData,
|
||||
needAuthor: 1,
|
||||
@ -165,6 +165,11 @@ class LockDetailLogic extends BaseGetXController {
|
||||
reply.data.removeRange(0, 6);
|
||||
// 把得到的数据按8位分割成数组 然后塞进一个新的数组里面
|
||||
var getList = splitList(reply.data, 8);
|
||||
if(reply.data.length < 8){
|
||||
await BlueManage().disconnect();
|
||||
cancelBlueConnetctToastTimer();
|
||||
return;
|
||||
}
|
||||
var uploadList = [];
|
||||
for (int i = 0; i < getList.length; i++) {
|
||||
var indexList = getList[i];
|
||||
@ -195,9 +200,12 @@ class LockDetailLogic extends BaseGetXController {
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
|
||||
BlueManage().disconnect();
|
||||
cancelBlueConnetctToastTimer();
|
||||
break;
|
||||
default:
|
||||
BlueManage().disconnect();
|
||||
cancelBlueConnetctToastTimer();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -335,7 +343,7 @@ class LockDetailLogic extends BaseGetXController {
|
||||
keyID: BlueManage().connectDeviceName,
|
||||
userID: await Storage.getUid(),
|
||||
openMode: state.openDoorModel,
|
||||
openTime: state.netTime,
|
||||
openTime: getNetTime(),
|
||||
onlineToken: state.lockNetToken,
|
||||
token: getTokenList,
|
||||
needAuthor: 1,
|
||||
@ -358,6 +366,9 @@ class LockDetailLogic extends BaseGetXController {
|
||||
|
||||
// 查询事件记录(时间查询)
|
||||
Future<void> senderReferEventRecordTime() async {
|
||||
showBlueConnetctToastTimer(isShowBlueConnetctToast: false, action: () {
|
||||
BlueManage().disconnect();
|
||||
});
|
||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
|
||||
if (connectionState == BluetoothConnectionState.connected) {
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
@ -384,17 +395,21 @@ class LockDetailLogic extends BaseGetXController {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 从服务器获取锁的时间 开锁时传入
|
||||
void getServerDatetime() async{
|
||||
var entity = await ApiRepository.to.getServerDatetimeData(
|
||||
lockId: state.keyInfos.value.lockId.toString(),
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
state.netTime = entity.data!.date!.toString().length > 10 ? entity.data!.date!~/ 1000 : entity.data!.date!;
|
||||
state.differentialTime = entity.data!.date! ~/ 1000 - DateTime.now().millisecondsSinceEpoch ~/ 1000;
|
||||
// AppLog.log("entity.data!.date! ~/ 1000:${entity.data!.date! ~/ 1000} DateTime.now().millisecondsSinceEpoch ~/ 1000:${DateTime.now().millisecondsSinceEpoch ~/ 1000} 服务器时间差:${state.differentialTime}");
|
||||
}
|
||||
}
|
||||
|
||||
int getNetTime(){
|
||||
return DateTime.now().millisecondsSinceEpoch ~/ 1000 + state.differentialTime;
|
||||
}
|
||||
|
||||
// 获取手机联网token,根据锁设置里面获取的开锁时是否联网来判断是否调用这个接口
|
||||
void getLockNetToken() async {
|
||||
LockNetTokenEntity entity = await ApiRepository.to.getLockNetToken(lockId: state.keyInfos.value.lockId.toString());
|
||||
|
||||
@ -78,7 +78,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
});
|
||||
}
|
||||
|
||||
void loadData() {
|
||||
Future<void> loadData() async {
|
||||
state.keyInfos.value = widget.lockListInfoItemEntity;
|
||||
CommonDataManage().currentLockUserNo = state.keyInfos.value.lockUserNo!;
|
||||
CommonDataManage().currentKeyInfo = state.keyInfos.value;
|
||||
@ -126,8 +126,11 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
var saveSignKeyList = changeIntListToStringList(signKeyData);
|
||||
Storage.setStringList(saveBlueSignKey, saveSignKeyList);
|
||||
|
||||
var saveTokenList = changeIntListToStringList([0, 0, 0, 0]);
|
||||
Storage.setStringList(saveBlueToken, saveTokenList);
|
||||
bool ifHaveKey = await Storage.ifHaveKey(saveBlueToken);
|
||||
if(!ifHaveKey){
|
||||
var saveTokenList = changeIntListToStringList([0, 0, 0, 0]);
|
||||
Storage.setStringList(saveBlueToken, saveTokenList);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@ -14,7 +14,7 @@ class LockDetailState {
|
||||
StreamSubscription? lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent;
|
||||
|
||||
String lockNetToken = "";
|
||||
int netTime = 0;
|
||||
int differentialTime = 0;
|
||||
int lockUserNo = 0;
|
||||
var senderUserId = 0;
|
||||
var isOnlyOneData = false;
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:star_lock/app_settings/app_settings.dart';
|
||||
|
||||
import '../../../../../tools/baseGetXController.dart';
|
||||
import '../../../../../tools/eventBusEventManage.dart';
|
||||
import '../../lockSet/lockSet_logic.dart';
|
||||
@ -24,6 +26,7 @@ class BasicInformationLogic extends BaseGetXController{
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
|
||||
AppLog.log("厂商 vendor:${state.lockBasicInfo.value.vendor} 型号 model:${state.lockBasicInfo.value.model}");
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@ -53,16 +53,16 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
|
||||
"${state.lockBasicInfo.value.mac??""}/${state.lockBasicInfo.value.lockId??""}",
|
||||
allHeight: 70.h,
|
||||
isHaveLine: true)),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: "厂商".tr,
|
||||
rightTitle: state.lockBasicInfo.value.vendor ??"",
|
||||
allHeight: 70.h,
|
||||
isHaveLine: true)),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: "型号".tr,
|
||||
rightTitle: state.lockBasicInfo.value.model ??"",
|
||||
allHeight: 70.h,
|
||||
isHaveLine: false)),
|
||||
// Obx(() => CommonItem(
|
||||
// leftTitel: "厂商".tr,
|
||||
// rightTitle: state.lockBasicInfo.value.vendor ??"",
|
||||
// allHeight: 70.h,
|
||||
// isHaveLine: true)),
|
||||
// Obx(() => CommonItem(
|
||||
// leftTitel: "型号".tr,
|
||||
// rightTitle: state.lockBasicInfo.value.model ??"",
|
||||
// allHeight: 70.h,
|
||||
// isHaveLine: false)),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
|
||||
@ -42,7 +42,7 @@ class _PasswordKeyDetailChangeDatePage extends State<PasswordKeyDetailChangeDate
|
||||
),
|
||||
onPressed: () {
|
||||
// if (state.lockId.value != 0 && state.pwdId.value.isNotEmpty) {
|
||||
logic.updatePwdRequest();
|
||||
logic.senderCustomPasswords();
|
||||
// }
|
||||
},
|
||||
),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user