Commit 125d6ba8 authored by zhangshuai's avatar zhangshuai

修改广告细节逻辑

parent d5c26465
......@@ -118,6 +118,14 @@
break;
case 4:
NSLog(@"激励视频");
[[IOSADManager shareADManager] showADType:ADType_Video resultBlock:^(BOOL success) {
if (success) {
}else{
}
}];
break;
case 5:
NSLog(@"直客任务链接 互动广告");
......
......@@ -600,13 +600,15 @@ NSDictionary* appLaunchOpts;
[data WirteDic:@"1" Key:@"firstInstall"];
}else{
[[IOSADManager shareADManager] showADType:ADType_OpenScreen resultBlock:^(BOOL success) {
[[IOSADManager shareADManager] requestVideoAD];
}];
}
});
}];
[[IOSADManager shareADManager] showADType:ADType_OpenScreen resultBlock:^(BOOL success) {
[[IOSADManager shareADManager] requestVideoAD];
}];
return YES;
}
......
......@@ -14,13 +14,13 @@
#ifndef GYPrefixHeader_pch
#define GYPrefixHeader_pch
#define ServerReport @"http://reporttest.zhangxinhulian.com"
#define ServerHost @"https://feedapitest.zhangxinhulian.com" // 服务端接口地址
#define ServerAds @"http://bstest.zhangxinhulian.com/v4/ads"
//#define ServerReport @"http://reporttest.zhangxinhulian.com"
//#define ServerHost @"https://feedapitest.zhangxinhulian.com" // 服务端接口地址
//#define ServerAds @"http://bstest.zhangxinhulian.com/v4/ads"
//#define ServerReport @"http://report.clouddistribute.net"
//#define ServerHost @"https://feedapi.clouddistribute.net" // 服务端接口地址
//#define ServerAds @"http://bs.clouddistribute.net/v4/ads"
#define ServerReport @"http://report.clouddistribute.net"
#define ServerHost @"https://feedapi.clouddistribute.net" // 服务端接口地址
#define ServerAds @"http://bs.clouddistribute.net/v4/ads"
#define WXAppId @"wxe7a03eb52cce1b51"
#define WXAppSecret @"6fa72a89ea188c4dff5729cff328b587"
......
......@@ -60,7 +60,7 @@
slot1.imgSize = imgSize;
slot1.position = BUAdSlotPositionFeed;
slot1.isSupportDeepLink = YES;
self.nativeExpressAdManager = [[BUNativeExpressAdManager alloc] initWithSlot:slot1 adSize:self.flowBgView.frame.size];
self.nativeExpressAdManager = [[BUNativeExpressAdManager alloc] initWithSlot:slot1 adSize:[IOSADManager shareADManager].nativeADSize];
self.nativeExpressAdManager.delegate = self;
[self.nativeExpressAdManager loadAd:1];
......@@ -95,7 +95,7 @@
self.loadSuccessCallbackBlock(self.csjLoadData, YES);
WEAKSELF;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
UIWindow *keyWindow =[UIApplication sharedApplication].windows.lastObject;
UIWindow *keyWindow = [UIApplication sharedApplication].windows.lastObject;
[keyWindow.rootViewController.view addSubview:weakSelf.splashAd_CSJ];
weakSelf.splashAd_CSJ.rootViewController = keyWindow.rootViewController;
});
......@@ -159,23 +159,33 @@
/**
This method is called when splash ad is about to close.
*/
- (void)splashAdWillClose:(BUSplashAdView *)splashAd;{}
- (void)splashAdWillClose:(BUSplashAdView *)splashAd;{
self.splashAd_CSJ.hidden = YES;
[self.splashAd_CSJ removeFromSuperview];
}
/**
This method is called when another controller has been closed.
@param interactionType : open appstore in app or open the webpage or view video ad details page.
*/
- (void)splashAdDidCloseOtherController:(BUSplashAdView *)splashAd interactionType:(BUInteractionType)interactionType;{}
- (void)splashAdDidCloseOtherController:(BUSplashAdView *)splashAd interactionType:(BUInteractionType)interactionType;{
}
/**
This method is called when spalashAd skip button is clicked.
*/
- (void)splashAdDidClickSkip:(BUSplashAdView *)splashAd;{}
- (void)splashAdDidClickSkip:(BUSplashAdView *)splashAd;{
}
/**
This method is called when spalashAd countdown equals to zero
*/
- (void)splashAdCountdownToZero:(BUSplashAdView *)splashAd;{}
- (void)splashAdCountdownToZero:(BUSplashAdView *)splashAd;{
self.splashAd_CSJ.hidden = YES;
[self.splashAd_CSJ removeFromSuperview];
}
//MARK: --- 视频 ---
......@@ -316,13 +326,22 @@
- (void)nativeExpressAdSuccessToLoad:(BUNativeExpressAdManager *)nativeExpressAd views:(NSArray<__kindof BUNativeExpressAdView *> *)views;{
self.loadSuccessCallbackBlock(self.csjLoadData,YES);
if ([nativeExpressAd isMemberOfClass:[BUNativeExpressAdManager class]]) {
if (views.count) {
BUNativeExpressAdView *expressView = (BUNativeExpressAdView *)[views firstObject];
expressView.rootViewController = self.currentVC;
[expressView render];
[IOSADManager shareADManager].flowBgView = expressView;
}
}
}
/**
* Sent when views fail to load ad
*/
- (void)nativeExpressAdFailToLoad:(BUNativeExpressAdManager *)nativeExpressAd error:(NSError *_Nullable)error;{
self.loadSuccessCallbackBlock(self.csjLoadData,YES);
self.loadSuccessCallbackBlock(self.csjLoadData,NO);
}
......
......@@ -29,7 +29,7 @@
self.splashAd_GDT = [[GDTSplashAd alloc] initWithPlacementId:model.codeId];
self.splashAd_GDT.delegate = self;
self.splashAd_GDT.fetchDelay = 3;
self.splashAd_GDT.fetchDelay = 4;
self.splashAd_GDT.backgroundImage = [UIImage imageNamed:@""];
self.splashAd_GDT.backgroundImage.accessibilityIdentifier = @"splash_ad";
//根据iPhone设备不同设置不同背景图
......@@ -55,7 +55,7 @@
}else if (AdType == ADType_BigImage){ //大图
// 支持视频广告的 PlacementId 会混出视频与图片广告
self.nativeExpressAd = [[GDTNativeExpressAd alloc] initWithPlacementId:model.codeId adSize:CGSizeMake(self.flowBgView.frame.size.width, self.flowBgView.frame.size.height)];
self.nativeExpressAd = [[GDTNativeExpressAd alloc] initWithPlacementId:model.codeId adSize: [IOSADManager shareADManager].nativeADSize];
self.nativeExpressAd.delegate = self;
[self.nativeExpressAd loadAd:1];
}
......@@ -85,7 +85,6 @@
* 开屏广告成功展示
*/
- (void)splashAdSuccessPresentScreen:(GDTSplashAd *)splashAd;{
self.showSuccessCallbackBlock(self.currentData, YES);
}
......@@ -96,7 +95,7 @@
self.loadSuccessCallbackBlock(self.currentData, YES);
WEAKSELF;
if (splashAd.isAdValid) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[weakSelf.splashAd_GDT showAdInWindow:self.currentWindow withBottomView:nil skipView:nil];
});
......@@ -133,7 +132,10 @@
/**
* 开屏广告将要关闭回调
*/
- (void)splashAdWillClosed:(GDTSplashAd *)splashAd;{}
- (void)splashAdWillClosed:(GDTSplashAd *)splashAd;{
self.showSuccessCallbackBlock(self.currentData, YES);
}
/**
* 开屏广告关闭回调
......@@ -143,27 +145,37 @@
/**
* 开屏广告点击以后即将弹出全屏广告页
*/
- (void)splashAdWillPresentFullScreenModal:(GDTSplashAd *)splashAd;{}
- (void)splashAdWillPresentFullScreenModal:(GDTSplashAd *)splashAd;{
}
/**
* 开屏广告点击以后弹出全屏广告页
*/
- (void)splashAdDidPresentFullScreenModal:(GDTSplashAd *)splashAd;{}
- (void)splashAdDidPresentFullScreenModal:(GDTSplashAd *)splashAd;{
}
/**
* 点击以后全屏广告页将要关闭
*/
- (void)splashAdWillDismissFullScreenModal:(GDTSplashAd *)splashAd;{}
- (void)splashAdWillDismissFullScreenModal:(GDTSplashAd *)splashAd;{
}
/**
* 点击以后全屏广告页已经关闭
*/
- (void)splashAdDidDismissFullScreenModal:(GDTSplashAd *)splashAd;{}
- (void)splashAdDidDismissFullScreenModal:(GDTSplashAd *)splashAd;{
}
/**
* 开屏广告剩余时间回调
*/
- (void)splashAdLifeTime:(NSUInteger)time;{}
- (void)splashAdLifeTime:(NSUInteger)time;{
}
//MARK: 视频
/**
......@@ -208,6 +220,7 @@
@param rewardedVideoAd GDTRewardVideoAd 实例
*/
- (void)gdt_rewardVideoAdDidClose:(GDTRewardVideoAd *)rewardedVideoAd;{
self.showSuccessCallbackBlock(self.currentData, YES);
}
......@@ -264,7 +277,6 @@
@param rewardedVideoAd GDTRewardVideoAd 实例
*/
- (void)gdt_rewardVideoAdDidRewardEffective:(GDTRewardVideoAd *)rewardedVideoAd;{
self.showSuccessCallbackBlock(self.currentData, YES);
}
......@@ -282,8 +294,15 @@
* 拉取原生模板广告成功
*/
- (void)nativeExpressAdSuccessToLoad:(GDTNativeExpressAd *)nativeExpressAd views:(NSArray<__kindof GDTNativeExpressAdView *> *)views;{
GDTNativeExpressAdView *expressView = (GDTNativeExpressAdView *)[views firstObject];
expressView.controller = self.currentVC;
[expressView render];
[IOSADManager shareADManager].flowBgView = expressView;
self.loadSuccessCallbackBlock(self.currentData, YES);
}
/**
......
......@@ -106,7 +106,9 @@
/**
开屏广告点击回调
*/
- (void)vl_splashAdDidClick:(VLNSplashAd *)splashAd{}
- (void)vl_splashAdDidClick:(VLNSplashAd *)splashAd{
}
/**
开屏广告关闭回调
......@@ -149,7 +151,10 @@
/**
视频播放页关闭回调
*/
- (void)vl_rewardVideoAdDidClose:(VLNRewardedVideoAd *)rewardedVideoAd{}
- (void)vl_rewardVideoAdDidClose:(VLNRewardedVideoAd *)rewardedVideoAd{
self.showSuccessCallbackBlock(self.currentData, YES);
}
/**
视频广告信息点击回调
......@@ -175,7 +180,6 @@
视频广告播放达到激励条件回调
*/
- (void)vl_rewardVideoAdDidRewardEffective:(VLNRewardedVideoAd *)rewardedVideoAd{
self.showSuccessCallbackBlock(self.currentData, YES);
}
......@@ -192,6 +196,12 @@
- (void)vl_nativeAdDidLoadSuccess:(VLNNativeAd *)nativeAd nativeAdModels:(NSArray <VLNativeAdInfo *>*)nativeAdModels;{
self.loadSuccessCallbackBlock(self.currentData, YES);
VLNativeAdInfo * info = nativeAdModels.firstObject;
if (info) {
[info renderToView:[IOSADManager shareADManager].flowBgView];
}
}
/**
......
......@@ -47,8 +47,7 @@
}else if (AdType == ADType_BigImage){ //大图
self.loadSuccessCallbackBlock(self.currentData, NO);
}
......@@ -144,7 +143,7 @@
@param placementId 广告位Id
*/
- (void)onVideoAdClosedWithInfo:(WindRewardInfo *)info placementId:(NSString *)placementId;{
self.showSuccessCallbackBlock(self.currentData, YES);
#warning z这里可以做个bool 用于 关闭确定是否有奖励
}
/**
......@@ -157,6 +156,16 @@
self.showSuccessCallbackBlock(self.currentData, NO);
}
/**
激励视频广告视频播关闭
@param placementId 广告位Id
*/
- (void)onVideoAdPlayEnd:(NSString *)placementId;{
self.showSuccessCallbackBlock(self.currentData, YES);
}
//MARK: ---- 大图 ---- 原生
......
......@@ -9,17 +9,32 @@
#import <Foundation/Foundation.h>
#import "GYBaseModel.h"
typedef enum : NSUInteger {
ADType_OpenScreen,
ADType_Video,
ADType_BigImage,
} eADType;
NS_ASSUME_NONNULL_BEGIN
@interface GYAdsTrackModel : GYBaseModel
@property (nonatomic ,strong) NSString *adPlatform;
@property (nonatomic ,assign) NSInteger adType;
@property (nonatomic ,strong) NSArray *clk_tracking;
@property (nonatomic ,strong) NSString *codeId;
@property (nonatomic ,strong) NSArray *imp_tracking;
@property (nonatomic ,assign) NSInteger platformId;
@property (nonatomic ,assign) NSInteger slot_id;
@property (nonatomic ,strong) NSString *adPlatform; // guangdiantong 平台
@property (nonatomic ,assign) NSInteger adType; // 忽略 //
@property (nonatomic ,strong) NSArray *clk_tracking; // 点击广告 调用
@property (nonatomic ,strong) NSString *codeId; // codeId = 945568416; //广告位ID 请求广告
@property (nonatomic ,strong) NSArray *imp_tracking; // 展示 调用
@property (nonatomic ,assign) NSInteger platformId; // 平台 ID
@property (nonatomic ,strong) NSString * showfail_tracking; //showfail_tracking 显示 失败
@property (nonatomic ,strong) NSString * pullfail_tracking; //showfail_tracking 拉 失败
@property (nonatomic ,strong) NSString * pullsucc_tracking; //showfail_tracking 拉 成功
@property (nonatomic ,assign) NSInteger codeAppId; //广告商APP ID
@property (nonatomic ,assign) NSInteger slot_id; //
@property (nonatomic ,strong) NSString * slotName; //
@property (nonatomic ,assign) BOOL loadSuccess; //加载成功
@property (nonatomic ,assign) eADType loadADType; //这个广告所属的广告类型
+(instancetype)modelWithDic:(NSDictionary *)dict;
......
......@@ -31,11 +31,6 @@
NS_ASSUME_NONNULL_BEGIN
typedef enum : NSUInteger {
ADType_OpenScreen,
ADType_Video,
ADType_BigImage,
} eADType;
//typedef enum : NSUInteger { //广告视频加载状态
// kVideoNull, //没有加载/失败
......@@ -53,6 +48,7 @@ typedef enum : NSUInteger {
@property (nonatomic ,weak)UIWindow * currentWindow; //当前视图窗口
@property (nonatomic, strong) UIView * flowBgView; //要展示的位置
@property (nonatomic, assign) CGSize nativeADSize; //用于展示原生广告的大小
//@property (nonatomic ,retain)NSMutableArray * loadOpenScreenSuccessArray; // 已经缓存的 开屏广告数据集合
......@@ -71,6 +67,10 @@ typedef enum : NSUInteger {
@property (nonatomic ,assign)BOOL showNow; //立即加载 广告
@property (nonatomic ,assign)BOOL haveLodeAD; //正在加载广告
@property (nonatomic ,retain)NSMutableArray * loadADDataArray; //正在加载 广告
/// 单利
+ (IOSADManager *)shareADManager;
......
......@@ -33,6 +33,7 @@ static IOSADManager * manager = nil;
}
// 视频数据
- (NSMutableArray *)cachevideo{
if (_cachevideo == nil) {
......@@ -76,6 +77,8 @@ static IOSADManager * manager = nil;
return _cacheBigImg;
}
#pragma mark -
- (UIViewController*)currentVC{
UIViewController* vc = [UIApplication sharedApplication].keyWindow.rootViewController;
while (true) {
......@@ -94,6 +97,7 @@ static IOSADManager * manager = nil;
- (UIWindow *)currentWindow{
NSArray *windows = [UIApplication sharedApplication].windows;
for (UIWindow *window in [windows reverseObjectEnumerator]) {
if ([window isKindOfClass:[UIWindow class]] && CGRectEqualToRect(window.bounds, [UIScreen mainScreen].bounds)) {
......@@ -106,7 +110,9 @@ static IOSADManager * manager = nil;
/// 显示广告
/// @param AdType 显示的类型
- (void)showADType:(eADType )AdType resultBlock:(void(^)(BOOL success)) adShowBlock;{
if (adShowBlock != nil) {
self.adShowBlock = adShowBlock;
}
if (AdType == ADType_Video) { // 视频
if (self.videoModels.count) {
......@@ -124,15 +130,26 @@ static IOSADManager * manager = nil;
[self requestVideoAD];
}
}else if (AdType == ADType_OpenScreen){ //开屏
if(self.openScreenModels.count){
if (self.cacheOpenScreen.count) {
[self showAdWithData:self.cacheOpenScreen.firstObject withADType:AdType];
}else{
[self loadAdWithData:self.openScreenModels.firstObject withADType:AdType];
}
}else{
[self requestOpenScreenAD];
}
}else if (AdType == ADType_BigImage){ //开屏
}else if (AdType == ADType_BigImage){ //原生 大图
if(self.bigImageModels.count){
if (self.cacheBigImg.count) {
[self showAdWithData:self.cacheBigImg.firstObject withADType:AdType];
}else{
[self loadAdWithData:self.bigImageModels.firstObject withADType:AdType];
}
}else{
[self requestNativeAD];
}
......@@ -144,6 +161,7 @@ static IOSADManager * manager = nil;
/// @param AdType 广告类型
- (void)loadAdWithData:(GYAdsTrackModel *)loadADModel withADType:(eADType )AdType;{
self.haveLodeAD = YES;
loadADModel.loadADType = AdType;
WEAKSELF;
if ([loadADModel.adPlatform isEqualToString:@"chuanshanjia"]) { // 穿山甲
......@@ -238,12 +256,11 @@ static IOSADManager * manager = nil;
}
}else if (AdType == ADType_BigImage){
[self.openScreenModels removeObject:self.openScreenModels.firstObject];
if (self.openScreenModels.count ) {
[self loadAdWithData:self.openScreenModels.firstObject withADType:AdType];
[self.bigImageModels removeObject:self.bigImageModels.firstObject];
if (self.bigImageModels.count ) {
[self loadAdWithData:self.bigImageModels.firstObject withADType:AdType];
}else{
[self requestOpenScreenAD];
[self requestNativeAD];
}
}
}
......@@ -288,7 +305,7 @@ static IOSADManager * manager = nil;
//查询这个Data 是否缓存
- (BOOL)contentADDataWith:(GYAdsTrackModel *)data {
if (data.adType == 7) {
if (data.loadADType == ADType_Video) {
if (self.cachevideo.count > 0) {
return YES;
}
......@@ -328,7 +345,29 @@ static IOSADManager * manager = nil;
}
/// 请求广告数据
- (void)requestNativeAD;{
WEAKSELF;
[[CGNetworkTools shared] getWithAdsAction:getAdsInfo parameters: @{@"slotName": @"common_bigimage"} success:^(id _Nonnull response) {
if ([[response objectForKey:@"status"] intValue] == 200) {
NSMutableArray * models = [NSMutableArray new];
NSArray * arr = response[@"result"][@"data"];
for (NSDictionary * dict in arr) {
GYAdsTrackModel * model = [GYAdsTrackModel new];
[model setValuesForKeysWithDictionary:dict];
[models addObject:model];
}
[weakSelf.bigImageModels removeAllObjects];
[weakSelf.bigImageModels addObjectsFromArray:models];
if (weakSelf.cacheBigImg.count == 0) {
[weakSelf loadAdWithData:weakSelf.bigImageModels.firstObject withADType:ADType_BigImage];
}
}else{
}
} failure:^(NSError * _Nonnull error) {
}];
}
......@@ -379,19 +418,12 @@ static IOSADManager * manager = nil;
}
//清空缓存
- (void)clearCache{
[self.cachevideo removeAllObjects];
[self.videoModels removeObject:self.videoModels.firstObject];
}
//MARK: 处理加载 的回调
- (void)blockResultLoadWithData:(GYAdsTrackModel *)model andSuccess:(BOOL)success{
WEAKSELF;
if(model.adType == 7){
if(model.loadADType == ADType_Video){
weakSelf.haveLodeAD = NO;
[MBProgressHUD hideHUD];
......@@ -402,19 +434,25 @@ static IOSADManager * manager = nil;
}
}else{
[weakSelf clearCache];
[weakSelf clearCache:model];
}
}else if(model.adType == 4){
}else if(model.loadADType == ADType_OpenScreen){
if(success){
[weakSelf.cacheOpenScreen addObject:model];
[weakSelf showADType:ADType_OpenScreen resultBlock:self.adShowBlock];
}else{
#warning 开屏加载失败
[weakSelf clearCache:model];
}
}else if (model.loadADType == ADType_BigImage){ //原生
if(success){
[weakSelf.cacheBigImg addObject:model];
[weakSelf showADType:ADType_BigImage resultBlock:self.adShowBlock];
}else{
[weakSelf clearCache:model];
}
}
......@@ -424,23 +462,60 @@ static IOSADManager * manager = nil;
//MARK: 处理加载的回调
- (void)blockResultShowWithData:(GYAdsTrackModel *)model andSuccess:(BOOL)success;{
if(model.adType == 7){
WEAKSELF;
[weakSelf clearCache];
if(model.loadADType == ADType_Video){
[weakSelf clearCache:model];
weakSelf.showNow = NO;
weakSelf.adShowBlock(success);
if (success) {
[[CGNetworkTools shared] postWithAction:adsEndReport parameters:@{} success:^(id _Nonnull response) {
} failure:^(NSError * _Nonnull error) {
}];
}else{
}
}else if(model.adType == 4){
}else if(model.loadADType == ADType_OpenScreen){
[weakSelf clearCache:model];
weakSelf.adShowBlock(success);
weakSelf.showNow = NO;
}else if (model.loadADType == ADType_BigImage){ //原生
[weakSelf clearCache:model];
weakSelf.adShowBlock(success);
weakSelf.showNow = NO;
}
}
//清空缓存
- (void)clearCache:(GYAdsTrackModel *)model{
if(model.loadADType == ADType_Video){
[self.cachevideo removeAllObjects];
[self.videoModels removeObject:self.videoModels.firstObject];
}else if(model.loadADType == ADType_OpenScreen){
[self.cacheOpenScreen removeAllObjects];
[self.openScreenModels removeObject:self.openScreenModels.firstObject];
}else if (model.loadADType == ADType_BigImage){ //原生
[self.cacheBigImg removeAllObjects];
[self.bigImageModels removeObject:self.bigImageModels.firstObject];
}
}
@end
......@@ -88,6 +88,8 @@
_idLab.text = [NSString stringWithFormat:@"ID: %@", [CGUserManager shared].uid];
[self getAdsDataSource];
}
......@@ -102,14 +104,19 @@
- (void)getAdsDataSource{
[IOSADManager shareADManager].nativeADSize = self.adsBgView.frame.size;
[IOSADManager shareADManager].flowBgView = self.adsBgView;
[[IOSADManager shareADManager] showADType:ADType_BigImage resultBlock:^(BOOL success) {
if (success) {
// self.adsHeightConstraint.constant = flowView.frame.size.height;
// self.headerView.frame = CGRectMake(0, 0, self.tableView.frame.size.width, flowView.frame.size.height+77);
// self.tableViewHeightConstraint.constant = self.headerView.frame.size.height + 300 < KScreenHeight-SafeAreaTopHeight ? self.headerView.frame.size.height + 300 : KScreenHeight-SafeAreaTopHeight;
// [self.tableView reloadData];
// [self.adsBgView addSubview:flowView];
UIView * flowView = [IOSADManager shareADManager].flowBgView;
self.adsHeightConstraint.constant = flowView.bounds.size.height;
self.headerView.frame = CGRectMake(0, 0, self.tableView.frame.size.width, flowView.frame.size.height+77);
self.tableViewHeightConstraint.constant = self.headerView.frame.size.height + 300 < KScreenHeight-SafeAreaTopHeight ? self.headerView.frame.size.height + 300 : KScreenHeight-SafeAreaTopHeight;
[self.tableView reloadData];
[self.adsBgView addSubview:flowView];
......
......@@ -79,14 +79,38 @@
}
- (IBAction)startBtn:(UIButton *)sender{
WEAKSELF;
if (self.isVideo) {
[[IOSADManager shareADManager] showADType:ADType_Video resultBlock:^(BOOL success) {
if (success) {
[[CGUserManager shared] addLocCollection:@"play_adVideo_end_turntable" value:@""];
[[CGUserManager shared] addLocCollection:@"click_lucky_turntable_lottery_look_video" value:@""];
[[IOSADManager shareADManager] showADType:ADType_Video resultBlock:^(BOOL success) {
if (success) {
[[CGUserManager shared] addLocCollection:@"click_lucky_turntable_lottery" value:@""];
weakSelf.isVideo = false;
if (weakSelf.isVideo){
[weakSelf.startBtn setBackgroundImage:[UIImage imageNamed:@"wheel_btn_video"] forState:(UIControlStateNormal)];
}else{
[weakSelf.startBtn setBackgroundImage:[UIImage imageNamed:@"wheel_btn_free"] forState:(UIControlStateNormal)];
}
if([weakSelf.remainderCount integerValue] == 0){
weakSelf.startBtn.userInteractionEnabled = false;
[weakSelf.startBtn setBackgroundImage:[UIImage imageNamed:@"wheel_btn_time"] forState:(UIControlStateNormal)];
}
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[weakSelf startBtn:weakSelf.startBtn];
});
}else{
#warning 再试一次提示
}
}];
return;
}
[[CGUserManager shared] addLocCollection:@"click_lucky_turntable_lottery" value:@""];
//奖励类型 1 水滴 2 果子 3 种子 4 金币 5 加速剂 6 现金红包
[[CGNetworkTools shared] postWithAction:WheelSurf parameters:@{} success:^(id _Nonnull response) {
NSDictionary * modelDic = [[response objectForKey:@"result"] objectForKey:@"data"];
......@@ -115,9 +139,9 @@
self.remainderCount = model.lotteryNum;
self.isVideo = [model.showVideo integerValue] != 0;
if (self.isVideo) {
[self getVideoDataSource];
}
// if (self.isVideo) {
// [self getVideoDataSource];
// }
if([model.lotteryNum integerValue] == 0){
self.startBtn.userInteractionEnabled = false;
......@@ -162,15 +186,11 @@
}
} failure:^(NSError * _Nonnull error) {
[MBProgressHUD showMessage:@"请稍后重试"];
}];
}else{
[[CGUserManager shared] addLocCollection:@"play_adVideo_end_cloud_speed_up" value:@""];
}
}];
......
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