Commit 22f1076a594a1f427afc9a4474bcbcd9f5d55027
1 parent
5a933918
更新用户SDK,增加手机号国家码 ,修改url不带4server
Showing
8 changed files
with
223 additions
and
22 deletions
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveCheckVerificationCode.h
| @@ -12,12 +12,22 @@ | @@ -12,12 +12,22 @@ | ||
| 12 | @interface CNLiveCheckVerificationCode : NSObject | 12 | @interface CNLiveCheckVerificationCode : NSObject |
| 13 | 13 | ||
| 14 | /** | 14 | /** |
| 15 | - 注册前校验手机验证码 | 15 | + 注册前校验手机验证码(旧) |
| 16 | */ | 16 | */ |
| 17 | - (void)registerCheckVerificationCodeWithAppId:(NSString *)appId appKey:(NSString *)appKey type:(CheckVerificationCodeType)type mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | 17 | - (void)registerCheckVerificationCodeWithAppId:(NSString *)appId appKey:(NSString *)appKey type:(CheckVerificationCodeType)type mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; |
| 18 | 18 | ||
| 19 | /** | 19 | /** |
| 20 | - 快捷登录前校验手机验证码 | 20 | + 注册前校验手机验证码(新) |
| 21 | + */ | ||
| 22 | +- (void)registerCheckVerificationCodeWithAppId:(NSString *)appId appKey:(NSString *)appKey type:(CheckVerificationCodeType)type mobile:(NSString *)mobile countryCode:(NSString *)countryCode verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | ||
| 23 | + | ||
| 24 | +/** | ||
| 25 | + 快捷登录前校验手机验证码(旧) | ||
| 21 | */ | 26 | */ |
| 22 | - (void)shortcutLoginCheckVerificationCodeWithAppId:(NSString *)appId appKey:(NSString *)appKey type:(CheckVerificationCodeType)type mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | 27 | - (void)shortcutLoginCheckVerificationCodeWithAppId:(NSString *)appId appKey:(NSString *)appKey type:(CheckVerificationCodeType)type mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; |
| 28 | + | ||
| 29 | +/** | ||
| 30 | + 快捷登录前校验手机验证码(新) | ||
| 31 | + */ | ||
| 32 | +- (void)shortcutLoginCheckVerificationCodeWithAppId:(NSString *)appId appKey:(NSString *)appKey type:(CheckVerificationCodeType)type mobile:(NSString *)mobile countryCode:(NSString *)countryCode verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | ||
| 23 | @end | 33 | @end |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveCheckVerificationCode.m
| @@ -38,6 +38,24 @@ static NSString *shortcutLoginCheckVerificationCodeFormalURL = @"https://api.cn | @@ -38,6 +38,24 @@ static NSString *shortcutLoginCheckVerificationCodeFormalURL = @"https://api.cn | ||
| 38 | [self requestWithURL:[self getURL:type] parameter:parameter success:success failure:failure]; | 38 | [self requestWithURL:[self getURL:type] parameter:parameter success:success failure:failure]; |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | +- (void)registerCheckVerificationCodeWithAppId:(NSString *)appId appKey:(NSString *)appKey type:(CheckVerificationCodeType)type mobile:(NSString *)mobile countryCode:(NSString *)countryCode verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure | ||
| 42 | +{ | ||
| 43 | + NSDictionary *params = @{@"appId":[CNLiveUserSystemTools verify:appId], | ||
| 44 | + @"mobile":[CNLiveUserSystemTools verify:mobile], | ||
| 45 | + @"countryCode":countryCode, | ||
| 46 | + @"verificationCode":[CNLiveUserSystemTools verify:verificationCode], | ||
| 47 | + @"clientPlat":@"i", | ||
| 48 | + @"platform_id":[NSBundle mainBundle].bundleIdentifier | ||
| 49 | + }; | ||
| 50 | + | ||
| 51 | + NSMutableDictionary *parameter = [NSMutableDictionary dictionaryWithDictionary:params]; | ||
| 52 | + NSString *string = [NSString stringWithFormat:@"%@&key=%@", [CNLiveUserSystemTools signvalue:parameter], [CNLiveUserSystemTools verify:appKey]]; | ||
| 53 | + NSString *signString = [[CNLiveUserSystemTools sha1:string] uppercaseString]; | ||
| 54 | + | ||
| 55 | + [parameter setObject:signString forKey:@"sign"]; | ||
| 56 | + [self requestWithURL:[self getURL:type] parameter:parameter success:success failure:failure]; | ||
| 57 | +} | ||
| 58 | + | ||
| 41 | - (void)shortcutLoginCheckVerificationCodeWithAppId:(NSString *)appId appKey:(NSString *)appKey type:(CheckVerificationCodeType)type mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure | 59 | - (void)shortcutLoginCheckVerificationCodeWithAppId:(NSString *)appId appKey:(NSString *)appKey type:(CheckVerificationCodeType)type mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure |
| 42 | { | 60 | { |
| 43 | NSDictionary *params = @{@"appId":[CNLiveUserSystemTools verify:appId], | 61 | NSDictionary *params = @{@"appId":[CNLiveUserSystemTools verify:appId], |
| @@ -55,6 +73,25 @@ static NSString *shortcutLoginCheckVerificationCodeFormalURL = @"https://api.cn | @@ -55,6 +73,25 @@ static NSString *shortcutLoginCheckVerificationCodeFormalURL = @"https://api.cn | ||
| 55 | [self requestWithURL:[self getURL:type] parameter:parameter success:success failure:failure]; | 73 | [self requestWithURL:[self getURL:type] parameter:parameter success:success failure:failure]; |
| 56 | } | 74 | } |
| 57 | 75 | ||
| 76 | +- (void)shortcutLoginCheckVerificationCodeWithAppId:(NSString *)appId appKey:(NSString *)appKey type:(CheckVerificationCodeType)type mobile:(NSString *)mobile countryCode:(NSString *)countryCode verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure | ||
| 77 | +{ | ||
| 78 | + NSDictionary *params = @{@"appId":[CNLiveUserSystemTools verify:appId], | ||
| 79 | + @"mobile":[CNLiveUserSystemTools verify:mobile], | ||
| 80 | + @"countryCode":countryCode, | ||
| 81 | + @"verificationCode":[CNLiveUserSystemTools verify:verificationCode], | ||
| 82 | + @"clientPlat":@"i", | ||
| 83 | + @"platform_id":[NSBundle mainBundle].bundleIdentifier | ||
| 84 | + }; | ||
| 85 | + | ||
| 86 | + NSMutableDictionary *parameter = [NSMutableDictionary dictionaryWithDictionary:params]; | ||
| 87 | + NSString *string = [NSString stringWithFormat:@"%@&key=%@", [CNLiveUserSystemTools signvalue:parameter], [CNLiveUserSystemTools verify:appKey]]; | ||
| 88 | + NSString *signString = [[CNLiveUserSystemTools sha1:string] uppercaseString]; | ||
| 89 | + | ||
| 90 | + [parameter setObject:signString forKey:@"sign"]; | ||
| 91 | + [self requestWithURL:[self getURL:type] parameter:parameter success:success failure:failure]; | ||
| 92 | + | ||
| 93 | +} | ||
| 94 | + | ||
| 58 | #pragma mark - request | 95 | #pragma mark - request |
| 59 | - (void)requestWithURL:(NSString *)URL parameter:(NSDictionary *)param success:(void(^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure | 96 | - (void)requestWithURL:(NSString *)URL parameter:(NSDictionary *)param success:(void(^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure |
| 60 | { | 97 | { |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveLogin.h
| @@ -16,11 +16,15 @@ | @@ -16,11 +16,15 @@ | ||
| 16 | - (void)thirdPartyLoginWithAppId:(NSString *)appId appKey:(NSString *)appKey thirdPartyPlatType:(NSString *)plat thirdPartyId:(NSString *)thirdPartyId nickName:(NSString *)nickName gender:(NSString *)gender location:(NSString *)location faceUrl:(NSString *)faceUrl frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | 16 | - (void)thirdPartyLoginWithAppId:(NSString *)appId appKey:(NSString *)appKey thirdPartyPlatType:(NSString *)plat thirdPartyId:(NSString *)thirdPartyId nickName:(NSString *)nickName gender:(NSString *)gender location:(NSString *)location faceUrl:(NSString *)faceUrl frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; |
| 17 | 17 | ||
| 18 | /** | 18 | /** |
| 19 | - * 快捷登录 | 19 | + * 快捷登录(旧) |
| 20 | */ | 20 | */ |
| 21 | - (void)shortcutLoginWithAppId:(NSString *)appId appKey:(NSString *)appKey userName:(NSString *)userName verificationCode:(NSString *)verificationCode frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | 21 | - (void)shortcutLoginWithAppId:(NSString *)appId appKey:(NSString *)appKey userName:(NSString *)userName verificationCode:(NSString *)verificationCode frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; |
| 22 | 22 | ||
| 23 | /** | 23 | /** |
| 24 | + * 快捷登录(新) | ||
| 25 | + */ | ||
| 26 | +- (void)shortcutLoginWithAppId:(NSString *)appId appKey:(NSString *)appKey userName:(NSString *)userName countryCode:(NSString *)countryCode verificationCode:(NSString *)verificationCode frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | ||
| 27 | +/** | ||
| 24 | * 登录 | 28 | * 登录 |
| 25 | */ | 29 | */ |
| 26 | - (void)loginWithAppId:(NSString *)appId appKey:(NSString *)appKey userName:(NSString *)userName password:(NSString *)password frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | 30 | - (void)loginWithAppId:(NSString *)appId appKey:(NSString *)appKey userName:(NSString *)userName password:(NSString *)password frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveLogin.m
| @@ -25,12 +25,12 @@ static NSString *thirdLoginFormalURL = @"https://api.cnlive.com/open/api2/user/ | @@ -25,12 +25,12 @@ static NSString *thirdLoginFormalURL = @"https://api.cnlive.com/open/api2/user/ | ||
| 25 | 25 | ||
| 26 | 26 | ||
| 27 | //验证第三方账号是否注册,若注册则登录返回用户信息,若未注册则errorCode | 27 | //验证第三方账号是否注册,若注册则登录返回用户信息,若未注册则errorCode |
| 28 | -static NSString *thirdCheckLoginTestURL = @"http://test.open.cnlive.com/openapi/api2/user/loginIn3rdHasMobile4server"; | ||
| 29 | -static NSString *thirdCheckLoginFormalURL = @"https://api.cnlive.com/open/api2/user/loginIn3rdHasMobile4server"; | 28 | +static NSString *thirdCheckLoginTestURL = @"http://test.open.cnlive.com/openapi/api2/user/loginIn3rdHasMobile"; |
| 29 | +static NSString *thirdCheckLoginFormalURL = @"https://api.cnlive.com/open/api2/user/loginIn3rdHasMobile"; | ||
| 30 | 30 | ||
| 31 | //第三方注册强制绑定手机号: 手机号+密码+验证码+三方账号 | 31 | //第三方注册强制绑定手机号: 手机号+密码+验证码+三方账号 |
| 32 | -static NSString *thirdBindMobileLoginTestURL = @"http://test.open.cnlive.com/openapi/api2/user/loginIn3rdAndBindMobile4server"; | ||
| 33 | -static NSString *thirdBindMobileLoginFormalURL = @"https://api.cnlive.com/open/api2/user/loginIn3rdAndBindMobile4server"; | 32 | +static NSString *thirdBindMobileLoginTestURL = @"http://test.open.cnlive.com/openapi/api2/user/loginIn3rdAndBindMobile"; |
| 33 | +static NSString *thirdBindMobileLoginFormalURL = @"https://api.cnlive.com/open/api2/user/loginIn3rdAndBindMobile"; | ||
| 34 | 34 | ||
| 35 | @implementation CNLiveLogin | 35 | @implementation CNLiveLogin |
| 36 | 36 | ||
| @@ -68,7 +68,7 @@ static NSString *thirdBindMobileLoginFormalURL = @"https://api.cnlive.com/open/ | @@ -68,7 +68,7 @@ static NSString *thirdBindMobileLoginFormalURL = @"https://api.cnlive.com/open/ | ||
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | /** | 70 | /** |
| 71 | - * 快捷登录 | 71 | + * 快捷登录(旧) |
| 72 | */ | 72 | */ |
| 73 | - (void)shortcutLoginWithAppId:(NSString *)appId appKey:(NSString *)appKey userName:(NSString *)userName verificationCode:(NSString *)verificationCode frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure | 73 | - (void)shortcutLoginWithAppId:(NSString *)appId appKey:(NSString *)appKey userName:(NSString *)userName verificationCode:(NSString *)verificationCode frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure |
| 74 | { | 74 | { |
| @@ -101,6 +101,40 @@ static NSString *thirdBindMobileLoginFormalURL = @"https://api.cnlive.com/open/ | @@ -101,6 +101,40 @@ static NSString *thirdBindMobileLoginFormalURL = @"https://api.cnlive.com/open/ | ||
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | /** | 103 | /** |
| 104 | + * 快捷登录(新) | ||
| 105 | + */ | ||
| 106 | +- (void)shortcutLoginWithAppId:(NSString *)appId appKey:(NSString *)appKey userName:(NSString *)userName countryCode:(NSString *)countryCode verificationCode:(NSString *)verificationCode frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure | ||
| 107 | +{ | ||
| 108 | + [CNLiveUserSystemTools getRealTimeString:^(NSString * _Nullable realTime, NSDate * _Nullable netDate) { | ||
| 109 | + | ||
| 110 | + NSString *timeString = realTime; | ||
| 111 | + | ||
| 112 | + NSDictionary *params = @{@"appId":[CNLiveUserSystemTools verify:appId], | ||
| 113 | + @"userName":[CNLiveUserSystemTools verify:userName], | ||
| 114 | + @"countryCode":countryCode, | ||
| 115 | + @"verificationCode":[CNLiveUserSystemTools verify:verificationCode], | ||
| 116 | + @"uuid":[CNLiveUserSystemTools uidForStat:realTime], | ||
| 117 | + @"frmId":[CNLiveUserSystemTools verify:frmId], | ||
| 118 | + @"clientPlat":@"i", | ||
| 119 | + @"platform_id":[NSBundle mainBundle].bundleIdentifier, | ||
| 120 | + @"timestamp": timeString}; | ||
| 121 | + | ||
| 122 | + NSMutableDictionary *parameter = [NSMutableDictionary dictionaryWithDictionary:params]; | ||
| 123 | + NSString *string = [NSString stringWithFormat:@"%@&key=%@", [CNLiveUserSystemTools signvalue:parameter], [CNLiveUserSystemTools verify:appKey]]; | ||
| 124 | + NSString *signString = [[CNLiveUserSystemTools sha1:string] uppercaseString]; | ||
| 125 | + | ||
| 126 | + [parameter setObject:signString forKey:@"sign"]; | ||
| 127 | + NSString *url; | ||
| 128 | + if ([CNLiveUserSystemTools isTestEnvironment]) { | ||
| 129 | + url = shortcutLoginTestURL; | ||
| 130 | + } else { | ||
| 131 | + url = shortcutLoginFormalURL; | ||
| 132 | + } | ||
| 133 | + [self requestWithURL:url parameter:parameter success:success failure:failure]; | ||
| 134 | + }]; | ||
| 135 | +} | ||
| 136 | + | ||
| 137 | +/** | ||
| 104 | * 登录 | 138 | * 登录 |
| 105 | */ | 139 | */ |
| 106 | - (void)loginWithAppId:(NSString *)appId appKey:(NSString *)appKey userName:(NSString *)userName password:(NSString *)password frmId:(NSString *)frmId success:(void (^)(id result))success failure:(void (^)(NSDictionary *))failure | 140 | - (void)loginWithAppId:(NSString *)appId appKey:(NSString *)appKey userName:(NSString *)userName password:(NSString *)password frmId:(NSString *)frmId success:(void (^)(id result))success failure:(void (^)(NSDictionary *))failure |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveUserInfo.h
| @@ -12,11 +12,16 @@ | @@ -12,11 +12,16 @@ | ||
| 12 | @interface CNLiveUserInfo : NSObject | 12 | @interface CNLiveUserInfo : NSObject |
| 13 | 13 | ||
| 14 | /** | 14 | /** |
| 15 | - * 更新手机号 | 15 | + * 更新手机号(旧) |
| 16 | */ | 16 | */ |
| 17 | - (void)updateMobileWithAppId:(NSString *)appId appKey:(NSString *)appKey uid:(NSString *)uid mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode token:(NSString *)token success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | 17 | - (void)updateMobileWithAppId:(NSString *)appId appKey:(NSString *)appKey uid:(NSString *)uid mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode token:(NSString *)token success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; |
| 18 | 18 | ||
| 19 | /** | 19 | /** |
| 20 | + * 更新手机号(新) | ||
| 21 | + */ | ||
| 22 | +- (void)updateMobileWithAppId:(NSString *)appId appKey:(NSString *)appKey uid:(NSString *)uid mobile:(NSString *)mobile countryCode:(NSString *)countryCode verificationCode:(NSString *)verificationCode token:(NSString *)token success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | ||
| 23 | + | ||
| 24 | +/** | ||
| 20 | * 绑定第三方账号 | 25 | * 绑定第三方账号 |
| 21 | */ | 26 | */ |
| 22 | - (void)bindingThirdPartyWithAppId:(NSString *)appId appKey:(NSString *)appKey uid:(NSString *)uid thirdPartyPlatType:(NSString *)plat thirdPartyId:(NSString *)thirdPartyId token:(NSString *)token success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; | 27 | - (void)bindingThirdPartyWithAppId:(NSString *)appId appKey:(NSString *)appKey uid:(NSString *)uid thirdPartyPlatType:(NSString *)plat thirdPartyId:(NSString *)thirdPartyId token:(NSString *)token success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveUserInfo.m
| @@ -20,8 +20,8 @@ static NSString *queryUserInfoTestURL = @"http://test.open.cnlive.com/open | @@ -20,8 +20,8 @@ static NSString *queryUserInfoTestURL = @"http://test.open.cnlive.com/open | ||
| 20 | static NSString *queryUserInfoFormalURL = @"https://api.cnlive.com/open/api2/user/readUserById"; | 20 | static NSString *queryUserInfoFormalURL = @"https://api.cnlive.com/open/api2/user/readUserById"; |
| 21 | 21 | ||
| 22 | //查询多条用户信息 | 22 | //查询多条用户信息 |
| 23 | -static NSString *queryMoreUserInfoTestURL = @"http://test.open.cnlive.com/openapi/api2/user/readUsersById4server"; | ||
| 24 | -static NSString *queryMoreUserInfoFormalURL = @"https://api.cnlive.com/open/api2/user/readUsersById4server"; | 23 | +static NSString *queryMoreUserInfoTestURL = @"http://test.open.cnlive.com/openapi/api2/user/readUsersById"; |
| 24 | +static NSString *queryMoreUserInfoFormalURL = @"https://api.cnlive.com/open/api2/user/readUsersById"; | ||
| 25 | 25 | ||
| 26 | //修改用户单项信息 | 26 | //修改用户单项信息 |
| 27 | static NSString *updateUserByIdTestURL = @"http://test.open.cnlive.com/openapi/api2/user/updateUserById"; | 27 | static NSString *updateUserByIdTestURL = @"http://test.open.cnlive.com/openapi/api2/user/updateUserById"; |
| @@ -29,7 +29,7 @@ static NSString *updateUserByIdFormalURL = @"https://api.cnlive.com/open/ap | @@ -29,7 +29,7 @@ static NSString *updateUserByIdFormalURL = @"https://api.cnlive.com/open/ap | ||
| 29 | 29 | ||
| 30 | //更新用户附加信息 | 30 | //更新用户附加信息 |
| 31 | static NSString *updateOtherInfoTestURL = @"http://test.open.cnlive.com/openapi/api2/user/updateUserExtInfo"; | 31 | static NSString *updateOtherInfoTestURL = @"http://test.open.cnlive.com/openapi/api2/user/updateUserExtInfo"; |
| 32 | -static NSString *updateOtherInfoFormalURL = @"http://172.16.3.67/open/api2/user/updateUserExtInfo";//@"https://api.cnlive.com/open/api2/user/updateUserExtInfo"; | 32 | +static NSString *updateOtherInfoFormalURL = @"https://api.cnlive.com/open/api2/user/updateUserExtInfo"; |
| 33 | 33 | ||
| 34 | //修改密码 | 34 | //修改密码 |
| 35 | static NSString *updatePwdTestURL = @"http://test.open.cnlive.com/openapi/api2/user/updatePwdByMobile"; | 35 | static NSString *updatePwdTestURL = @"http://test.open.cnlive.com/openapi/api2/user/updatePwdByMobile"; |
| @@ -46,7 +46,7 @@ static NSString *oldPwdUpdatePwdFormalURL = @"https://api.cnlive.com/open | @@ -46,7 +46,7 @@ static NSString *oldPwdUpdatePwdFormalURL = @"https://api.cnlive.com/open | ||
| 46 | @implementation CNLiveUserInfo | 46 | @implementation CNLiveUserInfo |
| 47 | 47 | ||
| 48 | /** | 48 | /** |
| 49 | - * 更新手机号 | 49 | + * 更新手机号(旧) |
| 50 | */ | 50 | */ |
| 51 | - (void)updateMobileWithAppId:(NSString *)appId appKey:(NSString *)appKey uid:(NSString *)uid mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode token:(NSString *)token success:(void (^)(id result))success failure:(void (^)(NSDictionary *))failure | 51 | - (void)updateMobileWithAppId:(NSString *)appId appKey:(NSString *)appKey uid:(NSString *)uid mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode token:(NSString *)token success:(void (^)(id result))success failure:(void (^)(NSDictionary *))failure |
| 52 | { | 52 | { |
| @@ -79,6 +79,40 @@ static NSString *oldPwdUpdatePwdFormalURL = @"https://api.cnlive.com/open | @@ -79,6 +79,40 @@ static NSString *oldPwdUpdatePwdFormalURL = @"https://api.cnlive.com/open | ||
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | /** | 81 | /** |
| 82 | + * 更新手机号(新) | ||
| 83 | + */ | ||
| 84 | +- (void)updateMobileWithAppId:(NSString *)appId appKey:(NSString *)appKey uid:(NSString *)uid mobile:(NSString *)mobile countryCode:(NSString *)countryCode verificationCode:(NSString *)verificationCode token:(NSString *)token success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure | ||
| 85 | +{ | ||
| 86 | + [CNLiveUserSystemTools getRealTimeString:^(NSString * _Nullable realTime, NSDate * _Nullable netDate) { | ||
| 87 | + | ||
| 88 | + NSString *timeString = realTime; | ||
| 89 | + | ||
| 90 | + NSDictionary *params = @{@"appId":[CNLiveUserSystemTools verify:appId], | ||
| 91 | + @"uid":[CNLiveUserSystemTools verify:uid], | ||
| 92 | + @"mobile":[CNLiveUserSystemTools verify:mobile], | ||
| 93 | + @"countryCode":countryCode, | ||
| 94 | + @"verificationCode":[CNLiveUserSystemTools verify:verificationCode], | ||
| 95 | + @"clientPlat":@"i", | ||
| 96 | + @"token":[CNLiveUserSystemTools verify:token], | ||
| 97 | + @"platform_id":[NSBundle mainBundle].bundleIdentifier, | ||
| 98 | + @"timestamp": timeString}; | ||
| 99 | + | ||
| 100 | + NSMutableDictionary *parameter = [NSMutableDictionary dictionaryWithDictionary:params]; | ||
| 101 | + NSString *string = [NSString stringWithFormat:@"%@&key=%@", [CNLiveUserSystemTools signvalue:parameter], [CNLiveUserSystemTools verify:appKey]]; | ||
| 102 | + NSString *signString = [[CNLiveUserSystemTools sha1:string] uppercaseString]; | ||
| 103 | + | ||
| 104 | + [parameter setObject:signString forKey:@"sign"]; | ||
| 105 | + NSString *url; | ||
| 106 | + if ([CNLiveUserSystemTools isTestEnvironment]) { | ||
| 107 | + url = updateMobileTestURL; | ||
| 108 | + } else { | ||
| 109 | + url = updateMobileFormalURL; | ||
| 110 | + } | ||
| 111 | + [self requestWithURL:url parameter:parameter success:success failure:failure]; | ||
| 112 | + }]; | ||
| 113 | +} | ||
| 114 | + | ||
| 115 | +/** | ||
| 82 | * 绑定第三方账号 | 116 | * 绑定第三方账号 |
| 83 | */ | 117 | */ |
| 84 | - (void)bindingThirdPartyWithAppId:(NSString *)appId appKey:(NSString *)appKey uid:(NSString *)uid thirdPartyPlatType:(NSString *)plat thirdPartyId:(NSString *)thirdPartyId token:(NSString *)token success:(void (^)(id))success failure:(void (^)(NSDictionary *))failure | 118 | - (void)bindingThirdPartyWithAppId:(NSString *)appId appKey:(NSString *)appKey uid:(NSString *)uid thirdPartyPlatType:(NSString *)plat thirdPartyId:(NSString *)thirdPartyId token:(NSString *)token success:(void (^)(id))success failure:(void (^)(NSDictionary *))failure |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveUserSystemCenter.h
| @@ -65,7 +65,7 @@ | @@ -65,7 +65,7 @@ | ||
| 65 | 65 | ||
| 66 | 66 | ||
| 67 | /** | 67 | /** |
| 68 | - @abstract 快捷登录 | 68 | + @abstract 快捷登录(旧) |
| 69 | @param userName 手机号 | 69 | @param userName 手机号 |
| 70 | @param verificationCode 验证码 | 70 | @param verificationCode 验证码 |
| 71 | @param frmId 渠道ID(非必填) | 71 | @param frmId 渠道ID(非必填) |
| @@ -74,6 +74,15 @@ | @@ -74,6 +74,15 @@ | ||
| 74 | */ | 74 | */ |
| 75 | + (void)shortcutLoginWithUserName:(NSString *)userName verificationCode:(NSString *)verificationCode frmId:(NSString *)frmId success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; | 75 | + (void)shortcutLoginWithUserName:(NSString *)userName verificationCode:(NSString *)verificationCode frmId:(NSString *)frmId success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; |
| 76 | 76 | ||
| 77 | +/** | ||
| 78 | + @abstract 快捷登录(新) | ||
| 79 | + @param userName 手机号 | ||
| 80 | + @param countryCode 手机号国家码 | ||
| 81 | + @param verificationCode 验证码 | ||
| 82 | + @param frmId 渠道ID(非必填) | ||
| 83 | + @param success 成功回调 | ||
| 84 | + @param failure 失败回调 | ||
| 85 | + */+ (void)shortcutLoginWithUserName:(NSString *)userName countryCode:(NSString *)countryCode verificationCode:(NSString *)verificationCode frmId:(NSString *)frmId success:(void (^)(id))success failure :(void (^)(NSDictionary *))failure; | ||
| 77 | 86 | ||
| 78 | /** | 87 | /** |
| 79 | @abstract 登录 | 88 | @abstract 登录 |
| @@ -118,7 +127,7 @@ | @@ -118,7 +127,7 @@ | ||
| 118 | 127 | ||
| 119 | 128 | ||
| 120 | /** | 129 | /** |
| 121 | - @abstract 更新手机号 | 130 | + @abstract 更新手机号(旧) |
| 122 | @param uid 用户ID | 131 | @param uid 用户ID |
| 123 | @param mobile 手机号 | 132 | @param mobile 手机号 |
| 124 | @param verificationCode 验证码 | 133 | @param verificationCode 验证码 |
| @@ -127,6 +136,16 @@ | @@ -127,6 +136,16 @@ | ||
| 127 | */ | 136 | */ |
| 128 | + (void)updateMobileWithUid:(NSString *)uid mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; | 137 | + (void)updateMobileWithUid:(NSString *)uid mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; |
| 129 | 138 | ||
| 139 | +/** | ||
| 140 | + @abstract 更新手机号(新) | ||
| 141 | + @param uid 用户ID | ||
| 142 | + @param mobile 手机号 | ||
| 143 | + @param countryCode 手机号国家码 | ||
| 144 | + @param verificationCode 验证码 | ||
| 145 | + @param success 成功回调 | ||
| 146 | + @param failure 失败回调 | ||
| 147 | + */ | ||
| 148 | ++(void)updateMobileWithUid:(NSString *)uid mobile:(NSString *)mobile countryCode:(NSString *)countryCode verificationCode:(NSString *)verificationCode success:(void (^)(id))success failure:(void (^)(NSDictionary *))failure; | ||
| 130 | 149 | ||
| 131 | /** | 150 | /** |
| 132 | @abstract 绑定第三方账号 | 151 | @abstract 绑定第三方账号 |
| @@ -224,18 +243,28 @@ | @@ -224,18 +243,28 @@ | ||
| 224 | 243 | ||
| 225 | 244 | ||
| 226 | /** | 245 | /** |
| 227 | - 注册前校验手机验证码 | 246 | + 注册前校验手机验证码(旧) |
| 228 | 247 | ||
| 229 | @param mobile 手机号 | 248 | @param mobile 手机号 |
| 230 | @param verificationCode 验证码 | 249 | @param verificationCode 验证码 |
| 231 | @param success 成功回调 | 250 | @param success 成功回调 |
| 232 | - @param getVersion 失败回调 | 251 | + @param failure 失败回调 |
| 233 | */ | 252 | */ |
| 234 | + (void)registerCheckVerificationCodeWithMobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | 253 | + (void)registerCheckVerificationCodeWithMobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; |
| 235 | 254 | ||
| 255 | +/** | ||
| 256 | + 注册前校验手机验证码(新) | ||
| 257 | + | ||
| 258 | + @param mobile 手机号 | ||
| 259 | + @param countryCode 手机号国家码 | ||
| 260 | + @param verificationCode 验证码 | ||
| 261 | + @param success 成功回调 | ||
| 262 | + @param failure 失败回调 | ||
| 263 | + */ | ||
| 264 | ++ (void)registerCheckVerificationCodeWithMobile:(NSString *)mobile countryCode:(NSString *)countryCode verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | ||
| 236 | 265 | ||
| 237 | /** | 266 | /** |
| 238 | - 快捷登录前校验手机验证码 | 267 | + 快捷登录前校验手机验证码(旧) |
| 239 | 268 | ||
| 240 | @param mobile 手机号 | 269 | @param mobile 手机号 |
| 241 | @param verificationCode 验证码 | 270 | @param verificationCode 验证码 |
| @@ -244,6 +273,15 @@ | @@ -244,6 +273,15 @@ | ||
| 244 | */ | 273 | */ |
| 245 | + (void)shortcutLoginCheckVerificationCodeWithMobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | 274 | + (void)shortcutLoginCheckVerificationCodeWithMobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; |
| 246 | 275 | ||
| 276 | +/** | ||
| 277 | + 快捷登录前校验手机验证码(新) | ||
| 278 | + | ||
| 279 | + @param mobile 手机号 | ||
| 280 | + @param countryCode 手机号国家码 | ||
| 281 | + @param success 成功回调 | ||
| 282 | + @param failure 失败回调 | ||
| 283 | + */ | ||
| 284 | ++ (void)shortcutLoginCheckVerificationCodeWithMobile:(NSString *)mobile countryCode:(NSString *)countryCode verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | ||
| 247 | 285 | ||
| 248 | /** | 286 | /** |
| 249 | 验证第三方账号是否注册,若注册则直接登录返回用户信息,若未注册返回errorCode | 287 | 验证第三方账号是否注册,若注册则直接登录返回用户信息,若未注册返回errorCode |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveUserSystemCenter.m
| @@ -71,7 +71,7 @@ | @@ -71,7 +71,7 @@ | ||
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | /** | 73 | /** |
| 74 | - * 快捷登录 | 74 | + * 快捷登录(旧) |
| 75 | */ | 75 | */ |
| 76 | 76 | ||
| 77 | + (void)shortcutLoginWithUserName:(NSString *)userName verificationCode:(NSString *)verificationCode frmId:(NSString *)frmId success:(void (^)(id))success failure :(void (^)(NSDictionary *))failure | 77 | + (void)shortcutLoginWithUserName:(NSString *)userName verificationCode:(NSString *)verificationCode frmId:(NSString *)frmId success:(void (^)(id))success failure :(void (^)(NSDictionary *))failure |
| @@ -82,6 +82,17 @@ | @@ -82,6 +82,17 @@ | ||
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | /** | 84 | /** |
| 85 | + * 快捷登录(新) | ||
| 86 | + */ | ||
| 87 | + | ||
| 88 | ++ (void)shortcutLoginWithUserName:(NSString *)userName countryCode:(NSString *)countryCode verificationCode:(NSString *)verificationCode frmId:(NSString *)frmId success:(void (^)(id))success failure :(void (^)(NSDictionary *))failure | ||
| 89 | +{ | ||
| 90 | + CNLiveLogin *shortcutLogin = [[CNLiveLogin alloc] init]; | ||
| 91 | + | ||
| 92 | + [shortcutLogin shortcutLoginWithAppId:[CNLiveUserManager manager].appId appKey:[CNLiveUserManager manager].appKey userName:userName countryCode:countryCode verificationCode:verificationCode frmId:frmId success:success failure:failure]; | ||
| 93 | +} | ||
| 94 | + | ||
| 95 | +/** | ||
| 85 | * 登录 | 96 | * 登录 |
| 86 | */ | 97 | */ |
| 87 | + (void)loginWithUserName:(NSString *)userName password:(NSString *)password frmId:(NSString *)frmId success:(void (^)(id))success failure :(void (^)(NSDictionary *))failure | 98 | + (void)loginWithUserName:(NSString *)userName password:(NSString *)password frmId:(NSString *)frmId success:(void (^)(id))success failure :(void (^)(NSDictionary *))failure |
| @@ -122,7 +133,7 @@ | @@ -122,7 +133,7 @@ | ||
| 122 | } | 133 | } |
| 123 | 134 | ||
| 124 | /** | 135 | /** |
| 125 | - * 更新手机号 | 136 | + * 更新手机号(旧) |
| 126 | */ | 137 | */ |
| 127 | +(void)updateMobileWithUid:(NSString *)uid mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id))success failure:(void (^)(NSDictionary *))failure | 138 | +(void)updateMobileWithUid:(NSString *)uid mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id))success failure:(void (^)(NSDictionary *))failure |
| 128 | { | 139 | { |
| @@ -132,6 +143,16 @@ | @@ -132,6 +143,16 @@ | ||
| 132 | } | 143 | } |
| 133 | 144 | ||
| 134 | /** | 145 | /** |
| 146 | + * 更新手机号(新) | ||
| 147 | + */ | ||
| 148 | ++(void)updateMobileWithUid:(NSString *)uid mobile:(NSString *)mobile countryCode:(NSString *)countryCode verificationCode:(NSString *)verificationCode success:(void (^)(id))success failure:(void (^)(NSDictionary *))failure | ||
| 149 | +{ | ||
| 150 | + CNLiveUserInfo *updateMobile = [[CNLiveUserInfo alloc] init]; | ||
| 151 | + | ||
| 152 | + [updateMobile updateMobileWithAppId:[CNLiveUserManager manager].appId appKey:[CNLiveUserManager manager].appKey uid:uid mobile:mobile countryCode:countryCode verificationCode:verificationCode token:[[self class] getToken] success:success failure:failure]; | ||
| 153 | +} | ||
| 154 | + | ||
| 155 | +/** | ||
| 135 | * 绑定第三方账号 | 156 | * 绑定第三方账号 |
| 136 | */ | 157 | */ |
| 137 | +(void)bindingThirdPartyWithUid:(NSString *)uid thirdPartyPlatType:(NSString *)plat thirdPartyId:(NSString *)thirdPartyId success:(void (^)(id))success failure:(void (^)(NSDictionary *))failure | 158 | +(void)bindingThirdPartyWithUid:(NSString *)uid thirdPartyPlatType:(NSString *)plat thirdPartyId:(NSString *)thirdPartyId success:(void (^)(id))success failure:(void (^)(NSDictionary *))failure |
| @@ -220,7 +241,7 @@ | @@ -220,7 +241,7 @@ | ||
| 220 | } | 241 | } |
| 221 | 242 | ||
| 222 | /** | 243 | /** |
| 223 | - * 注册前校验手机验证码 | 244 | + * 注册前校验手机验证码(旧) |
| 224 | */ | 245 | */ |
| 225 | + (void)registerCheckVerificationCodeWithMobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure | 246 | + (void)registerCheckVerificationCodeWithMobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure |
| 226 | { | 247 | { |
| @@ -229,7 +250,16 @@ | @@ -229,7 +250,16 @@ | ||
| 229 | } | 250 | } |
| 230 | 251 | ||
| 231 | /** | 252 | /** |
| 232 | - * 快捷登录前校验手机验证码 | 253 | + * 注册前校验手机验证码(新) |
| 254 | + */ | ||
| 255 | ++ (void)registerCheckVerificationCodeWithMobile:(NSString *)mobile countryCode:(NSString *)countryCode verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure | ||
| 256 | +{ | ||
| 257 | + CNLiveCheckVerificationCode *checkCode = [[CNLiveCheckVerificationCode alloc] init]; | ||
| 258 | + [checkCode registerCheckVerificationCodeWithAppId:[CNLiveUserManager manager].appId appKey:[CNLiveUserManager manager].appKey type:CheckVerificationCodeTypeRegister mobile:mobile countryCode:countryCode verificationCode:verificationCode success:success failure:failure]; | ||
| 259 | +} | ||
| 260 | + | ||
| 261 | +/** | ||
| 262 | + * 快捷登录前校验手机验证码(旧) | ||
| 233 | */ | 263 | */ |
| 234 | + (void)shortcutLoginCheckVerificationCodeWithMobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure | 264 | + (void)shortcutLoginCheckVerificationCodeWithMobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure |
| 235 | { | 265 | { |
| @@ -238,6 +268,15 @@ | @@ -238,6 +268,15 @@ | ||
| 238 | } | 268 | } |
| 239 | 269 | ||
| 240 | /** | 270 | /** |
| 271 | + * 快捷登录前校验手机验证码(新) | ||
| 272 | + */ | ||
| 273 | ++ (void)shortcutLoginCheckVerificationCodeWithMobile:(NSString *)mobile countryCode:(NSString *)countryCode verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure | ||
| 274 | +{ | ||
| 275 | + CNLiveCheckVerificationCode *checkCode = [[CNLiveCheckVerificationCode alloc] init]; | ||
| 276 | + [checkCode shortcutLoginCheckVerificationCodeWithAppId:[CNLiveUserManager manager].appId appKey:[CNLiveUserManager manager].appKey type:CheckVerificationCodeTypeShortcutLogin mobile:mobile countryCode:countryCode verificationCode:verificationCode success:success failure:failure]; | ||
| 277 | +} | ||
| 278 | + | ||
| 279 | +/** | ||
| 241 | * 验证第三方账号是否注册,若注册直接登录返回用户信息,若未注册返回errorCode | 280 | * 验证第三方账号是否注册,若注册直接登录返回用户信息,若未注册返回errorCode |
| 242 | */ | 281 | */ |
| 243 | + (void)thirdPartyCheckLoginWithThirdPartyPlatType:(NSString *)plat thirdPartyId:(NSString *)thirdPartyId frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure | 282 | + (void)thirdPartyCheckLoginWithThirdPartyPlatType:(NSString *)plat thirdPartyId:(NSString *)thirdPartyId frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure |