Pārlūkot izejas kodu

1、token 请求的key修改

2、账号冻结,禁用的处理
tags/0.0.3+2
PH2 pirms 3 gadiem
vecāks
revīzija
b73efa519b
1 mainītis faili ar 26 papildinājumiem un 1 dzēšanām
  1. +26
    -1
      lib/util/net_util.dart

+ 26
- 1
lib/util/net_util.dart Parādīt failu

@@ -160,6 +160,30 @@ class NetUtil {
}
}

///
/// 403028 账号被冻结
/// 403029 账号被禁用
/// 提示并且退出登录
///
if(result[GlobalConfig.HTTP_RESPONSE_KEY_CODE]?.toString() == '403028' || result[GlobalConfig.HTTP_RESPONSE_KEY_CODE]?.toString() == '403029') {

try {
// 提示
Fluttertoast.showToast(
msg: result[GlobalConfig.HTTP_RESPONSE_KEY_MSG],
toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.BOTTOM,
);
// 退出登录
Future.delayed(Duration(seconds: 0)).then((onValue) {
BuildContext context = navigatorKey.currentState.overlay.context;
Provider.of<UserInfoNotifier>(context, listen: false).unLogin();
});
} catch (e, s) {
Logger.error(e, s);
}
}

return result;
}
} catch (e) {
@@ -332,7 +356,8 @@ class NetUtil {
// token 读取SP缓存中的用户token
String token = await SharedPreferencesUtil.getStringValue(GlobalConfig.SHARED_KEY_TOKEN);
if (!EmptyUtil.isEmpty(token)) {
params['token'] = token;
// params['token'] = token;
params['Authorization'] = 'Bearer ' + token;
}
// secret_key
params['secret_key'] = setting['secret_key'] ?? '';


Notiek ielāde…
Atcelt
Saglabāt