1,新增猫眼设置部分接口处理逻辑
2,退出登录新增推送deviceID以处理退出登录后仍可收到通知
This commit is contained in:
parent
b7fcb60f28
commit
76d212c933
@ -282,7 +282,7 @@ class DoorLockLogLogic extends BaseGetXController {
|
||||
// senderReferEventRecordTime();
|
||||
// senderReferEventRecordNumber();
|
||||
|
||||
testReadJsonData();
|
||||
// testReadJsonData();
|
||||
mockNetworkDataRequest();
|
||||
}
|
||||
}
|
||||
|
||||
@ -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/tools/advancedCalendar/src/widget.dart';
|
||||
import 'package:star_lock/tools/menuItem/xsDropDownWidget.dart';
|
||||
import 'package:star_lock/tools/noData.dart';
|
||||
import 'package:timelines/timelines.dart';
|
||||
|
||||
import '../../../app_settings/app_colors.dart';
|
||||
@ -140,14 +141,15 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> {
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(16.w),
|
||||
),
|
||||
child: Timeline.tileBuilder(
|
||||
child: timelineDataList.isNotEmpty
|
||||
? Timeline.tileBuilder(
|
||||
builder: TimelineTileBuilder.fromStyle(
|
||||
contentsAlign: ContentsAlign.basic,
|
||||
itemCount: timelineDataList.length,
|
||||
contentsBuilder: (context, index) {
|
||||
DoorLockLogDataItem timelineData = timelineDataList[index];
|
||||
DateTime dateTime =
|
||||
DateTime.fromMillisecondsSinceEpoch(timelineData.operateDate!);
|
||||
DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(
|
||||
timelineData.operateDate!);
|
||||
String formattedTime =
|
||||
'${dateTime.hour.toString().padLeft(2, '0')}:${dateTime.minute.toString().padLeft(2, '0')}';
|
||||
|
||||
@ -224,7 +226,8 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> {
|
||||
position: 0.4,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
: NoData(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,7 +39,9 @@ class _CatEyeSetPageState extends State<CatEyeSetPage> {
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Get.toNamed(Routers.catEyeWorkModePage, arguments: {
|
||||
'lockSetInfoData': state.lockSetInfoData.value
|
||||
'lockSetInfoData': state.lockSetInfoData.value,
|
||||
'catEyeConfigata': state
|
||||
.lockSetInfoData.value.lockSettingInfo!.catEyeConfig![0]
|
||||
})?.then((value) {
|
||||
if (value != null) {
|
||||
state.selectCatEyeWorkMode.value = value;
|
||||
|
||||
@ -9,7 +9,8 @@ class CatEyeWorkModeLogic extends BaseGetXController {
|
||||
void updateCatEyeModeConfig() async {
|
||||
var entity = await ApiRepository.to.updateCatEyeModeConfig(
|
||||
lockId: state.lockSetInfoData.value.lockId!,
|
||||
catEyeConfig: {
|
||||
catEyeConfig: [
|
||||
{
|
||||
'catEyeMode': state.selectCatEyeWorkMode.value,
|
||||
'catEyeModeConfig': {
|
||||
'recordMode': state.recordMode.value,
|
||||
@ -19,10 +20,17 @@ class CatEyeWorkModeLogic extends BaseGetXController {
|
||||
'detectionDistance': state.detectionDistance.value,
|
||||
'realTimeMode': state.realTimeMode.value,
|
||||
}
|
||||
},
|
||||
}
|
||||
],
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast('设置成功');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,20 +1,38 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
|
||||
|
||||
class CatEyeWorkModeState {
|
||||
var lockSetInfoData = LockSetInfoData().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自定义时间
|
||||
//自定义时间需要填:recordStartTime与recordEndTime参数
|
||||
var recordStartTime = 0.obs; // 1709715049775,
|
||||
var recordEndTime = 0.obs; //1709715049775,
|
||||
var recordTime = 0.obs; //有人出现时录像
|
||||
var recordTime = ''.obs; //有人出现时录像
|
||||
var detectionDistance = 0.obs; //人体侦测距离
|
||||
var realTimeMode = 0.obs; //实时画面 0发生事件事查看 1实时查看
|
||||
var catEyeConfigData = CatEyeConfig().obs;
|
||||
|
||||
CatEyeWorkModeState() {
|
||||
Map map = Get.arguments;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -458,19 +458,27 @@ class LockSettingInfo {
|
||||
int? motorTorsion;
|
||||
int? stayWarn;
|
||||
int? abnormalWarn;
|
||||
List<CatEyeModeConfig>? catEyeConfig;
|
||||
List<CatEyeConfig>? catEyeConfig;
|
||||
int? faceSwitch; //人脸开关 0:关闭 1:开启
|
||||
int? faceAutoLightScreen; //人脸自动亮屏开关 0:关闭 1:开启
|
||||
int? faceInductionDistance; //人脸感应距离
|
||||
int? faceAntiMistakeOpen; //人脸防误开门 0:关闭 1:开启
|
||||
int? autoLightScreen; //猫眼-自动亮屏开关 0:关闭 1:开启
|
||||
int? autoLightScreenTime; //猫眼-自动亮屏时间
|
||||
int? dayNotOpenDoorSwitch; //N天未开门开关 (启用/禁用)
|
||||
int? dayNotOpenDoorValue; //N天未开门值
|
||||
int? doorNotCloseSwitch; //门未关闭开关 (启用/禁用)
|
||||
int? lowElecNoticeSwitch; //低电量开关 (启用/禁用)
|
||||
int? doorbellNoticeSwitch; //有人按门铃开关 (启用/禁用)
|
||||
int? someoneAtDoorSwitch; //有人出现在门口开关 (启用/禁用)//
|
||||
|
||||
// List<CatEyeModeConfig>? catEyeConfigList;
|
||||
// int? faceSwitch; //人脸开关 0:关闭 1:开启
|
||||
// int? faceAutoLightScreen; //人脸自动亮屏开关 0:关闭 1:开启
|
||||
// int? faceInductionDistance; //人脸感应距离
|
||||
// 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({
|
||||
this.remoteUnlock,
|
||||
@ -505,12 +513,12 @@ class LockSettingInfo {
|
||||
this.faceAntiMistakeOpen,
|
||||
this.autoLightScreen,
|
||||
this.autoLightScreenTime,
|
||||
this.dayNotOpenDoorSwitch,
|
||||
this.dayNotOpenDoorValue,
|
||||
this.doorNotCloseSwitch,
|
||||
this.lowElecNoticeSwitch,
|
||||
this.doorbellNoticeSwitch,
|
||||
this.someoneAtDoorSwitch,
|
||||
// this.dayNotOpenDoorSwitch,
|
||||
// this.dayNotOpenDoorValue,
|
||||
// this.doorNotCloseSwitch,
|
||||
// this.lowElecNoticeSwitch,
|
||||
// this.doorbellNoticeSwitch,
|
||||
// this.someoneAtDoorSwitch,
|
||||
});
|
||||
|
||||
LockSettingInfo.fromJson(Map<String, dynamic> json) {
|
||||
@ -545,9 +553,9 @@ class LockSettingInfo {
|
||||
stayWarn = json['stayWarn'];
|
||||
abnormalWarn = json['abnormalWarn'];
|
||||
if (json['catEyeConfig'] != null) {
|
||||
catEyeConfig = <CatEyeModeConfig>[];
|
||||
catEyeConfig = <CatEyeConfig>[];
|
||||
json['catEyeConfig'].forEach((v) {
|
||||
catEyeConfig!.add(CatEyeModeConfig.fromJson(v));
|
||||
catEyeConfig!.add(CatEyeConfig.fromJson(v));
|
||||
});
|
||||
}
|
||||
faceSwitch = json['faceSwitch'];
|
||||
@ -556,12 +564,12 @@ class LockSettingInfo {
|
||||
faceAntiMistakeOpen = json['faceAntiMistakeOpen'];
|
||||
autoLightScreen = json['autoLightScreen'];
|
||||
autoLightScreenTime = json['autoLightScreenTime'];
|
||||
dayNotOpenDoorSwitch = json['dayNotOpenDoorSwitch'];
|
||||
dayNotOpenDoorValue = json['dayNotOpenDoorValue'];
|
||||
doorNotCloseSwitch = json['doorNotCloseSwitch'];
|
||||
lowElecNoticeSwitch = json['lowElecNoticeSwitch'];
|
||||
doorbellNoticeSwitch = json['doorbellNoticeSwitch'];
|
||||
someoneAtDoorSwitch = json['someoneAtDoorSwitch'];
|
||||
// dayNotOpenDoorSwitch = json['dayNotOpenDoorSwitch'];
|
||||
// dayNotOpenDoorValue = json['dayNotOpenDoorValue'];
|
||||
// doorNotCloseSwitch = json['doorNotCloseSwitch'];
|
||||
// lowElecNoticeSwitch = json['lowElecNoticeSwitch'];
|
||||
// doorbellNoticeSwitch = json['doorbellNoticeSwitch'];
|
||||
// someoneAtDoorSwitch = json['someoneAtDoorSwitch'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
@ -603,12 +611,12 @@ class LockSettingInfo {
|
||||
data['faceAntiMistakeOpen'] = faceAntiMistakeOpen;
|
||||
data['autoLightScreen'] = autoLightScreen;
|
||||
data['autoLightScreenTime'] = autoLightScreenTime;
|
||||
data['dayNotOpenDoorSwitch'] = dayNotOpenDoorSwitch;
|
||||
data['dayNotOpenDoorValue'] = dayNotOpenDoorValue;
|
||||
data['doorNotCloseSwitch'] = doorNotCloseSwitch;
|
||||
data['lowElecNoticeSwitch'] = lowElecNoticeSwitch;
|
||||
data['doorbellNoticeSwitch'] = doorbellNoticeSwitch;
|
||||
data['someoneAtDoorSwitch'] = someoneAtDoorSwitch;
|
||||
// data['dayNotOpenDoorSwitch'] = dayNotOpenDoorSwitch;
|
||||
// data['dayNotOpenDoorValue'] = dayNotOpenDoorValue;
|
||||
// data['doorNotCloseSwitch'] = doorNotCloseSwitch;
|
||||
// data['lowElecNoticeSwitch'] = lowElecNoticeSwitch;
|
||||
// data['doorbellNoticeSwitch'] = doorbellNoticeSwitch;
|
||||
// data['someoneAtDoorSwitch'] = someoneAtDoorSwitch;
|
||||
|
||||
return data;
|
||||
}
|
||||
@ -641,7 +649,7 @@ class PassageModeConfig {
|
||||
}
|
||||
|
||||
class CatEyeConfig {
|
||||
int? catEyeMode;
|
||||
int? catEyeMode; //1省电模式 2逗留抓拍模式 3实时监控模式 4自定义模式(自定义模式下存在其他设置参数)
|
||||
CatEyeModeConfig? catEyeModeConfig;
|
||||
|
||||
CatEyeConfig({this.catEyeMode, this.catEyeModeConfig});
|
||||
@ -664,12 +672,12 @@ class CatEyeConfig {
|
||||
}
|
||||
|
||||
class CatEyeModeConfig {
|
||||
int? recordMode;
|
||||
String? recordTime;
|
||||
int? realTimeMode;
|
||||
int? recordEndTime;
|
||||
int? recordStartTime;
|
||||
double? detectionDistance;
|
||||
int? recordMode; //录像时段 0全天 1自定义时间
|
||||
String? recordTime; //有人出现时录像
|
||||
int? realTimeMode; //实时画面 0发生事件事查看 1实时查看
|
||||
int? recordEndTime; //录像时段自定义时间-结束时间
|
||||
int? recordStartTime; //录像时段自定义时间-开始时间
|
||||
int? detectionDistance; //人体侦测距离
|
||||
|
||||
CatEyeModeConfig(
|
||||
{this.recordMode,
|
||||
|
||||
@ -10,7 +10,7 @@ class StarLockMineLogic extends BaseGetXController {
|
||||
|
||||
//删除账号请求
|
||||
Future<void> userLogoutRequest() async {
|
||||
LoginEntity entity = await ApiRepository.to.userLogout();
|
||||
LoginEntity entity = await ApiRepository.to.userLogout(deviceld: '');
|
||||
if (entity.errorCode!.codeIsSuccessful) {}
|
||||
}
|
||||
|
||||
|
||||
@ -51,7 +51,10 @@ class MineSetLogic extends BaseGetXController {
|
||||
|
||||
//退出登录请求
|
||||
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) {
|
||||
UdpHelp().closeUDP();
|
||||
logOut();
|
||||
|
||||
@ -600,7 +600,8 @@ class ApiProvider extends BaseProvider {
|
||||
'pageSize': pageSize,
|
||||
}));
|
||||
|
||||
Future<Response> expireFingerprintList(String pageNo, String pageSize) => post(
|
||||
Future<Response> expireFingerprintList(String pageNo, String pageSize) =>
|
||||
post(
|
||||
expireFingerprintListURL.toUrl,
|
||||
jsonEncode({
|
||||
'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(
|
||||
@ -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,
|
||||
jsonEncode({
|
||||
'lockId': lockId,
|
||||
|
||||
@ -336,8 +336,7 @@ class ApiRepository {
|
||||
|
||||
//编辑电子钥匙有效期
|
||||
Future<KeyOperationRecordEntity> updateKeyDate(
|
||||
{
|
||||
required String keyId,
|
||||
{required String keyId,
|
||||
required String lockId,
|
||||
required String endDate,
|
||||
required String startDate,
|
||||
@ -346,10 +345,18 @@ class ApiRepository {
|
||||
required int startTime,
|
||||
required int endTime,
|
||||
required int isOnlyManageSelf,
|
||||
required int remoteEnable
|
||||
}) async {
|
||||
required int remoteEnable}) async {
|
||||
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);
|
||||
}
|
||||
|
||||
@ -538,10 +545,7 @@ class ApiRepository {
|
||||
|
||||
//删除电子钥匙
|
||||
Future<ElectronicKeyListEntity> deleteElectronicKey(
|
||||
{
|
||||
required String keyId,
|
||||
required int includeUnderlings
|
||||
}) async {
|
||||
{required String keyId, required int includeUnderlings}) async {
|
||||
final res = await apiProvider.deleteElectronicKey(keyId, includeUnderlings);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
return ExpireFingerprintEntity.fromJson(res.body);
|
||||
}
|
||||
@ -851,8 +859,7 @@ class ApiRepository {
|
||||
|
||||
//群发电子钥匙
|
||||
Future<KeyDetailEntity> batchSendKey(
|
||||
{
|
||||
required String endDate,
|
||||
{required String endDate,
|
||||
required List keyGroupIdList,
|
||||
required List lockIdList,
|
||||
required String createUser,
|
||||
@ -862,8 +869,7 @@ class ApiRepository {
|
||||
required String startDate,
|
||||
required String countryCode,
|
||||
required String usernameType,
|
||||
required List weekDays
|
||||
}) async {
|
||||
required List weekDays}) async {
|
||||
final res = await apiProvider.batchSendKey(
|
||||
endDate,
|
||||
keyGroupIdList,
|
||||
@ -1467,8 +1473,8 @@ class ApiRepository {
|
||||
}
|
||||
|
||||
// 退出登录
|
||||
Future<LoginEntity> userLogout() async {
|
||||
final res = await apiProvider.userLogout();
|
||||
Future<LoginEntity> userLogout({required String deviceld}) async {
|
||||
final res = await apiProvider.userLogout(deviceld);
|
||||
return LoginEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
@ -1693,7 +1699,7 @@ class ApiRepository {
|
||||
|
||||
// 设置猫眼工作模式
|
||||
Future<VersionUndateEntity> updateCatEyeModeConfig(
|
||||
{required int lockId, required Map catEyeConfig}) async {
|
||||
{required int lockId, required List catEyeConfig}) async {
|
||||
final res = await apiProvider.updateCatEyeModeConfig(lockId, catEyeConfig);
|
||||
return VersionUndateEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ import 'dart:typed_data';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:get/get.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 '../../tools/eventBusEventManage.dart';
|
||||
|
||||
@ -20,6 +20,7 @@ const isAgreeCamera = "isAgreeCamera"; //是否同意获取相机/相册弹窗
|
||||
|
||||
const isShowUpdateVersion = "isShowUpdateVersion"; //是否更新弹窗
|
||||
const saveLockAlias = "saveLockAlias"; //锁别名
|
||||
const pushDeviceID = 'pushDeviceID'; //推送设备ID
|
||||
|
||||
const saveUserLoginData = "userLoginData";
|
||||
|
||||
|
||||
@ -43,6 +43,10 @@ class XSJPushProvider {
|
||||
// Platform messages may fail, so we use a try/catch PlatformException.
|
||||
jpush.getRegistrationID().then((rid) {
|
||||
print("flutter get registration id : $rid");
|
||||
Storage.setString(
|
||||
pushDeviceID,
|
||||
rid,
|
||||
);
|
||||
pushBindDeviceID(rid, Platform.isAndroid ? 10 : 20);
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user