1,新增获取锁设置接口对接
2,新增设置门未关好接口对接
This commit is contained in:
parent
f8efe06412
commit
8937e988b6
@ -372,9 +372,8 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Get.toNamed(Routers.msgNotificationPage, arguments: {
|
||||
'lockSetInfoData': state.lockSetInfoData.value
|
||||
});
|
||||
Get.toNamed(Routers.msgNotificationPage,
|
||||
arguments: {'lockId': state.lockSetInfoData.value.lockId});
|
||||
})),
|
||||
//猫眼设置
|
||||
Obx(() => Visibility(
|
||||
|
||||
@ -0,0 +1,116 @@
|
||||
class MsgNotificationEntity {
|
||||
int? errorCode;
|
||||
String? description;
|
||||
String? errorMsg;
|
||||
Data? data;
|
||||
|
||||
MsgNotificationEntity(
|
||||
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||
|
||||
MsgNotificationEntity.fromJson(Map<String, dynamic> json) {
|
||||
errorCode = json['errorCode'];
|
||||
description = json['description'];
|
||||
errorMsg = json['errorMsg'];
|
||||
data = json['data'] != null ? Data.fromJson(json['data']) : null;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['errorCode'] = errorCode;
|
||||
data['description'] = description;
|
||||
data['errorMsg'] = errorMsg;
|
||||
if (this.data != null) {
|
||||
data['data'] = this.data!.toJson();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Data {
|
||||
List? openDoorNoticeList;
|
||||
int? dayNotOpenDoorState;
|
||||
int? dayNotOpenDoorValue;
|
||||
List? dayNotOpenDoorNoticeWayList;
|
||||
int? doorNotCloseState;
|
||||
int? tamperAlarmState;
|
||||
int? lowElecNoticeState;
|
||||
List<void>? lowElecNoticeWayList;
|
||||
List<void>? coercionOpenDoorNoticeList;
|
||||
int? doorbellNoticeState;
|
||||
int? someoneAtDoorNoticeState;
|
||||
|
||||
Data(
|
||||
{this.openDoorNoticeList,
|
||||
this.dayNotOpenDoorState,
|
||||
this.dayNotOpenDoorValue,
|
||||
this.dayNotOpenDoorNoticeWayList,
|
||||
this.doorNotCloseState,
|
||||
this.tamperAlarmState,
|
||||
this.lowElecNoticeState,
|
||||
this.lowElecNoticeWayList,
|
||||
this.coercionOpenDoorNoticeList,
|
||||
this.doorbellNoticeState,
|
||||
this.someoneAtDoorNoticeState});
|
||||
|
||||
Data.fromJson(Map<String, dynamic> json) {
|
||||
if (json['openDoorNoticeList'] != null) {
|
||||
openDoorNoticeList = [];
|
||||
json['openDoorNoticeList'].forEach((v) {
|
||||
openDoorNoticeList!.add(v);
|
||||
});
|
||||
}
|
||||
dayNotOpenDoorState = json['dayNotOpenDoorState'];
|
||||
dayNotOpenDoorValue = json['dayNotOpenDoorValue'];
|
||||
if (json['dayNotOpenDoorNoticeWayList'] != null) {
|
||||
dayNotOpenDoorNoticeWayList = [];
|
||||
json['dayNotOpenDoorNoticeWayList'].forEach((v) {
|
||||
dayNotOpenDoorNoticeWayList!.add(v);
|
||||
});
|
||||
}
|
||||
doorNotCloseState = json['doorNotCloseState'];
|
||||
tamperAlarmState = json['tamperAlarmState'];
|
||||
lowElecNoticeState = json['lowElecNoticeState'];
|
||||
if (json['lowElecNoticeWayList'] != null) {
|
||||
lowElecNoticeWayList = [];
|
||||
json['lowElecNoticeWayList'].forEach((v) {
|
||||
lowElecNoticeWayList!.add(v);
|
||||
});
|
||||
}
|
||||
if (json['coercionOpenDoorNoticeList'] != null) {
|
||||
coercionOpenDoorNoticeList = [];
|
||||
json['coercionOpenDoorNoticeList'].forEach((v) {
|
||||
coercionOpenDoorNoticeList!.add(v);
|
||||
});
|
||||
}
|
||||
doorbellNoticeState = json['doorbellNoticeState'];
|
||||
someoneAtDoorNoticeState = json['someoneAtDoorNoticeState'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
if (openDoorNoticeList != null) {
|
||||
data['openDoorNoticeList'] =
|
||||
openDoorNoticeList!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['dayNotOpenDoorState'] = dayNotOpenDoorState;
|
||||
data['dayNotOpenDoorValue'] = dayNotOpenDoorValue;
|
||||
if (dayNotOpenDoorNoticeWayList != null) {
|
||||
data['dayNotOpenDoorNoticeWayList'] =
|
||||
dayNotOpenDoorNoticeWayList!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['doorNotCloseState'] = doorNotCloseState;
|
||||
data['tamperAlarmState'] = tamperAlarmState;
|
||||
data['lowElecNoticeState'] = lowElecNoticeState;
|
||||
if (lowElecNoticeWayList != null) {
|
||||
data['lowElecNoticeWayList'] =
|
||||
lowElecNoticeWayList!.map((v) => v).toList();
|
||||
}
|
||||
if (coercionOpenDoorNoticeList != null) {
|
||||
data['coercionOpenDoorNoticeList'] =
|
||||
coercionOpenDoorNoticeList!.map((v) => v).toList();
|
||||
}
|
||||
data['doorbellNoticeState'] = doorbellNoticeState;
|
||||
data['someoneAtDoorNoticeState'] = someoneAtDoorNoticeState;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,41 @@
|
||||
|
||||
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/msgNotification/msgNotification_entity.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'msgNotification_state.dart';
|
||||
|
||||
class MsgNotificationLogic extends BaseGetXController {
|
||||
final MsgNotificationState state = MsgNotificationState();
|
||||
|
||||
// 获取锁消息设置
|
||||
void getLockNoticeSetting() async {
|
||||
MsgNotificationEntity entity = await ApiRepository.to.getLockNoticeSetting(
|
||||
lockId: state.getLockId.value,
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.nDaysNotOpenDoor.value =
|
||||
entity.data!.dayNotOpenDoorState! == 0 ? '未启用' : '已启用';
|
||||
state.isDoorNotShut.value =
|
||||
entity.data!.doorNotCloseState! == 0 ? false : true;
|
||||
state.isTamperAlarm.value =
|
||||
entity.data!.tamperAlarmState! == 0 ? '未启用' : '已启用';
|
||||
state.isLowBattery.value =
|
||||
entity.data!.lowElecNoticeState! == 0 ? '未启用' : '已启用';
|
||||
state.isSomeoneRing.value =
|
||||
entity.data!.doorbellNoticeState! == 0 ? false : true; //有人按门铃
|
||||
state.isSomeoneAppeared.value =
|
||||
entity.data!.someoneAtDoorNoticeState! == 0 ? false : true; //有人出现在门口
|
||||
}
|
||||
}
|
||||
|
||||
//设置门未关好
|
||||
void updateDoorNotCloseSetting() async {
|
||||
MsgNotificationEntity entity =
|
||||
await ApiRepository.to.updateDoorNotCloseSetting(
|
||||
lockId: state.getLockId.value,
|
||||
doorNotCloseState: state.isDoorNotShut.value ? 1 : 0,
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast('设置成功');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,6 +35,12 @@ class _MsgNotificationPageState extends State<MsgNotificationPage> {
|
||||
style: subTipsStyle),
|
||||
]);
|
||||
|
||||
@override
|
||||
initState() {
|
||||
super.initState();
|
||||
logic.getLockNoticeSetting();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@ -71,20 +77,18 @@ class _MsgNotificationPageState extends State<MsgNotificationPage> {
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Get.toNamed(Routers.openDoorNotifyPage, arguments: {
|
||||
'lockSetInfoData': state.lockSetInfoData.value,
|
||||
});
|
||||
},
|
||||
),
|
||||
CommonItem(
|
||||
leftTitel: 'N天未开门',
|
||||
rightTitle: "已启用",
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Get.toNamed(Routers.nDaysUnopenedPage);
|
||||
Get.toNamed(Routers.openDoorNotifyPage);
|
||||
},
|
||||
),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: 'N天未开门',
|
||||
rightTitle: state.nDaysNotOpenDoor.value,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Get.toNamed(Routers.nDaysUnopenedPage);
|
||||
},
|
||||
)),
|
||||
// SizedBox(
|
||||
// height: 20.h,
|
||||
// ),
|
||||
@ -102,21 +106,21 @@ class _MsgNotificationPageState extends State<MsgNotificationPage> {
|
||||
isHaveRightWidget: true,
|
||||
rightWidget:
|
||||
SizedBox(width: 60.w, height: 50.h, child: _switch(2)))),
|
||||
CommonItem(
|
||||
leftTitel: '防拆报警',
|
||||
rightTitle: "已启用",
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
),
|
||||
CommonItem(
|
||||
leftTitel: '低电量提醒',
|
||||
rightTitle: "已启用",
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Get.toNamed(Routers.lowBatteryReminderPage);
|
||||
},
|
||||
),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: '防拆报警',
|
||||
rightTitle: state.isTamperAlarm.value,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
)),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: '低电量提醒',
|
||||
rightTitle: state.isLowBattery.value,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Get.toNamed(Routers.lowBatteryReminderPage);
|
||||
},
|
||||
)),
|
||||
CommonItem(
|
||||
leftTitel: '胁迫开门',
|
||||
rightTitle: "",
|
||||
@ -204,7 +208,10 @@ class _MsgNotificationPageState extends State<MsgNotificationPage> {
|
||||
break;
|
||||
//门未关好
|
||||
case 2:
|
||||
state.isDoorNotShut.value = value;
|
||||
{
|
||||
state.isDoorNotShut.value = value;
|
||||
logic.updateDoorNotCloseSetting();
|
||||
}
|
||||
break;
|
||||
//有人按门铃
|
||||
case 3:
|
||||
|
||||
@ -1,9 +1,12 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
|
||||
|
||||
class MsgNotificationState {
|
||||
var lockSetInfoData = LockSetInfoData().obs;
|
||||
// var lockSetInfoData = LockSetInfoData().obs;
|
||||
var getLockId = 0.obs;
|
||||
var isCheck = false.obs;
|
||||
var nDaysNotOpenDoor = '已启用'.obs; //N天未开门
|
||||
var isTamperAlarm = '已启用'.obs; //防拆报警
|
||||
var isLowBattery = '已启用'.obs; //低电量提醒
|
||||
var isLeaveHomeOpenDoor = false.obs; //离家开门
|
||||
var isDoorNotShut = false.obs; //门未关好
|
||||
var isSomeoneRing = false.obs; //有人按门铃
|
||||
@ -11,8 +14,8 @@ class MsgNotificationState {
|
||||
|
||||
MsgNotificationState() {
|
||||
Map map = Get.arguments;
|
||||
if (map['lockSetInfoData'] != null) {
|
||||
lockSetInfoData.value = map['lockSetInfoData'];
|
||||
if (map['lockId'] != null) {
|
||||
getLockId.value = map['lockId'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,16 +1,6 @@
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/versionUndate/versionUndate_entity.dart';
|
||||
import 'openDoorNotify_state.dart';
|
||||
|
||||
class OpenDoorNotifyLogic extends BaseGetXController {
|
||||
final OpenDoorNotifyState state = OpenDoorNotifyState();
|
||||
|
||||
// 获取锁消息设置
|
||||
void getLockNoticeSetting() async {
|
||||
VersionUndateEntity entity = await ApiRepository.to.getLockNoticeSetting(
|
||||
lockId: state.lockSetInfoData.value.lockId!,
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {}
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,8 +22,6 @@ class _OpenDoorNotifyPageState extends State<OpenDoorNotifyPage> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
logic.getLockNoticeSetting();
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@ -196,6 +196,9 @@ abstract class Api {
|
||||
|
||||
final String getLockNoticeSettingURL =
|
||||
'/lockSetting/getLockNoticeSetting'; //获取锁消息设置
|
||||
final String updateLockNoticeSettingURL =
|
||||
'/lockSetting/updateLockNoticeSetting'; //设置开门通知
|
||||
|
||||
final String setWechatPushSwitchURL =
|
||||
'/user/setMpWechatPushSwitch'; //设置微信公众号推送
|
||||
final String getMpWechatQrCodeURL = '/user/getMpWechatQrCode'; //获取微信公众号二维码
|
||||
|
||||
@ -1683,9 +1683,8 @@ class ApiProvider extends BaseProvider {
|
||||
}));
|
||||
|
||||
// 删除所有消息
|
||||
Future<Response> deletAllMessageLoadData() => post(
|
||||
deletAllMessageURL.toUrl,
|
||||
jsonEncode({}));
|
||||
Future<Response> deletAllMessageLoadData() =>
|
||||
post(deletAllMessageURL.toUrl, jsonEncode({}));
|
||||
|
||||
// 获取最新版本号
|
||||
Future<Response> getVersionData(String brandName, String currentVersion) =>
|
||||
@ -1787,6 +1786,33 @@ class ApiProvider extends BaseProvider {
|
||||
'lockId': lockId,
|
||||
}));
|
||||
|
||||
// 设置N天未开门
|
||||
Future<Response> updateNdaysNotCloseDoorNoticeSetting(
|
||||
int lockId,
|
||||
int dayNotOpenDoorState,
|
||||
int dayNotOpenDoorValue,
|
||||
List dayNotOpenDoorNoticeWayList) =>
|
||||
post(
|
||||
updateLockNoticeSettingURL.toUrl,
|
||||
jsonEncode({
|
||||
'lockId': lockId,
|
||||
'dayNotOpenDoorState': dayNotOpenDoorState,
|
||||
'dayNotOpenDoorValue': dayNotOpenDoorValue,
|
||||
'dayNotOpenDoorNoticeWayList': dayNotOpenDoorNoticeWayList
|
||||
}));
|
||||
|
||||
// 设置门未关好
|
||||
Future<Response> updateDoorNotCloseSetting(
|
||||
int lockId,
|
||||
int doorNotCloseState,
|
||||
) =>
|
||||
post(
|
||||
updateLockNoticeSettingURL.toUrl,
|
||||
jsonEncode({
|
||||
'lockId': lockId,
|
||||
'doorNotCloseState': doorNotCloseState,
|
||||
}));
|
||||
|
||||
// 设置微信公众号推送
|
||||
Future<Response> setMpWechatPushSwitch(int mpWechatPushSwitch) => post(
|
||||
setWechatPushSwitchURL.toUrl,
|
||||
|
||||
@ -7,6 +7,7 @@ import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/ma
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart';
|
||||
import 'package:star_lock/main/lockDetail/face/addFace/addFace_entity.dart';
|
||||
import 'package:star_lock/main/lockDetail/lockSet/basicInformation/basicInformation/KeyDetailEntity.dart';
|
||||
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/msgNotification/msgNotification_entity.dart';
|
||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
|
||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart';
|
||||
import 'package:star_lock/mine/mall/lockMall_entity.dart';
|
||||
@ -1811,10 +1812,31 @@ class ApiRepository {
|
||||
}
|
||||
|
||||
// 获取锁消息设置
|
||||
Future<VersionUndateEntity> getLockNoticeSetting(
|
||||
Future<MsgNotificationEntity> getLockNoticeSetting(
|
||||
{required int lockId}) async {
|
||||
final res = await apiProvider.getLockNoticeSetting(lockId);
|
||||
return VersionUndateEntity.fromJson(res.body);
|
||||
return MsgNotificationEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
// 设置N天未开门
|
||||
Future<MsgNotificationEntity> updateNdaysNotCloseDoorNoticeSetting(
|
||||
{required int lockId,
|
||||
required int dayNotOpenDoorState,
|
||||
required int dayNotOpenDoorValue,
|
||||
required List dayNotOpenDoorNoticeWayList}) async {
|
||||
final res = await apiProvider.updateNdaysNotCloseDoorNoticeSetting(lockId,
|
||||
dayNotOpenDoorState, dayNotOpenDoorValue, dayNotOpenDoorNoticeWayList);
|
||||
return MsgNotificationEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
// 设置门未关好
|
||||
Future<MsgNotificationEntity> updateDoorNotCloseSetting({
|
||||
required int lockId,
|
||||
required int doorNotCloseState,
|
||||
}) async {
|
||||
final res =
|
||||
await apiProvider.updateDoorNotCloseSetting(lockId, doorNotCloseState);
|
||||
return MsgNotificationEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
// 设置微信公众号推送
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user