修复登录uid类型

This commit is contained in:
魏少阳 2024-01-16 10:41:08 +08:00
parent 0a6259607e
commit 4247db112f
17 changed files with 124 additions and 105 deletions

View File

@ -191,13 +191,15 @@ class BlueManage {
return;
}
// print("33333333333333333333333");
///
var isReturnedConnectResults = false;
_currentConnectionStream = _flutterReactiveBle!.connectToDevice(id: connectDeviceMacAddress, connectionTimeout: const Duration(seconds: 5)).listen((connectionStateUpdate) async {
//
deviceConnectionState = connectionStateUpdate.connectionState;
stopScan();
print('2 deviceConnectionState:$deviceConnectionState connectionStateUpdate.connectionState:${connectionStateUpdate.connectionState}');
if (connectionStateUpdate.connectionState == DeviceConnectionState.connected) {
isReturnedConnectResults = true;
//
try {
_subScribeToCharacteristic(QualifiedCharacteristic(characteristicId: _characteristicIdSubscription, serviceId: _serviceIdConnect, deviceId: connectDeviceMacAddress));
@ -211,9 +213,14 @@ class BlueManage {
print('Error occurred when discovering services: $e');
rethrow;
}
} else {
} else if (connectionStateUpdate.connectionState == DeviceConnectionState.disconnected) {
//
deviceConnectionState = connectionStateUpdate.connectionState;
connectStateCallBack(deviceConnectionState!);
if(isReturnedConnectResults == false){
isReturnedConnectResults = true;
//
connectStateCallBack(deviceConnectionState!);
}
}
print('ConnectionState for device $connectDeviceMacAddress : ${connectionStateUpdate.connectionState}');
}, onError: (Object e) {

View File

@ -1,10 +1,10 @@
class LoginData {
LoginData({
this.accessToken,
this.userid,
this.expiresAt,
this.expiresAtString,
this.mobile,
this.accessToken,
this.userid,
this.expiresAt,
this.expiresAtString,
this.mobile,
this.headUrl,
this.email,
this.nickname,
@ -32,7 +32,7 @@ class LoginData {
String? email;
String? nickname;
bool? haveSafeAnswer;
String? uid;
int? uid;
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};

View File

@ -111,12 +111,16 @@ class AddICCardLogic extends BaseGetXController{
//
print("${reply.commandType!.typeValue} 数据解析成功");
// print("添加指纹确认成功,调用添加指纹接口");
if(state.cardNumber.value == (reply.data[6]).toString()){
return;
}else{
state.cardNumber.value = (reply.data[6]).toString();
}
if(state.isCoerced.value == "1"){
//
int addResultStatus = reply.data[5];
if(addResultStatus == 0){
//
state.cardNumber.value = (reply.data[6]).toString();
addICCardData();
}else if(addResultStatus == 255){
// 255 退

View File

@ -1,7 +1,6 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
@ -10,7 +9,6 @@ import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../blue/blue_manage.dart';
import '../../../../tools/appRouteObserver.dart';
import '../../../../tools/dateTool.dart';
import '../../../../tools/keySearchWidget.dart';
import '../../../../tools/left_slide_actions.dart';
import '../../../../tools/noData.dart';
@ -243,15 +241,13 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
);
}
void showDeletAlertDialog(
BuildContext context,
) {
void showDeletAlertDialog(BuildContext context) {
showCupertinoDialog(
context: context,
builder: (context) {
return CupertinoAlertDialog(
title: const Text("提示"),
content: const Text('重置后该锁的卡都将被删除哦,确认要重置吗?'),
content: const Text('重置后该锁的卡都将被删除哦,确认要重置吗?'),
actions: [
CupertinoDialogAction(
child: Text(TranslationLoader.lanKeys!.cancel!.tr),

View File

@ -62,7 +62,7 @@ class AddFingerprintLogic extends BaseGetXController {
//
state.maxRegCount.value = reply.data[10];
print("state.maxRegCount.value:${state.maxRegCount.value}");
// state.fingerprintNumber.value = reply.data.last.toString();
break;
case 0x06:
@ -130,7 +130,7 @@ class AddFingerprintLogic extends BaseGetXController {
//
state.regIndex.value = reply.data[6];
print("state.addFingerprintProcessNumber.value:${state.regIndex.value}");
print("state.regIndex.value:${state.regIndex.value}");
}
break;
case 0x06:
@ -164,9 +164,14 @@ class AddFingerprintLogic extends BaseGetXController {
//
print("${reply.commandType!.typeValue} 数据解析成功");
// print("添加指纹确认成功,调用添加指纹接口");
if(state.fingerprintNumber.value == (reply.data[6]).toString()){
return;
}else{
state.fingerprintNumber.value = (reply.data[6]).toString();
}
if(state.isCoerced.value == "1"){
//
addFingerprintsData(reply.data[6].toString());
addFingerprintsData();
}else{
//
senderAddStressFingerprint();
@ -203,7 +208,7 @@ class AddFingerprintLogic extends BaseGetXController {
//
print("${reply.commandType!.typeValue} 数据解析成功");
// print("添加指纹确认成功,调用添加指纹接口");
addFingerprintsData(reply.data[6].toString());
addFingerprintsData();
break;
case 0x06:
//
@ -337,13 +342,13 @@ class AddFingerprintLogic extends BaseGetXController {
}
//
void addFingerprintsData(String fingerprintUserNo) async{
void addFingerprintsData() async{
var entity = await ApiRepository.to.addFingerprintsData(
lockId: state.lockId.value.toString(),
endDate: state.endDate.value,
addType:state.addType.value,
fingerprintName: state.fingerprintName.value,
fingerprintNumber: fingerprintUserNo,
fingerprintNumber: state.fingerprintNumber.value,
fingerprintType: state.fingerprintType.value,
isCoerced: state.isCoerced.value,
startDate: state.startDate.value,
@ -351,16 +356,16 @@ class AddFingerprintLogic extends BaseGetXController {
);
if(entity.errorCode!.codeIsSuccessful){
// Toast.show(msg: "添加成功");
updateFingerprintUserNoLoadData(entity.data!.fingerprintId.toString(), fingerprintUserNo);
updateFingerprintUserNoLoadData(entity.data!.fingerprintId.toString());
}
}
//
void updateFingerprintUserNoLoadData(String fingerprintId, String fingerprintUserNo) async{
void updateFingerprintUserNoLoadData(String fingerprintId) async{
var entity = await ApiRepository.to.updateFingerprintUserNoLoadData(
fingerprintId: fingerprintId,
lockId: state.lockId.value.toString(),
fingerprintUserNo: fingerprintUserNo,
fingerprintUserNo: state.fingerprintNumber.value,
);
if(entity.errorCode!.codeIsSuccessful){
Toast.show(msg: "添加成功");

View File

@ -119,23 +119,28 @@ class _AddFingerprintPageState extends State<AddFingerprintPage> with RouteAware
}
String getIconNumber(int number){
String iconPath = "";
switch(number){
case 0:
iconPath = 'images/main/icon_addFingerprint_fingerprint_one.png';
break;
case 1:
return 'images/main/icon_addFingerprint_fingerprint_two.png';
iconPath = 'images/main/icon_addFingerprint_fingerprint_two.png';
break;
case 2:
return 'images/main/icon_addFingerprint_fingerprint_three.png';
iconPath = 'images/main/icon_addFingerprint_fingerprint_three.png';
break;
case 3:
return 'images/main/icon_addFingerprint_fingerprint_four.png';
iconPath = 'images/main/icon_addFingerprint_fingerprint_four.png';
break;
case 4:
return 'images/main/icon_addFingerprint_fingerprint_five.png';
iconPath = 'images/main/icon_addFingerprint_fingerprint_five.png';
break;
default:
return 'images/main/icon_addFingerprint_fingerprint_one.png';
iconPath = 'images/main/icon_addFingerprint_fingerprint_four.png';
break;
}
return iconPath;
}
@override

View File

@ -8,6 +8,8 @@ class AddFingerprintState{
var maxRegCount = 0.obs;//
var regIndex = 0.obs;//
var fingerprintNumber = "".obs;
final lockId = 0.obs;
final endDate = "".obs;
final addType = "".obs;

View File

@ -250,7 +250,7 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
builder: (context) {
return CupertinoAlertDialog(
title: const Text("提示"),
content: const Text('重置后,改为该锁的指纹都将被删除哦,确认要重置吗?'),
content: const Text('重置后,该锁的指纹都将被删除哦,确认要重置吗?'),
actions: [
CupertinoDialogAction(
child: Text(TranslationLoader.lanKeys!.cancel!.tr),

View File

@ -269,6 +269,7 @@ class LockSetLogic extends BaseGetXController {
showEasyLoading();
showBlueConnetctToastTimer(isShowBlueConnetctToast: false, action: (){
dismissEasyLoading();
print("1111111");
showDeletAlertTipDialog(Get.context!);
});
BlueManage().bludSendData(BlueManage().connectDeviceName, (DeviceConnectionState connectionState) async {
@ -297,7 +298,10 @@ class LockSetLogic extends BaseGetXController {
} else if (connectionState == DeviceConnectionState.disconnected) {
dismissEasyLoading();
cancelBlueConnetctToastTimer();
showDeletAlertTipDialog(Get.context!);
print("222222");
if(state.ifCurrentScreen.value == true){
showDeletAlertTipDialog(Get.context!);
}
}
});
}
@ -307,6 +311,7 @@ class LockSetLogic extends BaseGetXController {
showEasyLoading();
showBlueConnetctToastTimer(isShowBlueConnetctToast: false, action: (){
dismissEasyLoading();
print("333333");
showDeletAlertTipDialog(Get.context!);
});
BlueManage().bludSendData(BlueManage().connectDeviceName, (DeviceConnectionState connectionState) async {
@ -331,7 +336,10 @@ class LockSetLogic extends BaseGetXController {
} else if (connectionState == DeviceConnectionState.disconnected) {
dismissEasyLoading();
cancelBlueConnetctToastTimer();
showDeletAlertTipDialog(Get.context!);
print("444444");
if(state.ifCurrentScreen.value == true){
showDeletAlertTipDialog(Get.context!);
}
}
});
}
@ -539,7 +547,7 @@ class LockSetLogic extends BaseGetXController {
state.deletWaitScanCompleter = Completer();
state.deletWaitScanTimer = Timer.periodic(const Duration(seconds: 1), (timer) {
//
if(index >= 5){
if(index >= 7){
// 10,
if(state.deletWaitScanTimer != null){
state.deletWaitScanTimer!.cancel();
@ -549,6 +557,7 @@ class LockSetLogic extends BaseGetXController {
}
BlueManage().stopScan();
dismissEasyLoading();
print("555555");
showDeletAlertTipDialog(Get.context!);
}else{
//
@ -596,6 +605,7 @@ class LockSetLogic extends BaseGetXController {
}
}else if(state.currentDeviceUUid.value[31] == "0"){
//
print("666666");
showDeletAlertTipDialog(Get.context!);
}
}

View File

@ -712,7 +712,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
builder: (context) {
return CupertinoAlertDialog(
title: const Text("提示"),
content: const Text('创建公司,考勤功能才能使用'),
content: const Text('创建公司,考勤功能才能使用'),
actions: [
CupertinoDialogAction(
child: Text(TranslationLoader.lanKeys!.cancel!.tr),

View File

@ -415,18 +415,29 @@ class LockDetailLogic extends BaseGetXController {
// state.animationController.reset();
// state.animationController.forward();
});
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
var signKey = await Storage.getStringList(saveBlueSignKey);
List<int> signKeyDataList = changeStringListToIntList(signKey!);
var token = await Storage.getStringList(saveBlueToken);
List<int> getTokenList = changeStringListToIntList(token!);
print("openDoorTokenPubToken:$getTokenList getPrivateKeyList:$getPrivateKeyList");
// List<int>listData = await IoSenderManage.senderOpenLock(
// keyID: BlueManage().connectDeviceName,
// userID: await Storage.getUid(),
// openMode: openMode,
// openTime: DateTime.now().millisecondsSinceEpoch ~/ 1000,
// onlineToken: state.lockNetToken,
// token: getTokenList,
// needAuthor: 1,
// signKey: signKeyDataList,
// privateKey: getPrivateKeyList,
// );
BlueManage().bludSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!, (DeviceConnectionState deviceConnectionState) async {
if (deviceConnectionState == DeviceConnectionState.connected){
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
var signKey = await Storage.getStringList(saveBlueSignKey);
List<int> signKeyDataList = changeStringListToIntList(signKey!);
var token = await Storage.getStringList(saveBlueToken);
List<int> getTokenList = changeStringListToIntList(token!);
print("openDoorTokenPubToken:$getTokenList getPrivateKeyList:$getPrivateKeyList");
IoSenderManage.senderOpenLock(
keyID: BlueManage().connectDeviceName,
userID: await Storage.getUid(),

View File

@ -38,9 +38,12 @@ class _LockDetailPageState extends State<LockDetailPage>
void initState() {
// TODO: implement initState
super.initState();
Get.log("LockDetailPage initState1111");
print("LockDetailPage isOnlyOneData==${widget.isOnlyOneData}");
state.keyInfos.value = widget.lockListInfoItemEntity;
state.lockUserNo = state.keyInfos.value.lockUserNo!;
print("state.lockUserNo==${state.lockUserNo}");
state.senderUserId = state.keyInfos.value.senderUserId!;
state.isAttendance.value = state.keyInfos.value.lockSetting!.attendance!;
state.isOpenLockNeedOnline.value =
@ -48,8 +51,7 @@ class _LockDetailPageState extends State<LockDetailPage>
state.electricQuantity.value = state.keyInfos.value.electricQuantity!;
state.isOpenPassageMode.value = state.keyInfos.value.passageMode!;
BlueManage().connectDeviceName =
state.keyInfos.value.bluetooth!.bluetoothDeviceName!;
BlueManage().connectDeviceName = state.keyInfos.value.bluetooth!.bluetoothDeviceName!;
List<int> publicKeyData =
state.keyInfos.value.bluetooth!.publicKey!.cast<int>();
@ -611,14 +613,13 @@ class _LockDetailPageState extends State<LockDetailPage>
// state.animationController.forward();
// state.animationController.dispose();
super.dispose();
BlueManage().disconnect(BlueManage().connectDeviceMacAddress);
}
///
@override
void didPush() {
super.didPush();
// print("LockDetailPage===didPush");
print("LockDetailPage===didPush");
state.ifCurrentScreen.value = true;
}
@ -626,10 +627,11 @@ class _LockDetailPageState extends State<LockDetailPage>
@override
void didPop() {
super.didPop();
// print("LockDetailPage===didPop");
print("LockDetailPage===didPop");
state.ifCurrentScreen.value = false;
logic.cancelBlueConnetctToastTimer();
BlueManage().stopScan();
BlueManage().disconnect(BlueManage().connectDeviceMacAddress);
state.openLockBtnState.value = 0;
state.animationController.reset();
state.animationController.forward();
@ -641,14 +643,14 @@ class _LockDetailPageState extends State<LockDetailPage>
void didPopNext() {
super.didPopNext();
state.ifCurrentScreen.value = true;
// print("LockDetailPage===didPopNext");
print("LockDetailPage===didPopNext");
}
///
@override
void didPushNext() {
super.didPushNext();
// print("LockDetailPage===didPushNext");
print("LockDetailPage===didPushNext");
state.ifCurrentScreen.value = false;
logic.cancelBlueConnetctToastTimer();
BlueManage().stopScan();

View File

@ -1,5 +1,6 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
// import 'package:flutter_pickers/pickers.dart';
// import 'package:flutter_pickers/time_picker/model/date_mode.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -269,24 +270,35 @@ class _AddRemoteControlPageState extends State<AddRemoteControlPage> {
//
Widget getTFWidget(String tfStr) {
return Container(
height: 50.h,
// color: Colors.red,
height: 65.h,
width: 300.w,
padding: EdgeInsets.only(top: 5.h),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
child: TextField(
//
maxLines: 1,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(18),
],
controller: state.nameController,
autofocus: false,
textAlign: TextAlign.end,
decoration: InputDecoration(
//
contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
// contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
hintText: tfStr,
hintStyle: TextStyle(fontSize: 24.sp),
//线
border: InputBorder.none,
hintStyle: TextStyle(fontSize: 22.sp),
focusedBorder: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
disabledBorder: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
enabledBorder: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
border: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
contentPadding: const EdgeInsets.symmetric(vertical: 0),
),
),
),

View File

@ -6,6 +6,7 @@ import 'package:get/get.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../tools/keySearchWidget.dart';
import '../../../../tools/noData.dart';
import '../../../../tools/showIosTipView.dart';
import '../../../../tools/storage.dart';
@ -54,7 +55,12 @@ class _RemoteControlListPageState extends State<RemoteControlListPage> {
),
body: Column(
children: [
_searchWidget(),
KeySearchWidget(
editingController: state.searchController,
onSubmittedAction: () {
},
),
SizedBox(
height: 20.h,
),
@ -100,50 +106,6 @@ class _RemoteControlListPageState extends State<RemoteControlListPage> {
// return title;
// }
Widget _searchWidget() {
return Container(
height: 60.h,
margin: EdgeInsets.only(top: 20.w, left: 20.w, right: 10.w),
decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadius.circular(5)),
child: TextField(
//
maxLines: 1,
controller: state.searchController,
autofocus: false,
onChanged: (value) {
print("onChanged:$value");
},
onEditingComplete: () {
print("onEditingComplete:");
},
onSubmitted: (value) {
//
},
decoration: InputDecoration(
//
contentPadding: const EdgeInsets.only(
top: 12.0, left: -19.0, right: -15.0, bottom: 8.0),
hintText: TranslationLoader.lanKeys!.pleaseEnter!.tr,
hintStyle: TextStyle(fontSize: 22.sp, height: 3.0),
//线
border: InputBorder.none,
//
icon: Padding(
padding: EdgeInsets.only(
top: 20.h, bottom: 20.h, right: 20.w, left: 10.w),
child: Image.asset(
'images/main/icon_main_search.png',
width: 40.w,
height: 40.w,
),
),
),
),
);
}
Widget _buildMainUI() {
String typeImgName = 'images/icon_card.png';
@ -252,7 +214,7 @@ class _RemoteControlListPageState extends State<RemoteControlListPage> {
builder: (context) {
return CupertinoAlertDialog(
title: const Text("提示"),
content: const Text('重置后信息都会清除哦,确认要重置吗?'),
content: const Text('重置后遥控信息都会清除哦,确认要重置吗?'),
actions: [
CupertinoDialogAction(
child: Text(TranslationLoader.lanKeys!.cancel!.tr),

View File

@ -38,7 +38,7 @@ class _AbountPageState extends State<AbountPage> {
),
SizedBox(height: 20.h),
Text(
"星锁 1.0.0.04(preRelease-20240108-1)",
"星锁 1.0.0.06(preRelease-20240115)",
style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor),
),
SizedBox(

View File

@ -4,6 +4,7 @@ import 'dart:typed_data';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
@ -157,6 +158,8 @@ class _NearbyLockPageState extends State<NearbyLockPage> with RouteAware {
super.didPop();
Get.log("NearbyLockLogic didPop()");
EasyLoading.isShow ? EasyLoading.dismiss() : null;
state.ifCurrentScreen.value = false;
logic.cancelBlueConnetctToastTimer();
logic.stopScanBlueList();

View File

@ -17,7 +17,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.0+1
version: 1.0.0+6
environment:
sdk: '>=2.12.0 <3.0.0'