Commit 9e9ffc437f8ee8ddce80149b2636c44e98c4bec5

Authored by 王军波
1 parent 90ae6bf0

点播列表更换接口

LiveVideoCloud.xcodeproj/project.pbxproj
... ... @@ -235,9 +235,9 @@
235 235 D2B7B2511E8247D400ED084E /* ChatBarrageManager.m in Sources */ = {isa = PBXBuildFile; fileRef = D2B7B2501E8247D400ED084E /* ChatBarrageManager.m */; };
236 236 D2B7B2541E824B2D00ED084E /* ChatBarrageView.m in Sources */ = {isa = PBXBuildFile; fileRef = D2B7B2531E824B2D00ED084E /* ChatBarrageView.m */; };
237 237 D2B7B2571E8261EF00ED084E /* ChatBarrOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = D2B7B2561E8261EF00ED084E /* ChatBarrOperation.m */; };
  238 + D2C6A8BF1F04998D00543EFA /* LVCVodListModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D2C6A8BE1F04998D00543EFA /* LVCVodListModel.m */; };
238 239 D2CBC13B1ECC157A00E00279 /* LVCVerifyLiveAuthService.m in Sources */ = {isa = PBXBuildFile; fileRef = D2CBC13A1ECC157A00E00279 /* LVCVerifyLiveAuthService.m */; };
239 240 D2D7D18D1E8A581000217771 /* timg.jpeg in Resources */ = {isa = PBXBuildFile; fileRef = D2D7D18C1E8A581000217771 /* timg.jpeg */; };
240   - D2EBC8571F01FF9200F198FB /* LVCCommentModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D2EBC8561F01FF9200F198FB /* LVCCommentModel.m */; };
241 241 D2EBC8711F02108000F198FB /* LiveListService.m in Sources */ = {isa = PBXBuildFile; fileRef = D2EBC8661F02108000F198FB /* LiveListService.m */; };
242 242 D2EBC8721F02108000F198FB /* LVCLiveActivityInfoService.m in Sources */ = {isa = PBXBuildFile; fileRef = D2EBC8681F02108000F198FB /* LVCLiveActivityInfoService.m */; };
243 243 D2EBC8741F02108000F198FB /* LVCUGCLiveListController.m in Sources */ = {isa = PBXBuildFile; fileRef = D2EBC86C1F02108000F198FB /* LVCUGCLiveListController.m */; };
... ... @@ -769,11 +769,11 @@
769 769 D2B7B2531E824B2D00ED084E /* ChatBarrageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChatBarrageView.m; sourceTree = "<group>"; };
770 770 D2B7B2551E8261EF00ED084E /* ChatBarrOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChatBarrOperation.h; sourceTree = "<group>"; };
771 771 D2B7B2561E8261EF00ED084E /* ChatBarrOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChatBarrOperation.m; sourceTree = "<group>"; };
  772 + D2C6A8BD1F04998D00543EFA /* LVCVodListModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCVodListModel.h; sourceTree = "<group>"; };
  773 + D2C6A8BE1F04998D00543EFA /* LVCVodListModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCVodListModel.m; sourceTree = "<group>"; };
772 774 D2CBC1391ECC157A00E00279 /* LVCVerifyLiveAuthService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LVCVerifyLiveAuthService.h; path = ../LVCVerifyLiveAuthService.h; sourceTree = "<group>"; };
773 775 D2CBC13A1ECC157A00E00279 /* LVCVerifyLiveAuthService.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = LVCVerifyLiveAuthService.m; path = ../LVCVerifyLiveAuthService.m; sourceTree = "<group>"; };
774 776 D2D7D18C1E8A581000217771 /* timg.jpeg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = timg.jpeg; sourceTree = "<group>"; };
775   - D2EBC8551F01FF9200F198FB /* LVCCommentModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCCommentModel.h; sourceTree = "<group>"; };
776   - D2EBC8561F01FF9200F198FB /* LVCCommentModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCCommentModel.m; sourceTree = "<group>"; };
777 777 D2EBC8651F02108000F198FB /* LiveListService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LiveListService.h; sourceTree = "<group>"; };
778 778 D2EBC8661F02108000F198FB /* LiveListService.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LiveListService.m; sourceTree = "<group>"; };
779 779 D2EBC8671F02108000F198FB /* LVCLiveActivityInfoService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCLiveActivityInfoService.h; sourceTree = "<group>"; };
... ... @@ -1181,8 +1181,8 @@
1181 1181 81A482FC1E88B0130097A80A /* Model */ = {
1182 1182 isa = PBXGroup;
1183 1183 children = (
1184   - D2EBC8551F01FF9200F198FB /* LVCCommentModel.h */,
1185   - D2EBC8561F01FF9200F198FB /* LVCCommentModel.m */,
  1184 + D2C6A8BD1F04998D00543EFA /* LVCVodListModel.h */,
  1185 + D2C6A8BE1F04998D00543EFA /* LVCVodListModel.m */,
1186 1186 );
1187 1187 path = Model;
1188 1188 sourceTree = "<group>";
... ... @@ -2285,6 +2285,7 @@
2285 2285 D2029CA01E6EADE10027CD92 /* NSObject+MJProperty.m in Sources */,
2286 2286 4BD855FE1EBACD530082061D /* AFSecurityPolicy.m in Sources */,
2287 2287 D2029CB51E6EADE10027CD92 /* SDiOSVersion.m in Sources */,
  2288 + D2C6A8BF1F04998D00543EFA /* LVCVodListModel.m in Sources */,
2288 2289 4B45CE981EB86A760079AFB7 /* UILabel+createLabel.m in Sources */,
2289 2290 D2029C9C1E6EADE10027CD92 /* MJPropertyType.m in Sources */,
2290 2291 D22831091E77D8D500627701 /* GiftModel.m in Sources */,
... ... @@ -2346,7 +2347,6 @@
2346 2347 4BD856181EBAD35C0082061D /* NSDictionary+Safety.m in Sources */,
2347 2348 4BD856011EBACD530082061D /* AFURLResponseSerialization.m in Sources */,
2348 2349 D2575C4A1E7685DE00E3A8FC /* UIView+Bubbling.m in Sources */,
2349   - D2EBC8571F01FF9200F198FB /* LVCCommentModel.m in Sources */,
2350 2350 D2EBC88B1F02361600F198FB /* LVCUGCLiveListView.m in Sources */,
2351 2351 D2029CA61E6EADE10027CD92 /* MJRefreshHeader.m in Sources */,
2352 2352 D2029CC41E6EADE10027CD92 /* UIImageView+WebCache.m in Sources */,
... ...
LiveVideoCloud/Classes/Sections/homeSections/Controller/LVCVodPlayerController.h
... ... @@ -10,6 +10,6 @@
10 10  
11 11 @interface LVCVodPlayerController : BaseViewController
12 12  
13   -@property (nonatomic, strong) ProgramModel *model;
  13 +@property (nonatomic, strong) LVCVodListModel *model;
14 14  
15 15 @end
... ...
LiveVideoCloud/Classes/Sections/homeSections/Controller/LVCVodPlayerController.m
... ... @@ -75,7 +75,7 @@ typedef enum {
75 75 [self.view addSubview:self.commentView];
76 76 }
77 77  
78   -- (void)setModel:(ProgramModel *)model {
  78 +- (void)setModel:(LVCVodListModel *)model {
79 79 _model = model;
80 80  
81 81 //用来更新视频当前播放时间
... ... @@ -88,7 +88,7 @@ typedef enum {
88 88 #pragma mark - 初始化播放器
89 89 - (void)playerInitialize {
90 90  
91   - _player = [[CNLiveMoviePlayerController alloc] initVodPlayWithVId:self.model.mediaId
  91 + _player = [[CNLiveMoviePlayerController alloc] initVodPlayWithVId:self.model.vId
92 92 authSuccess:^{
93 93  
94 94 _isPlaying = YES;
... ...
LiveVideoCloud/Classes/Sections/homeSections/Controller/LVCVodPlayerFullController.h
... ... @@ -10,6 +10,4 @@
10 10  
11 11 @interface LVCVodPlayerFullController : UIViewController
12 12  
13   -@property (nonatomic, strong) ProgramModel *model;
14   -
15 13 @end
... ...
LiveVideoCloud/Classes/Sections/homeSections/Controller/LVCVodPlayerListController.m
... ... @@ -10,6 +10,7 @@
10 10 #import "LVCTelevisionCell.h"
11 11 #import "LVCRequestFailedView.h"
12 12 #import "LVCVodPlayerController.h"
  13 +#import "CommonCrypto/CommonDigest.h"
13 14  
14 15 static NSString *vodCellId = @"vodCellId";
15 16  
... ... @@ -45,41 +46,44 @@ static NSString *vodCellId = @&quot;vodCellId&quot;;
45 46  
46 47 _failedView.hidden = YES;
47 48  
48   - NSString *uid;
49   - if ([UserTools isLogin]) {
50   - uid = [UserInformationModel manager].uid;
51   - } else {
52   - uid = [NSString stringWithFormat:@"%u", arc4random()%3];
53   - }
54   - NSString *tm = [NSString stringWithFormat:@"%u_%@", arc4random()%10, uid];
55   -
56   - NSDictionary *parameter = @{@"cid": @"82_news/",
57   - @"page": [NSString stringWithFormat:@"%d", 1],
58   - @"pagesize": @"15",
59   - @"tm": tm};
60   -
61   - [[AFHTTPRequestOperationManager manager] GET:Newslist parameters:[self addParameters:parameter] success:^(AFHTTPRequestOperation *operation, id responseObject) {
  49 + NSInteger time = [[NSDate date] timeIntervalSince1970];
  50 + NSString *timeString = [NSString stringWithFormat:@"%ld", (long)time];
  51 + NSMutableDictionary *parameter = [@{
  52 + @"appId" : UserAppId,
  53 + @"pageNumber": @"1",
  54 + @"pagesize": @"10",
  55 + @"timestamp": timeString,
  56 + @"platform_id": [NSBundle mainBundle].bundleIdentifier
  57 + } mutableCopy];
  58 + NSString *string = [NSString stringWithFormat:@"%@&key=%@", [self sortParameters:parameter], UserAppKey];
  59 + NSString *signString = [[self sha1:string] uppercaseString];
  60 + [parameter setObject:signString forKey:@"sign"];
  61 +
  62 + NSString *vodListURL = @"http://api.cnlive.com/open/api2/vod_epg/getVodListInfo4App";
  63 + NSString *testVodListURL = @"http://test.open.cnlive.com/openapi/api2/vod_epg/getVodListInfo4App";
  64 +
  65 + [[AFHTTPRequestOperationManager manager] POST:testVodListURL parameters:parameter success:^(AFHTTPRequestOperation *operation, id responseObject) {
62 66  
63 67 responseObject = [responseObject validatedDictionary];
64   -
65   - if (responseObject[@"programs"] && [responseObject[@"programs"] isKindOfClass:[NSArray class]]) {
66   -
67   - for (NSDictionary *dic in responseObject[@"programs"]) {
68   - ProgramModel *programModel = [ProgramModel modelWithDic:dic];
69   - [_programArrayM addObject:programModel];
70   - if (dic[@"comments"] && [dic[@"comments"] isKindOfClass:[NSArray class]] && [(NSArray *)dic[@"comments"] count] > 0) {
71   - NSMutableArray *comments = [[NSMutableArray alloc] init];
72   - for (NSDictionary *commentDic in dic[@"comments"]) {
73   - LVCCommentModel *commentModel = [LVCCommentModel modelWithDic:commentDic];
74   - [comments addObject:commentModel];
75   - }
76   - [_programArrayM addObject:comments];
  68 + if ([responseObject[@"errorCode"] isEqualToString:@"0"]) {
  69 + if (responseObject[@"data"] && [responseObject[@"data"] isKindOfClass:[NSArray class]]) {
  70 +
  71 + for (NSDictionary *dic in responseObject[@"data"]) {
  72 + LVCVodListModel *vodListModel = [LVCVodListModel modelWithDic:dic];
  73 + [_programArrayM addObject:vodListModel];
77 74 }
78 75 }
  76 + _timestamp = [[self timestamp] longLongValue];
  77 + [self.tableView.header endRefreshing];
  78 + [self.tableView reloadData];
  79 + } else {
  80 + NSLog(@"点播列表请求失败!");
  81 + _timestamp = [[self timestamp] longLongValue];
  82 + [self.tableView.header endRefreshing];
  83 + if (_programArrayM.count == 0) {
  84 + _failedView.hidden = NO;
  85 + }
79 86 }
80   - _timestamp = [[self timestamp] longLongValue];
81   - [self.tableView.header endRefreshing];
82   - [self.tableView reloadData];
83 87  
84 88 } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
85 89  
... ... @@ -190,20 +194,50 @@ static NSString *vodCellId = @&quot;vodCellId&quot;;
190 194 }
191 195  
192 196 #pragma mark ------------------------------ 分割线 ----------------------------------------------
193   -- (NSDictionary *)addParameters:(NSDictionary *)dict {
  197 +//sha1加密
  198 +- (NSString*)sha1:(NSString *)string
  199 +{
  200 + NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding];
  201 +
  202 + uint8_t digest[CC_SHA1_DIGEST_LENGTH];
  203 +
  204 + CC_SHA1(data.bytes, data.length, digest);
  205 +
  206 + NSMutableString* output = [NSMutableString stringWithCapacity:CC_SHA1_DIGEST_LENGTH * 2];
194 207  
195   - if (![dict isKindOfClass:[NSDictionary class]]) {
196   - return dict;
  208 + for(int i = 0; i < CC_SHA1_DIGEST_LENGTH; i++)
  209 + [output appendFormat:@"%02x", digest[i]];
  210 +
  211 + while ([[output substringToIndex:1] isEqualToString:@"0"]) {
  212 + output = [[NSMutableString alloc] initWithString:[output substringFromIndex:1]];
197 213 }
198   - if (!dict) {
199   - return @{@"appid": JBAppId, @"plat": @"i", @"version": JBAppVersion};
200   - } else {
201   - NSMutableDictionary *dic = [[NSMutableDictionary alloc] initWithDictionary:dict];
202   - [dic addEntriesFromDictionary:@{@"appid": JBAppId, @"plat": @"i", @"version": JBAppVersion}];
203   - return [[NSDictionary alloc] initWithDictionary:dic];
  214 +
  215 + return output;
  216 +}
  217 +//参数排序
  218 +- (NSString *)sortParameters:(NSDictionary*)parameters
  219 +{
  220 + //对所有传入参数按照字段名的 ASCII 码从小到大排序
  221 + NSArray *keyArr=[parameters allKeys];
  222 + NSArray *arr = [keyArr sortedArrayUsingSelector:@selector(compare:)];
  223 +
  224 + NSMutableString *string1 = [[NSMutableString alloc]init];
  225 + for (int i=0; i<arr.count; i++) {
  226 +
  227 + NSString *parametersString = parameters[[arr objectAtIndex:i]];
  228 + if (parametersString.length > 0) {
  229 + [string1 appendString:[NSString stringWithFormat:@"%@=%@&",[arr objectAtIndex:i],parameters[[arr objectAtIndex:i]]]];
  230 + }
  231 + }
  232 +
  233 + if (string1.length > 0) {
  234 + [string1 deleteCharactersInRange:NSMakeRange(string1.length-1, 1)];
204 235 }
  236 +
  237 + return string1;
205 238 }
206 239  
  240 +
207 241 - (void)didReceiveMemoryWarning {
208 242 [super didReceiveMemoryWarning];
209 243 // Dispose of any resources that can be recreated.
... ...
LiveVideoCloud/Classes/Sections/homeSections/Model/LVCCommentModel.h deleted 100644 → 0
1   -//
2   -// LVCCommentModel.h
3   -// LiveVideoCloud
4   -//
5   -// Created by cnliveJunBo on 17/6/27.
6   -// Copyright © 2017年 cnlive. All rights reserved.
7   -//
8   -
9   -#import "BaseModel.h"
10   -
11   -@interface LVCCommentModel : BaseModel
12   -
13   -@property (nonatomic, strong)NSString *content;
14   -@property (nonatomic, strong)NSString *uid;
15   -@property (nonatomic, strong)NSString *facepath;
16   -@property (nonatomic, strong)NSString *nick;
17   -
18   -@end
LiveVideoCloud/Classes/Sections/homeSections/Model/LVCCommentModel.m deleted 100644 → 0
1   -//
2   -// LVCCommentModel.m
3   -// LiveVideoCloud
4   -//
5   -// Created by cnliveJunBo on 17/6/27.
6   -// Copyright © 2017年 cnlive. All rights reserved.
7   -//
8   -
9   -#import "LVCCommentModel.h"
10   -
11   -@implementation LVCCommentModel
12   -
13   -@end
LiveVideoCloud/Classes/Sections/homeSections/Model/LVCVodListModel.h 0 → 100644
  1 +//
  2 +// LVCVodListModel.h
  3 +// LiveVideoCloud
  4 +//
  5 +// Created by cnliveJunBo on 17/6/29.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "BaseModel.h"
  10 +
  11 +@interface LVCVodListModel : BaseModel
  12 +
  13 +@property (nonatomic ,copy) NSString * _Nullable type;
  14 +@property (nonatomic ,copy) NSString * _Nullable vId;
  15 +@property (nonatomic ,copy) NSString * _Nullable img;
  16 +@property (nonatomic ,copy) NSString * _Nullable subTitle;
  17 +@property (nonatomic ,copy) NSString * _Nullable rates;
  18 +@property (nonatomic ,copy) NSString * _Nullable desc;
  19 +@property (nonatomic ,copy) NSString * _Nullable tag;
  20 +@property (nonatomic ,copy) NSString * _Nullable title;
  21 +@property (nonatomic ,copy) NSString * _Nullable category;
  22 +
  23 +@end
... ...
LiveVideoCloud/Classes/Sections/homeSections/Model/LVCVodListModel.m 0 → 100644
  1 +//
  2 +// LVCVodListModel.m
  3 +// LiveVideoCloud
  4 +//
  5 +// Created by cnliveJunBo on 17/6/29.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "LVCVodListModel.h"
  10 +
  11 +@implementation LVCVodListModel
  12 +
  13 +- (void)loadModel
  14 +{
  15 + [super loadModel];
  16 +
  17 + [LVCVodListModel mj_setupReplacedKeyFromPropertyName:^NSDictionary *{ return @{
  18 + @"desc":@"description"
  19 + };}];
  20 +
  21 +}
  22 +
  23 +@end
... ...
LiveVideoCloud/Classes/Sections/homeSections/View/LVCCommentTitleCell.h
... ... @@ -10,6 +10,6 @@
10 10  
11 11 @interface LVCCommentTitleCell : UITableViewCell
12 12  
13   -@property (nonatomic, strong) ProgramModel *model;
  13 +@property (nonatomic, strong) LVCVodListModel *model;
14 14  
15 15 @end
... ...
LiveVideoCloud/Classes/Sections/homeSections/View/LVCCommentTitleCell.m
... ... @@ -28,7 +28,7 @@
28 28 return self;
29 29 }
30 30  
31   -- (void)setModel:(ProgramModel *)model {
  31 +- (void)setModel:(LVCVodListModel *)model {
32 32  
33 33 self.titleLabel.text = model.title;
34 34 self.contentLabel.text = model.desc;
... ...
LiveVideoCloud/Classes/Sections/homeSections/View/LVCCommentView.h
... ... @@ -10,6 +10,6 @@
10 10  
11 11 @interface LVCCommentView : UIView
12 12  
13   -@property (nonatomic, strong) ProgramModel *model;
  13 +@property (nonatomic, strong) LVCVodListModel *model;
14 14  
15 15 @end
... ...
LiveVideoCloud/Classes/Sections/homeSections/View/LVCCommentView.m
... ... @@ -43,7 +43,7 @@ static NSString *commentCellId = @&quot;commentCellId&quot;;
43 43 return self;
44 44 }
45 45  
46   -- (void)setModel:(ProgramModel *)model {
  46 +- (void)setModel:(LVCVodListModel *)model {
47 47  
48 48 if (_model != model) {
49 49 _model = model;
... ...
LiveVideoCloud/PrefixHeader.pch
... ... @@ -29,9 +29,8 @@
29 29 #import <CNLivePlayerSDK/CNLiveWebcastManager.h>
30 30 #import <CNLiveMsgTools/CNLiveMsgManager.h>
31 31 #import <CNLiveChatManager/CNLiveChatManager.h>
32   -#import <CNLiveUserSystemSDK/CNLiveUserSystemCenter.h>
33   - #import "LVCCommentModel.h"
34   -
  32 + #import <CNLiveUserSystemSDK/CNLiveUserSystemCenter.h>
  33 + #import "LVCVodListModel.h"
35 34 #import "Common.h"
36 35 #import "MJExtension.h"
37 36 #import "CNLiveMacro.h"
... ... @@ -79,9 +78,6 @@
79 78 #define UserAppKey @"4c8658abc5d66f270f9bf5dcd1ef11e3597fab4c4e0af9"//@"13c6f0ad6f459cd479834b0b39cff99c6cf20c970815bb"//
80 79 #define UserAppSceret @"c2faeb120f0ea2e2d47020d4b03cb8a93bed2585897a94"//@"14c887b76ec2ecdf7083fb4c62808f13f6ab77a0f9dfec"//
81 80  
82   -#define JBAppId @"hdtv"
83   -#define JBAppVersion [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"] ///debug用 "CFBundleVersion"
84   -
85 81  
86 82 #define PlaceholderImage @"placehodler"
87 83 #define appDelegate ((AppDelegate *)[UIApplication sharedApplication].delegate)
... ...