|
|
@@ -44,13 +44,11 @@ class BaseSettingModel { |
|
|
|
static Future<BaseSettingModel> init({bool isGetCache}) async { |
|
|
|
try { |
|
|
|
///判断是否获取缓存 |
|
|
|
if (isGetCache != null && isGetCache) { |
|
|
|
String configData = await SharedPreferencesUtil.getStringValue(GlobalConfig.MAIN_CONFIG, defaultVal: '1'); |
|
|
|
if (configData != "1") { |
|
|
|
createBaseSet(json.decode(configData)); |
|
|
|
Logger.debug('基础设置初始化'); |
|
|
|
} |
|
|
|
String configData = await SharedPreferencesUtil.getStringValue(GlobalConfig.MAIN_CONFIG, defaultVal: '1'); |
|
|
|
if (isGetCache != null && isGetCache && configData != "1") { |
|
|
|
|
|
|
|
createBaseSet(json.decode(configData)); |
|
|
|
Logger.debug('基础设置初始化'); |
|
|
|
NetUtil.request('/api/v1/new/config.json',onSuccess: (data){ |
|
|
|
print(data); |
|
|
|
var cacheString=json.encode(data); |
|
|
@@ -62,6 +60,8 @@ class BaseSettingModel { |
|
|
|
Map result = |
|
|
|
await NetUtil.post('/api/v1/new/config.json', method: NetMethod.GET); |
|
|
|
var data = result['data']; |
|
|
|
var cacheString=json.encode(data); |
|
|
|
SharedPreferencesUtil.setNetCacheResult(GlobalConfig.MAIN_CONFIG, cacheString); |
|
|
|
createBaseSet(data); |
|
|
|
return _setting; |
|
|
|
} |
|
|
|