From 811b3ea356ed30d6910e67bb43f4f7fc8206833b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CDaisyWu=E2=80=9D?= <“18682150237@163.com”> Date: Thu, 25 Jul 2024 18:33:27 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=81=B6=E7=8E=B0?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E6=94=B6=E5=88=B0=E6=8E=A8=E9=80=81=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../register/starLock_register_logic.dart | 28 +++++++++---------- .../lockMain/xhj/lockMain_xhj_logic.dart | 22 +++++++++++++-- .../minePersonInfo_entity.dart | 6 +++- 3 files changed, 38 insertions(+), 18 deletions(-) diff --git a/lib/login/register/starLock_register_logic.dart b/lib/login/register/starLock_register_logic.dart index 4ecce101..5119acc4 100755 --- a/lib/login/register/starLock_register_logic.dart +++ b/lib/login/register/starLock_register_logic.dart @@ -1,4 +1,3 @@ - import 'dart:async'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; @@ -41,7 +40,6 @@ class StarLockRegisterLogic extends BaseGetXController { } Future register() async { - AppLog.log( 'state.pwd.value:${state.pwd.value} state.surePwd.value:${state.surePwd.value}'); if (state.pwd.value != state.surePwd.value) { @@ -67,25 +65,27 @@ class StarLockRegisterLogic extends BaseGetXController { } Future sendValidationCode() async { - final SendValidationCodeEntity entity = await ApiRepository.to.sendValidationCodeUnLogin( - // state.countryCode.value, - countryCode: state.countryCode.value.toString(), - account: state.phoneOrEmailStr.value, - channel: state.isIphoneType.value ? '1' : '2', - codeType: '1', - xWidth: state.xWidth.value.toString()); + final SendValidationCodeEntity entity = + await ApiRepository.to.sendValidationCodeUnLogin( + // state.countryCode.value, + countryCode: state.countryCode.value.toString(), + account: state.phoneOrEmailStr.value, + channel: state.isIphoneType.value ? '1' : '2', + codeType: '1', + xWidth: state.xWidth.value.toString()); if (entity.errorCode!.codeIsSuccessful) { _startTimer(); } else {} } Future checkIpAction() async { - final CheckIPEntity entity = await ApiRepository.to.checkIpAction( - ip: '' - ); + final CheckIPEntity entity = await ApiRepository.to.checkIpAction(ip: ''); if (entity.errorCode!.codeIsSuccessful) { - if(state.countryName.value == entity.data!.name){ - ShowTipView().showSureAlertDialog('国家地区的选择将影响数据安全,你当前选择的是阿尔巴尼亚,请确认后再继续'.tr, tipTitle: '确认国家或地区'.tr, sureStr: '我知道了'.tr); + if (state.countryName.value == entity.data!.name) { + ShowTipView().showSureAlertDialog( + '国家地区的选择将影响数据安全,你当前选择的是阿尔巴尼亚,请确认后再继续'.tr, + tipTitle: '确认国家或地区'.tr, + sureStr: '我知道了'.tr); } } } diff --git a/lib/main/lockMian/lockMain/xhj/lockMain_xhj_logic.dart b/lib/main/lockMian/lockMain/xhj/lockMain_xhj_logic.dart index 07326628..3b5c78fb 100755 --- a/lib/main/lockMian/lockMain/xhj/lockMain_xhj_logic.dart +++ b/lib/main/lockMian/lockMain/xhj/lockMain_xhj_logic.dart @@ -8,6 +8,7 @@ import 'package:star_lock/main/lockMian/lockMain/xhj/lockMain_xhj_state.dart'; import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_entity.dart'; import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/tools/baseGetXController.dart'; +import 'package:star_lock/tools/push/xs_jPhush.dart'; import 'package:star_lock/tools/storage.dart'; class LockMainXHJLogic extends BaseGetXController { @@ -18,13 +19,18 @@ class LockMainXHJLogic extends BaseGetXController { update(); } - bool get isMall => state.index ==1; + bool get isMall => state.index == 1; //用户信息 Future getUserInfoRequest() async { final MinePersonInfoEntity entity = await ApiRepository.to.getUserInfo(); if (entity.errorCode!.codeIsSuccessful) { - Storage.setBool(saveIsVip, entity.data!.isVip==1); + Storage.setBool(saveIsVip, entity.data!.isVip == 1); + if (entity.data!.deviceId != null) { + if (entity.data!.deviceId!.isEmpty) { + bindDevice(); + } + } } } @@ -51,9 +57,19 @@ class LockMainXHJLogic extends BaseGetXController { }); } + Future bindDevice() async { + // 初始化JPush服务并绑定设备ID + final XSJPushProvider jpushProvider = XSJPushProvider(); + await jpushProvider.initJPushService(); + await jpushProvider.bindDeviceID(); + await jpushProvider.initLocalNotification(isCancelLocalPush: false); + } + @override - void onReady() { + Future onReady() async { super.onReady(); + + bindDevice(); } @override diff --git a/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_entity.dart b/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_entity.dart index f531a7be..58d253d6 100755 --- a/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_entity.dart +++ b/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_entity.dart @@ -38,6 +38,7 @@ class MinePersonInfoData { String? email; String? countryName; int? isVip; + String? deviceId; MinePersonInfoData( {this.mobile, @@ -49,7 +50,8 @@ class MinePersonInfoData { this.countryId, this.email, this.countryName, - this.isVip}); + this.isVip, + this.deviceId}); MinePersonInfoData.fromJson(Map json) { mobile = json['mobile']; @@ -62,6 +64,7 @@ class MinePersonInfoData { email = json['email']; countryName = json['countryName']; isVip = json['isVip']; + deviceId = json['deviceId']; } Map toJson() { @@ -76,6 +79,7 @@ class MinePersonInfoData { data['email'] = email; data['countryName'] = countryName; data['isVip'] = isVip; + data['deviceId'] = deviceId; return data; } } From eb80ce287dc40eafd3861f4b045697368e772311 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AD=8F=E5=B0=91=E9=98=B3?= <786612630@qq.com> Date: Fri, 26 Jul 2024 10:00:58 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=B7=BB=E5=8A=A0=E5=AF=86=E7=A0=81=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lockDetail/doorLockLog/doorLockLog_logic.dart | 10 +++++----- .../lockDetail/lockDetail/lockDetail_logic.dart | 10 +++++----- .../lockOperatingRecord_logic.dart | 15 +++++---------- 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/lib/main/lockDetail/doorLockLog/doorLockLog_logic.dart b/lib/main/lockDetail/doorLockLog/doorLockLog_logic.dart index b0f3fda1..bc1a85e8 100755 --- a/lib/main/lockDetail/doorLockLog/doorLockLog_logic.dart +++ b/lib/main/lockDetail/doorLockLog/doorLockLog_logic.dart @@ -60,7 +60,7 @@ class DoorLockLogLogic extends BaseGetXController { final Map indexMap = {}; indexMap['type'] = indexList[0].toString(); const int operateDate = 0; - if (indexList[0] == 2) { + // if (indexList[0] == 2) { final int userNo = (indexList[1] * 256) + indexList[2]; indexMap['user'] = userNo.toString(); AppLog.log('userNouserNouserNouserNo:$userNo'); @@ -68,10 +68,10 @@ class DoorLockLogLogic extends BaseGetXController { final String password = utf8String(passwordData); indexMap['password'] = password.toString(); AppLog.log('passwordpasswordpassword:$password'); - } else { - final int userNo = (indexList[1] * 256) + indexList[2]; - indexMap['user'] = userNo.toString(); - } + // } else { + // final int userNo = (indexList[1] * 256) + indexList[2]; + // indexMap['user'] = userNo.toString(); + // } indexMap['success'] = '1'; diff --git a/lib/main/lockDetail/lockDetail/lockDetail_logic.dart b/lib/main/lockDetail/lockDetail/lockDetail_logic.dart index ed4dd52e..26cd29c1 100755 --- a/lib/main/lockDetail/lockDetail/lockDetail_logic.dart +++ b/lib/main/lockDetail/lockDetail/lockDetail_logic.dart @@ -277,15 +277,15 @@ class LockDetailLogic extends BaseGetXController { final Map indexMap = {}; indexMap['type'] = indexList[0].toString(); int operateDate = 0; - if (indexList[0] == 2) { + // if (indexList[0] == 2) { final List passwordData = indexList.sublist(7, 17); final String password = utf8String(passwordData); AppLog.log('passwordData:$passwordData password:$password'); indexMap['user'] = password.toString(); - } else { - final int userNo = (indexList[1] * 256) + indexList[2]; - indexMap['user'] = userNo.toString(); - } + // } else { + // final int userNo = (indexList[1] * 256) + indexList[2]; + // indexMap['user'] = userNo.toString(); + // } indexMap['success'] = '1'; diff --git a/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_logic.dart b/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_logic.dart index 0f16a437..adb7be65 100755 --- a/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_logic.dart +++ b/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_logic.dart @@ -55,12 +55,7 @@ class LockOperatingRecordLogic extends BaseGetXController { final Map indexMap = {}; indexMap['type'] = indexList[0].toString(); - if(indexList[0] == 2){ - // final List passwordData = indexList.sublist(7, 17); - // final String password = utf8String(passwordData); - // AppLog.log('password:$password passwordData:$passwordData'); - // indexMap['user'] = password; - + // if(indexList[0] == 2){ final int userNo = (indexList[1] * 256) + indexList[2]; indexMap['user'] = userNo.toString(); AppLog.log('userNouserNouserNouserNo:$userNo'); @@ -68,10 +63,10 @@ class LockOperatingRecordLogic extends BaseGetXController { final String password = utf8String(passwordData); indexMap['password'] = password.toString(); AppLog.log('passwordpasswordpassword:$password'); - }else{ - final int userNo = (indexList[1]*256) + indexList[2]; - indexMap['user'] = userNo.toString(); - } + // }else{ + // final int userNo = (indexList[1]*256) + indexList[2]; + // indexMap['user'] = userNo.toString(); + // } indexMap['success'] = '1';