Commit 3e72c6ce4ccd7c296b1d8daa773548dd9521ee85

Authored by 吴启风
1 parent 98670c0d

feat:登录刷新配置信息

lib/common/core/app_config_helper.dart
... ... @@ -22,8 +22,8 @@ class AppConfigHelper {
22 22 static bool checkedUpdate = false;
23 23  
24 24 // 获取用户信息
25   - static Future<AppConfigEntity?> getAppConfig() async {
26   - if (configEntityEntity != null) {
  25 + static Future<AppConfigEntity?> getAppConfig({ bool forceSync = false }) async {
  26 + if (forceSync == false && configEntityEntity != null) {
27 27 return configEntityEntity;
28 28 }
29 29 configEntityEntity = await SystemDao.getAppConfig();
... ...
lib/common/request/dao/user_dao.dart
... ... @@ -2,6 +2,7 @@ import &#39;package:wow_english/common/core/user_util.dart&#39;;
2 2 import 'package:wow_english/models/user_entity.dart';
3 3 import 'package:wow_english/utils/log_util.dart';
4 4  
  5 +import '../../core/app_config_helper.dart';
5 6 import '../request_client.dart';
6 7  
7 8 enum SmsType { login, change_passWord, stdDestroy }
... ... @@ -18,6 +19,8 @@ class UserDao {
18 19 UserUtil.saveUser(data);
19 20 // 由于userInfo接口不会返回token,所以这里需要再次保存一下token
20 21 final token = data.token;
  22 + //登录成功后刷新下配置信息
  23 + AppConfigHelper.getAppConfig(forceSync: true);
21 24 //登录成功后zip一下getUserInfo,因为进入首页需要的信息在userinfo里,保证进入首页数据是最新的
22 25 data = await getUserInfo();
23 26 data?.token = token;
... ...