Commit 64eb0052 by 刘卓鑫

adview的曝光、点击

parent 8acd6bf8
...@@ -107,6 +107,7 @@ ...@@ -107,6 +107,7 @@
1CA31627225C6AB2005ECF2B /* ZXAnnouncementView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1CA31626225C6AB2005ECF2B /* ZXAnnouncementView.m */; }; 1CA31627225C6AB2005ECF2B /* ZXAnnouncementView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1CA31626225C6AB2005ECF2B /* ZXAnnouncementView.m */; };
1CA7E88B229E8E310014E95F /* JDSDK.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 1CA7E889229E8E310014E95F /* JDSDK.bundle */; }; 1CA7E88B229E8E310014E95F /* JDSDK.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 1CA7E889229E8E310014E95F /* JDSDK.bundle */; };
1CA7E88C229E8E310014E95F /* JDSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1CA7E88A229E8E310014E95F /* JDSDK.framework */; }; 1CA7E88C229E8E310014E95F /* JDSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1CA7E88A229E8E310014E95F /* JDSDK.framework */; };
1CB10F1C233C63C900F94688 /* ZXAdViewService.m in Sources */ = {isa = PBXBuildFile; fileRef = 1CB10F1B233C63C900F94688 /* ZXAdViewService.m */; };
1CB3AC062304E195006F1724 /* ZXMePageCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 1CB3AC052304E195006F1724 /* ZXMePageCollectionViewCell.m */; }; 1CB3AC062304E195006F1724 /* ZXMePageCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 1CB3AC052304E195006F1724 /* ZXMePageCollectionViewCell.m */; };
1CB3AC092304E369006F1724 /* ZXMePageMenuModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 1CB3AC082304E369006F1724 /* ZXMePageMenuModel.m */; }; 1CB3AC092304E369006F1724 /* ZXMePageMenuModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 1CB3AC082304E369006F1724 /* ZXMePageMenuModel.m */; };
1CB3AC0C2305321D006F1724 /* ZXBindTelViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1CB3AC0B2305321D006F1724 /* ZXBindTelViewController.m */; }; 1CB3AC0C2305321D006F1724 /* ZXBindTelViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1CB3AC0B2305321D006F1724 /* ZXBindTelViewController.m */; };
...@@ -898,6 +899,8 @@ ...@@ -898,6 +899,8 @@
1CA31626225C6AB2005ECF2B /* ZXAnnouncementView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZXAnnouncementView.m; sourceTree = "<group>"; }; 1CA31626225C6AB2005ECF2B /* ZXAnnouncementView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZXAnnouncementView.m; sourceTree = "<group>"; };
1CA7E889229E8E310014E95F /* JDSDK.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = JDSDK.bundle; sourceTree = "<group>"; }; 1CA7E889229E8E310014E95F /* JDSDK.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = JDSDK.bundle; sourceTree = "<group>"; };
1CA7E88A229E8E310014E95F /* JDSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = JDSDK.framework; sourceTree = "<group>"; }; 1CA7E88A229E8E310014E95F /* JDSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = JDSDK.framework; sourceTree = "<group>"; };
1CB10F1A233C63C900F94688 /* ZXAdViewService.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ZXAdViewService.h; sourceTree = "<group>"; };
1CB10F1B233C63C900F94688 /* ZXAdViewService.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ZXAdViewService.m; sourceTree = "<group>"; };
1CB3AC042304E195006F1724 /* ZXMePageCollectionViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ZXMePageCollectionViewCell.h; sourceTree = "<group>"; }; 1CB3AC042304E195006F1724 /* ZXMePageCollectionViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ZXMePageCollectionViewCell.h; sourceTree = "<group>"; };
1CB3AC052304E195006F1724 /* ZXMePageCollectionViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ZXMePageCollectionViewCell.m; sourceTree = "<group>"; }; 1CB3AC052304E195006F1724 /* ZXMePageCollectionViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ZXMePageCollectionViewCell.m; sourceTree = "<group>"; };
1CB3AC072304E369006F1724 /* ZXMePageMenuModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ZXMePageMenuModel.h; sourceTree = "<group>"; }; 1CB3AC072304E369006F1724 /* ZXMePageMenuModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ZXMePageMenuModel.h; sourceTree = "<group>"; };
...@@ -2197,6 +2200,8 @@ ...@@ -2197,6 +2200,8 @@
children = ( children = (
1C785975232F81440055A494 /* ZXAdViewAdTool.h */, 1C785975232F81440055A494 /* ZXAdViewAdTool.h */,
1C785976232F81440055A494 /* ZXAdViewAdTool.m */, 1C785976232F81440055A494 /* ZXAdViewAdTool.m */,
1CB10F1A233C63C900F94688 /* ZXAdViewService.h */,
1CB10F1B233C63C900F94688 /* ZXAdViewService.m */,
); );
path = ADViewAd; path = ADViewAd;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -5460,6 +5465,7 @@ ...@@ -5460,6 +5465,7 @@
A75436E821D34594005584CC /* UpdateVersionModel.m in Sources */, A75436E821D34594005584CC /* UpdateVersionModel.m in Sources */,
A7F3E00E21B530F500010E23 /* ZXColorfulTopController.m in Sources */, A7F3E00E21B530F500010E23 /* ZXColorfulTopController.m in Sources */,
1C8F4A4C231E70BD00AAF24A /* DC_ZXWashCloseViewController.m in Sources */, 1C8F4A4C231E70BD00AAF24A /* DC_ZXWashCloseViewController.m in Sources */,
1CB10F1C233C63C900F94688 /* ZXAdViewService.m in Sources */,
1CF86307230280FB0007EBC6 /* AppUpdateVersion.m in Sources */, 1CF86307230280FB0007EBC6 /* AppUpdateVersion.m in Sources */,
A756C5CB21FAA6050006E418 /* SDCycleScrollView.m in Sources */, A756C5CB21FAA6050006E418 /* SDCycleScrollView.m in Sources */,
A7F3E19721B5330F00010E23 /* CXMLNode_XPathExtensions.m in Sources */, A7F3E19721B5330F00010E23 /* CXMLNode_XPathExtensions.m in Sources */,
......
...@@ -30,6 +30,38 @@ ...@@ -30,6 +30,38 @@
endingLineNumber = "289" endingLineNumber = "289"
landmarkName = "-changeAction" landmarkName = "-changeAction"
landmarkType = "7"> landmarkType = "7">
<Locations>
<Location
uuid = "5ABFA4A1-90B2-4BB2-A520-8212CD4CCAF9 - 4364e748c2fb8405"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "__41-[ZXChangeMsgViewController changeAction]_block_invoke.275"
moduleName = "ColorfulSchool"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/liuzhuoxin/codeStore/colorfulSchoolReconsitution/ColorfulSchool/ColorfulSchool/Classes/MineView(%E4%B8%AA%E4%BA%BA%E4%B8%AD%E5%BF%83)/UserSetting/ChangePasswordAndPhone/Controller/ZXChangeMsgViewController.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "289"
endingLineNumber = "289"
offsetFromSymbolStart = "92">
</Location>
<Location
uuid = "5ABFA4A1-90B2-4BB2-A520-8212CD4CCAF9 - 63e148375c775850"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "__41-[ZXChangeMsgViewController changeAction]_block_invoke_2.277"
moduleName = "ColorfulSchool"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/liuzhuoxin/codeStore/colorfulSchoolReconsitution/ColorfulSchool/ColorfulSchool/Classes/MineView(%E4%B8%AA%E4%BA%BA%E4%B8%AD%E5%BF%83)/UserSetting/ChangePasswordAndPhone/Controller/ZXChangeMsgViewController.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "289"
endingLineNumber = "289"
offsetFromSymbolStart = "32">
</Location>
</Locations>
</BreakpointContent> </BreakpointContent>
</BreakpointProxy> </BreakpointProxy>
<BreakpointProxy <BreakpointProxy
......
// //
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <net/if.h> #include <net/if.h>
#include <net/if_dl.h> #include <net/if_dl.h>
#import "ZXFullScreenAdView.h" #import "ZXFullScreenAdView.h"
#import "ZXAdViewService.h"
@interface ZXAdViewAdTool () @interface ZXAdViewAdTool ()
...@@ -25,7 +26,7 @@ ...@@ -25,7 +26,7 @@
NSString *url = [[NSString stringWithFormat:@"http://open.adview.cn/agent/openRequest.do?ver=2.7.0&n=1&appid=SDK20191516030954opvyhmi3khwalbw&pt=4&posId=POSIDn5ahrkelm20e&pack=com.pxkjformal.parallelcampus&w=%f&h=%f&tab=0&ip=%@&os=1&bdr=%@&tp=%@&brd=Apple&ua=%@&sw=%f&sh=%f&deny=%f&sn=%@&mac=%@&didsha1=%@&dpidsha1=%@&macsha1=%@&didmd5=%@&dpidmd5=%@&macmd5=%@&nt=%@&nop=%@&country=ISO-3166-1 Alpha-3&language=alpha-2/ISO 639- 1&tm=0&time=%@&token=%@", kScreenWidth, kScreenHeight, [BYHelp getIPAddress], [[UIDevice currentDevice] systemVersion], [ZXTool getCurrentDevice], [ZXTool returnUserAgent], kScreenWidth, kScreenHeight, [UIScreen mainScreen].scale, [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString], [self macAddress], [self iemi],[self sha1:[[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString]], [self sha1:[self macAddress]], [ZXTool md5:[self iemi]], [ZXTool md5:[[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString]], [ZXTool md5:[self macAddress]], [ZXTool returnNetworkStatus]==1?@"WIFI":@"4G", [ZXTool currentYYS], [ZXTool getCurrentTimeStamp], [ZXTool md5:[NSString stringWithFormat:@"SDK20191516030954opvyhmi3khwalbw%@", [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString]]]] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; NSString *url = [[NSString stringWithFormat:@"http://open.adview.cn/agent/openRequest.do?ver=2.7.0&n=1&appid=SDK20191516030954opvyhmi3khwalbw&pt=4&posId=POSIDn5ahrkelm20e&pack=com.pxkjformal.parallelcampus&w=%f&h=%f&tab=0&ip=%@&os=1&bdr=%@&tp=%@&brd=Apple&ua=%@&sw=%f&sh=%f&deny=%f&sn=%@&mac=%@&didsha1=%@&dpidsha1=%@&macsha1=%@&didmd5=%@&dpidmd5=%@&macmd5=%@&nt=%@&nop=%@&country=ISO-3166-1 Alpha-3&language=alpha-2/ISO 639- 1&tm=0&time=%@&token=%@", kScreenWidth, kScreenHeight, [BYHelp getIPAddress], [[UIDevice currentDevice] systemVersion], [ZXTool getCurrentDevice], [ZXTool returnUserAgent], kScreenWidth, kScreenHeight, [UIScreen mainScreen].scale, [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString], [self macAddress], [self iemi],[self sha1:[[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString]], [self sha1:[self macAddress]], [ZXTool md5:[self iemi]], [ZXTool md5:[[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString]], [ZXTool md5:[self macAddress]], [ZXTool returnNetworkStatus]==1?@"WIFI":@"4G", [ZXTool currentYYS], [ZXTool getCurrentTimeStamp], [ZXTool md5:[NSString stringWithFormat:@"SDK20191516030954opvyhmi3khwalbw%@", [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString]]]] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
// NSDictionary *dic = @{@"ver":@"4.0.1",@"n":@"1", @"appid":@"SDK20191516030954opvyhmi3khwalbw",@"pt":@"4", @"posId":@"POSIDn5ahrkelm20e", @"pack":@"com.pxkjformal.parallelcampus", @"w":@(kScreenWidth), @"h":@(kScreenHeight), @"tab":@"0", @"ip":[BYHelp getIPAddress], @"bdr":[[UIDevice currentDevice] systemVersion], @"tp":@"", @"brd":@"Apple", @"ua":[ZXTool getCurrentDevice], @"sw":@(kScreenWidth), @"sh":@(kScreenHeight), @"deny":@([UIScreen mainScreen].scale), @"sn":@"867FD2E0-F1FB-4D05-B3AE-383951FEE6EA", @"mac":[self macAddress], @"didsha1":[self iemi], @"dpidsha1":[self sha1:[[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString]], @"macsha1":[self sha1:[self macAddress]], @"didmd5":[ZXTool md5:[self iemi]], @"dpidmd5":[ZXTool md5:[[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString]], @"macmd5":[ZXTool md5:[self macAddress]], @"nt":([ZXTool returnNetworkStatus]==1?@"WIFI":@"4G"), @"nop":[ZXTool currentYYS], @"country":@"ISO-3166-1 Alpha-3", @"language":@"alpha-2/ISO639- 1", @"tm":@"0", @"time":[ZXTool getCurrentTimeStamp], @"token":[ZXTool md5:[NSString stringWithFormat:@"SDK20191516030954opvyhmi3khwalbw%@", [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString]]]}; // NSDictionary *dic = @{@"ver":@"4.0.1",@"n":@"1", @"appid":@"SDK20191516030954opvyhmi3khwalbw",@"pt":@"4", @"posId":@"POSIDn5ahrkelm20e", @"pack":@"com.pxkjformal.parallelcampus", @"w":@(kScreenWidth), @"h":@(kScreenHeight), @"tab":@"0", @"ip":[BYHelp getIPAddress], @"bdr":[[UIDevice currentDevice] systemVersion], @"tp":@"", @"brd":@"Apple", @"ua":[ZXTool getCurrentDevice], @"sw":@(kScreenWidth), @"sh":@(kScreenHeight), @"deny":@([UIScreen mainScreen].scale), @"sn":@"867FD2E0-F1FB-4D05-B3AE-383951FEE6EA", @"mac":[self macAddress], @"didsha1":[self iemi], @"dpidsha1":[self sha1:[[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString]], @"macsha1":[self sha1:[self macAddress]], @"didmd5":[ZXTool md5:[self iemi]], @"dpidmd5":[ZXTool md5:[[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString]], @"macmd5":[ZXTool md5:[self macAddress]], @"nt":([ZXTool returnNetworkStatus]==1?@"WIFI":@"4G"), @"nop":[ZXTool currentYYS], @"country":@"ISO-3166-1 Alpha-3", @"language":@"alpha-2/ISO639- 1", @"tm":@"0", @"time":[ZXTool getCurrentTimeStamp], @"token":[ZXTool md5:[NSString stringWithFormat:@"SDK20191516030954opvyhmi3khwalbw%@", [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString]]]};
[[self sharedManager] POST:url parameters:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nonnull responseObject) { [[ZXAdViewService sharedManager] POST:url parameters:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nonnull responseObject) {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
if (responseObject && [responseObject isKindOfClass:[NSDictionary class]]) { if (responseObject && [responseObject isKindOfClass:[NSDictionary class]]) {
[self createLauchAd:responseObject]; [self createLauchAd:responseObject];
...@@ -47,9 +48,9 @@ ...@@ -47,9 +48,9 @@
adView.adImageTapBlock = ^(NSString *content) { adView.adImageTapBlock = ^(NSString *content) {
@strongify(self); @strongify(self);
//内部点击 //内部点击
[self nativeAdClickByAdModel:ad]; [ZXAdViewService nativeAdClickByAdModel:ad];
//上报相关 //上报相关
[self clickAd:ad[@"ec"]]; [ZXAdViewService clickAd:ad[@"ec"]];
//点击逻辑 //点击逻辑
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:ad[@"dl"]]]; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:ad[@"dl"]]];
...@@ -58,98 +59,12 @@ ...@@ -58,98 +59,12 @@
[kAppWindow addSubview:adView]; [kAppWindow addSubview:adView];
//内部曝光 //内部曝光
[self nativeAdExposeByAdModel:ad]; [ZXAdViewService nativeAdExposeByAdModel:ad];
//广告曝光 //广告曝光
[self exposeAd:ad[@"es"]]; [ZXAdViewService exposeAd:ad[@"es"]];
} }
#pragma mark - 广告的曝光
/*
* model 广告模型
*/
- (void) nativeAdExposeByAdModel:(NSDictionary *) model {
if (model == nil) {
return;
}
dispatch_async(dispatch_get_global_queue(0, 0), ^{
if ([[kUserDefaults valueForKey:@"isNeedExposure"] isEqualToString:@"1"]) {
return;
}
NSString *img = [model[@"api"] firstObject];
NSString *pid = model[@"posId"];
NSString *uid = [kUserDefaults valueForKey:@"userId"]?[kUserDefaults valueForKey:@"userId"]:@"";
NSDictionary *dic = @{@"adsenseName":@"adView",@"advertType":@"曝光",@"advertTitle":@"adView", @"advertImg":img, @"customerId":uid, @"advertId":pid,@"platformCode":@"DCXY_iOS"};
//内部曝光
NSString *url = [NSString stringWithFormat:@"%@/app/adsenseCollectData/adsenseCollectData4Add",[kUserDefaults valueForKey:@"Ad"]];
[ZXTool requestDataHideLoadingToastWithType:kXMHTTPMethodPOST url:url para:dic completed:^(CommonModel *common, NSString *error) {
}];
});
}
#pragma mark - 广告的点击
/*
* model 广告模型
*/
- (void) nativeAdClickByAdModel:(NSDictionary *) model {
if (model == nil) {
return;
}
dispatch_async(dispatch_get_global_queue(0, 0), ^{
if ([[kUserDefaults valueForKey:@"isNeedExposure"] isEqualToString:@"1"]) {
return;
}
NSString *img = [model[@"api"] firstObject];
NSString *pid = model[@"posId"];
NSString *uid = [kUserDefaults valueForKey:@"userId"]?[kUserDefaults valueForKey:@"userId"]:@"";
NSDictionary *dic = @{@"adsenseName":@"adView",@"advertType":@"点击",@"advertTitle":@"adView", @"advertImg":img, @"customerId":uid, @"advertId":pid,@"platformCode":@"DCXY_iOS"};
//内部曝光
NSString *url = [NSString stringWithFormat:@"%@/app/adsenseCollectData/adsenseCollectData4Add",[kUserDefaults valueForKey:@"Ad"]];
[ZXTool requestDataHideLoadingToastWithType:kXMHTTPMethodPOST url:url para:dic completed:^(CommonModel *common, NSString *error) {
}];
});
}
#pragma mark - 广告相关上报
#pragma mark - 曝光
- (void) exposeAd:(NSDictionary *) dic {
if (dic == nil) {
return;
}
for (NSArray *arr in [dic allValues]) {
for (NSString *url in arr) {
[[self sharedManager] GET:url parameters:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nonnull responseObject) {} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {}];
}
}
}
#pragma mark - 点击
- (void) clickAd:(NSArray *) arr {
if (arr == nil) {
return;
}
for (NSString *url in arr) {
[[self sharedManager] GET:url parameters:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nonnull responseObject) {} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {}];
}
}
-(AFHTTPSessionManager *)sharedManager
{
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
manager.operationQueue.maxConcurrentOperationCount = 5;
manager.requestSerializer = [AFHTTPRequestSerializer serializer]; //
manager.requestSerializer.timeoutInterval = 30.0f;
// 设置请求头
[manager.requestSerializer setValue:@"gzip" forHTTPHeaderField:@"Content-Encoding"];
[manager.requestSerializer setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
manager.responseSerializer.acceptableContentTypes = [[NSSet alloc] initWithObjects:@"application/xml", @"text/xml",@"text/html", @"application/json",@"text/plain", @"application/x-gzip", @"text/json",nil];
manager.responseSerializer = [AFJSONResponseSerializer serializer];
manager.responseSerializer.acceptableContentTypes=[[NSSet alloc] initWithObjects:@"application/xml", @"text/xml",@"text/html", @"application/json",@"text/plain", @"text/json", nil];
return manager;
}
- (NSString *) iemi { - (NSString *) iemi {
return [NSString stringWithFormat:@"8%dae6249275%d439f2f80acf%dd78546%de5095a34%d", arc4random()/10, arc4random()/10, arc4random()/10, arc4random()/10, arc4random()/10]; return [NSString stringWithFormat:@"8%dae6249275%d439f2f80acf%dd78546%de5095a34%d", arc4random()/10, arc4random()/10, arc4random()/10, arc4random()/10, arc4random()/10];
} }
......
//
//
// ZXAdViewService.h
// ColorfulSchool
//
// Created by 刘卓鑫 on 2019/9/26.
// Copyright © 2019 Colorful Any Door. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface ZXAdViewService : NSObject
+(AFHTTPSessionManager *)sharedManager;
/*
* model 广告模型
*/
+ (void) nativeAdClickByAdModel:(NSDictionary *) model;
+ (void) nativeAdExposeByAdModel:(NSDictionary *) model;
// 曝光
+ (void) exposeAd:(NSDictionary *) dic;
+ (void) clickAd:(NSArray *) arr;
@end
NS_ASSUME_NONNULL_END
//
//
// ZXAdViewService.m
// ColorfulSchool
//
// Created by 刘卓鑫 on 2019/9/26.
// Copyright © 2019 Colorful Any Door. All rights reserved.
//
#import "ZXAdViewService.h"
@implementation ZXAdViewService
#pragma mark - 广告的点击
/*
* model 广告模型
*/
+ (void) nativeAdClickByAdModel:(NSDictionary *) model {
if (model == nil) {
return;
}
dispatch_async(dispatch_get_global_queue(0, 0), ^{
if ([[kUserDefaults valueForKey:@"isNeedExposure"] isEqualToString:@"1"]) {
return;
}
NSString *img = [model[@"api"] firstObject];
NSString *pid = model[@"posId"];
NSString *uid = [kUserDefaults valueForKey:@"userId"]?[kUserDefaults valueForKey:@"userId"]:@"";
NSDictionary *dic = @{@"adsenseName":@"adView",@"advertType":@"点击",@"advertTitle":@"adView", @"advertImg":img, @"customerId":uid, @"advertId":pid,@"platformCode":@"DCXY_iOS"};
//内部曝光
NSString *url = [NSString stringWithFormat:@"%@/app/adsenseCollectData/adsenseCollectData4Add",[kUserDefaults valueForKey:@"Ad"]];
[ZXTool requestDataHideLoadingToastWithType:kXMHTTPMethodPOST url:url para:dic completed:^(CommonModel *common, NSString *error) {
}];
});
}
+ (void) nativeAdExposeByAdModel:(NSDictionary *) model {
if (model == nil) {
return;
}
dispatch_async(dispatch_get_global_queue(0, 0), ^{
if ([[kUserDefaults valueForKey:@"isNeedExposure"] isEqualToString:@"1"]) {
return;
}
NSString *img = [model[@"api"] firstObject];
NSString *pid = model[@"posId"];
NSString *uid = [kUserDefaults valueForKey:@"userId"]?[kUserDefaults valueForKey:@"userId"]:@"";
NSDictionary *dic = @{@"adsenseName":@"adView",@"advertType":@"曝光",@"advertTitle":@"adView", @"advertImg":img, @"customerId":uid, @"advertId":pid,@"platformCode":@"DCXY_iOS"};
//内部曝光
NSString *url = [NSString stringWithFormat:@"%@/app/adsenseCollectData/adsenseCollectData4Add",[kUserDefaults valueForKey:@"Ad"]];
[ZXTool requestDataHideLoadingToastWithType:kXMHTTPMethodPOST url:url para:dic completed:^(CommonModel *common, NSString *error) {
}];
});
}
//AD曝光
+ (void) exposeAd:(NSDictionary *) dic {
if (dic == nil) {
return;
}
for (NSArray *arr in [dic allValues]) {
for (NSString *url in arr) {
[[self sharedManager] GET:url parameters:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nonnull responseObject) {
NSLog(@"xx");
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
NSLog(@"xx");
}];
}
}
}
#pragma mark - 点击
+ (void) clickAd:(NSArray *) arr {
if (arr == nil) {
return;
}
for (NSString *url in arr) {
[[self sharedManager] GET:url parameters:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nonnull responseObject) {} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {}];
}
}
+(AFHTTPSessionManager *)sharedManager
{
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
manager.operationQueue.maxConcurrentOperationCount = 5;
manager.requestSerializer = [AFHTTPRequestSerializer serializer]; //
manager.requestSerializer.timeoutInterval = 30.0f;
// 设置请求头
[manager.requestSerializer setValue:@"gzip" forHTTPHeaderField:@"Content-Encoding"];
[manager.requestSerializer setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
manager.responseSerializer.acceptableContentTypes = [[NSSet alloc] initWithObjects:@"application/xml", @"text/xml",@"text/html", @"application/json",@"text/plain", @"application/x-gzip", @"text/json",nil];
manager.responseSerializer = [AFJSONResponseSerializer serializer];
manager.responseSerializer.acceptableContentTypes=[[NSSet alloc] initWithObjects:@"application/xml", @"text/xml",@"text/html", @"application/json",@"text/plain", @"text/json", nil];
return manager;
}
@end
// //
...@@ -61,7 +61,6 @@ typedef void(^isCanChange)(BOOL iCan); ...@@ -61,7 +61,6 @@ typedef void(^isCanChange)(BOOL iCan);
- (void) operationSections { - (void) operationSections {
[self.sections1 removeAllObjects]; [self.sections1 removeAllObjects];
if ([CacheVersion isEqualToString:@"2.0"] || [CacheVersion isEqualToString:@"2"]) {
if ([[kUserDefaults valueForKey:kAPP_IS_OPEN_JK] isEqualToString:@"yes"]) { if ([[kUserDefaults valueForKey:kAPP_IS_OPEN_JK] isEqualToString:@"yes"]) {
NSArray *group1=@[@"app登录密码",@"设备密码",@"更换手机账户",@"开启设备登录密码",@"开启系统自动扣费", @"推送接收开关"]; NSArray *group1=@[@"app登录密码",@"设备密码",@"更换手机账户",@"开启设备登录密码",@"开启系统自动扣费", @"推送接收开关"];
NSArray *imagegroup1=@[@"Passwordtwo.png",@"设备.png",@"app.png",@"set_bar_code",@"icon_mianmi",@"icon-push"]; NSArray *imagegroup1=@[@"Passwordtwo.png",@"设备.png",@"app.png",@"set_bar_code",@"icon_mianmi",@"icon-push"];
...@@ -133,23 +132,6 @@ typedef void(^isCanChange)(BOOL iCan); ...@@ -133,23 +132,6 @@ typedef void(^isCanChange)(BOOL iCan);
} }
} }
} else {
ZXUserSettingModel *m1 = [[ZXUserSettingModel alloc] init];
ZXUserSettingModel *m2 = [[ZXUserSettingModel alloc] init];
ZXUserSettingModel *m5 = [[ZXUserSettingModel alloc] init];
m1.name = @"app登录密码";
m2.name = @"更换手机账户";
m1.imageName = @"Passwordtwo.png";
m2.imageName = @"app.png";
m5.imageName = @"icon-push";
m5.name = @"推送接收开关";
m5.isHasSwitch = YES;
m5.switchIsOn = [[kUserDefaults valueForKey:@"currentUserIsOpenJPush"] isEqualToString:@"yes"];;
m5.switchType = 3;
[self.sections1 addObject:m1];
[self.sections1 addObject:m2];
[self.sections1 addObject:m5];
}
if ([UserManager sharedUserManager].user.isWXAuthLogin) { if ([UserManager sharedUserManager].user.isWXAuthLogin) {
ZXUserSettingModel *mm = [[ZXUserSettingModel alloc] init]; ZXUserSettingModel *mm = [[ZXUserSettingModel alloc] init];
mm.name = @"微信解绑"; mm.name = @"微信解绑";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment