first commit
This commit is contained in:
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
|
||||
|
||||
class appAdsTrackerFrontendActions extends stActions
|
||||
{
|
||||
public function executeCheckAds() {
|
||||
|
||||
// $hash = $this->getRequestParameter('hash');
|
||||
$id = $this->getRequestParameter('id');
|
||||
|
||||
$return = $appAdsTrackerListId = $id;
|
||||
|
||||
$c = new Criteria();
|
||||
$c->add(AdsTrackerEnteringPeer::CREATED_AT, sprintf("DATE(%s) = '%s'", AdsTrackerEnteringPeer::CREATED_AT, date('Y-m-d')), Criteria::CUSTOM);
|
||||
$c->add(AdsTrackerEnteringPeer::APP_ADS_TRACKER_LIST_ID , $appAdsTrackerListId);
|
||||
$adsTrackerEntering = AdsTrackerEnteringPeer::doSelectOne($c);
|
||||
|
||||
if($adsTrackerEntering){
|
||||
$adsTrackerEntering->setAdsEntering($adsTrackerEntering->getAdsEntering()+1);
|
||||
$adsTrackerEntering->save();
|
||||
}else{
|
||||
$adsTrackerEntering = new AdsTrackerEntering();
|
||||
$adsTrackerEntering->setAppAdsTrackerListId($appAdsTrackerListId);
|
||||
$adsTrackerEntering->setAdsEntering(1);
|
||||
$adsTrackerEntering->save();
|
||||
}
|
||||
|
||||
return $this->renderText($return);
|
||||
|
||||
}
|
||||
|
||||
public function executeDebug() {
|
||||
|
||||
$config = stConfig::getInstance($this->getContext(), 'appAdsTrackerBackend');
|
||||
$config->setCulture($this->getUser()->getCulture());
|
||||
|
||||
$url = $this->getRequestParameter('url');
|
||||
$referrer = $this->getRequestParameter('referrer');
|
||||
$browser = $this->getRequestParameter('browser');
|
||||
$ip = $this->getRequestParameter('ip');
|
||||
$hash = $this->getRequestParameter('hash');
|
||||
$ads_id = $this->getRequestParameter('ads_id');
|
||||
$cookie = $this->getRequestParameter('cookie');
|
||||
|
||||
$cookie_array = json_decode($cookie);
|
||||
|
||||
foreach ($cookie_array as $key => $ads_cookie) {
|
||||
|
||||
if($ads_cookie->ads_last=="true"){
|
||||
$cookieAdsHash = $ads_cookie->ads_cookie_hash;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$c = new Criteria();
|
||||
$adsTrackerDebug = AdsTrackerDebugPeer::doCount($c);
|
||||
|
||||
if($adsTrackerDebug<=100000 && $ip!=""){
|
||||
|
||||
$adsTrackerDebug = new AdsTrackerDebug();
|
||||
$adsTrackerDebug->setAppAdsTrackerListId($ads_id);
|
||||
$adsTrackerDebug->setCookieAdsHash($cookieAdsHash);
|
||||
$adsTrackerDebug->setUrl($url);
|
||||
$adsTrackerDebug->setReferrer($referrer);
|
||||
$adsTrackerDebug->setBrowser($browser);
|
||||
$adsTrackerDebug->setIp($ip);
|
||||
$adsTrackerDebug->setHash($hash);
|
||||
$adsTrackerDebug->setCookie($cookie);
|
||||
$adsTrackerDebug->setAdsHashControl($config->get('hash_control'));
|
||||
$adsTrackerDebug->save();
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function executeRemoteAddressData() {
|
||||
|
||||
$config = stConfig::getInstance($this->getContext(), 'appAdsTrackerBackend');
|
||||
$config->setCulture($this->getUser()->getCulture());
|
||||
|
||||
|
||||
$url = $this->getRequestParameter('url');
|
||||
$remote_address = $this->getRequestParameter('remote_address');
|
||||
$hash = $this->getRequestParameter('hash');
|
||||
$ads_id = $this->getRequestParameter('ads_id');
|
||||
$cookie = $this->getRequestParameter('cookie');
|
||||
|
||||
$cookie_array = json_decode($cookie);
|
||||
|
||||
foreach ($cookie_array as $key => $ads_cookie) {
|
||||
|
||||
if($ads_cookie->ads_last=="true"){
|
||||
$cookieAdsHash = $ads_cookie->ads_cookie_hash;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$c = new Criteria();
|
||||
$adsTrackerRemoteAddress = AdsTrackerRemoteAddressPeer::doCount($c);
|
||||
|
||||
if($remote_address!=""){
|
||||
|
||||
$adsTrackerRemoteAddress = new AdsTrackerRemoteAddress();
|
||||
$adsTrackerRemoteAddress->setAppAdsTrackerListId($ads_id);
|
||||
$adsTrackerRemoteAddress->setCookieAdsHash($cookieAdsHash);
|
||||
$adsTrackerRemoteAddress->setUrl($url);
|
||||
$adsTrackerRemoteAddress->setRemoteAddress($remote_address);
|
||||
$adsTrackerRemoteAddress->setHash($hash);
|
||||
$adsTrackerRemoteAddress->setCookie($cookie);
|
||||
$adsTrackerRemoteAddress->setAdsHashControl($config->get('hash_control'));
|
||||
$adsTrackerRemoteAddress->save();
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user