1,新增猫眼设置部分接口处理逻辑

2,退出登录新增推送deviceID以处理退出登录后仍可收到通知
This commit is contained in:
Daisy 2024-04-03 09:53:30 +08:00
parent b7fcb60f28
commit 76d212c933
13 changed files with 235 additions and 178 deletions

View File

@ -282,7 +282,7 @@ class DoorLockLogLogic extends BaseGetXController {
// senderReferEventRecordTime(); // senderReferEventRecordTime();
// senderReferEventRecordNumber(); // senderReferEventRecordNumber();
testReadJsonData(); // testReadJsonData();
mockNetworkDataRequest(); mockNetworkDataRequest();
} }
} }

View File

@ -6,6 +6,7 @@ import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_entity.dart';
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_logic.dart'; import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_logic.dart';
import 'package:star_lock/tools/advancedCalendar/src/widget.dart'; import 'package:star_lock/tools/advancedCalendar/src/widget.dart';
import 'package:star_lock/tools/menuItem/xsDropDownWidget.dart'; import 'package:star_lock/tools/menuItem/xsDropDownWidget.dart';
import 'package:star_lock/tools/noData.dart';
import 'package:timelines/timelines.dart'; import 'package:timelines/timelines.dart';
import '../../../app_settings/app_colors.dart'; import '../../../app_settings/app_colors.dart';
@ -140,14 +141,15 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> {
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(16.w), borderRadius: BorderRadius.circular(16.w),
), ),
child: Timeline.tileBuilder( child: timelineDataList.isNotEmpty
? Timeline.tileBuilder(
builder: TimelineTileBuilder.fromStyle( builder: TimelineTileBuilder.fromStyle(
contentsAlign: ContentsAlign.basic, contentsAlign: ContentsAlign.basic,
itemCount: timelineDataList.length, itemCount: timelineDataList.length,
contentsBuilder: (context, index) { contentsBuilder: (context, index) {
DoorLockLogDataItem timelineData = timelineDataList[index]; DoorLockLogDataItem timelineData = timelineDataList[index];
DateTime dateTime = DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(
DateTime.fromMillisecondsSinceEpoch(timelineData.operateDate!); timelineData.operateDate!);
String formattedTime = String formattedTime =
'${dateTime.hour.toString().padLeft(2, '0')}:${dateTime.minute.toString().padLeft(2, '0')}'; '${dateTime.hour.toString().padLeft(2, '0')}:${dateTime.minute.toString().padLeft(2, '0')}';
@ -224,7 +226,8 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> {
position: 0.4, position: 0.4,
), ),
), ),
), )
: NoData(),
); );
} }
} }

View File

