Commit af9ea1a3a1c16707c73067ad0e9ba72a312f5ec7

Authored by 张旭
2 parents bd39f4f3 fec9ac1d

Merge branch 'master' of bj.gitlab.cnlive.com:ios-team/ScioLive

CNLiveScioLive.xcodeproj/project.pbxproj
... ... @@ -50,6 +50,7 @@
50 50 0838487D215CF6FC00186618 /* BaseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0838487C215CF6FB00186618 /* BaseViewController.m */; };
51 51 0838487E215CF6FC00186618 /* BaseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0838487C215CF6FB00186618 /* BaseViewController.m */; };
52 52 0838487F215CF6FC00186618 /* BaseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0838487C215CF6FB00186618 /* BaseViewController.m */; };
  53 + 08471A9F25E7864E0043FC2D /* VideoDetailPresent.m in Sources */ = {isa = PBXBuildFile; fileRef = 08471A9E25E7864E0043FC2D /* VideoDetailPresent.m */; };
53 54 084ACDFD21547AE80089E035 /* CNLiveContactUsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 084ACDFC21547AE80089E035 /* CNLiveContactUsViewController.m */; };
54 55 084ACDFE21547AE80089E035 /* CNLiveContactUsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 084ACDFC21547AE80089E035 /* CNLiveContactUsViewController.m */; };
55 56 084ACDFF21547AE80089E035 /* CNLiveContactUsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 084ACDFC21547AE80089E035 /* CNLiveContactUsViewController.m */; };
... ... @@ -781,6 +782,8 @@
781 782 08384877215CC9E400186618 /* GraphicLiveViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GraphicLiveViewController.h; sourceTree = "<group>"; };
782 783 0838487B215CF6FB00186618 /* BaseViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseViewController.h; sourceTree = "<group>"; };
783 784 0838487C215CF6FB00186618 /* BaseViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BaseViewController.m; sourceTree = "<group>"; };
  785 + 08471A9D25E7864E0043FC2D /* VideoDetailPresent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VideoDetailPresent.h; sourceTree = "<group>"; };
  786 + 08471A9E25E7864E0043FC2D /* VideoDetailPresent.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VideoDetailPresent.m; sourceTree = "<group>"; };
784 787 084ACDFB21547AE80089E035 /* CNLiveContactUsViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CNLiveContactUsViewController.h; sourceTree = "<group>"; };
785 788 084ACDFC21547AE80089E035 /* CNLiveContactUsViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CNLiveContactUsViewController.m; sourceTree = "<group>"; };
786 789 084ACE0021547B4D0089E035 /* CNLiveMyCollectionViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CNLiveMyCollectionViewController.h; sourceTree = "<group>"; };
... ... @@ -1288,6 +1291,7 @@
1288 1291 0838484A215CA71C00186618 /* OldController */ = {
1289 1292 isa = PBXGroup;
1290 1293 children = (
  1294 + 08471A8F25E785B50043FC2D /* Present */,
1291 1295 0838487B215CF6FB00186618 /* BaseViewController.h */,
1292 1296 0838487C215CF6FB00186618 /* BaseViewController.m */,
1293 1297 0838484B215CA73A00186618 /* OldArticleDetailViewController.h */,
... ... @@ -1316,6 +1320,15 @@
1316 1320 path = Html5Utils;
1317 1321 sourceTree = "<group>";
1318 1322 };
  1323 + 08471A8F25E785B50043FC2D /* Present */ = {
  1324 + isa = PBXGroup;
  1325 + children = (
  1326 + 08471A9D25E7864E0043FC2D /* VideoDetailPresent.h */,
  1327 + 08471A9E25E7864E0043FC2D /* VideoDetailPresent.m */,
  1328 + );
  1329 + path = Present;
  1330 + sourceTree = "<group>";
  1331 + };
1319 1332 084ACE0A21547F9F0089E035 /* DBAction */ = {
1320 1333 isa = PBXGroup;
1321 1334 children = (
... ... @@ -2659,6 +2672,7 @@
2659 2672 TargetAttributes = {
2660 2673 08C08F6D214F997E00E23D16 = {
2661 2674 CreatedOnToolsVersion = 9.4.1;
  2675 + LastSwiftMigration = 1240;
2662 2676 SystemCapabilities = {
2663 2677 com.apple.BackgroundModes = {
2664 2678 enabled = 1;
... ... @@ -3015,6 +3029,7 @@
3015 3029 08B5C5962153490B00F5476E /* CNMyAnnouncementsModel.m in Sources */,
3016 3030 08FB8777215DD3C600DA5423 /* NewsVoiceTableViewCell.m in Sources */,
3017 3031 08FB8774215DD3C600DA5423 /* SelectedTableViewCell.m in Sources */,
  3032 + 08471A9F25E7864E0043FC2D /* VideoDetailPresent.m in Sources */,
3018 3033 C3E502DA2152432700DA4320 /* CNHomeRightTableViewCell.m in Sources */,
3019 3034 08C090AB215103C400E23D16 /* CNLiveHeaderView.m in Sources */,
3020 3035 08585D56215B4C7200FC2CA2 /* PGDatePicker+Time.m in Sources */,
... ... @@ -3597,6 +3612,7 @@
3597 3612 buildSettings = {
3598 3613 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
3599 3614 ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
  3615 + CLANG_ENABLE_MODULES = YES;
3600 3616 CODE_SIGN_ENTITLEMENTS = CNLiveScioLive/CNLiveScioLive.entitlements;
3601 3617 CODE_SIGN_IDENTITY = "Apple Development";
3602 3618 CODE_SIGN_STYLE = Automatic;
... ... @@ -3639,6 +3655,9 @@
3639 3655 PRODUCT_BUNDLE_IDENTIFIER = cn.gov.scio.live1;
3640 3656 PRODUCT_NAME = "$(TARGET_NAME)";
3641 3657 PROVISIONING_PROFILE_SPECIFIER = "";
  3658 + SWIFT_OBJC_BRIDGING_HEADER = "CNLiveScioLive/Pages/Home/新闻详情/OldController/Present/CNLiveScioLive-Bridging-Header.h";
  3659 + SWIFT_OPTIMIZATION_LEVEL = "-Onone";
  3660 + SWIFT_VERSION = 5.0;
3642 3661 TARGETED_DEVICE_FAMILY = 1;
3643 3662 VALID_ARCHS = "arm64 arm64e armv7s";
3644 3663 };
... ... @@ -3650,6 +3669,7 @@
3650 3669 buildSettings = {
3651 3670 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
3652 3671 ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
  3672 + CLANG_ENABLE_MODULES = YES;
3653 3673 CODE_SIGN_ENTITLEMENTS = CNLiveScioLive/CNLiveScioLive.entitlements;
3654 3674 CODE_SIGN_IDENTITY = "Apple Development";
3655 3675 CODE_SIGN_STYLE = Automatic;
... ... @@ -3692,6 +3712,8 @@
3692 3712 PRODUCT_BUNDLE_IDENTIFIER = cn.gov.scio.live1;
3693 3713 PRODUCT_NAME = "$(TARGET_NAME)";
3694 3714 PROVISIONING_PROFILE_SPECIFIER = "";
  3715 + SWIFT_OBJC_BRIDGING_HEADER = "CNLiveScioLive/Pages/Home/新闻详情/OldController/Present/CNLiveScioLive-Bridging-Header.h";
  3716 + SWIFT_VERSION = 5.0;
3695 3717 TARGETED_DEVICE_FAMILY = 1;
3696 3718 VALID_ARCHS = "arm64 arm64e armv7s";
3697 3719 };
... ...
CNLiveScioLive/Pages/Header/SystemMacro.h
... ... @@ -9,6 +9,13 @@
9 9 #ifndef SystemMacro_h
10 10 #define SystemMacro_h
11 11  
  12 +#ifndef AppKeyWindow
  13 +#define AppKeyWindow ((AppDelegate *)[UIApplication sharedApplication].delegate).window
  14 +#endif
  15 +
  16 +//协议调取方法
  17 +#define CNMessageSend(instance,protocol,message) [(id<protocol>)(instance) message]
  18 +
12 19 // 系统语言
13 20 #define SYSTEM_LANGUAGE [[[NSUserDefaults standardUserDefaults] objectForKey:@"AppleLanguages"] objectAtIndex:0]
14 21 #define IS_CHINESE ([SYSTEM_LANGUAGE isEqualToString:@"zh-Hans-CN"]||[SYSTEM_LANGUAGE isEqualToString:@"zh-Hant-CN"]||[SYSTEM_LANGUAGE isEqualToString:@"zh-Hans"] ||[SYSTEM_LANGUAGE isEqualToString:@"zh-hans"])
... ...
CNLiveScioLive/Pages/Home/新闻详情/OldController/OldVideoDetailViewController.m
... ... @@ -12,9 +12,12 @@
12 12 #import "VideoTableViewCell.h"
13 13 #import "ArticleTableViewCell.h"
14 14 #import "SearchResultViewController.h"
15   -@interface OldVideoDetailViewController ()<CNLivePlayerControllerDelegate>{
  15 +#import "VideoDetailPresent.h"
  16 +@interface OldVideoDetailViewController ()<CNLivePlayerControllerDelegate,ProgramDelegate>{
16 17 UIButton *_shareBtn;
17 18 }
  19 +@property (nonatomic,strong)VideoDetailPresent *present;
  20 +@property (nonatomic,strong)NSString *content;
18 21  
19 22 @end
20 23 @implementation OldVideoDetailViewController
... ... @@ -43,8 +46,8 @@
43 46 movieUrl = [NSURL URLWithString:url];
44 47 videoHeight = MainScreenWidth * (9.0 / 16.0);
45 48 dispatch_async(dispatch_get_global_queue(0, 0), ^{
46   - if(!(0 == [self->_dictionary[@"img"] length])){
47   - NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:self->_dictionary[@"img"]]];
  49 + if(!(0 == [self->_dictionary[@"imgSmall"] length])){
  50 + NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:self->_dictionary[@"imgSmall"]]];
48 51 self->bgImg = [UIImage imageWithData:data];
49 52 dispatch_async(dispatch_get_main_queue(), ^{
50 53 if (self.videoController && self->bgImg) {
... ... @@ -63,10 +66,14 @@
63 66  
64 67 NSString* htmldate = @"";
65 68 NSString* htmlForm = @"";
  69 + NSString* content = @"";
66 70 if ([_dictionary objectForKey:@"publishDate"] && [_dictionary objectForKey:@"author"]) {
67 71 htmldate = [[NSString alloc] initWithFormat:@"<html><p>%@</p><body>",[NSString stringWithFormat:@"%@",[_dictionary objectForKey:@"publishDate"]]];
68 72 htmlForm = [[NSString alloc] initWithFormat:@"<html><p>%@:%@</p><body>", CustomStr(@"Source"), _dictionary[@"author"]];
69 73 self.authorName = _dictionary[@"author"];
  74 + if (self.content&&![self.content isEqualToString:@""]) {
  75 + content = [[NSString alloc] initWithFormat:@"<div class=\"logo\" style=\"text-indent:2em\"><font style=\"font-size:%@px;\">%@</font></div>",fontArray[fontIndex],self.content];
  76 + }
70 77 } else {
71 78 htmldate = [[NSString alloc] initWithFormat:@"<html><p>%@</p><body>",[NSString stringWithFormat:@"%@",[_dictionary objectForKey:@"publishDate"]]];
72 79 NSDictionary *author = [NSDictionary dictionaryWithContentsOfFile:FavouriteAuthors_PATH];
... ... @@ -76,7 +83,7 @@
76 83  
77 84 NSString* htmlBody = [[NSString alloc] initWithFormat:@"<div class=\"logo\" style=\"text-indent:2em\"><font style=\"font-size:%@px;\">%@</font></div>",fontArray[fontIndex],[_dictionary objectForKey:@"desc"]];
78 85 NSString* htmlFooter = @"</body></html>";
79   - NSString* strHtml = [[NSString alloc] initWithFormat:@"%@%@%@%@%@",htmlHeader,htmldate,htmlForm,htmlBody,htmlFooter];
  86 + NSString* strHtml = [[NSString alloc] initWithFormat:@"%@%@%@%@%@%@",htmlHeader,htmldate,htmlForm,content,htmlBody,htmlFooter];
80 87 return strHtml;
81 88 }
82 89  
... ... @@ -238,8 +245,11 @@
238 245 _webView.UIDelegate = self;
239 246 _webView.opaque = NO;
240 247 [backgroundView addSubview:_webView];
  248 + if ([_dictionary objectForKey:@"publishDate"] && [_dictionary objectForKey:@"author"]) {
  249 + [self.present requestProgram:_dictionary[@"cmsContentId"]];
  250 + }else{
241 251 [_webView loadHTMLString:[self setHTMLString] baseURL:nil];
242   -
  252 + }
243 253 self.tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];
244 254 self.tableView.backgroundColor = [UIColor whiteColor];
245 255 self.tableView.backgroundView = nil;
... ... @@ -252,6 +262,7 @@
252 262 if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) {
253 263 [self.tableView setSeparatorInset:UIEdgeInsetsZero];
254 264 }
  265 + [self.present loadRelatedInformation:_dictionary[@"cmsContentId"]];
255 266 self.errorLabe = [[UILabel alloc] initWithFrame:CGRectZero];
256 267 self.errorLabe.backgroundColor = [UIColor clearColor];
257 268 self.errorLabe.textColor = HEXCOLOR(0x333333);
... ... @@ -270,17 +281,18 @@
270 281 - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
271 282  
272 283 if ([keyPath isEqualToString:@"contentSize"] && !_webView.loading && _webView.height != _webView.scrollView.contentSize.height) {
273   - CGRect frame = self->_webView.frame;
  284 + CGRect frame = _webView.frame;
274 285 frame.size.width = MainScreenWidth;
275 286 frame.size.height = 1;
276 287 CGFloat graphicLiveHeight = self->_webView.scrollView.contentSize.height;
277   - frame.size.height = self->_webView.scrollView.contentSize.height;
278   - NSLog(@"YYYYYYYYYYY%f",self->_webView.scrollView.contentSize.height);
279   - self->_webView.frame = frame;
280   - if (0 == [self->heightArr[self->fontIndex] floatValue]) {
281   - [self->heightArr replaceObjectAtIndex:self->fontIndex withObject:[NSString stringWithFormat:@"%f",graphicLiveHeight]];
  288 + frame.size.height = _webView.scrollView.contentSize.height;
  289 + NSLog(@"YYYYYYYYYYY%f",_webView.scrollView.contentSize.height);
  290 + _webView.frame = frame;
  291 + [heightArr replaceObjectAtIndex:fontIndex withObject:[NSString stringWithFormat:@"%f",graphicLiveHeight]];
  292 + if (_newsArray.count != 0) {
  293 + [self.tableView setFrame:CGRectMake(0, [heightArr[fontIndex] floatValue], MainScreenWidth, 36 + 86*_newsArray.count)];
282 294 }
283   - [self loadRelatedInformation];
  295 + [backgroundView setContentSize:CGSizeMake(MainScreenWidth, [heightArr[fontIndex] floatValue] + self.tableView.frame.size.height)];
284 296 }
285 297 }
286 298 // CNLivePlayer
... ... @@ -444,48 +456,30 @@
444 456 NSLog(@"value: %@ error: %@", response, error);
445 457  
446 458 }];
  459 +
447 460 }
448   -- (void)loadRelatedInformation {
449   - if (![[Reachability reachabilityForInternetConnection] currentReachabilityStatus]) {
450   - [AlertViewTool showHUDViewText:CustomStr(@"NetworkiInterruption")];
451   - return;
  461 +
  462 +#pragma mark - ProgramDelegate
  463 +-(void)programDetail:(NSString *)content
  464 +{
  465 + self.content = content;
  466 + [_webView loadHTMLString:[self setHTMLString] baseURL:nil];
  467 +}
  468 +
  469 +- (void)reloadWithData:(NSArray *)dataArray
  470 +{
  471 + if (0 != [dataArray count]) {
  472 + _newsArray = [NSArray arrayWithArray:dataArray];
  473 + [self.tableView setFrame:CGRectMake(0, [heightArr[fontIndex] floatValue], MainScreenWidth, 36 + 86*_newsArray.count)];
  474 + } else {
  475 + // [self.errorLabe setFrame:CGRectMake(12, [heightArr[fontIndex] floatValue], MainScreenWidth - 24, 20)];
  476 + // self.errorLabe.hidden = NO;
452 477 }
453   - NSString *strUrl = @"http://app.phonemovie.cnlive.com/gxb/api/programRelative";
454   - NSLog(@"%@",strUrl);
455   - NSString *categoryId = [NSString stringWithFormat:@"{\"plat\":\"i\",\"version\":\"5.0\",\"appid\":\"gxb\",\"cmsContentId\":\"%@\"}",_dictionary[@"cmsContentId"]];
456   - NSLog(@"%@",categoryId);
457   - NSDictionary *parameters = @{@"params":categoryId};
458   - AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
459   - [manager POST:strUrl
460   - parameters:parameters headers:nil
461   - progress:^(NSProgress * _Nonnull uploadProgress) {}
462   - success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
463   - // 请求成功,解析数据
464   - NSLog(@"%@", responseObject);
465   - NSDictionary *_dic = [NSDictionary dictionaryWithDictionary:responseObject];
466   - if ([_dic[@"errorCode"] isEqualToString:@"0"]) {
467   - NSArray *array = _dic[@"programs"];
468   - if (0 != [array count]) {
469   - self->_newsArray = [NSArray arrayWithArray:array];
470   - [self.tableView setFrame:CGRectMake(0, [self->heightArr[self->fontIndex] floatValue], MainScreenWidth, 36 + 86*self->_newsArray.count)];
471   - } else {
472   - // [self.errorLabe setFrame:CGRectMake(12, [heightArr[fontIndex] floatValue], MainScreenWidth - 24, 20)];
473   - // self.errorLabe.hidden = NO;
474   - }
475   - NSLog(@"%@",NSStringFromCGRect(self.tableView.frame));
476   - [self->backgroundView setContentSize:CGSizeMake(MainScreenWidth, [self->heightArr[self->fontIndex] floatValue] + self.tableView.frame.size.height)];
477   - [self.tableView reloadData];
478   - } else {
479   - [AlertViewTool showHUDViewText:_dic[@"errorMessage"]];
480   - }
481   - }
482   - failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
483   - // 请求失败
484   - NSLog(@"%@", [error localizedDescription]);
485   - [SVProgressHUD dismiss];
486   - [AlertViewTool showHUDAddedToView:self.view text:CustomStr(@"ServerBusy")];
487   - }];
  478 + NSLog(@"%@",NSStringFromCGRect(self.tableView.frame));
  479 + [backgroundView setContentSize:CGSizeMake(MainScreenWidth, [heightArr[fontIndex] floatValue] + self.tableView.frame.size.height)];
  480 + [self.tableView reloadData];
488 481 }
  482 +#pragma mark - UITableViewDelegate And UITableViewDataSource
489 483 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
490 484 return [_newsArray count];
491 485 }
... ... @@ -605,4 +599,15 @@
605 599  
606 600 }
607 601  
  602 +#pragma mark - Lazy
  603 +- (VideoDetailPresent *)present
  604 +{
  605 + if (!_present) {
  606 + _present = [[VideoDetailPresent alloc] init];
  607 + _present.currentView = self;
  608 + _present.delegate = self;
  609 + }
  610 + return _present;
  611 +}
  612 +
608 613 @end
... ...
CNLiveScioLive/Pages/Home/新闻详情/OldController/Present/VideoDetailPresent.h 0 → 100644
  1 +//
  2 +// VideoDetailPresent.h
  3 +// CNLiveScioLive
  4 +//
  5 +// Created by CNLive on 2021/2/25.
  6 +// Copyright © 2021 CNLive. All rights reserved.
  7 +//
  8 +
  9 +#import <Foundation/Foundation.h>
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +@protocol ProgramDelegate<NSObject>
  13 +@required
  14 +-(void)programDetail:(NSString *)content;
  15 +-(void)reloadWithData:(NSArray *)dataArray;
  16 +@end
  17 +
  18 +@interface VideoDetailPresent : NSObject
  19 +@property(nonatomic,weak) id currentView;
  20 +@property(nonatomic,weak)id<ProgramDelegate> delegate;
  21 +
  22 +-(void)requestProgram:(NSString *)reportId;
  23 +-(void)loadRelatedInformation:(NSString *)reportId;
  24 +@end
  25 +
  26 +NS_ASSUME_NONNULL_END
... ...
CNLiveScioLive/Pages/Home/新闻详情/OldController/Present/VideoDetailPresent.m 0 → 100644
  1 +//
  2 +// VideoDetailPresent.m
  3 +// CNLiveScioLive
  4 +//
  5 +// Created by CNLive on 2021/2/25.
  6 +// Copyright © 2021 CNLive. All rights reserved.
  7 +//
  8 +
  9 +#import "VideoDetailPresent.h"
  10 +
  11 +@implementation VideoDetailPresent
  12 +
  13 +-(void)requestProgram:(NSString *)reportId
  14 +{
  15 + if (![[Reachability reachabilityForInternetConnection] currentReachabilityStatus]) {
  16 + [AlertViewTool showHUDViewText:CustomStr(@"NetworkiInterruption")];
  17 + return;
  18 + }
  19 + NSString *strUrl = @"http://app.phonemovie.cnlive.com/gxb/api/programDetail";
  20 + NSLog(@"%@",strUrl);
  21 + NSString *categoryId = [NSString stringWithFormat:@"{\"plat\":\"i\",\"version\":\"5.0\",\"appid\":\"gxb\",\"type\":\"program\",\"id\":\"%@\"}",reportId];
  22 + NSLog(@"%@",categoryId);
  23 + NSDictionary *parameters = @{@"params":categoryId};
  24 + AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
  25 + [manager POST:strUrl
  26 + parameters:parameters headers:nil
  27 + progress:^(NSProgress * _Nonnull uploadProgress) {}
  28 + success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
  29 + // 请求成功,解析数据
  30 + NSLog(@"%@", responseObject);
  31 + NSDictionary *_dic = [NSDictionary dictionaryWithDictionary:responseObject];
  32 + if ([_dic[@"errorCode"] isEqualToString:@"0"]) {
  33 + NSString *content = _dic[@"content"];
  34 + CNMessageSend(self.currentView, ProgramDelegate, programDetail:content);
  35 +
  36 + } else {
  37 + [AlertViewTool showHUDViewText:_dic[@"errorMessage"]];
  38 + }
  39 + }
  40 + failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
  41 + // 请求失败
  42 + NSLog(@"%@", [error localizedDescription]);
  43 + [SVProgressHUD dismiss];
  44 + [AlertViewTool showHUDAddedToView:AppKeyWindow text:CustomStr(@"ServerBusy")];
  45 + }];
  46 +}
  47 +- (void)loadRelatedInformation:(NSString *)reportId {
  48 + if (![[Reachability reachabilityForInternetConnection] currentReachabilityStatus]) {
  49 + [AlertViewTool showHUDViewText:CustomStr(@"NetworkiInterruption")];
  50 + return;
  51 + }
  52 + NSString *strUrl = @"http://app.phonemovie.cnlive.com/gxb/api/programRelative";
  53 + NSLog(@"%@",strUrl);
  54 + NSString *categoryId = [NSString stringWithFormat:@"{\"plat\":\"i\",\"version\":\"5.0\",\"appid\":\"gxb\",\"cmsContentId\":\"%@\"}",reportId];
  55 + NSLog(@"%@",categoryId);
  56 + NSDictionary *parameters = @{@"params":categoryId};
  57 + AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
  58 + [manager POST:strUrl
  59 + parameters:parameters headers:nil
  60 + progress:^(NSProgress * _Nonnull uploadProgress) {}
  61 + success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
  62 + // 请求成功,解析数据
  63 + NSLog(@"%@", responseObject);
  64 + NSDictionary *_dic = [NSDictionary dictionaryWithDictionary:responseObject];
  65 + if ([_dic[@"errorCode"] isEqualToString:@"0"]) {
  66 + NSArray *array = _dic[@"programs"];
  67 + CNMessageSend(self.currentView, ProgramDelegate, reloadWithData:array);
  68 + } else {
  69 + [AlertViewTool showHUDViewText:_dic[@"errorMessage"]];
  70 + }
  71 + }
  72 + failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
  73 + // 请求失败
  74 + NSLog(@"%@", [error localizedDescription]);
  75 + [SVProgressHUD dismiss];
  76 + [AlertViewTool showHUDAddedToView:AppKeyWindow text:CustomStr(@"ServerBusy")];
  77 + }];
  78 +}
  79 +@end
... ...
CNLiveScioLive/Pages/Newsound/OldController/VoiceViewController.m
... ... @@ -29,6 +29,8 @@
29 29 UIButton *shareBtn;//分享
30 30 UIButton *favoriteBtn;//收藏
31 31  
  32 + UIImageView *reviewImage;//预览图片
  33 +
32 34 UIButton *playBackBtn;//15s
33 35 UIButton *playBtn;//播放
34 36 UIButton *playNextBtn;//下一首
... ... @@ -645,6 +647,17 @@ static const NSInteger margin = 34;
645 647 playProgress.backgroundColor = HEXCOLOR(0x1959C9);
646 648 [self.view addSubview:playProgress];
647 649  
  650 + reviewImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];
  651 + reviewImage.backgroundColor = [UIColor whiteColor];
  652 + reviewImage.contentMode = UIViewContentModeScaleAspectFit;
  653 + [self.view addSubview:reviewImage];
  654 + [reviewImage mas_makeConstraints:^(MASConstraintMaker *make) {
  655 + make.left.equalTo(self->titleLabel.mas_left);
  656 + make.right.equalTo(self->titleLabel.mas_right);
  657 + make.top.equalTo(self->favoriteBtn.mas_bottom).with.offset(5);
  658 + make.bottom.equalTo(self->playBtn.mas_top).with.offset(-5);
  659 + }];
  660 +
648 661 }
649 662 //2个列表UI
650 663 - (void)createUI{
... ... @@ -847,6 +860,7 @@ static const NSInteger margin = 34;
847 860 } else {
848 861 sourceLabel.text = [NSString stringWithFormat:@"Source: %@",dic[@"author"]];
849 862 }
  863 + [reviewImage sd_setImageWithURL:dic[@"imgSmall"]];
850 864 // 判断收藏按钮状态
851 865 TableData *notice = [[TableData alloc] initWithJSONDictionary:_dictionary];
852 866 BOOL isIn = [[DBAction sharedDBAction] isInTable:[User_Defaults objectForKey:Language_Local] notice:notice];
... ...
CNLiveScioLive/Pages/Tools/DBAction/DBAction.m
... ... @@ -127,15 +127,15 @@ static DBAction *instance = nil;
127 127 - (void)createTable:(NSString *)tableName{
128 128 if ([db open]) {
129 129 tableName = [tableName substringToIndex:2];
130   - NSString * sql = [NSString stringWithFormat:@"CREATE TABLE %@DATATABLE (cmsColumnName varchar, cmsColumnId varchar, cmsContentId int, createDate varchar, desc varchar, gxbArticleId int, gxbVideoId int, img varchar, pageUrl varchar, picType varchar, playType varchar, publishDate varchar, subTitle varchar, title varchar, type varchar, uploadVideoUrl varchar, videoUrl varchar, vipFlag int, uuid varchar)",tableName.uppercaseString];
  130 + NSString * sql = [NSString stringWithFormat:@"CREATE TABLE IF NOT EXISTS %@SDATATABLE (cmsColumnName varchar, cmsColumnId varchar, cmsContentId int, createDate varchar, desc varchar, gxbArticleId int, gxbVideoId int, img varchar,imgSmall varchar, pageUrl varchar, picType varchar, playType varchar, publishDate varchar, subTitle varchar, title varchar, type varchar, uploadVideoUrl varchar, videoUrl varchar, vipFlag int, uuid varchar,author varchar)",tableName.uppercaseString];
131 131 BOOL res = [db executeUpdate:sql];
132 132 if (!res) {
133 133 NSLog(@"建表失败");
134 134  
135   - NSString *sql1 = [NSString stringWithFormat:@"ALTER TABLE %@DATATABLE ADD %@ VARCHAR",tableName,@"playType"];
  135 + NSString *sql1 = [NSString stringWithFormat:@"ALTER TABLE %@SDATATABLE ADD %@ VARCHAR",tableName,@"playType"];
136 136 BOOL result1 = [db executeUpdate:sql1];
137 137  
138   - NSString *sql2 = [NSString stringWithFormat:@"ALTER TABLE %@DATATABLE ADD %@ VARCHAR",tableName,@"uuid"];
  138 + NSString *sql2 = [NSString stringWithFormat:@"ALTER TABLE %@SDATATABLE ADD %@ VARCHAR",tableName,@"uuid"];
139 139 BOOL result2 = [db executeUpdate:sql2];
140 140  
141 141 } else {
... ... @@ -150,7 +150,7 @@ static DBAction *instance = nil;
150 150 - (BOOL)isInTable:(NSString *)tableName notice:(TableData*)notice{
151 151 if ([db open]) {
152 152 tableName = [tableName substringToIndex:2];
153   - NSString * check = [NSString stringWithFormat:@"SELECT * FROM %@DATATABLE where cmsContentId = %d",tableName.uppercaseString,notice.cmsContentId];
  153 + NSString * check = [NSString stringWithFormat:@"SELECT * FROM %@SDATATABLE where cmsContentId = %d",tableName.uppercaseString,notice.cmsContentId];
154 154 FMResultSet * re = [db executeQuery:check];
155 155 while ([re next]) {
156 156 return YES;
... ... @@ -163,12 +163,12 @@ static DBAction *instance = nil;
163 163 - (BOOL)insertTable:(NSString *)tableName notice:(TableData*)notice{
164 164 if ([db open]) {
165 165 tableName = [tableName substringToIndex:2];
166   - NSString * check = [NSString stringWithFormat:@"SELECT * FROM %@DATATABLE where cmsContentId = %d",tableName.uppercaseString,notice.cmsContentId];
  166 + NSString * check = [NSString stringWithFormat:@"SELECT * FROM %@SDATATABLE where cmsContentId = %d",tableName.uppercaseString,notice.cmsContentId];
167 167 FMResultSet * re = [db executeQuery:check];
168 168 if (![re next]) {
169 169 NSString *desc = [notice.desc stringByReplacingOccurrencesOfString:@"'" withString:@"''"];
170 170 NSString *title = [notice.title stringByReplacingOccurrencesOfString:@"'" withString:@"‘"];
171   - NSString * sql = [NSString stringWithFormat:@"INSERT INTO %@DATATABLE (cmsColumnName, cmsColumnId, cmsContentId, createDate, desc, gxbArticleId, gxbVideoId, img, pageUrl, picType, playType, publishDate, subTitle, title, type, uploadVideoUrl, videoUrl, vipFlag, uuid) values('%@','%@','%d', '%@','%@','%d','%d', '%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%d', '%@')",tableName.uppercaseString, notice.cmsColumnName, notice.cmsColumnId, notice.cmsContentId, notice.createDate, desc, notice.gxbArticleId, notice.gxbVideoId, notice.img, notice.pageUrl, notice.picType, notice.playType, notice.publishDate, notice.subTitle, title, notice.type, notice.uploadVideoUrl, notice.videoUrl, notice.vipFlag, notice.uuid?notice.uuid:@""];
  171 + NSString * sql = [NSString stringWithFormat:@"INSERT INTO %@SDATATABLE (cmsColumnName, cmsColumnId, cmsContentId, createDate, desc, gxbArticleId, gxbVideoId, img, imgSmall, pageUrl, picType, playType, publishDate, subTitle, title, type, uploadVideoUrl, videoUrl, vipFlag, uuid,author) values('%@','%@','%d', '%@','%@','%d','%d', '%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%d', '%@','%@')",tableName.uppercaseString, notice.cmsColumnName, notice.cmsColumnId, notice.cmsContentId, notice.createDate, desc, notice.gxbArticleId, notice.gxbVideoId, notice.img, notice.imgSmall, notice.pageUrl, notice.picType, notice.playType, notice.publishDate, notice.subTitle, title, notice.type, notice.uploadVideoUrl, notice.videoUrl, notice.vipFlag, notice.uuid?notice.uuid:@"",notice.author];
172 172 BOOL res = [db executeUpdate:sql];
173 173 if (!res) {
174 174 return NO;
... ... @@ -184,7 +184,7 @@ static DBAction *instance = nil;
184 184 - (BOOL)deleteTable:(NSString *)tableName notice:(TableData*)notice{
185 185 if ([db open]) {
186 186 tableName = [tableName substringToIndex:2];
187   - NSString * sql = [NSString stringWithFormat:@"DELETE FROM %@DATATABLE where cmsContentId = %d",tableName.uppercaseString,notice.cmsContentId];
  187 + NSString * sql = [NSString stringWithFormat:@"DELETE FROM %@SDATATABLE where cmsContentId = %d",tableName.uppercaseString,notice.cmsContentId];
188 188 BOOL res = [db executeUpdate:sql];
189 189 if (!res) {
190 190 return NO;
... ... @@ -200,7 +200,7 @@ static DBAction *instance = nil;
200 200 NSMutableArray *list = [[NSMutableArray alloc] init];
201 201 if ([db open]) {
202 202 tableName = [tableName substringToIndex:2];
203   - NSString *sql = [NSString stringWithFormat:@"SELECT * FROM %@DATATABLE",tableName.uppercaseString];
  203 + NSString *sql = [NSString stringWithFormat:@"SELECT * FROM %@SDATATABLE",tableName.uppercaseString];
204 204 FMResultSet * rs = [db executeQuery:sql];
205 205 while ([rs next]) {
206 206 TableData * notice = [[TableData alloc] init];
... ... @@ -212,6 +212,7 @@ static DBAction *instance = nil;
212 212 notice.gxbArticleId = [rs intForColumn:@"gxbArticleId"];
213 213 notice.gxbVideoId = [rs intForColumn:@"gxbVideoId"];
214 214 notice.img = [rs stringForColumn:@"img"];
  215 + notice.imgSmall = [rs stringForColumn:@"imgSmall"];
215 216 notice.pageUrl = [rs stringForColumn:@"pageUrl"];
216 217 notice.picType = [rs stringForColumn:@"picType"];
217 218 notice.playType = [rs stringForColumn:@"playType"];
... ... @@ -224,6 +225,7 @@ static DBAction *instance = nil;
224 225 notice.uploadVideoUrl= [rs stringForColumn:@"uploadVideoUrl"];
225 226 notice.videoUrl = [rs stringForColumn:@"videoUrl"];
226 227 notice.vipFlag = [rs intForColumn:@"vipFlag"];
  228 + notice.author = [rs stringForColumn:@"author"];
227 229 [list addObject:notice];
228 230 }
229 231 [db close];
... ...
CNLiveScioLive/Pages/Tools/DBAction/NoticeData.h
... ... @@ -24,6 +24,7 @@
24 24 @property(nonatomic, assign) int gxbArticleId;
25 25 @property(nonatomic, assign) int gxbVideoId;
26 26 @property(nonatomic, copy) NSString *img;
  27 +@property(nonatomic, copy) NSString *imgSmall;
27 28 @property(nonatomic, copy) NSString *pageUrl;
28 29 @property(nonatomic, copy) NSString *picType;
29 30 @property(nonatomic, copy) NSString *playType;
... ...
CNLiveScioLive/Pages/Tools/DBAction/NoticeData.m
... ... @@ -102,6 +102,11 @@
102 102 }else{
103 103 self.img = [jsonDic objectForKey:@"img"];
104 104 }
  105 + if ([jsonDic objectForKey:@"imgSmall"] == [NSNull null]) {
  106 + self.imgSmall = @"";
  107 + }else{
  108 + self.imgSmall = [jsonDic objectForKey:@"imgSmall"];
  109 + }
105 110 if ([jsonDic objectForKey:@"pageUrl"] == [NSNull null]) {
106 111 self.pageUrl = @"";
107 112 }else{
... ... @@ -167,11 +172,11 @@
167 172 self.uuid = [jsonDic objectForKey:@"uuid"];
168 173 }
169 174  
170   -// if ([jsonDic objectForKey:@"author"] == [NSNull null]) {
171   -// self.author = @"";
172   -// }else{
173   -// self.author = [jsonDic objectForKey:@"author"];
174   -// }
  175 + if ([jsonDic objectForKey:@"author"] == [NSNull null]) {
  176 + self.author = @"";
  177 + }else{
  178 + self.author = [jsonDic objectForKey:@"author"];
  179 + }
175 180 return self;
176 181 }
177 182  
... ... @@ -186,6 +191,7 @@
186 191 [dic setObject:[NSNumber numberWithInt:self.gxbArticleId] forKey:@"gxbArticleId"];
187 192 [dic setObject:[NSNumber numberWithInt:self.gxbVideoId] forKey:@"gxbVideoId"];
188 193 [dic setObject:self.img forKey:@"img"];
  194 + [dic setObject:self.imgSmall forKey:@"imgSmall"];
189 195 [dic setObject:self.pageUrl forKey:@"pageUrl"];
190 196 [dic setObject:self.picType forKey:@"picType"];
191 197 [dic setObject:self.playType?self.playType:@"" forKey:@"playType"];
... ... @@ -199,7 +205,7 @@
199 205 [dic setObject:self.uploadVideoUrl forKey:@"uploadVideoUrl"];
200 206 [dic setObject:self.videoUrl forKey:@"videoUrl"];
201 207 [dic setObject:[NSNumber numberWithInt:self.vipFlag] forKey:@"vipFlag"];
202   -// [dic setObject:self.author forKey:@"author"];
  208 + [dic setObject:self.author forKey:@"author"];
203 209 return [NSDictionary dictionaryWithDictionary:dic];
204 210 }
205 211 @end
... ...
CNLiveScioLive/Pages/Tools/ZXVideoPlayer/Classes/ZXVideoPlayerController.m
No preview for this file type