// // LoginPasswordPresent.m // YUMI // // Created by YUMI on 2021/9/9. // #import "LoginPasswordPresent.h" ///Http #import "Api+Login.h" ///Tool #import "AccountInfoStorage.h" #import "DESEncrypt.h" #import "YUMIConstant.h" ///Model #import "AccountModel.h" ///Protocol #import "LoginPasswordProtocol.h" @implementation LoginPasswordPresent - (id)getView { return ((id) [super getView]); } /// 使用手机号和密码登录 /// @param phone 手机号 /// @param password 验证码 - (void)loginWithPhone:(NSString *)phone password:(NSString *)password { NSString * desPassword = [DESEncrypt encryptUseDES:password key:KeyWithType(KeyType_PasswordEncode)]; NSString * desPhone = [DESEncrypt encryptUseDES:phone key:KeyWithType(KeyType_PasswordEncode)]; [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] phoneAndPasswordLoginSuccess]; } showLoading:YES errorToast:YES] phone:desPhone password:desPassword client_secret:@"uyzjdhds" version:@"1" client_id:@"erban-client" grant_type:@"password"]; } @end