Authored by 盖剑秋

Add secret.

... ... @@ -23,6 +23,8 @@
#import "YH_BarrageViewController.h"
#import "YH_SocketService.h"
#import "UIViewAdditions.h"
#import <CommonCrypto/CommonDigest.h>
//static const NSInteger socketMaxRetryCount = 3;
... ... @@ -587,9 +589,11 @@
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
manager.responseSerializer.acceptableContentTypes = [manager.responseSerializer.acceptableContentTypes setByAddingObject:@"text/html"];
manager.requestSerializer = [YH_HTTPRequestSerializer new];
NSString *temp=[NSString stringWithFormat:@"%@yohocms",_currentChannel.room?:@"0"];
NSString *md5 = [self md5:temp];
NSURLSessionDataTask *task = [manager
GET:@"http://newboys.test.yoho.cn/yohoboyins/v4/qcloud/startLive"
parameters:@{@"cid":_currentChannel.room?:@"0"}
parameters:@{@"cid":_currentChannel.room?:@"0",@"secret":md5}
progress:^(NSProgress * _Nonnull downloadProgress) {
NSLog(@"aaaa");
}
... ... @@ -631,9 +635,12 @@
NSLog(@"%@----%@",_currentChannel.room,_currentChannel.cid);
NSString *temp=[NSString stringWithFormat:@"%@yohocms",_currentChannel.room?:@"0"];
NSString *md5 = [self md5:temp];
NSURLSessionDataTask *task = [manager
GET:@"http://newboys.test.yoho.cn/yohoboyins/v4/qcloud/closeLive"
parameters:@{@"cid":_currentChannel.room?:@"0"}
parameters:@{@"cid":_currentChannel.room?:@"0",@"secret":md5}
progress:NULL
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
NSLog(@"bbbb%@",responseObject);
... ... @@ -650,6 +657,21 @@
}
}
- (NSString *)md5:(NSString *)str
{
const char *cStr = [str UTF8String];
unsigned char result[16];
CC_MD5(cStr, (CC_LONG)strlen(cStr), result); // This is the md5 call
return [NSString stringWithFormat:
@"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
result[0], result[1], result[2], result[3],
result[4], result[5], result[6], result[7],
result[8], result[9], result[10], result[11],
result[12], result[13], result[14], result[15]
];
}
- (void)hideAllToolView {
_vBeauty.hidden = YES;
... ...