Commit bab6c691fe9a2bf86f5f7f29168e1ad1bf990553
1 parent
0994d116
no message
Showing
2 changed files
with
121 additions
and
10 deletions
Example/CNLiveIntegralModule/CNLIVEAppDelegate.m
| ... | ... | @@ -7,30 +7,33 @@ |
| 7 | 7 | // |
| 8 | 8 | |
| 9 | 9 | #import "CNLIVEAppDelegate.h" |
| 10 | + | |
| 11 | +#import <CommonCrypto/CommonDigest.h> | |
| 12 | + | |
| 10 | 13 | #import "CNLiveEnvironment.h" |
| 14 | +#import <CNLiveRequestBastKit/CNLiveNetworking.h> | |
| 15 | + | |
| 16 | +#import "CNLIVEViewController.h" | |
| 11 | 17 | #import "CNLiveTaskListController.h" |
| 12 | -#import "CNLiveGoldWhereaboutsView.h" | |
| 13 | -#import "CNLiveAddScoreView.h" | |
| 14 | -#import "CNLiveSignInView.h" | |
| 15 | -#import "CNLiveIntegralServiceProtocol.h" | |
| 16 | -@interface CNLIVEAppDelegate()<CNLiveAddScoreViewDelegate> | |
| 18 | + | |
| 19 | +@interface CNLIVEAppDelegate() | |
| 17 | 20 | |
| 18 | 21 | @end |
| 19 | 22 | @implementation CNLIVEAppDelegate |
| 20 | -- (void)loginNow{ | |
| 21 | - | |
| 22 | -} | |
| 23 | 23 | |
| 24 | 24 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions |
| 25 | 25 | { |
| 26 | 26 | // Override point for customization after application launch. |
| 27 | 27 | |
| 28 | - [CNLiveEnvironmentManager setEnvironment:CNLiveDebugAppStore]; | |
| 29 | - | |
| 28 | + [CNLiveEnvironmentManager setEnvironment:CNLiveProductionAppStore]; | |
| 29 | + [self networkParamAction]; | |
| 30 | + | |
| 30 | 31 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; |
| 31 | 32 | |
| 32 | 33 | CNLiveTaskListController *vc = [[CNLiveTaskListController alloc] init]; |
| 33 | 34 | |
| 35 | +// CNLIVEViewController *vc = [[CNLIVEViewController alloc] init]; | |
| 36 | + | |
| 34 | 37 | UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vc]; |
| 35 | 38 | |
| 36 | 39 | self.window.rootViewController = nav;//设置根视图控制器 |
| ... | ... | @@ -67,4 +70,23 @@ |
| 67 | 70 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. |
| 68 | 71 | } |
| 69 | 72 | |
| 73 | +- (void)networkParamAction{ | |
| 74 | + NSMutableDictionary * mDict = [[NSMutableDictionary alloc] init]; | |
| 75 | + [mDict setValue:@"10514405" forKey:@"loginSid"]; | |
| 76 | + | |
| 77 | + [mDict setValue:BundleId forKey:@"platform_id"]; | |
| 78 | + | |
| 79 | + [mDict setValue:[[[[UIDevice currentDevice] identifierForVendor] UUIDString] stringByReplacingOccurrencesOfString:@"-" withString:@""] forKey:@"uuid"]; | |
| 80 | + [mDict setValue:@"i" forKey:@"plat"]; | |
| 81 | + [mDict setValue:@"1.7.8.19.10.30.15"forKey:@"ver"]; | |
| 82 | + [mDict setObject:AppId forKey:@"appId"]; | |
| 83 | + [CNLiveNetworking setupDefaultParam:mDict]; | |
| 84 | + [CNLiveNetworking setupShowResult:NO]; | |
| 85 | + [CNLiveNetworking setupSignKey:APPKey]; | |
| 86 | + [CNLiveNetworking setAllowRequestDefaultArgument:YES]; | |
| 87 | + [CNLiveNetworking setResponseSerializerType:CNLiveResponseSerializerJSON]; | |
| 88 | + | |
| 89 | +} | |
| 90 | + | |
| 91 | + | |
| 70 | 92 | @end | ... | ... |
Example/CNLiveIntegralModule/CNLIVEViewController.m
| ... | ... | @@ -8,6 +8,10 @@ |
| 8 | 8 | |
| 9 | 9 | #import "CNLIVEViewController.h" |
| 10 | 10 | |
| 11 | +#import "CNLiveEnvironment.h" | |
| 12 | +#import "CNLiveNetworking.h" | |
| 13 | +#import "CNUserInfoManager.h" | |
| 14 | + | |
| 11 | 15 | @interface CNLIVEViewController () |
| 12 | 16 | |
| 13 | 17 | @end |
| ... | ... | @@ -17,9 +21,94 @@ |
| 17 | 21 | - (void)viewDidLoad |
| 18 | 22 | { |
| 19 | 23 | [super viewDidLoad]; |
| 24 | + self.view.backgroundColor = [UIColor whiteColor]; | |
| 20 | 25 | // Do any additional setup after loading the view, typically from a nib. |
| 26 | + NSArray *userIds = @[@"10514405"]; | |
| 27 | + | |
| 28 | + for(int i = 0; i < userIds.count; i++ ){ | |
| 29 | + [self request:userIds[i]]; | |
| 30 | + } | |
| 31 | + | |
| 21 | 32 | } |
| 22 | 33 | |
| 34 | +- (void)request:(NSString *)userId{ | |
| 35 | + // 积分 | |
| 36 | + // 签到 | |
| 37 | + NSDictionary *params = @{@"sid":userId,@"appId":AppId}; | |
| 38 | + [CNLiveNetworking setAllowRequestDefaultArgument:YES]; | |
| 39 | + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNIntegralSignInUrl Param:params CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | |
| 40 | + | |
| 41 | + }]; | |
| 42 | + | |
| 43 | + //1.观看视频/分享目击者视频 | |
| 44 | + NSArray *contentIds1 = @[@"769_cf49366d0e274bd2a8c6ecc751ddbab6", | |
| 45 | + @"769_afe6c01e49784eb79ce32e240be3e029", | |
| 46 | + @"769_799f6825b3d14e8c885049e5542ed56a", | |
| 47 | + @"769_fc8fb5e3aab1412c91b032b2297b9e76", | |
| 48 | + @"769_bd81aa260e1f4f569fb549af51c5004e", | |
| 49 | + @"769_938f9aca45ec4c0dbd860438fcac29fc", | |
| 50 | + @"769_62c8ed911f5e4a8e90e808b928794fa0", | |
| 51 | + @"769_3eba7437d0484328b31c6b7f61345a3d", | |
| 52 | + @"769_0a637e368210483f94537a8d9af2e130", | |
| 53 | + @"769_2516ed081c95405dbfa357298ec25dd7"]; | |
| 54 | + for(int i = 0; i < contentIds1.count; i++ ){ | |
| 55 | + NSDictionary *params1 = @{@"sid":userId,@"taskId":@"watch_video",@"contentId":contentIds1[i],@"appId":AppId}; | |
| 56 | + [CNLiveNetworking setAllowRequestDefaultArgument:YES]; | |
| 57 | + [CNLiveNetworking setupShowDataResult:NO]; | |
| 58 | + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNIntegralAddUrl Param:params1 CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | |
| 59 | + | |
| 60 | + }]; | |
| 61 | + | |
| 62 | + NSDictionary *params2 = @{@"sid":userId,@"taskId":@"share_video",@"contentId":contentIds1[i],@"appId":AppId}; | |
| 63 | + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNIntegralAddUrl Param:params2 CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | |
| 64 | + | |
| 65 | + }]; | |
| 66 | + | |
| 67 | + } | |
| 68 | + | |
| 69 | + //2.听本小说 | |
| 70 | + NSArray *contentIds2 = @[@"300827", | |
| 71 | + @"300853", | |
| 72 | + @"300945", | |
| 73 | + @"300946", | |
| 74 | + @"300947", | |
| 75 | + @"300948", | |
| 76 | + @"329015", | |
| 77 | + @"329016", | |
| 78 | + @"329027", | |
| 79 | + @"329028", | |
| 80 | + @"329079"]; | |
| 81 | + for(int i = 0; i < contentIds2.count; i++ ){ | |
| 82 | + NSDictionary *params = @{@"sid":userId,@"taskId":@"listen_novel",@"contentId":contentIds2[i],@"appId":AppId}; | |
| 83 | + [CNLiveNetworking setAllowRequestDefaultArgument:YES]; | |
| 84 | + [CNLiveNetworking setupShowDataResult:NO]; | |
| 85 | + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNIntegralAddUrl Param:params CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | |
| 86 | + | |
| 87 | + }]; | |
| 88 | + } | |
| 89 | + | |
| 90 | + //3.啃篇文档/分享文章内容 | |
| 91 | + NSArray *contentIds3 = @[@"399227",@"399219",@"399204",@"399384",@"399382",@"968",@"399381",@"399380",@"399377",@"399376",@"399373"]; | |
| 92 | + for(int i = 0; i < contentIds3.count; i++ ){ | |
| 93 | + NSDictionary *params1 = @{@"sid":userId,@"taskId":@"read_article",@"contentId":contentIds2[i],@"appId":AppId}; | |
| 94 | + [CNLiveNetworking setAllowRequestDefaultArgument:YES]; | |
| 95 | + [CNLiveNetworking setupShowDataResult:NO]; | |
| 96 | + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNIntegralAddUrl Param:params1 CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | |
| 97 | + | |
| 98 | + }]; | |
| 99 | + | |
| 100 | + NSDictionary *params2 = @{@"sid":userId,@"taskId":@"share_article",@"contentId":contentIds3[i],@"appId":AppId}; | |
| 101 | + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNIntegralAddUrl Param:params2 CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | |
| 102 | + | |
| 103 | + }]; | |
| 104 | + | |
| 105 | + NSDictionary *params3 = @{@"sid":userId,@"taskId":@"publish_comment",@"contentId":contentIds3[i],@"appId":AppId}; | |
| 106 | + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNIntegralAddUrl Param:params3 CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | |
| 107 | + | |
| 108 | + }]; | |
| 109 | + | |
| 110 | + } | |
| 111 | +} | |
| 23 | 112 | - (void)didReceiveMemoryWarning |
| 24 | 113 | { |
| 25 | 114 | [super didReceiveMemoryWarning]; | ... | ... |