所有设备ID获取方式统一为使用 KRDeviceInfoService().deviceId(基于 device_info_plus
库)。这确保了全局使用一致的设备标识
This commit is contained in:
parent
040d7d746a
commit
b11d5a6001
@ -8,7 +8,7 @@ import 'package:kaer_with_panels/app/model/enum/kr_request_type.dart';
|
||||
import 'package:kaer_with_panels/app/modules/kr_main/controllers/kr_main_controller.dart';
|
||||
import 'package:kaer_with_panels/app/services/kr_socket_service.dart';
|
||||
import 'package:kaer_with_panels/app/utils/kr_secure_storage.dart';
|
||||
import 'package:kaer_with_panels/app/utils/kr_device_util.dart';
|
||||
import 'package:kaer_with_panels/app/services/kr_device_info_service.dart';
|
||||
|
||||
import 'package:kaer_with_panels/app/utils/kr_log_util.dart';
|
||||
|
||||
@ -244,8 +244,8 @@ class KRAppRunData {
|
||||
Future<void> _kr_connectSocket(String userId) async {
|
||||
// 如果已存在连接,先断开
|
||||
await _kr_disconnectSocket();
|
||||
|
||||
final deviceId = await KRDeviceUtil().kr_getDeviceId();
|
||||
|
||||
final deviceId = KRDeviceInfoService().deviceId ?? 'unknown';
|
||||
KRLogUtil.kr_i('设备ID: $deviceId', tag: 'AppRunData');
|
||||
KrSocketService.instance.kr_init(
|
||||
baseUrl: AppConfig.getInstance().wsBaseUrl,
|
||||
|
||||
@ -6,7 +6,7 @@ import 'package:kaer_with_panels/app/localization/kr_language_utils.dart';
|
||||
import 'dart:io' show Platform;
|
||||
import 'dart:async';
|
||||
|
||||
import '../../../utils/kr_device_util.dart';
|
||||
import '../../../services/kr_device_info_service.dart';
|
||||
|
||||
/// Crisp 聊天控制器
|
||||
class KRCrispController extends GetxController {
|
||||
@ -68,7 +68,7 @@ class KRCrispController extends GetxController {
|
||||
final userEmail = appData.kr_account.value ?? '';
|
||||
|
||||
// 获取设备 ID
|
||||
final deviceId = await KRDeviceUtil().kr_getDeviceId();
|
||||
final deviceId = KRDeviceInfoService().deviceId ?? 'unknown';
|
||||
final identifier = userEmail.isNotEmpty ? userEmail : deviceId;
|
||||
|
||||
// 根据当前语言设置对应的 Crisp locale
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:kaer_with_panels/app/utils/kr_log_util.dart';
|
||||
import 'package:kaer_with_panels/app/utils/kr_device_util.dart';
|
||||
import 'package:kaer_with_panels/app/services/api_service/kr_api.user.dart';
|
||||
import 'package:kaer_with_panels/app/widgets/dialogs/kr_dialog.dart';
|
||||
import 'package:kaer_with_panels/app/common/app_run_data.dart';
|
||||
@ -34,7 +33,7 @@ class KRDeviceManagementController extends GetxController {
|
||||
/// 初始化当前设备ID
|
||||
Future<void> _initDeviceId() async {
|
||||
try {
|
||||
currentDeviceId = await KRDeviceUtil().kr_getDeviceId();
|
||||
currentDeviceId = KRDeviceInfoService().deviceId ?? 'unknown';
|
||||
KRLogUtil.kr_i('当前设备ID: $currentDeviceId', tag: 'DeviceManagement');
|
||||
} catch (e) {
|
||||
KRLogUtil.kr_e('获取设备ID失败: $e', tag: 'DeviceManagement');
|
||||
|
||||
@ -12,7 +12,6 @@ import 'package:kaer_with_panels/app/model/response/kr_login_data.dart';
|
||||
import 'package:kaer_with_panels/app/network/base_response.dart';
|
||||
import 'package:kaer_with_panels/app/network/http_error.dart';
|
||||
import 'package:kaer_with_panels/app/network/http_util.dart';
|
||||
import 'package:kaer_with_panels/app/utils/kr_device_util.dart';
|
||||
|
||||
import '../../utils/kr_common_util.dart';
|
||||
import '../../utils/kr_log_util.dart';
|
||||
@ -28,7 +27,7 @@ class KRAuthApi {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['email'] = email;
|
||||
|
||||
final deviceId = await KRDeviceUtil().kr_getDeviceId();
|
||||
final deviceId = KRDeviceInfoService().deviceId ?? 'unknown';
|
||||
KRLogUtil.kr_i('设备ID: $deviceId', tag: 'KRAuthApi');
|
||||
data["identifier"] = deviceId;
|
||||
|
||||
@ -53,7 +52,7 @@ class KRAuthApi {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['email'] = email;
|
||||
data['password'] = password;
|
||||
data["identifier"] = await KRDeviceUtil().kr_getDeviceId();
|
||||
data["identifier"] = KRDeviceInfoService().deviceId ?? 'unknown';
|
||||
|
||||
// 验证码是可选的,只有在提供时才发送
|
||||
if (code != null && code.isNotEmpty) {
|
||||
@ -105,7 +104,7 @@ class KRAuthApi {
|
||||
data['email'] = email;
|
||||
data['password'] = password;
|
||||
|
||||
final deviceId = await KRDeviceUtil().kr_getDeviceId();
|
||||
final deviceId = KRDeviceInfoService().deviceId ?? 'unknown';
|
||||
KRLogUtil.kr_i('设备ID: $deviceId', tag: 'KRAuthApi');
|
||||
data["identifier"] = deviceId;
|
||||
|
||||
@ -161,7 +160,7 @@ class KRAuthApi {
|
||||
data['email'] = email;
|
||||
data['password'] = password;
|
||||
data["code"] = code;
|
||||
data["identifier"] = await KRDeviceUtil().kr_getDeviceId();
|
||||
data["identifier"] = KRDeviceInfoService().deviceId ?? 'unknown';
|
||||
|
||||
BaseResponse<KRLoginData> baseResponse = await HttpUtil.getInstance()
|
||||
.request<KRLoginData>(Api.kr_setNewPsdByForgetPsd, data,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user