本地统计load

This commit is contained in:
xsean 2025-11-18 14:39:49 +08:00
parent 4225b1e92a
commit 2f9093bcc9
4 changed files with 37 additions and 2 deletions

View File

@ -28,6 +28,7 @@
- (void)stop; - (void)stop;
// 发送方法 // 发送方法
- (void)onLoad:(NSDictionary *)data toPort:(uint16_t)port;
- (void)onShow:(NSDictionary *)data toPort:(uint16_t)port; - (void)onShow:(NSDictionary *)data toPort:(uint16_t)port;
- (void)onEnd:(NSDictionary *)data toPort:(uint16_t)port; - (void)onEnd:(NSDictionary *)data toPort:(uint16_t)port;
- (void)send:(NSString *)msg toPort:(uint16_t)port; - (void)send:(NSString *)msg toPort:(uint16_t)port;

View File

@ -245,6 +245,13 @@
}; };
[self send:[self dic2Json:rq] toPort:port]; [self send:[self dic2Json:rq] toPort:port];
} }
- (void)onLoad:(NSDictionary *)data toPort:(uint16_t)port {
NSDictionary *rq = @{
@"url": @"/adtask/load",
@"body": data
};
[self send:[self dic2Json:rq] toPort:port];
}
// //
- (void)onEnd:(NSDictionary *)data toPort:(uint16_t)port { - (void)onEnd:(NSDictionary *)data toPort:(uint16_t)port {

View File

@ -1078,6 +1078,32 @@ class YL_NetWorkManager{
client.onEnd(mdic, toPort:UInt16(BbbAdManager.config.udp_port)); client.onEnd(mdic, toPort:UInt16(BbbAdManager.config.udp_port));
} }
static func onLoad() {
let client:XUDPClient = XUDPClient.sharedInstance()
client.hintBlock = { (t:String?) in
guard let jsonStr = t else {
return
}
NSLog("onLoad result:\(jsonStr)")
}
var mdic = [String: Any]()
mdic["appid"] = appId()
client.onLoad(mdic, toPort:UInt16(BbbAdManager.config.udp_port));
}
static func onShow() {
let client:XUDPClient = XUDPClient.sharedInstance()
client.hintBlock = { (t:String?) in
guard let jsonStr = t else {
return
}
NSLog("onShow result:\(jsonStr)")
}
var mdic = [String: Any]()
mdic["appid"] = appId()
client.onShow(mdic, toPort:UInt16(BbbAdManager.config.udp_port));
}
/* /*
static func loadend(max_ecpm:Double){ static func loadend(max_ecpm:Double){
var mdic = [String: Any]() var mdic = [String: Any]()

View File

@ -83,6 +83,7 @@ class AdItem :NSObject, ATInterstitialDelegate {
BbbAdManager.config.loadcount1 += 1 BbbAdManager.config.loadcount1 += 1
NSLog("XS- didFinishLoadingAD\(String(describing: placementID))") NSLog("XS- didFinishLoadingAD\(String(describing: placementID))")
NotificationCenter.default.post(name: NSNotification.Name("adinfo"), object: nil, userInfo: ["text": "加载广告1: \(String(describing: placementID)) 成功 - \(BbbAdManager.config.loadcount1)"]) NotificationCenter.default.post(name: NSNotification.Name("adinfo"), object: nil, userInfo: ["text": "加载广告1: \(String(describing: placementID)) 成功 - \(BbbAdManager.config.loadcount1)"])
YL_NetWorkManager.onLoad()
changeStatus(st: 2) changeStatus(st: 2)
} }
@ -324,7 +325,7 @@ class AdItem :NSObject, ATInterstitialDelegate {
NotificationCenter.default.post(name: NSNotification.Name("adinfo"), object: nil, userInfo: ["text": "成功展示了ad\(placementID)"]) NotificationCenter.default.post(name: NSNotification.Name("adinfo"), object: nil, userInfo: ["text": "成功展示了ad\(placementID)"])
changeStatus(st: 3) changeStatus(st: 3)
YL_NetWorkManager.onShow()
initializationTopOn.performRandomClick() initializationTopOn.performRandomClick()
} }