VideoDetailPresent.m
3.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
//
// VideoDetailPresent.m
// CNLiveScioLive
//
// Created by CNLive on 2021/2/25.
// Copyright © 2021 CNLive. All rights reserved.
//
#import "VideoDetailPresent.h"
@implementation VideoDetailPresent
-(void)requestProgram:(NSString *)reportId
{
if (![[Reachability reachabilityForInternetConnection] currentReachabilityStatus]) {
[AlertViewTool showHUDViewText:CustomStr(@"NetworkiInterruption")];
return;
}
NSString *strUrl = REQUESTURL(@"gxb/api/programDetail");
NSLog(@"%@",strUrl);
NSString *categoryId = [NSString stringWithFormat:@"{\"plat\":\"i\",\"version\":\"5.0\",\"appid\":\"gxb\",\"type\":\"program\",\"id\":\"%@\"}",reportId];
NSLog(@"%@",categoryId);
NSDictionary *parameters = @{@"params":categoryId};
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
[manager POST:strUrl
parameters:parameters headers:nil
progress:^(NSProgress * _Nonnull uploadProgress) {}
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
// 请求成功,解析数据
NSLog(@"%@", responseObject);
NSDictionary *_dic = [NSDictionary dictionaryWithDictionary:responseObject];
if ([_dic[@"errorCode"] isEqualToString:@"0"]) {
NSString *content = _dic[@"content"];
CNMessageSend(self.currentView, ProgramDelegate, programDetail:content);
} else {
[AlertViewTool showHUDViewText:_dic[@"errorMessage"]];
}
}
failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
// 请求失败
NSLog(@"%@", [error localizedDescription]);
[SVProgressHUD dismiss];
[AlertViewTool showHUDAddedToView:AppKeyWindow text:CustomStr(@"ServerBusy")];
}];
}
- (void)loadRelatedInformation:(NSString *)reportId {
if (![[Reachability reachabilityForInternetConnection] currentReachabilityStatus]) {
[AlertViewTool showHUDViewText:CustomStr(@"NetworkiInterruption")];
return;
}
NSString *strUrl = REQUESTURL(@"gxb/api/programRelative");
NSLog(@"%@",strUrl);
NSString *categoryId = [NSString stringWithFormat:@"{\"plat\":\"i\",\"version\":\"5.0\",\"appid\":\"gxb\",\"cmsContentId\":\"%@\"}",reportId];
NSLog(@"%@",categoryId);
NSDictionary *parameters = @{@"params":categoryId};
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
[manager POST:strUrl
parameters:parameters headers:nil
progress:^(NSProgress * _Nonnull uploadProgress) {}
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
// 请求成功,解析数据
NSLog(@"%@", responseObject);
NSDictionary *_dic = [NSDictionary dictionaryWithDictionary:responseObject];
if ([_dic[@"errorCode"] isEqualToString:@"0"]) {
NSArray *array = _dic[@"programs"];
CNMessageSend(self.currentView, ProgramDelegate, reloadWithData:array);
} else {
[AlertViewTool showHUDViewText:_dic[@"errorMessage"]];
}
}
failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
// 请求失败
NSLog(@"%@", [error localizedDescription]);
[SVProgressHUD dismiss];
[AlertViewTool showHUDAddedToView:AppKeyWindow text:CustomStr(@"ServerBusy")];
}];
}
@end