Commit e0ccedc17bd7b6342333cb155dfad537b08440c4

Authored by 张旭
1 parent 507b96f6

liveBaseView增加roomId

LiveVideoCloud/Classes/Sections/InteractionSections/Gift/GiftModel/GiftModel.h
@@ -17,13 +17,13 @@ typedef NS_ENUM(NSInteger, GiftStyle) {//礼物类型 @@ -17,13 +17,13 @@ typedef NS_ENUM(NSInteger, GiftStyle) {//礼物类型
17 17
18 @interface GiftModel : BaseModel <PresentModelAble> 18 @interface GiftModel : BaseModel <PresentModelAble>
19 @property (copy, nonatomic) NSString *_Nullable sender;//送礼人 19 @property (copy, nonatomic) NSString *_Nullable sender;//送礼人
20 -@property (copy, nonatomic) NSString *_Nullable giftName;//礼物名称 20 +@property (copy, nonatomic) NSString *_Nullable giftName;//礼物名称 ***
21 @property (copy, nonatomic) NSString *_Nullable icon;//送礼头像 21 @property (copy, nonatomic) NSString *_Nullable icon;//送礼头像
22 @property (copy, nonatomic) NSString *_Nullable giftImageName;//礼物图片名字 22 @property (copy, nonatomic) NSString *_Nullable giftImageName;//礼物图片名字
23 -@property (assign, nonatomic) NSInteger giftNumber;//礼物数量 23 +@property (assign, nonatomic) NSInteger giftNumber;//礼物数量 ***
24 24
25 //可本地处理 25 //可本地处理
26 -@property (nonatomic ,copy ) NSString * _Nullable price; 26 +@property (nonatomic ,copy ) NSString * _Nullable price; // ***
27 @property (nonatomic ) GiftStyle giftStyle;//动画类型 27 @property (nonatomic ) GiftStyle giftStyle;//动画类型
28 @property (nonatomic ) NSInteger index;//索引和giftname一样 28 @property (nonatomic ) NSInteger index;//索引和giftname一样
29 29
LiveVideoCloud/Classes/Sections/InteractionSections/Gift/GiftViews/GiftListView.m
@@ -39,7 +39,7 @@ @@ -39,7 +39,7 @@
39 _images = [NSArray arrayWithObjects:@"porsch_small80",@"fighter_small80",@"plane_small80",@"love_gift",@"beer",@"chicken",@"cucumber",@"flower",@"hug",@"mouth",@"ring",@"rose",@"sticks",nil]; 39 _images = [NSArray arrayWithObjects:@"porsch_small80",@"fighter_small80",@"plane_small80",@"love_gift",@"beer",@"chicken",@"cucumber",@"flower",@"hug",@"mouth",@"ring",@"rose",@"sticks",nil];
40 _giftNames = [NSArray arrayWithObjects:@"跑车",@"歼灭机",@"飞机",@"大大的爱心",@"啤酒",@"小鸡",@"小黄瓜",@"鲜花",@"抱抱",@"亲吻",@"戒指",@"玫瑰花",@"荧光棒",nil]; 40 _giftNames = [NSArray arrayWithObjects:@"跑车",@"歼灭机",@"飞机",@"大大的爱心",@"啤酒",@"小鸡",@"小黄瓜",@"鲜花",@"抱抱",@"亲吻",@"戒指",@"玫瑰花",@"荧光棒",nil];
41 _prices = [NSArray arrayWithObjects:@"300000000",@"300000000",@"300000",@"30",@"30",@"3",@"3",@"1",@"3",@"1",@"3",@"30",@"300", nil]; 41 _prices = [NSArray arrayWithObjects:@"300000000",@"300000000",@"300000",@"30",@"30",@"3",@"3",@"1",@"3",@"1",@"3",@"30",@"300", nil];
42 - _types = [NSArray arrayWithObjects:@2,@3,@4,@1,@1,@1,@1,@1,@1,@1,@1,@1,@1, nil]; 42 + _types = [NSArray arrayWithObjects:@"2",@"3",@"4",@"1",@"1",@"1",@"1",@"1",@"1",@"1",@"1",@"1",@"1", nil];
43 43
44 self.liveBaseView = liveBaseView; 44 self.liveBaseView = liveBaseView;
45 self.animQueueManager = [AnimQueueManager sharedAnimQueueManager]; 45 self.animQueueManager = [AnimQueueManager sharedAnimQueueManager];
@@ -185,8 +185,8 @@ @@ -185,8 +185,8 @@
185 NSMutableArray *tempArr = [NSMutableArray array]; 185 NSMutableArray *tempArr = [NSMutableArray array];
186 for (int i = 0; i < _images.count; i ++) { 186 for (int i = 0; i < _images.count; i ++) {
187 187
188 - int type = [_types[i] intValue];  
189 - if (type == 1) { 188 + NSString *type = _types[i];
  189 + if ([type isEqualToString:@"1"]) {
190 //combo 190 //combo
191 GiftModel *model1 = [GiftModel modelWithSender:senders[i] giftName:[self giftNameWithImageName:_images[i]] icon:@"love" giftImageName:_images[i]]; 191 GiftModel *model1 = [GiftModel modelWithSender:senders[i] giftName:[self giftNameWithImageName:_images[i]] icon:@"love" giftImageName:_images[i]];
192 model1.giftStyle = GiftStyleCombo; 192 model1.giftStyle = GiftStyleCombo;
@@ -197,15 +197,15 @@ @@ -197,15 +197,15 @@
197 {//expen 197 {//expen
198 GiftModel *model = [GiftModel modelWithSender:senders[i] giftName:[self giftNameWithImageName:_images[i]] icon:@"love" giftImageName:@""]; 198 GiftModel *model = [GiftModel modelWithSender:senders[i] giftName:[self giftNameWithImageName:_images[i]] icon:@"love" giftImageName:@""];
199 199
200 - if (type == 2) { 200 + if ([type isEqualToString:@"2"]) {
201 model.giftStyle = GiftStylePorsch; 201 model.giftStyle = GiftStylePorsch;
202 model.giftImageName = @"porsch_small80"; 202 model.giftImageName = @"porsch_small80";
203 } 203 }
204 - if (type == 3) { 204 + if ([type isEqualToString:@"3"]) {
205 model.giftStyle = GiftStyleFighter; 205 model.giftStyle = GiftStyleFighter;
206 model.giftImageName = @"fighter_small80"; 206 model.giftImageName = @"fighter_small80";
207 } 207 }
208 - if (type == 4) { 208 + if ([type isEqualToString:@"4"]) {
209 model.giftStyle = GiftStylePlane; 209 model.giftStyle = GiftStylePlane;
210 model.giftImageName = @"plane_small80"; 210 model.giftImageName = @"plane_small80";
211 } 211 }
LiveVideoCloud/Classes/Sections/InteractionSections/LiveBaseView.h
@@ -29,6 +29,7 @@ typedef NS_ENUM(NSInteger, JumpControllerType) {//跳转控制器类型 @@ -29,6 +29,7 @@ typedef NS_ENUM(NSInteger, JumpControllerType) {//跳转控制器类型
29 @property (nonatomic ,strong) UIViewController * _Nullable viewController; 29 @property (nonatomic ,strong) UIViewController * _Nullable viewController;
30 @property (nonatomic ,strong ,readonly) PresentView * _Nullable presentView; 30 @property (nonatomic ,strong ,readonly) PresentView * _Nullable presentView;
31 @property (nonatomic ,strong) AnimationBaseView * _Nullable animationBaseView; 31 @property (nonatomic ,strong) AnimationBaseView * _Nullable animationBaseView;
  32 +@property (nonatomic ,copy) NSString * _Nullable roomId;
32 33
33 + (instancetype _Nullable)liveBaseView; 34 + (instancetype _Nullable)liveBaseView;
34 35
LiveVideoCloud/Classes/Sections/InteractionSections/LiveBaseView.m
@@ -42,13 +42,13 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 @@ -42,13 +42,13 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型
42 @property (nonatomic ,strong ) GiftListView * _Nullable giftListView; 42 @property (nonatomic ,strong ) GiftListView * _Nullable giftListView;
43 @property (nonatomic ,weak ) UIView * _Nullable giftPopView; 43 @property (nonatomic ,weak ) UIView * _Nullable giftPopView;
44 @property (nonatomic ,strong ,readwrite) PresentView * _Nullable presentView;//连击View 44 @property (nonatomic ,strong ,readwrite) PresentView * _Nullable presentView;//连击View
45 -@property (nonatomic ,assign ) PopType popType;  
46 -@property (nonatomic ,strong ) UITableView * _Nullable chatTableView;  
47 -@property (nonatomic ,strong ) NSMutableArray * _Nullable chatMsgArray;//聊天消息数组 45 +@property (nonatomic ,assign ) PopType popType;
  46 +@property (nonatomic ,strong ) UITableView * _Nullable chatTableView;
  47 +@property (nonatomic ,strong ) NSMutableArray * _Nullable chatMsgArray;//聊天消息数组
48 @property (nonatomic ,strong ) TopToolView * _Nullable topToolsView; 48 @property (nonatomic ,strong ) TopToolView * _Nullable topToolsView;
49 @property (nonatomic ,strong ) UIView * _Nullable commentsView; 49 @property (nonatomic ,strong ) UIView * _Nullable commentsView;
50 @property (nonatomic ,strong ) UITextField * _Nullable commentText; 50 @property (nonatomic ,strong ) UITextField * _Nullable commentText;
51 -@property (nonatomic ,assign ) CGFloat offsetHeight; 51 +@property (nonatomic ,assign ) CGFloat offsetHeight;
52 @property (nonatomic ,strong ) UISwitch * _Nullable barrageSwitch; 52 @property (nonatomic ,strong ) UISwitch * _Nullable barrageSwitch;
53 @property (nonatomic ,strong ) ChatBarrageManager * _Nullable chatManager; 53 @property (nonatomic ,strong ) ChatBarrageManager * _Nullable chatManager;
54 @property (nonatomic ,strong ) ChatBarrageView * _Nullable barrageView; 54 @property (nonatomic ,strong ) ChatBarrageView * _Nullable barrageView;
@@ -86,19 +86,23 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 @@ -86,19 +86,23 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型
86 [self.animationBaseView addSubview:self.topToolsView]; 86 [self.animationBaseView addSubview:self.topToolsView];
87 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; 87 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
88 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHidden:) name:UIKeyboardWillHideNotification object:nil]; 88 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHidden:) name:UIKeyboardWillHideNotification object:nil];
89 -  
90 - [CNLiveChatManager sharedCNLiveChatManager].delegate = self;  
91 - [[CNLiveChatManager sharedCNLiveChatManager] joinChatRoom:@"1234" messageCount:10 success:^(NSString *targetId) {  
92 - NSLog(@"success");  
93 - } error:^(CNLiveChatErrorCode errors, NSString *targetId) {  
94 - NSLog(@"error");  
95 - }];  
96 -  
97 - [CNLiveChatManager sharedCNLiveChatManager].currentUserInfo.portraitUri = @"http://b.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=f0c5c08030d3d539c16807c70fb7c566/8ad4b31c8701a18bbef9f231982f07082838feba.jpg";  
98 } 89 }
99 return self; 90 return self;
100 } 91 }
101 92
  93 +- (void)setRoomId:(NSString *)roomId
  94 +{
  95 + _roomId = roomId;
  96 + [CNLiveChatManager sharedCNLiveChatManager].delegate = self;
  97 + [[CNLiveChatManager sharedCNLiveChatManager] joinChatRoom:roomId messageCount:10 success:^(NSString *targetId) {
  98 + NSLog(@"success");
  99 + } error:^(CNLiveChatErrorCode errors, NSString *targetId) {
  100 + NSLog(@"error");
  101 + }];
  102 +
  103 + [CNLiveChatManager sharedCNLiveChatManager].currentUserInfo.portraitUri = @"http://b.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=f0c5c08030d3d539c16807c70fb7c566/8ad4b31c8701a18bbef9f231982f07082838feba.jpg";
  104 +}
  105 +
