|
|
@ -26,6 +26,7 @@ class VersionUpdateService extends GetxService { |
|
|
static String? _updateUrl = ""; //更新链接 |
|
|
static String? _updateUrl = ""; //更新链接 |
|
|
static AppInfo? _appInfo; //应用信息 |
|
|
static AppInfo? _appInfo; //应用信息 |
|
|
static bool? _isShowTourists = false; //是否显示游客登录 |
|
|
static bool? _isShowTourists = false; //是否显示游客登录 |
|
|
|
|
|
static bool? _allowSkipDeviceBinding = false; //是否允许跳过设备绑定 |
|
|
static DateTime? _lastCheckTime; //上次检查时间 |
|
|
static DateTime? _lastCheckTime; //上次检查时间 |
|
|
static const int _cacheIntervalMinutes = 10; // 可配置化 |
|
|
static const int _cacheIntervalMinutes = 10; // 可配置化 |
|
|
static final String? _countryCode = Get.deviceLocale?.countryCode; //国家地区编码 |
|
|
static final String? _countryCode = Get.deviceLocale?.countryCode; //国家地区编码 |
|
|
@ -73,6 +74,9 @@ class VersionUpdateService extends GetxService { |
|
|
/// 获取缓存的游客登录状态 |
|
|
/// 获取缓存的游客登录状态 |
|
|
bool get cachedShowTourists => _isShowTourists ?? false; |
|
|
bool get cachedShowTourists => _isShowTourists ?? false; |
|
|
|
|
|
|
|
|
|
|
|
/// 获取缓存的是否允许跳过设备绑定 |
|
|
|
|
|
bool get cachedAllowSkipDeviceBinding => _allowSkipDeviceBinding ?? false; |
|
|
|
|
|
|
|
|
/// 获取上次检查时间 |
|
|
/// 获取上次检查时间 |
|
|
DateTime? get lastCheckTime => _lastCheckTime; |
|
|
DateTime? get lastCheckTime => _lastCheckTime; |
|
|
|
|
|
|
|
|
@ -123,6 +127,7 @@ class VersionUpdateService extends GetxService { |
|
|
// 调用后端接口获取最新版本信息 |
|
|
// 调用后端接口获取最新版本信息 |
|
|
final response = |
|
|
final response = |
|
|
await Api.getChannelApp({'channel': platformInfo.channel.value}); |
|
|
await Api.getChannelApp({'channel': platformInfo.channel.value}); |
|
|
|
|
|
// final response = await Api.getChannelApps(); |
|
|
|
|
|
|
|
|
_logger.d('lxm--获取渠道包信息:$response'); |
|
|
_logger.d('lxm--获取渠道包信息:$response'); |
|
|
|
|
|
|
|
|
@ -147,6 +152,8 @@ class VersionUpdateService extends GetxService { |
|
|
|
|
|
|
|
|
// 设置游客登录显示状态(先用当前渠道结果作为回退,再用.env渠道覆盖以保持一致) |
|
|
// 设置游客登录显示状态(先用当前渠道结果作为回退,再用.env渠道覆盖以保持一致) |
|
|
_isShowTourists = appInfo.tourists; |
|
|
_isShowTourists = appInfo.tourists; |
|
|
|
|
|
_allowSkipDeviceBinding = appInfo.allowskipdevicebinding; |
|
|
|
|
|
|
|
|
//print('lxm--_isShowTourists: $_isShowTourists'); |
|
|
//print('lxm--_isShowTourists: $_isShowTourists'); |
|
|
if (Platform.isAndroid && _channel != platformInfo.channel) { |
|
|
if (Platform.isAndroid && _channel != platformInfo.channel) { |
|
|
//[4]当前渠道与.env渠道不同,需要从.env渠道获取游客登录配置 |
|
|
//[4]当前渠道与.env渠道不同,需要从.env渠道获取游客登录配置 |
|
|
@ -300,11 +307,14 @@ class VersionUpdateService extends GetxService { |
|
|
final envChannel = UserChannel.fromName(envChannelName); |
|
|
final envChannel = UserChannel.fromName(envChannelName); |
|
|
|
|
|
|
|
|
final resp = await Api.getChannelApp({'channel': envChannel.value}); |
|
|
final resp = await Api.getChannelApp({'channel': envChannel.value}); |
|
|
|
|
|
// _logger.d('lxm--获取渠道包信息:$resp'); |
|
|
if (resp != null && resp.containsKey('app')) { |
|
|
if (resp != null && resp.containsKey('app')) { |
|
|
final envAppInfo = AppInfo.fromJson(resp['app']); |
|
|
final envAppInfo = AppInfo.fromJson(resp['app']); |
|
|
|
|
|
// print('lxm--envAppInfo: ${envAppInfo.toJson()}'); |
|
|
_isShowTourists = envAppInfo.tourists; |
|
|
_isShowTourists = envAppInfo.tourists; |
|
|
|
|
|
_allowSkipDeviceBinding = envAppInfo.allowskipdevicebinding; |
|
|
_logger.d( |
|
|
_logger.d( |
|
|
'lxm--游客登录配置已按.env渠道同步: ${envAppInfo.tourists} (channel=$envChannelName),_isShowTourists: $_isShowTourists'); |
|
|
'lxm--游客登录配置已按.env${envChannel.value}渠道同步: ${envAppInfo.tourists} (channel=$envChannelName),_isShowTourists: $_isShowTourists,_allowSkipDeviceBinding: $_allowSkipDeviceBinding'); |
|
|
} else { |
|
|
} else { |
|
|
_logger.w('按.env渠道获取游客配置失败:响应为空或不含app字段'); |
|
|
_logger.w('按.env渠道获取游客配置失败:响应为空或不含app字段'); |
|
|
} |
|
|
} |
|
|
|