Commit 2c3ffd58 authored by zhangshuai's avatar zhangshuai

修改缓存 不连贯的bug

parent 60fcc8e8
......@@ -212,7 +212,7 @@ static IOSADManager * manager = nil;
}else{
time = 5;
}
// 去加载
// 去加载
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(time * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
self.csjAd = nil;
AddCSJADManager * csjAd = [[AddCSJADManager alloc]init];
......@@ -301,11 +301,16 @@ static IOSADManager * manager = nil;
}else{
[adData.backups removeObject:adData.backups.firstObject];
}
if (adData.backups.count) {
[self loadAdWithData:adData.backups.firstObject withADType:AdType];
}else{
[self requestVideoAD];
[self.videoModels removeObject:self.videoModels.firstObject];
if (self.videoModels.count) {
[self loadAdWithData:self.videoModels.firstObject withADType:AdType];
}else{
[self requestVideoAD];
}
}
......@@ -363,10 +368,12 @@ static IOSADManager * manager = nil;
}else if ([showData.adPlatform isEqualToString:@"ruishi"]){
[self.ruishiAd showAdWithData:showData withADType:adType];
}
if (self.videoModels.count == 1) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[weakSelf requestVideoAD];
});
}
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[weakSelf requestVideoAD];
});
......@@ -478,12 +485,18 @@ static IOSADManager * manager = nil;
[models addObject:model];
}
//添加至 备用数据
[weakSelf.videoModels removeAllObjects];
[weakSelf.videoModels addObjectsFromArray:models];
//有缓存
if (weakSelf.cachevideo.count <= 1 && models.count) {
if (weakSelf.cachevideo.count == 0 && weakSelf.videoModels > 0) {
[weakSelf loadAdWithData:weakSelf.videoModels.firstObject withADType:ADType_Video];
}else{
if (weakSelf.videoModels.count >=2) {
[weakSelf loadAdWithData:weakSelf.videoModels[1] withADType:ADType_Video];
}else{
NSLog(@">>>>weakSelf.cachevideo == %lu",(unsigned long)weakSelf.videoModels.count);
}
}
}else{
[[CGUserManager shared] addLocCollection:@"reward_request" value:@"reward_request_failed"];
......@@ -559,12 +572,11 @@ static IOSADManager * manager = nil;
}
if(model.loadADType == ADType_Video){
[weakSelf clearCache:model];
weakSelf.adShowBlock(success);
if (success) {
[[CGNetworkTools shared] postWithAction:adsEndReport parameters:@{} success:^(id _Nonnull response) {
} failure:^(NSError * _Nonnull error) {
}];
}else{
......
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