102 - (void)dealloc 106 - (void)dealloc
103 { 107 {
104 [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil]; 108 [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil];
LiveVideoCloud/Classes/Sections/LiveSections/Controller/LVCLiveViewController.m
@@ -200,6 +200,7 @@ @@ -200,6 +200,7 @@
200 if (!_liveBaseView) 200 if (!_liveBaseView)
201 { 201 {
202 _liveBaseView = [LiveBaseView liveBaseView]; 202 _liveBaseView = [LiveBaseView liveBaseView];
  203 + _liveBaseView.roomId = [UserInformationModel manager].uid;
203 _liveBaseView.jumpType = JumpControllerTypePresent; 204 _liveBaseView.jumpType = JumpControllerTypePresent;
204 _liveBaseView.viewController = self; 205 _liveBaseView.viewController = self;
205 _liveBaseView.backgroundColor = [UIColor clearColor]; 206 _liveBaseView.backgroundColor = [UIColor clearColor];
LiveVideoCloud/Classes/Sections/LiveSections/LVCVerifyLiveAuthService.m
@@ -24,15 +24,12 @@ @@ -24,15 +24,12 @@
24 NSString *string = [NSString stringWithFormat:@"%@&key=%@", [self sortParameters:parameter], UserAppKey]; 24 NSString *string = [NSString stringWithFormat:@"%@&key=%@", [self sortParameters:parameter], UserAppKey];
25 NSString *signString = [[self sha1:string] uppercaseString]; 25 NSString *signString = [[self sha1:string] uppercaseString];
26 [parameter setObject:signString forKey:@"sign"]; 26 [parameter setObject:signString forKey:@"sign"];
27 -// [parameter setObject:[UserInformationModel manager].uid forKey:@"sid"];  
28 -// [parameter removeObjectForKey:@"channelId"];  
29 -  
30 27
31 NSMutableDictionary *params = parameter.mutableCopy; 28 NSMutableDictionary *params = parameter.mutableCopy;
32 completionHandler compleionHandler = ^(id data,NSError *error) { 29 completionHandler compleionHandler = ^(id data,NSError *error) {
33 handler(data,error); 30 handler(data,error);
34 }; 31 };
35 - return [[HttpService service] sendRequestWithHttpMethod:E_HTTP_REQUEST_METHOD_GET URLPath:[ZXServerUrl verifyLiveAuthURL] parameters:params completionHandler:compleionHandler]; 32 + return [[HttpService service] sendRequestWithHttpMethod:E_HTTP_REQUEST_METHOD_GET URLPath:[ZXServerUrl getVerifyLiveAuthURL] parameters:params completionHandler:compleionHandler];
36 } 33 }
37 34
38 //sha1加密 35 //sha1加密
LiveVideoCloud/UtilKits/ServerUrl/ZXServerUrl.h
@@ -31,7 +31,6 @@ @@ -31,7 +31,6 @@
31 + (NSString *)getLiveActivityInfoURL; 31 + (NSString *)getLiveActivityInfoURL;
32 32
33 /** 验证主播是否有直播权限 */ 33 /** 验证主播是否有直播权限 */
34 -+ (NSString *)verifyLiveAuthURL;  
35 - 34 ++ (NSString *)getVerifyLiveAuthURL;
36 35
37 @end 36 @end
LiveVideoCloud/UtilKits/ServerUrl/ZXServerUrl.m
@@ -76,7 +76,7 @@ static NSString *g_VerifyLiveAuthURL = @&quot;/live_epg/channel/info4App&quot;; @@ -76,7 +76,7 @@ static NSString *g_VerifyLiveAuthURL = @&quot;/live_epg/channel/info4App&quot;;
76 } 76 }
77 77
78 /** 验证主播是否有直播权限 */ 78 /** 验证主播是否有直播权限 */
79 -+ (NSString *)verifyLiveAuthURL 79 ++ (NSString *)getVerifyLiveAuthURL
80 { 80 {
81 NSString *url = serverBaseURL; 81 NSString *url = serverBaseURL;
82 return [NSString stringWithFormat:@"%@%@", url, g_VerifyLiveAuthURL]; 82 return [NSString stringWithFormat:@"%@%@", url, g_VerifyLiveAuthURL];
LiveVideoCloud/UtilKits/UserTools/UserTools.m
@@ -253,8 +253,8 @@ @@ -253,8 +253,8 @@
253 NSString *signString = [[LiveListService sha1:string] uppercaseString]; 253 NSString *signString = [[LiveListService sha1:string] uppercaseString];
254 parms[@"sign"] = signString ; 254 parms[@"sign"] = signString ;
255 255
256 -  
257 - [[AFHTTPRequestOperationManager manager] GET:@"https://api.cnlive.com/open/api2/live_epg/channel/info4App" parameters:parms success:^(AFHTTPRequestOperation *operation, id responseObject) { 256 + NSString *url = appDelegate.isTestEnvironment ? @"http://test.open.cnlive.com/openapi/api2/live_epg/channel/info4App" : @"https://api.cnlive.com/open/api2/live_epg/channel/info4App";
  257 + [[AFHTTPRequestOperationManager manager] GET:url parameters:parms success:^(AFHTTPRequestOperation *operation, id responseObject) {
258 258
259 if ([responseObject[@"errorCode"] isEqualToString:@"0"]) { 259 if ([responseObject[@"errorCode"] isEqualToString:@"0"]) {
260 success(operation,responseObject); 260 success(operation,responseObject);