37 lines
1.0 KiB
Objective-C
37 lines
1.0 KiB
Objective-C
//
|
|
// LoginPasswordPresent.m
|
|
// xplan-ios
|
|
//
|
|
// Created by 冯硕 on 2021/9/9.
|
|
//
|
|
|
|
#import "LoginPasswordPresent.h"
|
|
///Http
|
|
#import "Api+Login.h"
|
|
///Tool
|
|
#import "AccountInfoStorage.h"
|
|
#import "DESEncrypt.h"
|
|
///Model
|
|
#import "AccountModel.h"
|
|
|
|
|
|
@implementation LoginPasswordPresent
|
|
|
|
/// 使用手机号和密码登录
|
|
/// @param phone 手机号
|
|
/// @param password 验证码
|
|
- (void)loginWithPhone:(NSString *)phone password:(NSString *)password {
|
|
NSString * desPassword = [DESEncrypt encryptUseDES:password key:@"1ea53d260ecf11e7b56e00163e046a26"];
|
|
[Api loginWithPassword:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
|
AccountModel * accountModel = [AccountModel modelWithDictionary:data.data];
|
|
if (accountModel && accountModel.access_token.length > 0) {
|
|
[[AccountInfoStorage instance] saveAccountInfo:accountModel];
|
|
}
|
|
// [[self getView] loginSuccess];
|
|
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
|
|
|
}] phone:phone password:desPassword client_secret:@"uyzjdhds" version:@"1" client_id:@"erban-client" grant_type:@"password"];
|
|
}
|
|
|
|
@end
|