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 17  
18 18 @interface GiftModel : BaseModel <PresentModelAble>
19 19 @property (copy, nonatomic) NSString *_Nullable sender;//送礼人
20   -@property (copy, nonatomic) NSString *_Nullable giftName;//礼物名称
  20 +@property (copy, nonatomic) NSString *_Nullable giftName;//礼物名称 ***
21 21 @property (copy, nonatomic) NSString *_Nullable icon;//送礼头像
22 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 27 @property (nonatomic ) GiftStyle giftStyle;//动画类型
28 28 @property (nonatomic ) NSInteger index;//索引和giftname一样
29 29  
... ...
LiveVideoCloud/Classes/Sections/InteractionSections/Gift/GiftViews/GiftListView.m
... ... @@ -39,7 +39,7 @@
39 39 _images = [NSArray arrayWithObjects:@"porsch_small80",@"fighter_small80",@"plane_small80",@"love_gift",@"beer",@"chicken",@"cucumber",@"flower",@"hug",@"mouth",@"ring",@"rose",@"sticks",nil];
40 40 _giftNames = [NSArray arrayWithObjects:@"跑车",@"歼灭机",@"飞机",@"大大的爱心",@"啤酒",@"小鸡",@"小黄瓜",@"鲜花",@"抱抱",@"亲吻",@"戒指",@"玫瑰花",@"荧光棒",nil];
41 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 44 self.liveBaseView = liveBaseView;
45 45 self.animQueueManager = [AnimQueueManager sharedAnimQueueManager];
... ... @@ -185,8 +185,8 @@
185 185 NSMutableArray *tempArr = [NSMutableArray array];
186 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 190 //combo
191 191 GiftModel *model1 = [GiftModel modelWithSender:senders[i] giftName:[self giftNameWithImageName:_images[i]] icon:@"love" giftImageName:_images[i]];
192 192 model1.giftStyle = GiftStyleCombo;
... ... @@ -197,15 +197,15 @@
197 197 {//expen
198 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 201 model.giftStyle = GiftStylePorsch;
202 202 model.giftImageName = @"porsch_small80";
203 203 }
204   - if (type == 3) {
  204 + if ([type isEqualToString:@"3"]) {
205 205 model.giftStyle = GiftStyleFighter;
206 206 model.giftImageName = @"fighter_small80";
207 207 }
208   - if (type == 4) {
  208 + if ([type isEqualToString:@"4"]) {
209 209 model.giftStyle = GiftStylePlane;
210 210 model.giftImageName = @"plane_small80";
211 211 }
... ...
LiveVideoCloud/Classes/Sections/InteractionSections/LiveBaseView.h
... ... @@ -29,6 +29,7 @@ typedef NS_ENUM(NSInteger, JumpControllerType) {//跳转控制器类型
29 29 @property (nonatomic ,strong) UIViewController * _Nullable viewController;
30 30 @property (nonatomic ,strong ,readonly) PresentView * _Nullable presentView;
31 31 @property (nonatomic ,strong) AnimationBaseView * _Nullable animationBaseView;
  32 +@property (nonatomic ,copy) NSString * _Nullable roomId;
32 33  
33 34 + (instancetype _Nullable)liveBaseView;
34 35  
... ...
LiveVideoCloud/Classes/Sections/InteractionSections/LiveBaseView.m
... ... @@ -42,13 +42,13 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型
42 42 @property (nonatomic ,strong ) GiftListView * _Nullable giftListView;
43 43 @property (nonatomic ,weak ) UIView * _Nullable giftPopView;
44 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 48 @property (nonatomic ,strong ) TopToolView * _Nullable topToolsView;
49 49 @property (nonatomic ,strong ) UIView * _Nullable commentsView;
50 50 @property (nonatomic ,strong ) UITextField * _Nullable commentText;
51   -@property (nonatomic ,assign ) CGFloat offsetHeight;
  51 +@property (nonatomic ,assign ) CGFloat offsetHeight;
52 52 @property (nonatomic ,strong ) UISwitch * _Nullable barrageSwitch;
53 53 @property (nonatomic ,strong ) ChatBarrageManager * _Nullable chatManager;
54 54 @property (nonatomic ,strong ) ChatBarrageView * _Nullable barrageView;
... ... @@ -86,19 +86,23 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型
86 86 [self.animationBaseView addSubview:self.topToolsView];
87 87 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
88 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 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 106 - (void)dealloc
103 107 {
104 108 [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil];
... ...
LiveVideoCloud/Classes/Sections/LiveSections/Controller/LVCLiveViewController.m
... ... @@ -200,6 +200,7 @@
200 200 if (!_liveBaseView)
201 201 {
202 202 _liveBaseView = [LiveBaseView liveBaseView];
  203 + _liveBaseView.roomId = [UserInformationModel manager].uid;
203 204 _liveBaseView.jumpType = JumpControllerTypePresent;
204 205 _liveBaseView.viewController = self;
205 206 _liveBaseView.backgroundColor = [UIColor clearColor];
... ...
LiveVideoCloud/Classes/Sections/LiveSections/LVCVerifyLiveAuthService.m
... ... @@ -24,15 +24,12 @@
24 24 NSString *string = [NSString stringWithFormat:@"%@&key=%@", [self sortParameters:parameter], UserAppKey];
25 25 NSString *signString = [[self sha1:string] uppercaseString];
26 26 [parameter setObject:signString forKey:@"sign"];
27   -// [parameter setObject:[UserInformationModel manager].uid forKey:@"sid"];
28   -// [parameter removeObjectForKey:@"channelId"];
29   -
30 27  
31 28 NSMutableDictionary *params = parameter.mutableCopy;
32 29 completionHandler compleionHandler = ^(id data,NSError *error) {
33 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 35 //sha1加密
... ...
LiveVideoCloud/UtilKits/ServerUrl/ZXServerUrl.h
... ... @@ -31,7 +31,6 @@
31 31 + (NSString *)getLiveActivityInfoURL;
32 32  
33 33 /** 验证主播是否有直播权限 */
34   -+ (NSString *)verifyLiveAuthURL;
35   -
  34 ++ (NSString *)getVerifyLiveAuthURL;
36 35  
37 36 @end
... ...
LiveVideoCloud/UtilKits/ServerUrl/ZXServerUrl.m
... ... @@ -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 81 NSString *url = serverBaseURL;
82 82 return [NSString stringWithFormat:@"%@%@", url, g_VerifyLiveAuthURL];
... ...
LiveVideoCloud/UtilKits/UserTools/UserTools.m
... ... @@ -253,8 +253,8 @@
253 253 NSString *signString = [[LiveListService sha1:string] uppercaseString];
254 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 259 if ([responseObject[@"errorCode"] isEqualToString:@"0"]) {
260 260 success(operation,responseObject);
... ...