Files
yinmeng-ios/xplan-ios/Main/Tabbar/MainPresenter.m

36 lines
990 B
Mathematica
Raw Normal View History

2021-09-07 23:05:43 +08:00
//
// MainPresenter.m
// xplan-ios
//
// Created by apple on 2021/9/8.
//
#import "MainPresenter.h"
#import "AccountInfoStorage.h"
#import "AccountModel.h"
#import "Api+Main.h"
#import "MainProtocol.h"
@implementation MainPresenter
- (void)autoLogin {
AccountModel *accountModel = [[AccountInfoStorage instance] getCurrentAccountInfo];
if (accountModel == nil) {
[[self getView] tokenInvalid];
return;
}
if ([[AccountInfoStorage instance] getTicket].length > 0) {
2021-09-07 23:05:43 +08:00
return;
}
[Api requestTicket:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
NSArray *tickets = [data.data valueForKey:@"tickets"];
NSString *ticket = [tickets[0] valueForKey:@"ticket"];
[[AccountInfoStorage instance] saveTicket:ticket];
[[self getView] autoLoginSuccess];
} fail:^(NSInteger code, NSString * _Nullable msg) {
2021-09-07 23:05:43 +08:00
} showLoading:NO] access_token:accountModel.access_token issue_type:@"multi"];
2021-09-07 23:05:43 +08:00
}
@end