@ -39,7 +39,9 @@ class _CatEyeSetPageState extends State<CatEyeSetPage> {
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.catEyeWorkModePage, arguments: { Get.toNamed(Routers.catEyeWorkModePage, arguments: {
'lockSetInfoData': state.lockSetInfoData.value 'lockSetInfoData': state.lockSetInfoData.value,
'catEyeConfigata': state
.lockSetInfoData.value.lockSettingInfo!.catEyeConfig![0]
})?.then((value) { })?.then((value) {
if (value != null) { if (value != null) {
state.selectCatEyeWorkMode.value = value; state.selectCatEyeWorkMode.value = value;

View File

@ -9,7 +9,8 @@ class CatEyeWorkModeLogic extends BaseGetXController {
void updateCatEyeModeConfig() async { void updateCatEyeModeConfig() async {
var entity = await ApiRepository.to.updateCatEyeModeConfig( var entity = await ApiRepository.to.updateCatEyeModeConfig(
lockId: state.lockSetInfoData.value.lockId!, lockId: state.lockSetInfoData.value.lockId!,
catEyeConfig: { catEyeConfig: [
{
'catEyeMode': state.selectCatEyeWorkMode.value, 'catEyeMode': state.selectCatEyeWorkMode.value,
'catEyeModeConfig': { 'catEyeModeConfig': {
'recordMode': state.recordMode.value, 'recordMode': state.recordMode.value,
@ -19,10 +20,17 @@ class CatEyeWorkModeLogic extends BaseGetXController {
'detectionDistance': state.detectionDistance.value, 'detectionDistance': state.detectionDistance.value,
'realTimeMode': state.realTimeMode.value, 'realTimeMode': state.realTimeMode.value,
} }
}, }
],
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
showToast('设置成功'); showToast('设置成功');
} }
} }
@override
void onReady() {
// TODO: implement onReady
super.onReady();
}
} }

View File

@ -1,20 +1,38 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart'; import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
class CatEyeWorkModeState { class CatEyeWorkModeState {
var lockSetInfoData = LockSetInfoData().obs; var lockSetInfoData = LockSetInfoData().obs;
var selectCatEyeWorkMode = 0.obs; // var selectCatEyeWorkMode = 0.obs; //
var boolList = [true, false, false, false].obs; var boolList = [false, false, false, false].obs;
var recordMode = 0.obs; // 0 1 var recordMode = 0.obs; // 0 1
//recordStartTime与recordEndTime参数 //recordStartTime与recordEndTime参数
var recordStartTime = 0.obs; // 1709715049775, var recordStartTime = 0.obs; // 1709715049775,
var recordEndTime = 0.obs; //1709715049775, var recordEndTime = 0.obs; //1709715049775,
var recordTime = 0.obs; // var recordTime = ''.obs; //
var detectionDistance = 0.obs; // var detectionDistance = 0.obs; //
var realTimeMode = 0.obs; // 0 1 var realTimeMode = 0.obs; // 0 1
var catEyeConfigData = CatEyeConfig().obs;
CatEyeWorkModeState() { CatEyeWorkModeState() {
Map map = Get.arguments; Map map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"]; lockSetInfoData.value = map["lockSetInfoData"];
catEyeConfigData.value = map['catEyeConfigata'];
selectCatEyeWorkMode.value = catEyeConfigData.value.catEyeMode!;
if (catEyeConfigData.value.catEyeMode ==
XSConstantMacro.catEyeWorkModePowerSaving) {
boolList[0] = true;
} else if (catEyeConfigData.value.catEyeMode ==
XSConstantMacro.catEyeWorkModeStayCapture) {
boolList[1] = true;
} else if (catEyeConfigData.value.catEyeMode ==
XSConstantMacro.catEyeWorkModeRealTimeMonitoring) {
boolList[2] = true;
} else if (catEyeConfigData.value.catEyeMode ==
XSConstantMacro.catEyeWorkModeCustom) {
boolList[3] = true;
}
} }
} }

View File

@ -458,19 +458,27 @@ class LockSettingInfo {
int? motorTorsion; int? motorTorsion;
int? stayWarn; int? stayWarn;
int? abnormalWarn; int? abnormalWarn;
List<CatEyeModeConfig>? catEyeConfig; List<CatEyeConfig>? catEyeConfig;
int? faceSwitch; // 0: 1: int? faceSwitch; // 0: 1:
int? faceAutoLightScreen; // 0: 1: int? faceAutoLightScreen; // 0: 1:
int? faceInductionDistance; // int? faceInductionDistance; //
int? faceAntiMistakeOpen; // 0: 1: int? faceAntiMistakeOpen; // 0: 1:
int? autoLightScreen; //- 0: 1: int? autoLightScreen; //- 0: 1:
int? autoLightScreenTime; //- int? autoLightScreenTime; //-
int? dayNotOpenDoorSwitch; //N天未开门开关 (/)
int? dayNotOpenDoorValue; //N天未开门值 // List<CatEyeModeConfig>? catEyeConfigList;
int? doorNotCloseSwitch; // (/) // int? faceSwitch; // 0: 1:
int? lowElecNoticeSwitch; // (/) // int? faceAutoLightScreen; // 0: 1:
int? doorbellNoticeSwitch; // (/) // int? faceInductionDistance; //
int? someoneAtDoorSwitch; // (/)// // int? faceAntiMistakeOpen; // 0: 1:
// int? autoLightScreen; //- 0: 1:
// int? autoLightScreenTime; //-
// int? dayNotOpenDoorSwitch; //N天未开门开关 (/)
// int? dayNotOpenDoorValue; //N天未开门值
// int? doorNotCloseSwitch; // (/)
// int? lowElecNoticeSwitch; // (/)
// int? doorbellNoticeSwitch; // (/)
// int? someoneAtDoorSwitch; // (/)//
LockSettingInfo({ LockSettingInfo({
this.remoteUnlock, this.remoteUnlock,
@ -505,12 +513,12 @@ class LockSettingInfo {
this.faceAntiMistakeOpen, this.faceAntiMistakeOpen,
this.autoLightScreen, this.autoLightScreen,
this.autoLightScreenTime, this.autoLightScreenTime,
this.dayNotOpenDoorSwitch, // this.dayNotOpenDoorSwitch,
this.dayNotOpenDoorValue, // this.dayNotOpenDoorValue,
this.doorNotCloseSwitch, // this.doorNotCloseSwitch,
this.lowElecNoticeSwitch, // this.lowElecNoticeSwitch,
this.doorbellNoticeSwitch, // this.doorbellNoticeSwitch,
this.someoneAtDoorSwitch, // this.someoneAtDoorSwitch,
}); });
LockSettingInfo.fromJson(Map<String, dynamic> json) { LockSettingInfo.fromJson(Map<String, dynamic> json) {
@ -545,9 +553,9 @@ class LockSettingInfo {
stayWarn = json['stayWarn']; stayWarn = json['stayWarn'];
abnormalWarn = json['abnormalWarn']; abnormalWarn = json['abnormalWarn'];
if (json['catEyeConfig'] != null) { if (json['catEyeConfig'] != null) {
catEyeConfig = <CatEyeModeConfig>[]; catEyeConfig = <CatEyeConfig>[];
json['catEyeConfig'].forEach((v) { json['catEyeConfig'].forEach((v) {
catEyeConfig!.add(CatEyeModeConfig.fromJson(v)); catEyeConfig!.add(CatEyeConfig.fromJson(v));
}); });
} }
faceSwitch = json['faceSwitch']; faceSwitch = json['faceSwitch'];
@ -556,12 +564,12 @@ class LockSettingInfo {
faceAntiMistakeOpen = json['faceAntiMistakeOpen']; faceAntiMistakeOpen = json['faceAntiMistakeOpen'];
autoLightScreen = json['autoLightScreen']; autoLightScreen = json['autoLightScreen'];
autoLightScreenTime = json['autoLightScreenTime']; autoLightScreenTime = json['autoLightScreenTime'];
dayNotOpenDoorSwitch = json['dayNotOpenDoorSwitch']; // dayNotOpenDoorSwitch = json['dayNotOpenDoorSwitch'];
dayNotOpenDoorValue = json['dayNotOpenDoorValue']; // dayNotOpenDoorValue = json['dayNotOpenDoorValue'];
doorNotCloseSwitch = json['doorNotCloseSwitch']; // doorNotCloseSwitch = json['doorNotCloseSwitch'];
lowElecNoticeSwitch = json['lowElecNoticeSwitch']; // lowElecNoticeSwitch = json['lowElecNoticeSwitch'];
doorbellNoticeSwitch = json['doorbellNoticeSwitch']; // doorbellNoticeSwitch = json['doorbellNoticeSwitch'];
someoneAtDoorSwitch = json['someoneAtDoorSwitch']; // someoneAtDoorSwitch = json['someoneAtDoorSwitch'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -603,12 +611,12 @@ class LockSettingInfo {
data['faceAntiMistakeOpen'] = faceAntiMistakeOpen; data['faceAntiMistakeOpen'] = faceAntiMistakeOpen;
data['autoLightScreen'] = autoLightScreen; data['autoLightScreen'] = autoLightScreen;
data['autoLightScreenTime'] = autoLightScreenTime; data['autoLightScreenTime'] = autoLightScreenTime;
data['dayNotOpenDoorSwitch'] = dayNotOpenDoorSwitch; // data['dayNotOpenDoorSwitch'] = dayNotOpenDoorSwitch;
data['dayNotOpenDoorValue'] = dayNotOpenDoorValue; // data['dayNotOpenDoorValue'] = dayNotOpenDoorValue;
data['doorNotCloseSwitch'] = doorNotCloseSwitch; // data['doorNotCloseSwitch'] = doorNotCloseSwitch;
data['lowElecNoticeSwitch'] = lowElecNoticeSwitch; // data['lowElecNoticeSwitch'] = lowElecNoticeSwitch;
data['doorbellNoticeSwitch'] = doorbellNoticeSwitch; // data['doorbellNoticeSwitch'] = doorbellNoticeSwitch;
data['someoneAtDoorSwitch'] = someoneAtDoorSwitch; // data['someoneAtDoorSwitch'] = someoneAtDoorSwitch;
return data; return data;
} }
@ -641,7 +649,7 @@ class PassageModeConfig {
} }
class CatEyeConfig { class CatEyeConfig {
int? catEyeMode; int? catEyeMode; //1 2 3 4
CatEyeModeConfig? catEyeModeConfig; CatEyeModeConfig? catEyeModeConfig;
CatEyeConfig({this.catEyeMode, this.catEyeModeConfig}); CatEyeConfig({this.catEyeMode, this.catEyeModeConfig});
@ -664,12 +672,12 @@ class CatEyeConfig {
} }
class CatEyeModeConfig { class CatEyeModeConfig {
int? recordMode; int? recordMode; // 0 1
String? recordTime; String? recordTime; //
int? realTimeMode; int? realTimeMode; // 0 1
int? recordEndTime; int? recordEndTime; //-
int? recordStartTime; int? recordStartTime; //-
double? detectionDistance; int? detectionDistance; //
CatEyeModeConfig( CatEyeModeConfig(
{this.recordMode, {this.recordMode,

View File

@ -10,7 +10,7 @@ class StarLockMineLogic extends BaseGetXController {
// //
Future<void> userLogoutRequest() async { Future<void> userLogoutRequest() async {
LoginEntity entity = await ApiRepository.to.userLogout(); LoginEntity entity = await ApiRepository.to.userLogout(deviceld: '');
if (entity.errorCode!.codeIsSuccessful) {} if (entity.errorCode!.codeIsSuccessful) {}
} }

View File

@ -51,7 +51,10 @@ class MineSetLogic extends BaseGetXController {
//退 //退
Future<void> userLogoutRequest() async { Future<void> userLogoutRequest() async {
LoginEntity entity = await ApiRepository.to.userLogout(); var getPushDeviceID = await Storage.getString(pushDeviceID);
LoginEntity entity =
await ApiRepository.to.userLogout(deviceld: getPushDeviceID!);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
UdpHelp().closeUDP(); UdpHelp().closeUDP();
logOut(); logOut();

View File

@ -600,7 +600,8 @@ class ApiProvider extends BaseProvider {
'pageSize': pageSize, 'pageSize': pageSize,
})); }));
Future<Response> expireFingerprintList(String pageNo, String pageSize) => post( Future<Response> expireFingerprintList(String pageNo, String pageSize) =>
post(
expireFingerprintListURL.toUrl, expireFingerprintListURL.toUrl,
jsonEncode({ jsonEncode({
'pageNo': pageNo, 'pageNo': pageNo,
@ -1500,7 +1501,8 @@ class ApiProvider extends BaseProvider {
})); }));
//退 //退
Future<Response> userLogout() => get(userLogoutURL.toUrl); Future<Response> userLogout(String deviceld) =>
post(userLogoutURL.toUrl, jsonEncode({'deviceld': deviceld}));
// //
Future<Response> deleteAccount( Future<Response> deleteAccount(
@ -1657,7 +1659,8 @@ class ApiProvider extends BaseProvider {
})); }));
// //
Future<Response> updateCatEyeModeConfig(int lockId, Map catEyeConfig) => post( Future<Response> updateCatEyeModeConfig(int lockId, List catEyeConfig) =>
post(
updateCatEyeConfigURL.toUrl, updateCatEyeConfigURL.toUrl,
jsonEncode({ jsonEncode({
'lockId': lockId, 'lockId': lockId,

View File

@ -336,8 +336,7 @@ class ApiRepository {
// //
Future<KeyOperationRecordEntity> updateKeyDate( Future<KeyOperationRecordEntity> updateKeyDate(
{ {required String keyId,
required String keyId,
required String lockId, required String lockId,
required String endDate, required String endDate,
required String startDate, required String startDate,
@ -346,10 +345,18 @@ class ApiRepository {
required int startTime, required int startTime,
required int endTime, required int endTime,
required int isOnlyManageSelf, required int isOnlyManageSelf,
required int remoteEnable required int remoteEnable}) async {
}) async {
final res = await apiProvider.updateKeyDate( final res = await apiProvider.updateKeyDate(
keyId, lockId, endDate, startDate, weekDays, keyType, startTime, endTime, isOnlyManageSelf, remoteEnable); keyId,
lockId,
endDate,
startDate,
weekDays,
keyType,
startTime,
endTime,
isOnlyManageSelf,
remoteEnable);
return KeyOperationRecordEntity.fromJson(res.body); return KeyOperationRecordEntity.fromJson(res.body);
} }
@ -538,10 +545,7 @@ class ApiRepository {
// //
Future<ElectronicKeyListEntity> deleteElectronicKey( Future<ElectronicKeyListEntity> deleteElectronicKey(
{ {required String keyId, required int includeUnderlings}) async {
required String keyId,
required int includeUnderlings
}) async {
final res = await apiProvider.deleteElectronicKey(keyId, includeUnderlings); final res = await apiProvider.deleteElectronicKey(keyId, includeUnderlings);
return ElectronicKeyListEntity.fromJson(res.body); return ElectronicKeyListEntity.fromJson(res.body);
} }
@ -566,13 +570,15 @@ class ApiRepository {
} }
// //
Future<ElectronicKeyListEntity> setAdministrator({required String keyId}) async { Future<ElectronicKeyListEntity> setAdministrator(
{required String keyId}) async {
final res = await apiProvider.setAdministrator(keyId); final res = await apiProvider.setAdministrator(keyId);
return ElectronicKeyListEntity.fromJson(res.body); return ElectronicKeyListEntity.fromJson(res.body);
} }
// //
Future<ElectronicKeyListEntity> cancelAdministrator({required String keyId}) async { Future<ElectronicKeyListEntity> cancelAdministrator(
{required String keyId}) async {
final res = await apiProvider.cancelAdministrator(keyId); final res = await apiProvider.cancelAdministrator(keyId);
return ElectronicKeyListEntity.fromJson(res.body); return ElectronicKeyListEntity.fromJson(res.body);
} }
@ -604,13 +610,15 @@ class ApiRepository {
} }
// //
Future<ExpireCardEntity> expireCardList(String pageNo, String pageSize) async { Future<ExpireCardEntity> expireCardList(
String pageNo, String pageSize) async {
final res = await apiProvider.expireCardList(pageNo, pageSize); final res = await apiProvider.expireCardList(pageNo, pageSize);
return ExpireCardEntity.fromJson(res.body); return ExpireCardEntity.fromJson(res.body);
} }
// //
Future<ExpireFingerprintEntity> expireFingerprintList(String pageNo, String pageSize) async { Future<ExpireFingerprintEntity> expireFingerprintList(
String pageNo, String pageSize) async {
final res = await apiProvider.expireFingerprintList(pageNo, pageSize); final res = await apiProvider.expireFingerprintList(pageNo, pageSize);
return ExpireFingerprintEntity.fromJson(res.body); return ExpireFingerprintEntity.fromJson(res.body);
} }
@ -851,8 +859,7 @@ class ApiRepository {
// //
Future<KeyDetailEntity> batchSendKey( Future<KeyDetailEntity> batchSendKey(
{ {required String endDate,
required String endDate,
required List keyGroupIdList, required List keyGroupIdList,
required List lockIdList, required List lockIdList,
required String createUser, required String createUser,
@ -862,8 +869,7 @@ class ApiRepository {
required String startDate, required String startDate,
required String countryCode, required String countryCode,
required String usernameType, required String usernameType,
required List weekDays required List weekDays}) async {
}) async {
final res = await apiProvider.batchSendKey( final res = await apiProvider.batchSendKey(
endDate, endDate,
keyGroupIdList, keyGroupIdList,
@ -1467,8 +1473,8 @@ class ApiRepository {
} }
// 退 // 退
Future<LoginEntity> userLogout() async { Future<LoginEntity> userLogout({required String deviceld}) async {
final res = await apiProvider.userLogout(); final res = await apiProvider.userLogout(deviceld);
return LoginEntity.fromJson(res.body); return LoginEntity.fromJson(res.body);
} }
@ -1693,7 +1699,7 @@ class ApiRepository {
// //
Future<VersionUndateEntity> updateCatEyeModeConfig( Future<VersionUndateEntity> updateCatEyeModeConfig(
{required int lockId, required Map catEyeConfig}) async { {required int lockId, required List catEyeConfig}) async {
final res = await apiProvider.updateCatEyeModeConfig(lockId, catEyeConfig); final res = await apiProvider.updateCatEyeModeConfig(lockId, catEyeConfig);
return VersionUndateEntity.fromJson(res.body); return VersionUndateEntity.fromJson(res.body);
} }

View File

@ -3,6 +3,7 @@ import 'dart:typed_data';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/talk/udp/udp_manage.dart'; import 'package:star_lock/talk/udp/udp_manage.dart';
import 'package:star_lock/tools/storage.dart';
import '../../blue/io_tool/io_tool.dart'; import '../../blue/io_tool/io_tool.dart';
import '../../tools/eventBusEventManage.dart'; import '../../tools/eventBusEventManage.dart';

View File

@ -20,6 +20,7 @@ const isAgreeCamera = "isAgreeCamera"; //是否同意获取相机/相册弹窗
const isShowUpdateVersion = "isShowUpdateVersion"; // const isShowUpdateVersion = "isShowUpdateVersion"; //
const saveLockAlias = "saveLockAlias"; // const saveLockAlias = "saveLockAlias"; //
const pushDeviceID = 'pushDeviceID'; //ID
const saveUserLoginData = "userLoginData"; const saveUserLoginData = "userLoginData";

View File

@ -43,6 +43,10 @@ class XSJPushProvider {
// Platform messages may fail, so we use a try/catch PlatformException. // Platform messages may fail, so we use a try/catch PlatformException.
jpush.getRegistrationID().then((rid) { jpush.getRegistrationID().then((rid) {
print("flutter get registration id : $rid"); print("flutter get registration id : $rid");
Storage.setString(
pushDeviceID,
rid,
);
pushBindDeviceID(rid, Platform.isAndroid ? 10 : 20); pushBindDeviceID(rid, Platform.isAndroid ? 10 : 20);
}); });
} }