You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.6 KiB
52 lines
1.6 KiB
// |
|
// TFAdvertisementBasicView.m |
|
// TFReader |
|
// |
|
// Created by 谢腾飞 on 2020/12/23. |
|
// Copyright © 2020 xtfei_2011@126.com. All rights reserved. |
|
// |
|
|
|
#import "TFAdvertisementBasicView.h" |
|
|
|
@implementation TFAdvertisementBasicView |
|
|
|
- (instancetype)initWithFrame:(CGRect)frame advertisementType:(TFAdvertisementType)type advertisementPosition:(TFAdvertisementPosition)position |
|
{ |
|
if (self = [super initWithFrame:frame]) { |
|
self.type = type; |
|
self.position = position; |
|
|
|
[self createSubviews]; |
|
} |
|
return self; |
|
} |
|
|
|
- (void)createSubviews |
|
{ |
|
self.backgroundColor = kGrayViewColor; |
|
} |
|
|
|
- (void)clickAd |
|
{ |
|
NSMutableDictionary *params = [NSMutableDictionary dictionary]; |
|
params[@"advert_id"] = [TFUtilsHelper formatStringWithInteger:self.advertModel.advert_id]; |
|
|
|
[TFNetworkTools POST:AdVert_Click parameters:params model:nil success:nil failure:nil]; |
|
} |
|
|
|
- (void)requestAdvertisementWithType:(TFAdvertisementType)type advertisementPostion:(TFAdvertisementPosition)position complete:(void(^)(TFAdvertModel * _Nullable advertModel, NSString *msg))complete |
|
{ |
|
NSMutableDictionary *params = [NSMutableDictionary dictionary]; |
|
params[@"type"] = @(type); |
|
params[@"position"] = @(position); |
|
|
|
[TFNetworkTools POST:Advert_Info parameters:params model:TFAdvertModel.class success:^(BOOL isSuccess, TFAdvertModel * _Nullable t_model, TFNetworkRequestModel * _Nonnull requestModel) { |
|
if (isSuccess) { |
|
!complete ?: complete(t_model, requestModel.msg ?: @""); |
|
} else { |
|
!complete ?: complete(nil, requestModel.msg ?: @""); |
|
} |
|
} failure:nil]; |
|
} |
|
|
|
@end
|
|
|