mirror of
https://github.com/alibaba/flutter-go.git
synced 2025-06-02 07:47:08 +08:00
添加 github Oauth ,个人中心
This commit is contained in:
@ -8,29 +8,38 @@ class DataUtils {
|
||||
// 登陆获取用户信息
|
||||
static Future doLogin(Map<String, String> params) async {
|
||||
var response = await NetUtils.post(Api.DO_LOGIN, params);
|
||||
print(response);
|
||||
try {
|
||||
UserInfo userInfo = UserInfo.fromJson(response['data']);
|
||||
UserInformation userInfo = UserInformation.fromJson(response['data']);
|
||||
return userInfo;
|
||||
} catch (err) {
|
||||
return response['data'];
|
||||
return response['message'];
|
||||
}
|
||||
}
|
||||
|
||||
// 获取用户信息
|
||||
static Future<UserInfo> getUserInfo(Map<String, String> params) async {
|
||||
static Future<UserInformation> getUserInfo(Map<String, String> params) async {
|
||||
var response = await NetUtils.get(Api.GET_USER_INFO, params);
|
||||
print(response);
|
||||
UserInfo userInfo = UserInfo.fromJson(response['data']);
|
||||
return userInfo;
|
||||
try {
|
||||
UserInformation userInfo = UserInformation.fromJson(response['data']);
|
||||
return userInfo;
|
||||
} catch (err) {
|
||||
return response['message'];
|
||||
}
|
||||
}
|
||||
|
||||
// 验证登陆
|
||||
|
||||
static Future<bool> checkLogin() async {
|
||||
static Future checkLogin() async {
|
||||
var response = await NetUtils.get(Api.CHECK_LOGIN);
|
||||
print('验证登陆:$response');
|
||||
return response['success'];
|
||||
try {
|
||||
if (response['success']) {
|
||||
UserInformation userInfo = UserInformation.fromJson(response['data']);
|
||||
return userInfo;
|
||||
} else {
|
||||
return response['success'];
|
||||
}
|
||||
} catch (err) {
|
||||
return response['message'];
|
||||
}
|
||||
}
|
||||
|
||||
// 退出登陆
|
||||
|
Reference in New Issue
Block a user