Commit f9d4f95c87e9cca9050cb75af5d8cfe68b333120

Authored by 朱林
1 parent 9c211396

no message

CNLiveUserSystemDemo.xcodeproj/project.pbxproj
... ... @@ -61,6 +61,8 @@
61 61 812642DF1D86A7A800B402CA /* CNLiveUserSystemDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 812642DE1D86A7A800B402CA /* CNLiveUserSystemDemoTests.m */; };
62 62 812642EA1D86A7A800B402CA /* CNLiveUserSystemDemoUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 812642E91D86A7A800B402CA /* CNLiveUserSystemDemoUITests.m */; };
63 63 812642FA1D86A83100B402CA /* CNLiveUserSystemCenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 812642F91D86A83100B402CA /* CNLiveUserSystemCenter.m */; };
  64 + 81661FCA1DDEA9C300E3C65A /* ThirdPartyView.m in Sources */ = {isa = PBXBuildFile; fileRef = 81661FC91DDEA9C300E3C65A /* ThirdPartyView.m */; };
  65 + 81661FCC1DDED9DD00E3C65A /* cancel.png in Resources */ = {isa = PBXBuildFile; fileRef = 81661FCB1DDED9DD00E3C65A /* cancel.png */; };
64 66 817C6EC31D90D60E0016F211 /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 817C6EC21D90D60E0016F211 /* ImageIO.framework */; };
65 67 8187A8EF1D8E6394007FAFB6 /* Tools.m in Sources */ = {isa = PBXBuildFile; fileRef = 8187A8EE1D8E6394007FAFB6 /* Tools.m */; };
66 68 8187A8F61D8E6486007FAFB6 /* NSObject+UserModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 8187A8F11D8E6486007FAFB6 /* NSObject+UserModel.m */; };
... ... @@ -206,6 +208,9 @@
206 208 812642F81D86A83100B402CA /* CNLiveUserSystemCenter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNLiveUserSystemCenter.h; sourceTree = "<group>"; };
207 209 812642F91D86A83100B402CA /* CNLiveUserSystemCenter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CNLiveUserSystemCenter.m; sourceTree = "<group>"; };
208 210 812642FB1D86AFE600B402CA /* CNLiveUserSystemTypeDef.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CNLiveUserSystemTypeDef.h; sourceTree = "<group>"; };
  211 + 81661FC81DDEA9C300E3C65A /* ThirdPartyView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThirdPartyView.h; sourceTree = "<group>"; };
  212 + 81661FC91DDEA9C300E3C65A /* ThirdPartyView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ThirdPartyView.m; sourceTree = "<group>"; };
  213 + 81661FCB1DDED9DD00E3C65A /* cancel.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = cancel.png; sourceTree = "<group>"; };
209 214 817C6EC21D90D60E0016F211 /* ImageIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ImageIO.framework; path = System/Library/Frameworks/ImageIO.framework; sourceTree = SDKROOT; };
210 215 818735211DA8FD2700046D84 /* Common.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Common.h; sourceTree = "<group>"; };
211 216 8187A8ED1D8E6394007FAFB6 /* Tools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Tools.h; sourceTree = "<group>"; };
... ... @@ -392,6 +397,8 @@
392 397 children = (
393 398 8116F8E21D8916250084FE49 /* IdAndPwdView.h */,
394 399 8116F8E31D8916250084FE49 /* IdAndPwdView.m */,
  400 + 81661FC81DDEA9C300E3C65A /* ThirdPartyView.h */,
  401 + 81661FC91DDEA9C300E3C65A /* ThirdPartyView.m */,
395 402 8116F8EF1D891BCD0084FE49 /* RegistBasicInformationView.h */,
396 403 8116F8F01D891BCD0084FE49 /* RegistBasicInformationView.m */,
397 404 B6B54BE81D8D009800089C9C /* UserInfoHeaderImageTableViewCell.h */,
... ... @@ -443,6 +450,7 @@
443 450 812642C31D86A7A800B402CA /* CNLiveUserSystemDemo */ = {
444 451 isa = PBXGroup;
445 452 children = (
  453 + 81661FCB1DDED9DD00E3C65A /* cancel.png */,
446 454 812642C71D86A7A800B402CA /* AppDelegate.h */,
447 455 812642C81D86A7A800B402CA /* AppDelegate.m */,
448 456 8187A8EC1D8E6385007FAFB6 /* Tools */,
... ... @@ -685,6 +693,7 @@
685 693 812642D41D86A7A800B402CA /* LaunchScreen.storyboard in Resources */,
686 694 812642D11D86A7A800B402CA /* Assets.xcassets in Resources */,
687 695 812642CF1D86A7A800B402CA /* Main.storyboard in Resources */,
  696 + 81661FCC1DDED9DD00E3C65A /* cancel.png in Resources */,
688 697 810D9B661D8FB70600B7A776 /* TencentOpenApi_IOS_Bundle.bundle in Resources */,
689 698 8187A90D1D8E9A7B007FAFB6 /* SVProgressHUD.bundle in Resources */,
690 699 810D9B681D8FB70600B7A776 /* WeiboSDK.bundle in Resources */,
... ... @@ -750,6 +759,7 @@
750 759 811600EE1D927E7E003CAE7D /* MKAnnotationView+WebCache.m in Sources */,
751 760 811600F91D927E7E003CAE7D /* UIImage+MultiFormat.m in Sources */,
752 761 B6B54BED1D8D011000089C9C /* UserInfoTableViewCell.m in Sources */,
  762 + 81661FCA1DDEA9C300E3C65A /* ThirdPartyView.m in Sources */,
753 763 8187A8F81D8E6486007FAFB6 /* UserInfoSava.m in Sources */,
754 764 811600EF1D927E7E003CAE7D /* NSData+ImageContentType.m in Sources */,
755 765 812642C61D86A7A800B402CA /* main.m in Sources */,
... ...
CNLiveUserSystemDemo.xcodeproj/project.xcworkspace/xcuserdata/iOS.xcuserdatad/UserInterfaceState.xcuserstate
No preview for this file type
CNLiveUserSystemDemo.xcodeproj/xcuserdata/iOS.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
... ... @@ -51,14 +51,46 @@
51 51 shouldBeEnabled = "Yes"
52 52 ignoreCount = "0"
53 53 continueAfterRunningActions = "No"
54   - filePath = "CNLiveUserSystemDemo/Conreollers/ModifyUserInfoViewController.m"
55   - timestampString = "501062337.466231"
  54 + filePath = "CNLiveUserSystemDemo/Conreollers/ViewController.m"
  55 + timestampString = "501142248.547315"
56 56 startingColumnNumber = "9223372036854775807"
57 57 endingColumnNumber = "9223372036854775807"
58   - startingLineNumber = "63"
59   - endingLineNumber = "63"
60   - landmarkName = "-saveBtnAction"
  58 + startingLineNumber = "73"
  59 + endingLineNumber = "73"
  60 + landmarkName = "-tapGesturedDetected:"
61 61 landmarkType = "7">
  62 + <Locations>
  63 + <Location
  64 + shouldBeEnabled = "Yes"
  65 + ignoreCount = "0"
  66 + continueAfterRunningActions = "No"
  67 + symbolName = "-[ViewController tapGesturedDetected:]"
  68 + moduleName = "CNLiveUserSystemDemo"
  69 + usesParentBreakpointCondition = "Yes"
  70 + urlString = "file:///Users/android/Git/CNLiveUserSystemSDK/CNLiveUserSystemDemo/Conreollers/ViewController.m"
  71 + timestampString = "501648183.675403"
  72 + startingColumnNumber = "9223372036854775807"
  73 + endingColumnNumber = "9223372036854775807"
  74 + startingLineNumber = "73"
  75 + endingLineNumber = "73"
  76 + offsetFromSymbolStart = "64">
  77 + </Location>
  78 + <Location
  79 + shouldBeEnabled = "Yes"
  80 + ignoreCount = "0"
  81 + continueAfterRunningActions = "No"
  82 + symbolName = "__38-[ViewController tapGesturedDetected:]_block_invoke"
  83 + moduleName = "CNLiveUserSystemDemo"
  84 + usesParentBreakpointCondition = "Yes"
  85 + urlString = "file:///Users/android/Git/CNLiveUserSystemSDK/CNLiveUserSystemDemo/Conreollers/ViewController.m"
  86 + timestampString = "501648183.677109"
  87 + startingColumnNumber = "9223372036854775807"
  88 + endingColumnNumber = "9223372036854775807"
  89 + startingLineNumber = "73"
  90 + endingLineNumber = "73"
  91 + offsetFromSymbolStart = "15">
  92 + </Location>
  93 + </Locations>
62 94 </BreakpointContent>
63 95 </BreakpointProxy>
64 96 <BreakpointProxy
... ... @@ -67,13 +99,29 @@
67 99 shouldBeEnabled = "Yes"
68 100 ignoreCount = "0"
69 101 continueAfterRunningActions = "No"
70   - filePath = "CNLiveUserSystemDemo/Conreollers/ModifyUserInfoViewController.m"
71   - timestampString = "501062339.330438"
  102 + filePath = "CNLiveUserSystemDemo/Conreollers/RegisterViewController.m"
  103 + timestampString = "501385209.643505"
  104 + startingColumnNumber = "9223372036854775807"
  105 + endingColumnNumber = "9223372036854775807"
  106 + startingLineNumber = "89"
  107 + endingLineNumber = "89"
  108 + landmarkName = "-loginBtnAction"
  109 + landmarkType = "7">
  110 + </BreakpointContent>
  111 + </BreakpointProxy>
  112 + <BreakpointProxy
  113 + BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
  114 + <BreakpointContent
  115 + shouldBeEnabled = "Yes"
  116 + ignoreCount = "0"
  117 + continueAfterRunningActions = "No"
  118 + filePath = "CNLiveUserSystemDemo/Conreollers/RegisterViewController.m"
  119 + timestampString = "501385209.643505"
72 120 startingColumnNumber = "9223372036854775807"
73 121 endingColumnNumber = "9223372036854775807"
74   - startingLineNumber = "67"
75   - endingLineNumber = "67"
76   - landmarkName = "-saveBtnAction"
  122 + startingLineNumber = "95"
  123 + endingLineNumber = "95"
  124 + landmarkName = "-loginBtnAction"
77 125 landmarkType = "7">
78 126 </BreakpointContent>
79 127 </BreakpointProxy>
... ...
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveUserInfo.h
... ... @@ -17,6 +17,11 @@
17 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)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;
  23 +
  24 +/**
20 25 * 查询用户信息
21 26 */
22 27 - (void)queryUserInfoWithAppId:(NSString *)appId appKey:(NSString *)appKey uid:(NSString *)uid srcUid:(NSString *)srcUid token:(NSString *)token success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure;
... ...
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveUserInfo.m
... ... @@ -12,19 +12,23 @@
12 12 #import "NSDictionary+Safety.h"
13 13  
14 14 //更新手机号
15   -static NSString *updateMobileURL = @"https://api.cnlive.com/open/api2/user/updateMobileById";
  15 +static NSString *updateMobileURL = @"https://api.cnlive.com/open/api2/user/updateMobileById";
16 16  
17 17 //查询用户信息
18   -static NSString *queryUserInfoURL = @"https://api.cnlive.com/open/api2/user/readUserById";
  18 +static NSString *queryUserInfoURL = @"https://api.cnlive.com/open/api2/user/readUserById";
19 19  
20 20 //修改用户单项信息
21   -static NSString *updateUserByIdURL = @"https://api.cnlive.com/open/api2/user/updateUserById";
  21 +static NSString *updateUserByIdURL = @"https://api.cnlive.com/open/api2/user/updateUserById";
22 22  
23 23 //更新用户附加信息
24   -static NSString *updateOtherInfoURL = @"https://api.cnlive.com/open/api2/user/updateUserExtInfo";
  24 +static NSString *updateOtherInfoURL = @"https://api.cnlive.com/open/api2/user/updateUserExtInfo";
25 25  
26 26 //修改密码
27   -static NSString *updatePwdURL = @"https://api.cnlive.com/open/api2/user/updatePwdByMobile";
  27 +static NSString *updatePwdURL = @"https://api.cnlive.com/open/api2/user/updatePwdByMobile";
  28 +
  29 +//绑定第三方账号
  30 +static NSString *BindingThirdURL = @"https://api.cnlive.com/open/api2/user/bind3rd";
  31 +
28 32  
29 33 @implementation CNLiveUserInfo
30 34  
... ... @@ -56,6 +60,32 @@ static NSString *updatePwdURL = @&quot;https://api.cnlive.com/open/api2/user/updateP
56 60 }
57 61  
58 62 /**
  63 + * 绑定第三方账号
  64 + */
  65 +- (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
  66 +{
  67 + NSDate *date = [NSDate date];
  68 + NSInteger time = [date timeIntervalSince1970];
  69 + NSString *timeString = [NSString stringWithFormat:@"%ld", (long)time];
  70 +
  71 + NSDictionary *params = @{@"appId":[CNLiveUserSystemTools verify:appId],
  72 + @"uid":[CNLiveUserSystemTools verify:uid],
  73 + @"thirdPartyPlat":[CNLiveUserSystemTools verify:plat],
  74 + @"thirdPartyId":[CNLiveUserSystemTools verify:thirdPartyId],
  75 + @"token":[CNLiveUserSystemTools verify:token],
  76 + @"clientPlat":@"i",
  77 + @"platform_id":[NSBundle mainBundle].bundleIdentifier,
  78 + @"timestamp": timeString};
  79 +
  80 + NSMutableDictionary *parameter = [NSMutableDictionary dictionaryWithDictionary:params];
  81 + NSString *string = [NSString stringWithFormat:@"%@&key=%@", [CNLiveUserSystemTools signvalue:parameter], [CNLiveUserSystemTools verify:appKey]];
  82 + NSString *signString = [[CNLiveUserSystemTools sha1:string] uppercaseString];
  83 +
  84 + [parameter setObject:signString forKey:@"sign"];
  85 + [self requestWithURL:BindingThirdURL parameter:parameter success:success failure:failure];
  86 +}
  87 +
  88 +/**
59 89 * 查询用户信息
60 90 */
61 91 - (void)queryUserInfoWithAppId:(NSString *)appId appKey:(NSString *)appKey uid:(NSString *)uid srcUid:(NSString *)srcUid token:(NSString *)token success:(void (^)(id result))success failure:(void (^)(NSDictionary *))failure
... ... @@ -71,9 +101,7 @@ static NSString *updatePwdURL = @&quot;https://api.cnlive.com/open/api2/user/updateP
71 101 @"token":[CNLiveUserSystemTools verify:token],
72 102 @"platform_id":[NSBundle mainBundle].bundleIdentifier,
73 103 @"timestamp": timeString};
74   -
75   - NSLog(@"查询参数-----------%@",params);
76   -
  104 +
77 105 NSMutableDictionary *parameter = [NSMutableDictionary dictionaryWithDictionary:params];
78 106 NSString *string = [NSString stringWithFormat:@"%@&key=%@", [CNLiveUserSystemTools signvalue:parameter], [CNLiveUserSystemTools verify:appKey]];
79 107 NSString *signString = [[CNLiveUserSystemTools sha1:string] uppercaseString];
... ... @@ -168,7 +196,8 @@ static NSString *updatePwdURL = @&quot;https://api.cnlive.com/open/api2/user/updateP
168 196 {
169 197  
170 198 [[CNLiveNetworkManager manager] requestPostURL:URL parameters:param success:^(NSURLResponse * _Nullable response, id _Nullable responseObject) {
171   -
  199 +
  200 +
172 201 responseObject = [responseObject validatedDictionary];
173 202  
174 203 if ([[responseObject allKeys] containsObject:@"errorCode"] && [responseObject[@"errorCode"] isEqualToString:@"0"]) {
... ...
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveUserSystemCenter.h
... ... @@ -22,6 +22,7 @@
22 22 */
23 23 + (void)setAppId:(NSString *)appId appKey:(NSString *)appKey appSecret:(NSString *)appSecret;
24 24  
  25 +
25 26 /**
26 27 @abstract 注册
27 28 @param userName 邮箱或手机
... ... @@ -34,9 +35,10 @@
34 35 */
35 36 + (void)registerWithUserName:(NSString *)userName password:(NSString *)password verificationCode:(NSString *)verificationCode invitationCode:(NSString *)invitationCode frmId:(NSString *)frmId success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure;
36 37  
  38 +
37 39 /**
38 40 @abstract 第三方登录
39   - @param plat 第三方平台编号(如plat: 1:sina weibo 2:qq weibo 3:weixin 4:renren 注:如qq登录,plat=@"2")
  41 + @param plat 第三方平台编号(如plat: 1:sina weibo 2:qq 3:weixin 4:renren 注:如qq登录,plat=@"2")
40 42 @param thirdPartyId 第三方用户ID
41 43 @param nickName 用户昵称
42 44 @param gender 性别,m:男、f:女、n:未知(非必填)
... ... @@ -48,6 +50,7 @@
48 50 */
49 51 + (void)thirdPartyLoginWithThirdPartyPlatType:(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;
50 52  
  53 +
51 54 /**
52 55 @abstract 快捷登录
53 56 @param userName 手机号
... ... @@ -58,6 +61,7 @@
58 61 */
59 62 + (void)shortcutLoginWithUserName:(NSString *)userName verificationCode:(NSString *)verificationCode frmId:(NSString *)frmId success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure;
60 63  
  64 +
61 65 /**
62 66 @abstract 登录
63 67 @param userName 手机号或邮箱
... ... @@ -68,6 +72,7 @@
68 72 */
69 73 + (void)loginWithUserName:(NSString *)userName password:(NSString *)password frmId:(NSString *)frmId success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure;
70 74  
  75 +
71 76 /**
72 77 @abstract 发送验证码
73 78 @param mobile 手机号
... ... @@ -77,6 +82,7 @@
77 82 */
78 83 + (void)verificationCodeType:(VerificationCodeType)type mobile:(NSString *)mobile success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure;
79 84  
  85 +
80 86 /**
81 87 @abstract 更新用户附加信息
82 88 @param uid 用户ID
... ... @@ -86,6 +92,7 @@
86 92 */
87 93 + (void)updateOtherInfoWithUid:(NSString *)uid extInfo:(NSString *)extInfo success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure;
88 94  
  95 +
89 96 /**
90 97 @abstract 修改用户单项信息
91 98 @param type 修改类型(nickName-昵称,gender-性别,email-邮箱, location-联系方式(地址))
... ... @@ -96,6 +103,7 @@
96 103 */
97 104 + (void)modifyUserInfoType:(UserInfoType)type uid:(NSString *)uid modifyInfo:(NSString *)info success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure;
98 105  
  106 +
99 107 /**
100 108 @abstract 更新手机号
101 109 @param uid 用户ID
... ... @@ -106,6 +114,18 @@
106 114 */
107 115 + (void)updateMobileWithUid:(NSString *)uid mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure;
108 116  
  117 +
  118 +/**
  119 + @abstract 绑定第三方账号
  120 + @param uid 用户ID
  121 + @param plat 第三方平台编号(如platform: 1:sina weibo 2:qq 3:weixin 4:renren 注:如绑定qq,thirdPartyPlat = @"2")
  122 + @param thirdPartyId 第三方用户ID
  123 + @param success 成功回调
  124 + @param failure 失败回调
  125 + */
  126 ++ (void)bindingThirdPartyWithUid:(NSString *)uid thirdPartyPlatType:(NSString *)plat thirdPartyId:(NSString *)thirdPartyId success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure;
  127 +
  128 +
109 129 /**
110 130 @abstract 修改密码(通过手机号修改)
111 131 @param mobile 手机号
... ... @@ -116,6 +136,7 @@
116 136 */
117 137 + (void)changePasswordWithMobile:(NSString *)mobile verificationCode:(NSString *)verificationCode newPassword:(NSString *)newPassword success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure;
118 138  
  139 +
119 140 /**
120 141 @abstract 上传头像
121 142 @param uid 用户ID
... ... @@ -125,6 +146,7 @@
125 146 */
126 147 + (void)uploadIconWithUid:(NSString *)uid icon:(UIImage *)icon success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure;
127 148  
  149 +
128 150 /**
129 151 @abstract 查询用户信息
130 152 @param uid 用户ID
... ... @@ -134,6 +156,7 @@
134 156 */
135 157 + (void)queryUserInfoWithUid:(NSString *)uid srcUid:(NSString *)srcUid success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure;
136 158  
  159 +
137 160 /**
138 161 @abstract 用户反馈
139 162 @param contentId 举报内容ID
... ... @@ -143,6 +166,7 @@
143 166 */
144 167 + (void)feedbackWithContentId:(NSString *)contentId message:(NSString *)message success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure;
145 168  
  169 +
146 170 /**
147 171 * 获取SDK版本号
148 172 */
... ...
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveUserSystemCenter.m
... ... @@ -110,6 +110,16 @@
110 110 }
111 111  
112 112 /**
  113 + * 绑定第三方账号
  114 + */
  115 ++(void)bindingThirdPartyWithUid:(NSString *)uid thirdPartyPlatType:(NSString *)plat thirdPartyId:(NSString *)thirdPartyId success:(void (^)(id))success failure:(void (^)(NSDictionary *))failure
  116 +{
  117 + CNLiveUserInfo *bindingThird = [[CNLiveUserInfo alloc] init];
  118 +
  119 + [bindingThird bindingThirdPartyWithAppId:[CNLiveUserManager manager].appId appKey:[CNLiveUserManager manager].appKey uid:uid thirdPartyPlatType:plat thirdPartyId:thirdPartyId token:[[self class] getToken] success:success failure:failure];
  120 +}
  121 +
  122 +/**
113 123 * 修改密码
114 124 */
115 125 +(void)changePasswordWithMobile:(NSString *)mobile verificationCode:(NSString *)verificationCode newPassword:(NSString *)newPassword success:(void (^)(id))success failure:(void (^)(NSDictionary *))failure
... ...
CNLiveUserSystemDemo/Conreollers/LoginViewController.m
... ... @@ -84,17 +84,17 @@
84 84  
85 85 - (void)weChatBtnAction
86 86 {
87   - [[CNLiveThirdLoginManager manager] weChatLogin];
  87 + [[CNLiveThirdLoginManager manager] weChatLoginIsBindingThirdParty:NO];
88 88 }
89 89  
90 90 - (void)sinaBtnAction
91 91 {
92   - [[CNLiveThirdLoginManager manager] sinaLogin];
  92 + [[CNLiveThirdLoginManager manager] sinaLoginIsBindingThirdParty:NO];
93 93 }
94 94  
95 95 - (void)qqBtnAction
96 96 {
97   - [[CNLiveThirdLoginManager manager] qqLogin];
  97 + [[CNLiveThirdLoginManager manager] qqLoginIsBindingThirdParty:NO];
98 98 }
99 99  
100 100 - (void)loginSuccess
... ...
CNLiveUserSystemDemo/Conreollers/RegisterViewController.m
... ... @@ -85,6 +85,7 @@
85 85  
86 86 [CNLiveUserSystemCenter registerWithUserName:_registBasicInformationView.phoneTF.text password:_registBasicInformationView.setPwdTF.text verificationCode:_registBasicInformationView.verificationTF.text invitationCode:nil frmId:nil success:^(id result) {
87 87  
  88 + NSLog(@"result --- %@",result);
88 89 [Tools setUserLogin:YES];
89 90 [SVProgressHUD showSuccessWithStatus:@"成功"];
90 91 [UserInfoSava saveUserinfoDic:result[@"data"]];
... ...
CNLiveUserSystemDemo/Conreollers/ViewController.m
... ... @@ -12,13 +12,16 @@
12 12 #import "UserInfoViewController.h"
13 13 #import "CNLiveLogout.h"
14 14 #import "UserInfoSava.h"
  15 +#import "ThirdPartyView.h"
  16 +#import "CNLiveThirdLoginManager.h"
15 17  
16   -@interface ViewController ()<UITableViewDelegate,UITableViewDataSource>
  18 +@interface ViewController ()<UITableViewDelegate,UITableViewDataSource,ThirdPartyViewDelegate,UIGestureRecognizerDelegate>
17 19 {
18 20 NSArray *_dataArr;
19 21 }
20 22  
21 23 @property (nonatomic, strong) UITableView *tableView;
  24 +@property (nonatomic, strong) ThirdPartyView *thirPartydView;
22 25 @property (nonatomic, strong) UIButton *loginBtn;
23 26 @end
24 27  
... ... @@ -30,9 +33,14 @@
30 33 self.view.backgroundColor = [UIColor whiteColor];
31 34  
32 35 [self.view addSubview:self.tableView];
33   - [self.tableView addSubview:self.loginBtn];
34   -
35   - _dataArr = @[@"通过手机号修改密码",@"更新附加信息",@"修改用户信息",@"查询用户信息",@"反馈"];
  36 + [self.view addSubview:self.loginBtn];
  37 + [self.view addSubview:self.thirPartydView];
  38 +
  39 +// UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapGesturedDetected:)]; // 手势类型随你喜欢。
  40 +// tapGesture.delegate = self;
  41 +// [self.view addGestureRecognizer:tapGesture];
  42 +
  43 + _dataArr = @[@"通过手机号修改密码",@"更新附加信息",@"修改用户信息",@"查询用户信息",@"反馈",@"绑定第三方账号"];
36 44 }
37 45  
38 46 - (void)viewWillAppear:(BOOL)animated
... ... @@ -60,6 +68,36 @@
60 68 }
61 69 }
62 70  
  71 +- (void)tapGesturedDetected:(UITapGestureRecognizer *)recognizer
  72 +{
  73 + [UIView animateWithDuration:0.25 animations:^{
  74 + _thirPartydView.frame = CGRectMake(0, KScreenHeight, KScreenWidth, 160);
  75 + }];
  76 +}
  77 +
  78 +#pragma mark - ThirdPartyViewDelegate
  79 +- (void)thirdPartyBtnAction:(NSString *)title
  80 +{
  81 + if ([title isEqualToString:@"微信"]) {
  82 + [[CNLiveThirdLoginManager manager] weChatLoginIsBindingThirdParty:YES];
  83 + } else if ([title isEqualToString:@"微博"]) {
  84 + [[CNLiveThirdLoginManager manager] sinaLoginIsBindingThirdParty:YES];
  85 + } else {
  86 + [[CNLiveThirdLoginManager manager] qqLoginIsBindingThirdParty:YES];
  87 + }
  88 +
  89 + [UIView animateWithDuration:0.25 animations:^{
  90 + _thirPartydView.frame = CGRectMake(0, KScreenHeight, KScreenWidth, 160);
  91 + }];
  92 +}
  93 +
  94 +- (void)cancelThirdView
  95 +{
  96 + [UIView animateWithDuration:0.25 animations:^{
  97 + _thirPartydView.frame = CGRectMake(0, KScreenHeight, KScreenWidth, 160);
  98 + }];
  99 +}
  100 +
63 101 #pragma mark - UITableView
64 102  
65 103 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
... ... @@ -171,6 +209,13 @@
171 209 [Tools toast:[NSString stringWithFormat:@"errorCode : %@ \n errorMessage : %@", errorDic[@"errorCode"],errorDic[@"errorMessage"]]];
172 210 }];
173 211 }
  212 +
  213 + if (indexPath.row == 6) {
  214 +
  215 + [UIView animateWithDuration:0.25 animations:^{
  216 + _thirPartydView.frame = CGRectMake(0, KScreenHeight-160, KScreenWidth, 160);
  217 + }];
  218 + }
174 219 }
175 220  
176 221 - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
... ... @@ -186,7 +231,7 @@
186 231 - (UITableView *)tableView
187 232 {
188 233 if (!_tableView) {
189   - _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight) style:UITableViewStylePlain];
  234 + _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight -80) style:UITableViewStylePlain];
190 235 _tableView.backgroundColor = [UIColor whiteColor];
191 236 _tableView.tableFooterView = [[UIView alloc] init];
192 237 _tableView.delegate = self;
... ... @@ -194,12 +239,20 @@
194 239 }
195 240 return _tableView;
196 241 }
  242 +- (ThirdPartyView *)thirPartydView
  243 +{
  244 + if (!_thirPartydView) {
  245 + _thirPartydView = [[ThirdPartyView alloc] initWithFrame:CGRectMake(0, KScreenHeight, KScreenWidth, 160) binding:YES];
  246 + _thirPartydView.delegate = self;
  247 + }
  248 + return _thirPartydView;
  249 +}
197 250  
198 251 - (UIButton *)loginBtn
199 252 {
200 253 if (!_loginBtn) {
201 254 _loginBtn = [UIButton buttonWithType:UIButtonTypeCustom];
202   - _loginBtn.frame = CGRectMake(20, 53*5+63+12+80, KScreenWidth-40, 40);
  255 + _loginBtn.frame = CGRectMake(20, KScreenHeight-60, KScreenWidth-40, 40);
203 256 [_loginBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
204 257 [_loginBtn setBackgroundColor:[UIColor orangeColor]];
205 258 _loginBtn.titleLabel.font = [UIFont systemFontOfSize:17];
... ... @@ -210,6 +263,11 @@
210 263 return _loginBtn;
211 264 }
212 265  
  266 +- (void)dealloc
  267 +{
  268 + _thirPartydView.delegate = nil;
  269 +}
  270 +
213 271 - (void)didReceiveMemoryWarning {
214 272 [super didReceiveMemoryWarning];
215 273 // Dispose of any resources that can be recreated.
... ...
CNLiveUserSystemDemo/Tools/CNLiveThirdLoginManager.h
... ... @@ -14,10 +14,10 @@
14 14  
15 15 - (BOOL)handleOpenURL:(NSURL *)url;
16 16  
17   -- (void)qqLogin;
  17 +- (void)qqLoginIsBindingThirdParty:(BOOL)Binding;
18 18  
19   -- (void)weChatLogin;
  19 +- (void)weChatLoginIsBindingThirdParty:(BOOL)Binding;
20 20  
21   -- (void)sinaLogin;
  21 +- (void)sinaLoginIsBindingThirdParty:(BOOL)Binding;
22 22  
23 23 @end
... ...
CNLiveUserSystemDemo/Tools/CNLiveThirdLoginManager.m
... ... @@ -16,6 +16,7 @@
16 16 @interface CNLiveThirdLoginManager ()<WXApiDelegate,TencentSessionDelegate,TencentLoginDelegate,WBHttpRequestDelegate,WeiboSDKDelegate>
17 17 {
18 18 TencentOAuth *tencentOAuth;
  19 + BOOL _isBindingThird;
19 20 }
20 21  
21 22 @property (nonatomic, copy)NSString *appCode;
... ... @@ -62,16 +63,28 @@
62 63 }
63 64 }
64 65  
65   --(void)qqLogin
  66 +-(void)qqLoginIsBindingThirdParty:(BOOL)Binding
66 67 {
  68 + if (Binding) {
  69 + _isBindingThird = YES;
  70 + } else {
  71 + _isBindingThird = NO;
  72 + }
  73 +
67 74 tencentOAuth = [[TencentOAuth alloc] initWithAppId:QQAppKey andDelegate:self];
68 75 NSArray *permissions = [NSArray arrayWithObjects:kOPEN_PERMISSION_GET_VIP_INFO, kOPEN_PERMISSION_GET_USER_INFO, kOPEN_PERMISSION_GET_SIMPLE_USER_INFO, nil];
69 76 [tencentOAuth authorize:permissions inSafari:NO];
70 77  
71 78 }
72 79  
73   -- (void)weChatLogin
  80 +- (void)weChatLoginIsBindingThirdParty:(BOOL)Binding
74 81 {
  82 + if (Binding) {
  83 + _isBindingThird = YES;
  84 + } else {
  85 + _isBindingThird = NO;
  86 + }
  87 +
75 88 if ([WXApi isWXAppInstalled]) {
76 89 SendAuthReq* req = [[SendAuthReq alloc] init];
77 90 req.scope = @"snsapi_userinfo";
... ... @@ -83,9 +96,15 @@
83 96 }
84 97 }
85 98  
86   -- (void)sinaLogin
  99 +- (void)sinaLoginIsBindingThirdParty:(BOOL)Binding
87 100 {
88 101  
  102 + if (Binding) {
  103 + _isBindingThird = YES;
  104 + } else {
  105 + _isBindingThird = NO;
  106 + }
  107 +
89 108 WBAuthorizeRequest *request = [WBAuthorizeRequest request];
90 109 request.redirectURI = kSinaRedirectURI;
91 110 request.scope = @"all";
... ... @@ -111,26 +130,38 @@
111 130  
112 131 NSDictionary *result = response.jsonResponse;
113 132  
114   - NSString *gender;
115   - if ([[result objectForKey:@"gender"] isEqualToString:@"女"]) {
116   - gender = @"f";
117   - } else if ([[result objectForKey:@"gender"] isEqualToString:@"男"]) {
118   - gender = @"m";
  133 + if (_isBindingThird) {
  134 +
  135 + UserInfoModel *model = [UserInfoModel modelWithKeyValues:[Tools getLocalUserInfo]];
  136 +
  137 + [CNLiveUserSystemCenter bindingThirdPartyWithUid:model.uid thirdPartyPlatType:@"2" thirdPartyId:[tencentOAuth getUserOpenID] success:^(id result) {
  138 + NSLog(@"绑定成功----%@",result);
  139 + } failure:^(NSDictionary *errorDic) {
  140 + NSLog(@"绑定失败----%@",errorDic);
  141 + }];
  142 +
119 143 } else {
120   - gender = @"n";
121   - }
122   -
123   - [CNLiveUserSystemCenter thirdPartyLoginWithThirdPartyPlatType:@"2" thirdPartyId:[tencentOAuth getUserOpenID] nickName:[result objectForKey:@"nickname"] gender:gender location:[result objectForKey:@"city"] faceUrl:[result objectForKey:@"figureurl"] frmId:nil success:^(id result) {
124   - NSLog(@"qq登录------%@",result);
  144 + NSString *gender;
  145 + if ([[result objectForKey:@"gender"] isEqualToString:@"女"]) {
  146 + gender = @"f";
  147 + } else if ([[result objectForKey:@"gender"] isEqualToString:@"男"]) {
  148 + gender = @"m";
  149 + } else {
  150 + gender = @"n";
  151 + }
125 152  
126   - [Tools setUserLogin:YES];
127   - [SVProgressHUD showSuccessWithStatus:@"登录成功"];
128   - [UserInfoSava saveUserinfoDic:result[@"data"]];
129   - [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginSuccess object:nil userInfo:nil];
130   -
131   - } failure:^(NSDictionary *errorDic) {
132   - [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginFailure object:nil userInfo:nil];
133   - }];
  153 + [CNLiveUserSystemCenter thirdPartyLoginWithThirdPartyPlatType:@"2" thirdPartyId:[tencentOAuth getUserOpenID] nickName:[result objectForKey:@"nickname"] gender:gender location:[result objectForKey:@"city"] faceUrl:[result objectForKey:@"figureurl"] frmId:nil success:^(id result) {
  154 + NSLog(@"qq登录------%@",result);
  155 +
  156 + [Tools setUserLogin:YES];
  157 + [SVProgressHUD showSuccessWithStatus:@"登录成功"];
  158 + [UserInfoSava saveUserinfoDic:result[@"data"]];
  159 + [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginSuccess object:nil userInfo:nil];
  160 +
  161 + } failure:^(NSDictionary *errorDic) {
  162 + [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginFailure object:nil userInfo:nil];
  163 + }];
  164 + }
134 165 }
135 166  
136 167 //非网络错误导致登录失败:
... ... @@ -217,44 +248,55 @@
217 248 if (data) {
218 249 NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
219 250  
220   - if ([[dic allKeys] containsObject:@"errcode"]) {
  251 + if (_isBindingThird) {
  252 + UserInfoModel *model = [UserInfoModel modelWithKeyValues:[Tools getLocalUserInfo]];
  253 +
  254 + [CNLiveUserSystemCenter bindingThirdPartyWithUid:model.uid thirdPartyPlatType:@"3" thirdPartyId:dic[@"openid"] success:^(id result) {
  255 + NSLog(@"绑定成功----%@",result);
  256 + } failure:^(NSDictionary *errorDic) {
  257 + NSLog(@"绑定失败----%@",errorDic);
  258 + }];
221 259  
222   - [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginFailure object:nil userInfo:nil];
223 260 } else {
224   -
225   - NSString *getGender = [dic objectForKey:@"sex"];
226   - NSString *gender;
227   - switch ([getGender intValue]) {
228   - case 0:
229   - {
230   - gender = @"n";
231   - }
232   - break;
233   - case 1:
234   - {
235   - gender = @"m";
236   - }
237   - break;
238   - case 2:
239   - {
240   - gender = @"f";
241   - }
242   - break;
243   - default:
244   - break;
245   - }
246   -
247   - [CNLiveUserSystemCenter thirdPartyLoginWithThirdPartyPlatType:@"3" thirdPartyId:[dic objectForKey:@"openid"] nickName:[dic objectForKey:@"nickname"] gender:gender location:[dic objectForKey:@"country"] faceUrl:[dic objectForKey:@"headimgurl"] frmId:nil success:^(id result) {
248   - NSLog(@"微信登录------%@",result);
  261 + if ([[dic allKeys] containsObject:@"errcode"]) {
249 262  
250   - [Tools setUserLogin:YES];
251   - [SVProgressHUD showSuccessWithStatus:@"登录成功"];
252   - [UserInfoSava saveUserinfoDic:result[@"data"]];
253   - [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginSuccess object:nil userInfo:nil];
254   -
255   - } failure:^(NSDictionary *errorDic) {
256 263 [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginFailure object:nil userInfo:nil];
257   - }];
  264 + } else {
  265 +
  266 + NSString *getGender = [dic objectForKey:@"sex"];
  267 + NSString *gender;
  268 + switch ([getGender intValue]) {
  269 + case 0:
  270 + {
  271 + gender = @"n";
  272 + }
  273 + break;
  274 + case 1:
  275 + {
  276 + gender = @"m";
  277 + }
  278 + break;
  279 + case 2:
  280 + {
  281 + gender = @"f";
  282 + }
  283 + break;
  284 + default:
  285 + break;
  286 + }
  287 +
  288 + [CNLiveUserSystemCenter thirdPartyLoginWithThirdPartyPlatType:@"3" thirdPartyId:[dic objectForKey:@"openid"] nickName:[dic objectForKey:@"nickname"] gender:gender location:[dic objectForKey:@"country"] faceUrl:[dic objectForKey:@"headimgurl"] frmId:nil success:^(id result) {
  289 + NSLog(@"微信登录------%@",result);
  290 +
  291 + [Tools setUserLogin:YES];
  292 + [SVProgressHUD showSuccessWithStatus:@"登录成功"];
  293 + [UserInfoSava saveUserinfoDic:result[@"data"]];
  294 + [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginSuccess object:nil userInfo:nil];
  295 +
  296 + } failure:^(NSDictionary *errorDic) {
  297 + [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginFailure object:nil userInfo:nil];
  298 + }];
  299 + }
258 300 }
259 301 }
260 302 });
... ... @@ -262,7 +304,7 @@
262 304 });
263 305 }
264 306  
265   -#pragma mark - <#mark#>
  307 +#pragma mark - sinaDelegate
266 308 - (void)didReceiveWeiboRequest:(WBBaseRequest *)request
267 309 {
268 310  
... ... @@ -293,24 +335,37 @@
293 335 if ([request.tag isEqualToString:@"userinfo"]) {
294 336 NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
295 337  
296   - NSString *gender;
297   - if ([dic objectForKey:@"gender"]) {
298   - gender = [dic objectForKey:@"gender"];
  338 + if (_isBindingThird) {
  339 +
  340 + UserInfoModel *model = [UserInfoModel modelWithKeyValues:[Tools getLocalUserInfo]];
  341 +
  342 + [CNLiveUserSystemCenter bindingThirdPartyWithUid:model.uid thirdPartyPlatType:@"1" thirdPartyId:[dic objectForKey:@"id"] success:^(id result) {
  343 + NSLog(@"绑定成功----%@",result);
  344 + } failure:^(NSDictionary *errorDic) {
  345 + NSLog(@"绑定失败----%@",errorDic);
  346 + }];
  347 +
299 348 } else {
300   - gender = @"n";
301   - }
302   -
303   - [CNLiveUserSystemCenter thirdPartyLoginWithThirdPartyPlatType:@"1" thirdPartyId:[dic objectForKey:@"id"] nickName:[dic objectForKey:@"name"] gender:gender location:[dic objectForKey:@"location"] faceUrl:[dic objectForKey:@"avatar_hd"] frmId:nil success:^(id result) {
304   - NSLog(@"微博登录------%@",result);
305 349  
306   - [Tools setUserLogin:YES];
307   - [SVProgressHUD showSuccessWithStatus:@"登录成功"];
308   - [UserInfoSava saveUserinfoDic:result[@"data"]];
309   - [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginSuccess object:nil userInfo:nil];
310   -
311   - } failure:^(NSDictionary *errorDic) {
312   - [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginFailure object:nil userInfo:nil];
313   - }];
  350 + NSString *gender;
  351 + if ([dic objectForKey:@"gender"]) {
  352 + gender = [dic objectForKey:@"gender"];
  353 + } else {
  354 + gender = @"n";
  355 + }
  356 +
  357 + [CNLiveUserSystemCenter thirdPartyLoginWithThirdPartyPlatType:@"1" thirdPartyId:[dic objectForKey:@"id"] nickName:[dic objectForKey:@"name"] gender:gender location:[dic objectForKey:@"location"] faceUrl:[dic objectForKey:@"avatar_hd"] frmId:nil success:^(id result) {
  358 + NSLog(@"微博登录------%@",result);
  359 +
  360 + [Tools setUserLogin:YES];
  361 + [SVProgressHUD showSuccessWithStatus:@"登录成功"];
  362 + [UserInfoSava saveUserinfoDic:result[@"data"]];
  363 + [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginSuccess object:nil userInfo:nil];
  364 +
  365 + } failure:^(NSDictionary *errorDic) {
  366 + [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginFailure object:nil userInfo:nil];
  367 + }];
  368 + }
314 369 }
315 370 }
316 371  
... ...
CNLiveUserSystemDemo/Views/ThirdPartyView.h 0 → 100644
  1 +//
  2 +// ThirdPartyView.h
  3 +// CNLiveUserSystemDemo
  4 +//
  5 +// Created by iOS on 16/11/18.
  6 +// Copyright © 2016年 zhulin. All rights reserved.
  7 +//
  8 +
  9 +#import <UIKit/UIKit.h>
  10 +
  11 +@protocol ThirdPartyViewDelegate <NSObject>
  12 +
  13 +- (void)thirdPartyBtnAction:(NSString *)title;
  14 +
  15 +@optional
  16 +- (void)cancelThirdView;
  17 +
  18 +@end
  19 +
  20 +@interface ThirdPartyView : UIView
  21 +
  22 +@property (nonatomic, assign) id<ThirdPartyViewDelegate> delegate;
  23 +
  24 +- (instancetype)initWithFrame:(CGRect)frame binding:(BOOL)binding;
  25 +
  26 +@end
... ...
CNLiveUserSystemDemo/Views/ThirdPartyView.m 0 → 100644
  1 +//
  2 +// ThirdPartyView.m
  3 +// CNLiveUserSystemDemo
  4 +//
  5 +// Created by iOS on 16/11/18.
  6 +// Copyright © 2016年 zhulin. All rights reserved.
  7 +//
  8 +
  9 +#import "ThirdPartyView.h"
  10 +
  11 +#define SpaceWidth (KScreenWidth-80*3)/4
  12 +@interface ThirdPartyView ()
  13 +
  14 +@property (nonatomic, strong) UIButton *weChatBtn;
  15 +@property (nonatomic, strong) UIButton *sinaBtn;
  16 +@property (nonatomic, strong) UIButton *qqBtn;
  17 +@property (nonatomic, strong) UILabel *thirdpartyLoginLbl;
  18 +@property (nonatomic, strong) UIButton *cancelBtn;
  19 +
  20 +@end
  21 +
  22 +@implementation ThirdPartyView
  23 +
  24 +- (instancetype)initWithFrame:(CGRect)frame binding:(BOOL)binding
  25 +{
  26 + self = [super initWithFrame:frame];
  27 + if (self) {
  28 + self.backgroundColor = [UIColor blackColor];
  29 + [self addSubview:self.sinaBtn];
  30 + [self addSubview:self.qqBtn];
  31 + [self addSubview:self.weChatBtn];
  32 + [self addSubview:self.thirdpartyLoginLbl];
  33 +
  34 + if (binding) {
  35 + [self addSubview:self.cancelBtn];
  36 + }
  37 + }
  38 + return self;
  39 +}
  40 +
  41 +#pragma mark - ****************action******
  42 +- (void)thirdPartyBtnAction:(UIButton *)button
  43 +{
  44 + if (self.delegate && [self.delegate respondsToSelector:@selector(thirdPartyBtnAction:)]) {
  45 + [self.delegate thirdPartyBtnAction:button.titleLabel.text];
  46 + }
  47 +}
  48 +
  49 +- (void)cancelBtnAction
  50 +{
  51 + if (self.delegate && [self.delegate respondsToSelector:@selector(cancelThirdView)]) {
  52 + [self.delegate cancelThirdView];
  53 + }
  54 +}
  55 +
  56 +#pragma mark - ****************getter******
  57 +
  58 +- (UILabel *)thirdpartyLoginLbl
  59 +{
  60 + if (!_thirdpartyLoginLbl) {
  61 + _thirdpartyLoginLbl = [[UILabel alloc] initWithFrame:CGRectMake(0, 20, KScreenWidth, 15)];
  62 + _thirdpartyLoginLbl.textAlignment = NSTextAlignmentCenter;
  63 + _thirdpartyLoginLbl.textColor = [UIColor orangeColor];
  64 + _thirdpartyLoginLbl.text = @"第三方平台";
  65 + _thirdpartyLoginLbl.font = [UIFont systemFontOfSize:15];
  66 + }
  67 + return _thirdpartyLoginLbl;
  68 +}
  69 +
  70 +- (UIButton *)weChatBtn
  71 +{
  72 + if (!_weChatBtn) {
  73 + _weChatBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  74 + _weChatBtn.backgroundColor = [UIColor orangeColor];
  75 + [_weChatBtn setFrame:CGRectMake(SpaceWidth, 70, 80, 40)];
  76 + _weChatBtn.layer.cornerRadius = 20;
  77 + _weChatBtn.layer.masksToBounds = YES;
  78 + [_weChatBtn setTitle:@"微信" forState:UIControlStateNormal];
  79 + [_weChatBtn addTarget:self action:@selector(thirdPartyBtnAction:) forControlEvents:UIControlEventTouchUpInside];
  80 + }
  81 + return _weChatBtn;
  82 +}
  83 +
  84 +- (UIButton *)sinaBtn
  85 +{
  86 + if (!_sinaBtn) {
  87 + _sinaBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  88 + _sinaBtn.backgroundColor = [UIColor orangeColor];
  89 + [_sinaBtn setFrame:CGRectMake(SpaceWidth*2+80, 70, 80, 40)];
  90 + _sinaBtn.layer.cornerRadius = 20;
  91 + _sinaBtn.layer.masksToBounds = YES;
  92 + [_sinaBtn setTitle:@"微博" forState:UIControlStateNormal];
  93 + [_sinaBtn addTarget:self action:@selector(thirdPartyBtnAction:) forControlEvents:UIControlEventTouchUpInside];
  94 + }
  95 + return _sinaBtn;
  96 +}
  97 +
  98 +- (UIButton *)qqBtn
  99 +{
  100 + if (!_qqBtn) {
  101 + _qqBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  102 + _qqBtn.backgroundColor = [UIColor orangeColor];
  103 + [_qqBtn setFrame:CGRectMake(SpaceWidth*3+80*2, 70, 80, 40)];
  104 + _qqBtn.layer.cornerRadius = 20;
  105 + _qqBtn.layer.masksToBounds = YES;
  106 + [_qqBtn setTitle:@"QQ" forState:UIControlStateNormal];
  107 + [_qqBtn addTarget:self action:@selector(thirdPartyBtnAction:) forControlEvents:UIControlEventTouchUpInside];
  108 + }
  109 + return _qqBtn;
  110 +}
  111 +
  112 +- (UIButton *)cancelBtn
  113 +{
  114 + if (!_cancelBtn) {
  115 + _cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  116 + _cancelBtn.frame = CGRectMake(self.bounds.size.width-30, 10, 20, 20);
  117 + [_cancelBtn setBackgroundImage:[UIImage imageNamed:@"cancel"] forState:UIControlStateNormal];
  118 + [_cancelBtn addTarget:self action:@selector(cancelBtnAction) forControlEvents:UIControlEventTouchUpInside];
  119 + }
  120 + return _cancelBtn;
  121 +}
  122 +
  123 +@end
