コード例 #1
0
    /**
     * @service traffic_stats read
     * @param $data
     */
    public function getClicksData(Gpf_Rpc_Params $params) {
        $data = new Gpf_Rpc_Data($params);
        $filters = $this->checkFilters($data);
        $statsParameters = new Pap_Stats_Params();
        $statsParameters->initFrom($filters);
         
        $clicks = new Pap_Stats_Clicks($statsParameters);

        $data->setValue("clicks", $clicks->getCount()->getAll());
        $data->setValue("clicksDeclined", $clicks->getCount()->getDeclined());
        $data->setValue("clicksRaw", $clicks->getCount()->getRaw());
        $data->setValue("clicksUnique", $clicks->getCount()->getUnique());

        return $data;
    }
コード例 #2
0
	/**
	 *
	 * @service banner_stats read
	 * @param $data
	 */
	public function loadFilteredStatistics(Gpf_Rpc_Params $params) {
		$data = new Gpf_Rpc_Data($params);
		$statsParams = new Pap_Stats_Params();		
		$statsParams->initFrom($data->getFilters());				
		$impressions = new Pap_Stats_Impressions($statsParams);
		$clicks = new Pap_Stats_Clicks($statsParams);
		$sales = new Pap_Stats_Sales($statsParams);

		$data->setValue("impressions", $impressions->getCount()->getAll());
		$data->setValue("rawClicks", $clicks->getCount()->getRaw());
		$data->setValue("uniqueClicks", $clicks->getCount()->getUnique());
		$data->setValue("sales", $sales->getCount()->getApproved());
		$data->setValue("ctr", 0);
		if ($impressions->getCount()->getAll() !== 0) {
			$data->setValue("ctr", $clicks->getCount()->getAll() / ($impressions->getCount()->getAll() / 100));
		}

		return $data;
	}
コード例 #3
0
ファイル: Data.class.php プロジェクト: AmineCherrai/rostanvo
	private function getStats(Pap_Stats_Params $statsParams) {
		$stats = array();
		if($this->clientDate != '') {
			$stats['fordate'] = substr($this->clientDate, 0, 10); // get only date part of the date
		} else {
			$stats['fordate'] = $statsParams->getDateFrom()->toDate(); // get only date part of the date
		}

		if ($statsParams->getAffiliateId() != '') {
			$stats['usertype'] = 'affiliate';
		} else {
			$stats['usertype'] = 'merchant';
		}

		$clicks = new Pap_Stats_Clicks($statsParams);
		$imps = new Pap_Stats_Impressions($statsParams);
		$sales = new Pap_Stats_Sales($statsParams);

		$stats['today_clicks'] = $clicks->getCount()->getAll();
		$stats['today_impressions'] = $imps->getCount()->getAll();
		$stats['today_unique_impressions'] = $imps->getCount()->getUnique();
		$stats['today_sales_approved'] = $sales->getCount()->getApproved();
		$stats['today_sales_pending'] = $sales->getCount()->getPending();
		$stats['today_sales_declined'] = $sales->getCount()->getDeclined();

		if ($statsParams->getAffiliateId() != '') {
			$transactions = new Pap_Stats_Transactions($statsParams);
			$stats['approved'] = $transactions->getCommission()->getApproved();
			$stats['pending'] = $transactions->getCommission()->getPending();
			$stats['declined'] = $transactions->getCommission()->getDeclined();
		} else {
			$affiliateStats = $this->getAffiliateStats(new Pap_Stats_Params());

			$affiliateStats->rewind();
			while ($affiliateStats->valid()) {
				$stats[$affiliateStats->key()] = $this->correctNullValue($affiliateStats->current());
				$affiliateStats->next();
			}
		}

		$stats['today_leads_approved'] = 0;
		$stats['today_leads_pending'] = 0;
		$stats['today_leads_declined'] = 0;
		$stats['currency'] = 'U';

		return $stats;
	}
コード例 #4
0
	public function traficOverview($session,$today){
		$this->loginFromSession($session);
		$homeData = new Pap_Merchants_HomeData();
		if($today){
			$statParams = $homeData->getStatsParams('T');
		}else{
			$statParams = $homeData->getStatsParams('TM');
		}
		$response = new Pap_Mobile_Response(true);

		$impressions = new Pap_Stats_Impressions($statParams);
		$response->impressionsraw = (int)$impressions->getCount()->getRaw();
		$response->impressionsunique = (int)$impressions->getCount()->getUnique();

		$clicks = new Pap_Stats_Clicks($statParams);
		$response->clicksraw = (int)$clicks->getCount()->getRaw();
		$response->clicksunique = (int)$clicks->getCount()->getUnique();

		$sales = new Pap_Stats_Sales($statParams);

		$response->salespaid = (int)$sales->getCount()->getPaid();
		$response->salespending = (int)$sales->getCount()->getPending();
		$response->salesapproved = (int)$sales->getCount()->getApproved();

		$response->salescostpaid = $this->toCurency($sales->getTotalCost()->getPaid());
		$response->salescostpending = $this->toCurency($sales->getTotalCost()->getPending());
		$response->salescostapproved = $this->toCurency($sales->getTotalCost()->getApproved());

		$commisions = new Pap_Stats_Transactions($statParams);
		$response->commisionspaid = $this->toCurency($commisions->getCommission()->getPaid());
		$response->commisionspending = $this->toCurency($commisions->getCommission()->getPending());
		$response->commisionsapproved = $this->toCurency($commisions->getCommission()->getApproved());

		$refunds = new Pap_Stats_Refunds($statParams);
		$response->refundspaid = $this->toCurency($refunds->getCommission()->getPaid());
		$response->refundspending = $this->toCurency($refunds->getCommission()->getPending());
		$response->refundsapproved = $this->toCurency($refunds->getCommission()->getApproved());

		$chargebacks = new Pap_Stats_Chargebacks($statParams);
		$response->chargebackspaid = $this->toCurency($chargebacks->getCommission()->getPaid());
		$response->chargebackspending = $this->toCurency($chargebacks->getCommission()->getPending());
		$response->chargebacksapproved = $this->toCurency($chargebacks->getCommission()->getApproved());

		return $response;
	}