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] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=81=B6=E7=8E=B0=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E6=94=B6=E5=88=B0=E6=8E=A8=E9=80=81=E9=97=AE=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; } }