... ...
CNLiveUserSystemDemo/cancel.png 0 → 100644

5.67 KB

CNLiveUserSystemSDK.xcodeproj/project.xcworkspace/xcuserdata/iOS.xcuserdatad/UserInterfaceState.xcuserstate
No preview for this file type
CNLiveUserSystemSDK/Info.plist
... ... @@ -17,7 +17,7 @@
17 17 <key>CFBundleShortVersionString</key>
18 18 <string>1.1.2</string>
19 19 <key>CFBundleVersion</key>
20   - <string>1.1.12.111714</string>
  20 + <string>1.1.2.112110</string>
21 21 <key>NSPrincipalClass</key>
22 22 <string></string>
23 23 </dict>
... ...
Products/CNLiveUserSystemSDK.framework/CNLiveUserSystemSDK
No preview for this file type
Products/CNLiveUserSystemSDK.framework/Headers/CNLiveUserSystemCenter.h
... ... @@ -22,6 +22,7 @@
22 22 */
23 23 + (void)setAppId:(NSString *)appId appKey:(NSString *)appKey appSecret:(NSString *)appSecret;
24 24  
  25 +
25 26 /**
26 27 @abstract 注册
27 28 @param userName 邮箱或手机
... ... @@ -32,11 +33,12 @@
32 33 @param success 成功回调
33 34 @param failure 失败回调
34 35 */
35   -+ (void)registerWithUserName:(NSString *)userName password:(NSString *)password verificationCode:(NSString *)verificationCode invitationCode:(NSString *)invitationCode frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSError *error))failure;
  36 ++ (void)registerWithUserName:(NSString *)userName password:(NSString *)password verificationCode:(NSString *)verificationCode invitationCode:(NSString *)invitationCode frmId:(NSString *)frmId success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure;
  37 +
