This commit is contained in:
wyf
2025-08-04 18:19:53 +08:00
parent 4c4f324c56
commit 00215e99d2
13 changed files with 879 additions and 134 deletions

View File

@@ -271,14 +271,30 @@ class MHTLoginController extends GetControllerEx<LoginModel> {
queryUrl: queryUrl,
data: data);
if (apiResponse.code == HttpStatusCodes.ok) {
// UserInfoController userInfoController = Get.find();
// if (userInfoController.model.user!.phone == null ||
// userInfoController.model.user!.phone!.isEmpty) {
// Get.toNamed("/auth_bind_tel");
// return;
// }
UserInfoController userInfoController = Get.find();
userInfoController.model.login = 1;
userInfoController.model.user = UserModel.fromJson(apiResponse.data);
userInfoController.model.login = 1;
String token = apiResponse.rawResponse.headers['token']!.first;
EasyDartModule.dio.token = token;
final box = GetStorage();
box.write('token', token); // 存储 token
box.write('user', userInfoController.model.user!.toJson()); // 存储用户信息
if (userInfoController.model.user!.phone == null ||
userInfoController.model.user!.phone!.isEmpty) {
await Get.toNamed("/auth_bind_tel");
}
if (userInfoController.model.user!.phone == null ||
userInfoController.model.user!.phone!.isEmpty) {
userInfoController.model.login = 0;
}
} else {
EasyDartModule.logger.error("[微信登录]:失败-》${apiResponse}");
}
return apiResponse.code!;
}