36 38  
37 39 /**
38 40 @abstract 第三方登录
39   - @param plat 第三方平台编号(如plat: 1:sina weibo 2:qq weibo 3:weixin 4:renren 注:如qq登录,plat=@"2")
  41 + @param plat 第三方平台编号(如plat: 1:sina weibo 2:qq 3:weixin 4:renren 注:如qq登录,plat=@"2")
40 42 @param thirdPartyId 第三方用户ID
41 43 @param nickName 用户昵称
42 44 @param gender 性别,m:男、f:女、n:未知(非必填)
... ... @@ -46,7 +48,8 @@
46 48 @param success 成功回调
47 49 @param failure 失败回调
48 50 */
49   -+ (void)thirdPartyLoginWithThirdPartyPlatType:(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 (^)(NSError *error))failure;
  51 ++ (void)thirdPartyLoginWithThirdPartyPlatType:(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;
  52 +
50 53  
51 54 /**
52 55 @abstract 快捷登录
... ... @@ -56,7 +59,8 @@
56 59 @param success 成功回调
57 60 @param failure 失败回调
58 61 */
59   -+ (void)shortcutLoginWithUserName:(NSString *)userName verificationCode:(NSString *)verificationCode frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSError *error))failure;
  62 ++ (void)shortcutLoginWithUserName:(NSString *)userName verificationCode:(NSString *)verificationCode frmId:(NSString *)frmId success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure;
  63 +
60 64  
61 65 /**
62 66 @abstract 登录
... ... @@ -66,7 +70,8 @@
66 70 @param success 成功回调
67 71 @param failure 失败回调
68 72 */
69   -+ (void)loginWithUserName:(NSString *)userName password:(NSString *)password frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSError *error))failure;
  73 ++ (void)loginWithUserName:(NSString *)userName password:(NSString *)password frmId:(NSString *)frmId success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure;
  74 +
70 75  
71 76 /**
72 77 @abstract 发送验证码
... ... @@ -75,7 +80,8 @@
75 80 @param success 成功回调
76 81 @param failure 失败回调
77 82 */
78   -+ (void)verificationCodeType:(VerificationCodeType)type mobile:(NSString *)mobile success:(void (^)(id result))success failure :(void (^)(NSError *error))failure;
  83 ++ (void)verificationCodeType:(VerificationCodeType)type mobile:(NSString *)mobile success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure;
  84 +
79 85  
80 86 /**
81 87 @abstract 更新用户附加信息
... ... @@ -84,7 +90,8 @@
84 90 @param success 成功回调
85 91 @param failure 失败回调
86 92 */
87   -+ (void)updateOtherInfoWithUid:(NSString *)uid extInfo:(NSString *)extInfo success:(void (^)(id result))success failure :(void (^)(NSError *error))failure;
  93 ++ (void)updateOtherInfoWithUid:(NSString *)uid extInfo:(NSString *)extInfo success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure;
  94 +
88 95  
89 96 /**
90 97 @abstract 修改用户单项信息
... ... @@ -94,7 +101,8 @@
94 101 @param success 成功回调
95 102 @param failure 失败回调
96 103 */
97   -+ (void)modifyUserInfoType:(UserInfoType)type uid:(NSString *)uid modifyInfo:(NSString *)info success:(void (^)(id result))success failure :(void (^)(NSError *error))failure;
  104 ++ (void)modifyUserInfoType:(UserInfoType)type uid:(NSString *)uid modifyInfo:(NSString *)info success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure;
  105 +
98 106  
99 107 /**
100 108 @abstract 更新手机号
... ... @@ -104,7 +112,19 @@
104 112 @param success 成功回调
105 113 @param failure 失败回调
106 114 */
107   -+ (void)updateMobileWithUid:(NSString *)uid mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure :(void (^)(NSError *error))failure;
  115 ++ (void)updateMobileWithUid:(NSString *)uid mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure;
  116 +
  117 +
  118 +/**
  119 + @abstract 绑定第三方账号
  120 + @param uid 用户ID
  121 + @param plat 第三方平台编号(如platform: 1:sina weibo 2:qq 3:weixin 4:renren 注:如绑定qq,thirdPartyPlat = @"2")
  122 + @param thirdPartyId 第三方用户ID
  123 + @param success 成功回调
  124 + @param failure 失败回调
  125 + */
  126 ++ (void)bindingThirdPartyWithUid:(NSString *)uid thirdPartyPlatType:(NSString *)plat thirdPartyId:(NSString *)thirdPartyId success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure;
  127 +
108 128  
109 129 /**
110 130 @abstract 修改密码(通过手机号修改)
... ... @@ -114,7 +134,8 @@
114 134 @param success 成功回调
115 135 @param failure 失败回调
116 136 */
117   -+ (void)changePasswordWithMobile:(NSString *)mobile verificationCode:(NSString *)verificationCode newPassword:(NSString *)newPassword success:(void (^)(id result))success failure :(void (^)(NSError *error))failure;
  137 ++ (void)changePasswordWithMobile:(NSString *)mobile verificationCode:(NSString *)verificationCode newPassword:(NSString *)newPassword success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure;
  138 +
118 139  
119 140 /**
120 141 @abstract 上传头像
... ... @@ -123,7 +144,8 @@
123 144 @param success 成功回调
124 145 @param failure 失败回调
125 146 */
126   -+ (void)uploadIconWithUid:(NSString *)uid icon:(UIImage *)icon success:(void (^)(id result))success failure :(void (^)(NSError *error))failure;
  147 ++ (void)uploadIconWithUid:(NSString *)uid icon:(UIImage *)icon success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure;
  148 +
127 149  
128 150 /**
129 151 @abstract 查询用户信息
... ... @@ -132,7 +154,8 @@
132 154 @param success 成功回调
133 155 @param failure 失败回调
134 156 */
135   -+ (void)queryUserInfoWithUid:(NSString *)uid srcUid:(NSString *)srcUid success:(void (^)(id result))success failure :(void (^)(NSError *error))failure;
  157 ++ (void)queryUserInfoWithUid:(NSString *)uid srcUid:(NSString *)srcUid success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure;
  158 +
136 159  
137 160 /**
138 161 @abstract 用户反馈
... ... @@ -141,7 +164,8 @@
141 164 @param success 成功回调
142 165 @param failure 失败回调
143 166 */
144   -+ (void)feedbackWithContentId:(NSString *)contentId message:(NSString *)message success:(void (^)(id result))success failure :(void (^)(NSError *error))failure;
  167 ++ (void)feedbackWithContentId:(NSString *)contentId message:(NSString *)message success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure;
  168 +
145 169  
146 170 /**
147 171 * 获取SDK版本号
... ...
Products/CNLiveUserSystemSDK.framework/Info.plist
No preview for this file type
用户系统.pages
No preview for this file type