本文整理汇总了PHP中Oara_Utilities::transactionMapPerDay方法的典型用法代码示例。如果您正苦于以下问题:PHP Oara_Utilities::transactionMapPerDay方法的具体用法?PHP Oara_Utilities::transactionMapPerDay怎么用?PHP Oara_Utilities::transactionMapPerDay使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Oara_Utilities
的用法示例。
在下文中一共展示了Oara_Utilities::transactionMapPerDay方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getOverviewList
/**
* (non-PHPdoc)
* @see library/Oara/Network/Oara_Network_Base#getOverviewList($merchantId,$dStartDate,$dEndDate)
*/
public function getOverviewList($transactionList = null, $merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null)
{
$totalOverview = array();
//At first, we need to be sure that there are some data.
$auxStartDate = clone $dStartDate;
$auxStartDate->setHour("00");
$auxStartDate->setMinute("00");
$auxStartDate->setSecond("00");
$auxEndDate = clone $dEndDate;
$auxEndDate->setHour("23");
$auxEndDate->setMinute("59");
$auxEndDate->setSecond("59");
$params = array();
$params['sDateType'] = 'transaction';
if ($dStartDate != null) {
$params['dStartDate'] = $auxStartDate->toString("yyyy-MM-ddTHH:mm:ss");
}
if ($dEndDate != null) {
$params['dEndDate'] = $auxEndDate->toString("yyyy-MM-ddTHH:mm:ss");
}
if ($merchantList != null) {
$params['aMerchantIds'] = $merchantList;
}
$params['iOffset'] = null;
$params['iLimit'] = $this->_pageSize;
$clickStats = $this->_apiClient->getClickStats($params);
$impressionStats = $this->_apiClient->getImpressionStats($params);
$transactionList = Oara_Utilities::transactionMapPerDay($transactionList);
if (count($clickStats->getClickStatsReturn) > 0 || count($impressionStats->getImpressionStatsReturn) > 0 || count($transactionList) > 0) {
unset($clickStats);
unset($impressionStats);
$dateArray = Oara_Utilities::daysOfDifference($dStartDate, $dEndDate);
for ($i = 0; $i < sizeof($dateArray); $i++) {
$groupMap = array();
$auxStartDate = clone $dateArray[$i];
$auxStartDate->setHour("00");
$auxStartDate->setMinute("00");
$auxStartDate->setSecond("00");
$auxEndDate = clone $dateArray[$i];
$auxEndDate->setHour("23");
$auxEndDate->setMinute("59");
$auxEndDate->setSecond("59");
$params = array();
$params['sDateType'] = 'transaction';
if ($dStartDate != null) {
$params['dStartDate'] = $auxStartDate->toString("yyyy-MM-ddTHH:mm:ss");
}
if ($dEndDate != null) {
$params['dEndDate'] = $auxEndDate->toString("yyyy-MM-ddTHH:mm:ss");
}
if ($merchantList != null) {
$params['aMerchantIds'] = $merchantList;
}
$params['iOffset'] = null;
$params['iLimit'] = $this->_pageSize;
$clickStats = $this->_apiClient->getClickStats($params);
if (count($clickStats->getClickStatsReturn) > 0) {
$groupMap = self::groupOverview($groupMap, Oara_Utilities::soapConverter($clickStats->getClickStatsReturn, $this->_clickConverterConfiguration));
$iteration = self::calculeIterationNumber($clickStats->getClickStatsCountReturn->iRowsAvailable, $this->_pageSize);
unset($clickStats);
for ($j = 1; $j < $iteration; $j++) {
$params['iOffset'] = $this->_pageSize * $j;
$clickStats = $this->_apiClient->getClickStats($params);
$groupMap = self::groupOverview($groupMap, Oara_Utilities::soapConverter($clickStats->getClickStatsReturn, $this->_clickConverterConfiguration));
unset($clickStats);
gc_collect_cycles();
}
}
$params['iOffset'] = null;
$impressionStats = $this->_apiClient->getImpressionStats($params);
if (count($impressionStats->getImpressionStatsReturn) > 0) {
$groupMap = self::groupOverview($groupMap, Oara_Utilities::soapConverter($impressionStats->getImpressionStatsReturn, $this->_impressionConverterConfiguration));
$iteration = self::calculeIterationNumber($impressionStats->getImpressionStatsCountReturn->iRowsAvailable, $this->_pageSize);
unset($impressionStats);
for ($j = 1; $j < $iteration; $j++) {
$params['iOffset'] = $this->_pageSize * $j;
$impressionStats = $this->_apiClient->getImpressionStats($params);
$groupMap = self::groupOverview($groupMap, Oara_Utilities::soapConverter($impressionStats->getImpressionStatsReturn, $this->_impressionConverterConfiguration));
unset($impressionStats);
gc_collect_cycles();
}
}
$transactionDateArray = array();
foreach ($transactionList as $merchantId => $data) {
$transactionDateArray = array_merge($transactionDateArray, Oara_Utilities::getDayFromArray($merchantId, $transactionList, $auxStartDate));
}
if (count($transactionDateArray) > 0) {
$groupMap = self::groupOverview($groupMap, $transactionDateArray);
}
foreach ($groupMap as $merchant => $overview) {
$overview['merchantId'] = $merchant;
$overview['date'] = $auxStartDate->toString("yyyy-MM-dd HH:mm:ss");
if (Oara_Utilities::checkRegister($overview)) {
$totalOverview[] = $overview;
}
}
//.........这里部分代码省略.........
示例2: getOverviewList
/**
* (non-PHPdoc)
* @see library/Oara/Network/Oara_Network_Base#getOverviewList($merchantId, $dStartDate, $dEndDate)
*/
public function getOverviewList($transactionList = null, $merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null)
{
self::logIn();
$overviewArray = array();
$transactionArray = Oara_Utilities::transactionMapPerDay($transactionList);
foreach ($this->_idBox as $id) {
foreach ($merchantList as $merchantId) {
$try = 0;
$done = false;
while (!$done && $try < 5) {
try {
$overviewArray = array_merge($overviewArray, self::getOverviewReportRecursive($transactionArray, $id, $dStartDate, $dEndDate));
$done = true;
} catch (Exception $e) {
$try++;
echo "try again {$try}\n\n";
}
}
if ($try == 5) {
throw new Exception("Couldn't get data from the overview");
}
}
}
return $overviewArray;
}
示例3: getOverviewList
/**
* (non-PHPdoc)
* @see library/Oara/Network/Oara_Network_Base#getOverviewList($merchantId, $dStartDate, $dEndDate)
*/
public function getOverviewList($transactionList = null, $merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null)
{
$totalOverview = array();
$urls = array();
$valuesFromExport = Oara_Utilities::cloneArray($this->_exportOverviewParameters);
$valuesFromExport[] = new Oara_Curl_Parameter('startyear', $dStartDate->get(Zend_Date::YEAR));
$valuesFromExport[] = new Oara_Curl_Parameter('startmonth', (int) $dStartDate->get(Zend_Date::MONTH) - 1);
$valuesFromExport[] = new Oara_Curl_Parameter('startday', $dStartDate->get(Zend_Date::DAY));
$valuesFromExport[] = new Oara_Curl_Parameter('endyear', $dEndDate->get(Zend_Date::YEAR));
$valuesFromExport[] = new Oara_Curl_Parameter('endmonth', (int) $dEndDate->get(Zend_Date::MONTH) - 1);
$valuesFromExport[] = new Oara_Curl_Parameter('endday', $dEndDate->get(Zend_Date::DAY));
$urls[] = new Oara_Curl_Request('https://members.cj.com/member/' . $this->_memberId . '/publisher/report/performance.do?', $valuesFromExport);
$exportReport = $this->_client->get($urls);
$exportData = str_getcsv($exportReport[0], "\n");
$num = count($exportData);
if ($num > 1) {
$transactionArray = Oara_Utilities::transactionMapPerDay($transactionList);
$dateArray = Oara_Utilities::daysOfDifference($dStartDate, $dEndDate);
foreach ($dateArray as $currentStartDate) {
$groupMap = array();
$urls = array();
$valuesFromExport = Oara_Utilities::cloneArray($this->_exportOverviewParameters);
$valuesFromExport[] = new Oara_Curl_Parameter('startyear', $currentStartDate->get(Zend_Date::YEAR));
$valuesFromExport[] = new Oara_Curl_Parameter('startmonth', (int) $currentStartDate->get(Zend_Date::MONTH) - 1);
$valuesFromExport[] = new Oara_Curl_Parameter('startday', $currentStartDate->get(Zend_Date::DAY));
$valuesFromExport[] = new Oara_Curl_Parameter('endyear', $currentStartDate->get(Zend_Date::YEAR));
$valuesFromExport[] = new Oara_Curl_Parameter('endmonth', (int) $currentStartDate->get(Zend_Date::MONTH) - 1);
$valuesFromExport[] = new Oara_Curl_Parameter('endday', $currentStartDate->get(Zend_Date::DAY));
$urls[] = new Oara_Curl_Request('https://members.cj.com/member/' . $this->_memberId . '/publisher/report/performance.do?', $valuesFromExport);
$exportReport = $this->_client->get($urls);
$clickImpressionsArray = array();
if (!preg_match("/error/i", $exportReport[0], $matches)) {
$exportData = str_getcsv($exportReport[0], "\n");
$num = count($exportData);
for ($i = 1; $i < $num; $i++) {
$overviewExportArray = str_getcsv($exportData[$i], ",");
if (isset($this->_merchantMap[$overviewExportArray[0]]) && in_array((int) $this->_merchantMap[$overviewExportArray[0]], $merchantList)) {
$obj = array();
$obj['merchantId'] = $this->_merchantMap[$overviewExportArray[0]];
$obj['date'] = $currentStartDate->toString("yyyy-MM-dd HH:mm:ss");
$obj['click_number'] = $overviewExportArray[6];
$obj['impression_number'] = $overviewExportArray[7];
$clickImpressionsArray[] = $obj;
}
}
} else {
echo "Warning overview could fail for the day " . $currentStartDate->toString("dd/MM/yyyy") . " \n\n";
}
$groupMap = self::groupOverview($groupMap, $clickImpressionsArray);
$transactionDateArray = array();
foreach ($transactionArray as $merchantId => $data) {
$transactionDateArray = array_merge($transactionDateArray, Oara_Utilities::getDayFromArray($merchantId, $transactionArray, $currentStartDate));
}
if (count($transactionDateArray) > 0) {
$groupMap = self::groupOverview($groupMap, $transactionDateArray);
}
foreach ($groupMap as $merchant => $groupOverview) {
$groupOverview['merchantId'] = $merchant;
$groupOverview['date'] = $currentStartDate->toString("yyyy-MM-dd HH:mm:ss");
if (Oara_Utilities::checkRegister($groupOverview)) {
$totalOverview[] = $groupOverview;
}
}
}
}
return $totalOverview;
}
示例4: getOverviewList
/**
* (non-PHPdoc)
* @see library/Oara/Network/Oara_Network_Base#getOverviewList($merchantId,$dStartDate,$dEndDate)
*/
public function getOverviewList($transactionList = null, $merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null)
{
$totalOverview = array();
//At first, we need to be sure that there are some data.
$auxStartDate = clone $dStartDate;
$auxStartDate->setHour("00");
$auxStartDate->setMinute("00");
$auxStartDate->setSecond("00");
$auxEndDate = clone $dEndDate;
$auxEndDate->setHour("23");
$auxEndDate->setMinute("59");
$auxEndDate->setSecond("59");
//Set the webservice
$publisherStatisticsServiceUrl = 'https://api.affili.net/V2.0/PublisherStatistics.svc?wsdl';
$publisherStatisticsService = new Oara_Import_Soap_Client($publisherStatisticsServiceUrl, array('compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | SOAP_COMPRESSION_DEFLATE, 'soap_version' => SOAP_1_1));
$transactionList = Oara_Utilities::transactionMapPerDay($transactionList);
foreach ($merchantList as $merchantId) {
//Call the function
$params = array('StartDate' => strtotime($auxStartDate->toString("yyyy-MM-dd")), 'EndDate' => strtotime($auxEndDate->toString("yyyy-MM-dd")), 'ProgramId' => (string) $merchantId, 'SubId' => '', 'ProgramTypes' => 'All', 'ValuationType' => 'DateOfRegistration');
$overviewList = self::affilinetCall('overview', $publisherStatisticsService, $params);
if (isset($overviewList->DailyStatisticsRecords->DailyStatisticRecords->DailyStatisticsRecord) && !is_array($overviewList->DailyStatisticsRecords->DailyStatisticRecords->DailyStatisticsRecord)) {
$overviewList->DailyStatisticsRecords->DailyStatisticRecords->DailyStatisticsRecord = array($overviewList->DailyStatisticsRecords->DailyStatisticRecords->DailyStatisticsRecord);
}
if (isset($overviewList->DailyStatisticsRecords->DailyStatisticRecords->DailyStatisticsRecord)) {
foreach ($overviewList->DailyStatisticsRecords->DailyStatisticRecords->DailyStatisticsRecord as $overviewDay) {
$overview = array();
$overview['date'] = $overviewDay->Date;
$overview['merchantId'] = $merchantId;
$overview['click_number'] = $overviewDay->PayPerClick->Clicks + $overviewDay->PayPerSaleLead->Clicks + $overviewDay->CombinedPrograms->Clicks;
$overview['impression_number'] = $overviewDay->PayPerClick->Views + $overviewDay->PayPerSaleLead->Views + $overviewDay->CombinedPrograms->Views;
$overview['transaction_confirmed_value'] = 0;
$overview['transaction_pending_value'] = 0;
$overview['transaction_declined_value'] = 0;
$overview['transaction_confirmed_commission'] = 0;
$overview['transaction_pending_commission'] = 0;
$overview['transaction_declined_commission'] = 0;
$overviewDate = new Zend_Date($overviewDay->Date, "dd-MM-yyyy HH:mm:ss");
$transactionArray = Oara_Utilities::getDayFromArray($merchantId, $transactionList, $overviewDate);
$overview['transaction_number'] = count($transactionArray);
foreach ($transactionArray as $transaction) {
if ($transaction['status'] == Oara_Utilities::STATUS_CONFIRMED) {
$overview['transaction_confirmed_value'] += $transaction['amount'];
$overview['transaction_confirmed_commission'] += $transaction['commission'];
} else {
if ($transaction['status'] == Oara_Utilities::STATUS_PENDING) {
$overview['transaction_pending_value'] += $transaction['amount'];
$overview['transaction_pending_commission'] += $transaction['commission'];
} else {
if ($transaction['status'] == Oara_Utilities::STATUS_DECLINED) {
$overview['transaction_declined_value'] += $transaction['amount'];
$overview['transaction_declined_commission'] += $transaction['commission'];
}
}
}
}
if (Oara_Utilities::checkRegister($overview)) {
$totalOverview[] = $overview;
}
}
}
}
return $totalOverview;
}
示例5: getOverviewList
/**
* (non-PHPdoc)
* @see library/Oara/Network/Oara_Network_Base#getOverviewList($merchantId, $dStartDate, $dEndDate)
*/
public function getOverviewList($transactionList = null, $merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null)
{
$totalOverviews = array();
$transactionArray = Oara_Utilities::transactionMapPerDay($transactionList);
foreach ($transactionArray as $merchantId => $merchantTransaction) {
foreach ($merchantTransaction as $date => $transactionList) {
$overview = array();
$overview['merchantId'] = $merchantId;
$overviewDate = new Zend_Date($date, "yyyy-MM-dd");
$overview['date'] = $overviewDate->toString("yyyy-MM-dd HH:mm:ss");
$overview['click_number'] = 0;
$overview['impression_number'] = 0;
$overview['transaction_number'] = 0;
$overview['transaction_confirmed_value'] = 0;
$overview['transaction_confirmed_commission'] = 0;
$overview['transaction_pending_value'] = 0;
$overview['transaction_pending_commission'] = 0;
$overview['transaction_declined_value'] = 0;
$overview['transaction_declined_commission'] = 0;
foreach ($transactionList as $transaction) {
$overview['transaction_number']++;
if ($transaction['status'] == Oara_Utilities::STATUS_CONFIRMED) {
$overview['transaction_confirmed_value'] += $transaction['amount'];
$overview['transaction_confirmed_commission'] += $transaction['commission'];
} else {
if ($transaction['status'] == Oara_Utilities::STATUS_PENDING) {
$overview['transaction_pending_value'] += $transaction['amount'];
$overview['transaction_pending_commission'] += $transaction['commission'];
} else {
if ($transaction['status'] == Oara_Utilities::STATUS_DECLINED) {
$overview['transaction_declined_value'] += $transaction['amount'];
$overview['transaction_declined_commission'] += $transaction['commission'];
}
}
}
}
$totalOverviews[] = $overview;
}
}
return $totalOverviews;
}
示例6: getOverviewList
/**
* (non-PHPdoc)
* @see library/Oara/Network/Oara_Network_Base#getOverviewList($merchantId, $dStartDate, $dEndDate)
*/
public function getOverviewList($transactionList = null, $merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null)
{
$overviewArray = array();
$transactionArray = Oara_Utilities::transactionMapPerDay($transactionList);
$valuesFromExport = Oara_Utilities::cloneArray($this->_exportTransactionParameters);
$valuesFromExport[] = new Oara_Curl_Parameter('ctl00%24m_mainPlaceholder%24m_periodFromField_hidden', "%3CDateChooser%20Value%3D%22" . $dStartDate->toString("yyyy") . "x" . $dStartDate->toString("M") . "x" . $dStartDate->toString("d") . "%22%3E%3C/DateChooser%3E");
$valuesFromExport[] = new Oara_Curl_Parameter('ctl00xmxmainPlaceholderxmxperiodFromField_input', $dStartDate->toString("dd/MM/yyyy"));
$valuesFromExport[] = new Oara_Curl_Parameter('ctl00_m_mainPlaceholder_m_periodFromField_DrpPnl_Calendar1', "%3Cx%20PostData%3D%22" . $dStartDate->toString("yyyy") . "x" . $dStartDate->toString("M") . "x" . $dStartDate->toString("yyyy") . "x" . $dStartDate->toString("M") . "x" . $dStartDate->toString("d") . "%22%3E%3C/x%3E");
$valuesFromExport[] = new Oara_Curl_Parameter('ctl00%24m_mainPlaceholder%24m_periodToField_hidden', "%3CDateChooser%20Value%3D%22" . $dEndDate->toString("yyyy") . "x" . $dEndDate->toString("M") . "x" . $dEndDate->toString("d") . "%22%3E%3C/DateChooser%3E");
$valuesFromExport[] = new Oara_Curl_Parameter('ctl00xmxmainPlaceholderxmxperiodToField_input', $dEndDate->toString("dd/MM/yyyy"));
$valuesFromExport[] = new Oara_Curl_Parameter('ctl00_m_mainPlaceholder_m_periodToField_DrpPnl_Calendar1', "%3Cx%20PostData%3D%22" . $dEndDate->toString("yyyy") . "x" . $dEndDate->toString("M") . "x" . $dEndDate->toString("yyyy") . "x" . $dEndDate->toString("M") . "x" . $dEndDate->toString("d") . "%22%3E%3C/x%3E");
$urls = array();
$urls[] = new Oara_Curl_Request('https://www.bet365affiliates.com/Members/Members/Statistics/Default.aspx', array());
$exportReport = $this->_client->get($urls);
$forbiddenList = array('ctl00$m_mainPlaceholder$m_periodFromField_hidden', 'ctl00_m_mainPlaceholder_m_periodFromField_DrpPnl_Calendar1', 'ctl00$m_mainPlaceholder$m_periodToField_hidden', 'ctl00_m_mainPlaceholder_m_periodToField_DrpPnl_Calendar1');
$dom = new Zend_Dom_Query($exportReport[0]);
$hiddenList = $dom->query('input[type="hidden"]');
foreach ($hiddenList as $hidden) {
if (!in_array($hidden->getAttribute("name"), $forbiddenList)) {
$valuesFromExport[] = new Oara_Curl_Parameter($hidden->getAttribute("name"), $hidden->getAttribute("value"));
}
}
$urls = array();
$urls[] = new Oara_Curl_Request('https://www.bet365affiliates.com/Members/Members/Statistics/Default.aspx', $valuesFromExport);
$exportReport = $this->_client->post($urls);
$dom = new Zend_Dom_Query($exportReport[0]);
$tableList = $dom->query('table');
$exportData = self::htmlToCsv(self::DOMinnerHTML($tableList->current()));
$num = count($exportData);
for ($i = 2; $i < $num - 1; $i++) {
$overviewExportArray = str_getcsv($exportData[$i], ";");
$overview = array();
$overview['merchantId'] = 1;
$overviewDate = new Zend_Date($overviewExportArray[1], 'dd-MM-yyyy', 'en');
$overview['date'] = $overviewDate->toString("yyyy-MM-dd HH:mm:ss");
$overview['click_number'] = (int) $overviewExportArray[2];
$overview['impression_number'] = 0;
$overview['transaction_number'] = 0;
$overview['transaction_confirmed_value'] = 0;
$overview['transaction_confirmed_commission'] = 0;
$overview['transaction_pending_value'] = 0;
$overview['transaction_pending_commission'] = 0;
$overview['transaction_declined_value'] = 0;
$overview['transaction_declined_commission'] = 0;
$transactionDateArray = Oara_Utilities::getDayFromArray($overview['merchantId'], $transactionArray, $overviewDate);
foreach ($transactionDateArray as $transaction) {
$overview['transaction_number']++;
if ($transaction['status'] == Oara_Utilities::STATUS_CONFIRMED) {
$overview['transaction_confirmed_value'] += $transaction['amount'];
$overview['transaction_confirmed_commission'] += $transaction['commission'];
} else {
if ($transaction['status'] == Oara_Utilities::STATUS_PENDING) {
$overview['transaction_pending_value'] += $transaction['amount'];
$overview['transaction_pending_commission'] += $transaction['commission'];
} else {
if ($transaction['status'] == Oara_Utilities::STATUS_DECLINED) {
$overview['transaction_declined_value'] += $transaction['amount'];
$overview['transaction_declined_commission'] += $transaction['commission'];
}
}
}
}
if (Oara_Utilities::checkRegister($overview)) {
$overviewArray[] = $overview;
}
}
return $overviewArray;
}
示例7: getOverviewList
/**
* (non-PHPdoc)
* @see library/Oara/Network/Oara_Network_Base#getOverviewList($merchantId, $dStartDate, $dEndDate)
*/
public function getOverviewList($transactionList = null, $merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null)
{
$totalOverview = array();
$mothOverviewUrls = array();
$valuesFormExport = Oara_Utilities::cloneArray($this->_exportOverviewParameters);
$valuesFormExport[] = new Oara_Curl_Parameter('fromDate', $dStartDate->toString("M/d/yyyy"));
$valuesFormExport[] = new Oara_Curl_Parameter('toDate', $dEndDate->toString("M/d/yyyy"));
$mothOverviewUrls[] = new Oara_Curl_Request('https://cli.linksynergy.com/cli/publisher/reports/advancedReports.php', $valuesFormExport);
$exportMothReport = $this->_client->post($mothOverviewUrls);
$exportReportNumber = count($exportMothReport);
for ($i = 0; $i < $exportReportNumber; $i++) {
$doc = new DOMDocument();
libxml_use_internal_errors(true);
$doc->validateOnParse = true;
$doc->loadHTML($exportMothReport[$i]);
$frame = $doc->getElementById('frame');
if ($frame !== null) {
$frameUrl = null;
foreach ($frame->attributes as $attrName => $attrNode) {
if ($attrName == 'src') {
$frameUrl = $attrNode->nodeValue;
}
}
$urls = array();
$urls[] = new Oara_Curl_Request($frameUrl, array());
$exportReport = $this->_client->get($urls);
if (preg_match("/result=\"searching\"/", $exportReport[0]) || preg_match("/Logging in/", $exportReport[0])) {
$urls = array();
$urls[] = new Oara_Curl_Request($frameUrl, array());
$exportReport = $this->_client->get($urls);
}
if (!preg_match("/<a class=\"NQWMenuItem\" name=\"SectionElements\" href=\"javascript:void\\(null\\);\" onclick=\"NQWClearActiveMenu\\(\\);Download\\('([^<]*)'\\); return false\">Download Data<\\/a>/", $exportReport[0], $matches)) {
if (preg_match("/No Results/", $exportReport[0])) {
return $totalOverview;
}
}
}
}
$transactionArray = Oara_Utilities::transactionMapPerDay($transactionList);
$mothOverviewUrls = array();
$dateArray = Oara_Utilities::daysOfDifference($dStartDate, $dEndDate);
$dateArraySize = sizeof($dateArray);
for ($i = 0; $i < $dateArraySize; $i++) {
$valuesFormExport = Oara_Utilities::cloneArray($this->_exportOverviewParameters);
$valuesFormExport[] = new Oara_Curl_Parameter('fromDate', $dateArray[$i]->toString("M/d/yyyy"));
$valuesFormExport[] = new Oara_Curl_Parameter('toDate', $dateArray[$i]->toString("M/d/yyyy"));
$mothOverviewUrls[] = new Oara_Curl_Request('https://cli.linksynergy.com/cli/publisher/reports/advancedReports.php', $valuesFormExport);
}
$exportMothReport = $this->_client->post($mothOverviewUrls);
$exportReportNumber = count($exportMothReport);
for ($i = 0; $i < $exportReportNumber; $i++) {
$doc = new DOMDocument();
libxml_use_internal_errors(true);
$doc->validateOnParse = true;
$doc->loadHTML($exportMothReport[$i]);
$frame = $doc->getElementById('frame');
$frameUrl = null;
if ($frame !== null) {
foreach ($frame->attributes as $attrName => $attrNode) {
if ($attrName == 'src') {
$frameUrl = $attrNode->nodeValue;
}
}
$urls = array();
$urls[] = new Oara_Curl_Request($frameUrl, array());
$exportReport = $this->_client->get($urls);
while (!preg_match("/No Results/", $exportReport[0], $matches)) {
if (preg_match("/<a class=\"NQWMenuItem\" name=\"SectionElements\" href=\"javascript:void\\(null\\);\" onclick=\"NQWClearActiveMenu\\(\\);Download\\('([^<]*)'\\); return false\">Download Data<\\/a>/", $exportReport[0], $matches)) {
$totalOverview = self::getOverview($matches, $totalOverview, $merchantList, $mothOverviewUrls[$i]->getParameter(9), $transactionArray);
break;
} else {
if (preg_match("/result=\"searching\"/", $exportReport[0]) || preg_match("/Logging in/", $exportReport[0])) {
$urls = array();
$urls[] = new Oara_Curl_Request($frameUrl, array());
$exportReport = $this->_client->get($urls);
} else {
//echo $exportReport[0];
throw new Exception("Error getting transactions");
}
}
}
}
}
return $totalOverview;
}
示例8: getOverviewList
/**
* (non-PHPdoc)
* @see library/Oara/Network/Oara_Network_Base#getOverviewList($merchantId, $dStartDate, $dEndDate)
*/
public function getOverviewList($transactionList = null, $merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null)
{
self::logIn();
$overviewArray = array();
$transactionArray = Oara_Utilities::transactionMapPerDay($transactionList);
$epcStartDate = clone $dStartDate;
$epcStartDate->addDay(1);
$epcEndDate = clone $dEndDate;
$epcEndDate->addDay(1);
$overviewExport = Oara_Utilities::cloneArray($this->_exportOverviewParameters);
$overviewExport[] = new Oara_Curl_Parameter('epc_start_date', $epcStartDate->toString("MM/dd/yy"));
$overviewExport[] = new Oara_Curl_Parameter('epc_start_date_month', $epcStartDate->toString("MM"));
$overviewExport[] = new Oara_Curl_Parameter('epc_start_date_day', $epcStartDate->toString("dd"));
$overviewExport[] = new Oara_Curl_Parameter('epc_start_date_year', $epcStartDate->toString("yyyy"));
$overviewExport[] = new Oara_Curl_Parameter('epc_end_date', $epcEndDate->toString("MM/dd/yy"));
$overviewExport[] = new Oara_Curl_Parameter('epc_end_date_month', $epcEndDate->toString("MM"));
$overviewExport[] = new Oara_Curl_Parameter('epc_end_date_day', $epcEndDate->toString("dd"));
$overviewExport[] = new Oara_Curl_Parameter('epc_end_date_year', $epcEndDate->toString("yyyy"));
$overviewByDateArray = array();
$try = 0;
$done = false;
while (!$done && $try < 5) {
try {
$urls = array();
$urls[] = new Oara_Curl_Request('https://publisher.ebaypartnernetwork.com/PublisherReportsTx?', $overviewExport);
$exportReport = $this->_client->get($urls);
$exportData = str_getcsv($exportReport[0], "\n");
$overviewByDateArray = array_merge($overviewByDateArray, self::getOverviewReportRecursive($exportData));
$done = true;
} catch (Exception $e) {
$try++;
}
}
if ($try == 5) {
echo $exportReport[0];
throw new Exception("Couldn't get overview ");
}
// Ad clicks and transactions for this day
foreach ($overviewByDateArray as $date => $obj) {
$overviewDate = new Zend_Date($date, "yyyy/MM/dd");
$returnObject = self::getDayFromArray($obj['merchantId'], $transactionArray, $overviewDate, true);
$transactionDateArray = $returnObject->resultArray;
$transactionArray = $returnObject->dateArray;
unset($overviewDate);
foreach ($transactionDateArray as $transaction) {
$obj['transaction_number']++;
if ($transaction['status'] == Oara_Utilities::STATUS_CONFIRMED) {
$obj['transaction_confirmed_value'] += $transaction['amount'];
$obj['transaction_confirmed_commission'] += $transaction['commission'];
} else {
if ($transaction['status'] == Oara_Utilities::STATUS_PENDING) {
$obj['transaction_pending_value'] += $transaction['amount'];
$obj['transaction_pending_commission'] += $transaction['commission'];
} else {
if ($transaction['status'] == Oara_Utilities::STATUS_DECLINED) {
$obj['transaction_declined_value'] += $transaction['amount'];
$obj['transaction_declined_commission'] += $transaction['commission'];
}
}
}
}
if (Oara_Utilities::checkRegister($obj)) {
$overviewArray[] = $obj;
}
}
//Add transactions
foreach ($transactionArray as $merchantId => $merchantTransaction) {
foreach ($merchantTransaction as $date => $transactionList) {
$overview = array();
$overview['merchantId'] = $merchantId;
$overviewDate = new Zend_Date($date, "yyyy-MM-dd");
$overview['date'] = $overviewDate->toString("yyyy-MM-dd HH:mm:ss");
unset($overviewDate);
$overview['click_number'] = 0;
$overview['impression_number'] = 0;
$overview['transaction_number'] = 0;
$overview['transaction_confirmed_value'] = 0;
$overview['transaction_confirmed_commission'] = 0;
$overview['transaction_pending_value'] = 0;
$overview['transaction_pending_commission'] = 0;
$overview['transaction_declined_value'] = 0;
$overview['transaction_declined_commission'] = 0;
foreach ($transactionList as $transaction) {
$overview['transaction_number']++;
if ($transaction['status'] == Oara_Utilities::STATUS_CONFIRMED) {
$overview['transaction_confirmed_value'] += $transaction['amount'];
$overview['transaction_confirmed_commission'] += $transaction['commission'];
} else {
if ($transaction['status'] == Oara_Utilities::STATUS_PENDING) {
$overview['transaction_pending_value'] += $transaction['amount'];
$overview['transaction_pending_commission'] += $transaction['commission'];
} else {
if ($transaction['status'] == Oara_Utilities::STATUS_DECLINED) {
$overview['transaction_declined_value'] += $transaction['amount'];
$overview['transaction_declined_commission'] += $transaction['commission'];
}
//.........这里部分代码省略.........
示例9: getOverviewList
/**
* (non-PHPdoc)
* @see library/Oara/Network/Oara_Network_Base#getOverviewList($merchantId, $dStartDate, $dEndDate)
*/
public function getOverviewList($transactionList = null, $merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null)
{
$overviewArray = array();
$transactionArray = Oara_Utilities::transactionMapPerDay($transactionList);
$valuesFromExport = Oara_Utilities::cloneArray($this->_exportTransactionParameters);
$valuesFromExport[] = new Oara_Curl_Parameter('fromPeriod', $dStartDate->toString("yyyy-MM-dd"));
$valuesFromExport[] = new Oara_Curl_Parameter('toPeriod', $dEndDate->toString("yyyy-MM-dd"));
$urls = array();
$urls[] = new Oara_Curl_Request('https://www.affutd.com/en/traffic-stats/advertiser', array());
$exportReport = $this->_client->get($urls);
$dom = new Zend_Dom_Query($exportReport[0]);
$campaignOption = $dom->query('option[label="DEFAULT"]');
$campaignOption = $campaignOption->current();
$valuesFromExport[] = new Oara_Curl_Parameter('campaign', $campaignOption->getAttribute('value'));
$hiddenParam = $dom->query('#jsonCampaigns');
$hiddenParam = $hiddenParam->current();
$valuesFromExport[] = new Oara_Curl_Parameter($hiddenParam->getAttribute('id'), $hiddenParam->getAttribute('value'));
$urls = array();
$urls[] = new Oara_Curl_Request('https://www.affutd.com/en/traffic-stats/advertiser', $valuesFromExport);
$exportReport = $this->_client->post($urls);
$exportData = str_getcsv($exportReport[0], "\n");
$num = count($exportData);
for ($i = 1; $i < $num - 1; $i++) {
$overviewExportArray = str_getcsv($exportData[$i], ",");
if (isset($this->_merchantMap[$overviewExportArray[0]]) && in_array($this->_merchantMap[$overviewExportArray[0]], $merchantList)) {
$overview = array();
$overview['merchantId'] = $this->_merchantMap[$overviewExportArray[0]];
$overviewDate = new Zend_Date($overviewExportArray[1], 'yyyy-MM-dd', 'en');
$overview['date'] = $overviewDate->toString("yyyy-MM-dd HH:mm:ss");
$overview['click_number'] = (int) $overviewExportArray[8];
$overview['impression_number'] = (int) $overviewExportArray[9];
$overview['transaction_number'] = 0;
$overview['transaction_confirmed_value'] = 0;
$overview['transaction_confirmed_commission'] = 0;
$overview['transaction_pending_value'] = 0;
$overview['transaction_pending_commission'] = 0;
$overview['transaction_declined_value'] = 0;
$overview['transaction_declined_commission'] = 0;
$transactionDateArray = Oara_Utilities::getDayFromArray($overview['merchantId'], $transactionArray, $overviewDate);
foreach ($transactionDateArray as $transaction) {
$overview['transaction_number']++;
if ($transaction['status'] == Oara_Utilities::STATUS_CONFIRMED) {
$overview['transaction_confirmed_value'] += $transaction['amount'];
$overview['transaction_confirmed_commission'] += $transaction['commission'];
} else {
if ($transaction['status'] == Oara_Utilities::STATUS_PENDING) {
$overview['transaction_pending_value'] += $transaction['amount'];
$overview['transaction_pending_commission'] += $transaction['commission'];
} else {
if ($transaction['status'] == Oara_Utilities::STATUS_DECLINED) {
$overview['transaction_declined_value'] += $transaction['amount'];
$overview['transaction_declined_commission'] += $transaction['commission'];
}
}
}
}
if (Oara_Utilities::checkRegister($overview)) {
$overviewArray[] = $overview;
}
}
}
return $overviewArray;
}
示例10: getOverviewList
/**
* (non-PHPdoc)
* @see library/Oara/Network/Oara_Network_Interface#getOverviewList($aMerchantIds, $dStartDate, $dEndDate)
*/
public function getOverviewList($transactionList = null, $merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null)
{
$overviewArray = array();
$transactionArray = array();
$mothOverviewUrls = array();
$valuesFromExport = Oara_Utilities::cloneArray($this->_exportOverviewParameters);
$valuesFromExport[] = new Oara_Curl_Parameter('from_year', $dStartDate->get(Zend_Date::YEAR));
$valuesFromExport[] = new Oara_Curl_Parameter('from_month', $dStartDate->get(Zend_Date::MONTH));
$valuesFromExport[] = new Oara_Curl_Parameter('from_day', $dStartDate->get(Zend_Date::DAY));
$valuesFromExport[] = new Oara_Curl_Parameter('to_year', $dEndDate->get(Zend_Date::YEAR));
$valuesFromExport[] = new Oara_Curl_Parameter('to_month', $dEndDate->get(Zend_Date::MONTH));
$valuesFromExport[] = new Oara_Curl_Parameter('to_day', $dEndDate->get(Zend_Date::DAY));
$valuesFromExport[] = new Oara_Curl_Parameter('prog_id', '0');
$urls = array();
$urls[] = new Oara_Curl_Request('http://users.buy.at/ma/index.php/affiliateReport/dailySummary?', $valuesFromExport);
$exportReport = $this->_client->get($urls);
$exportData = str_getcsv($exportReport[0], "\r\n");
if (self::checkOverview($exportData)) {
$transactionArray = Oara_Utilities::transactionMapPerDay($transactionList);
foreach ($merchantList as $idMerchant) {
$valuesFromExport = Oara_Utilities::cloneArray($this->_exportOverviewParameters);
$valuesFromExport[] = new Oara_Curl_Parameter('from_year', $dStartDate->get(Zend_Date::YEAR));
$valuesFromExport[] = new Oara_Curl_Parameter('from_month', $dStartDate->get(Zend_Date::MONTH));
$valuesFromExport[] = new Oara_Curl_Parameter('from_day', $dStartDate->get(Zend_Date::DAY));
$valuesFromExport[] = new Oara_Curl_Parameter('to_year', $dEndDate->get(Zend_Date::YEAR));
$valuesFromExport[] = new Oara_Curl_Parameter('to_month', $dEndDate->get(Zend_Date::MONTH));
$valuesFromExport[] = new Oara_Curl_Parameter('to_day', $dEndDate->get(Zend_Date::DAY));
$valuesFromExport[] = new Oara_Curl_Parameter('prog_id', $idMerchant);
$mothOverviewUrls[] = new Oara_Curl_Request('http://users.buy.at/ma/index.php/affiliateReport/dailySummary?', $valuesFromExport);
}
}
if (count($mothOverviewUrls) > 0) {
$exportReport = $this->_client->get($mothOverviewUrls);
$exportReportNumber = count($exportReport);
for ($i = 0; $i < $exportReportNumber; $i++) {
$exportData = str_getcsv($exportReport[$i], "\r\n");
$num = count($exportData);
if (self::checkOverview($exportData)) {
for ($j = 1; $j < $num; $j++) {
$overviewExportArray = str_getcsv($exportData[$j], ",");
$parameter = $mothOverviewUrls[$i]->getParameter(21);
$parameterMerchantId = $parameter->getValue();
$obj = array();
$obj['merchantId'] = $parameterMerchantId;
$overviewDate = new Zend_Date($overviewExportArray[0], "yyyy-MM-dd");
$obj['date'] = $overviewDate->toString("yyyy-MM-dd HH:mm:ss");
$obj['impression_number'] = 0;
$obj['click_number'] = $overviewExportArray[1];
$obj['transaction_number'] = 0;
$obj['transaction_confirmed_commission'] = 0;
$obj['transaction_confirmed_value'] = 0;
$obj['transaction_pending_commission'] = 0;
$obj['transaction_pending_value'] = 0;
$obj['transaction_declined_commission'] = 0;
$obj['transaction_declined_value'] = 0;
$transactionDateArray = Oara_Utilities::getDayFromArray($obj['merchantId'], $transactionArray, $overviewDate);
foreach ($transactionDateArray as $transaction) {
$obj['transaction_number']++;
if ($transaction['status'] == Oara_Utilities::STATUS_CONFIRMED) {
$obj['transaction_confirmed_value'] += $transaction['amount'];
$obj['transaction_confirmed_commission'] += $transaction['commission'];
} else {
if ($transaction['status'] == Oara_Utilities::STATUS_PENDING) {
$obj['transaction_pending_value'] += $transaction['amount'];
$obj['transaction_pending_commission'] += $transaction['commission'];
} else {
if ($transaction['status'] == Oara_Utilities::STATUS_DECLINED) {
$obj['transaction_declined_value'] += $transaction['amount'];
$obj['transaction_declined_commission'] += $transaction['commission'];
}
}
}
}
if (Oara_Utilities::checkRegister($obj)) {
$overviewArray[] = $obj;
}
}
}
}
}
return $overviewArray;
}
示例11: getOverviewList
/**
* (non-PHPdoc)
* @see library/Oara/Network/Oara_Network_Base#getOverviewList($merchantId, $dStartDate, $dEndDate)
*/
public function getOverviewList($transactionList = null, $merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null)
{
$overviewArray = array();
$transactionArray = Oara_Utilities::transactionMapPerDay($transactionList);
$valuesFromExport = Oara_Utilities::cloneArray($this->_exportTransactionParameters);
$valuesFromExport[] = new Oara_Curl_Parameter('fromDate', $dStartDate->toString("dd/MM/yyyy"));
$valuesFromExport[] = new Oara_Curl_Parameter('until', $dEndDate->toString("dd/MM/yyyy"));
$urls = array();
$urls[] = new Oara_Curl_Request('https://www.ladbrokes.com/aff_man', $valuesFromExport);
$exportReport = $this->_client->post($urls);
$dom = new Zend_Dom_Query($exportReport[0]);
$tableList = $dom->query('#results_table');
$exportData = self::htmlToCsv(self::DOMinnerHTML($tableList->current()));
$num = count($exportData);
for ($i = 2; $i < $num - 2; $i++) {
$overviewExportArray = str_getcsv($exportData[$i], ";");
$overview = array();
$overview['merchantId'] = 1;
$overviewDate = new Zend_Date($overviewExportArray[0], 'dd-MM-yy', 'en');
$overview['date'] = $overviewDate->toString("yyyy-MM-dd HH:mm:ss");
$overview['click_number'] = (int) $overviewExportArray[3];
$overview['impression_number'] = (int) $overviewExportArray[2];
$overview['transaction_number'] = 0;
$overview['transaction_confirmed_value'] = 0;
$overview['transaction_confirmed_commission'] = 0;
$overview['transaction_pending_value'] = 0;
$overview['transaction_pending_commission'] = 0;
$overview['transaction_declined_value'] = 0;
$overview['transaction_declined_commission'] = 0;
$transactionDateArray = Oara_Utilities::getDayFromArray($overview['merchantId'], $transactionArray, $overviewDate);
foreach ($transactionDateArray as $transaction) {
$overview['transaction_number']++;
if ($transaction['status'] == Oara_Utilities::STATUS_CONFIRMED) {
$overview['transaction_confirmed_value'] += $transaction['amount'];
$overview['transaction_confirmed_commission'] += $transaction['commission'];
} else {
if ($transaction['status'] == Oara_Utilities::STATUS_PENDING) {
$overview['transaction_pending_value'] += $transaction['amount'];
$overview['transaction_pending_commission'] += $transaction['commission'];
} else {
if ($transaction['status'] == Oara_Utilities::STATUS_DECLINED) {
$overview['transaction_declined_value'] += $transaction['amount'];
$overview['transaction_declined_commission'] += $transaction['commission'];
}
}
}
}
if (Oara_Utilities::checkRegister($overview)) {
$overviewArray[] = $overview;
}
}
return $overviewArray;
}
示例12: getOverviewList
/**
* (non-PHPdoc)
* @see library/Oara/Network/Oara_Network_Base#getOverviewList($merchantId, $dStartDate, $dEndDate)
*/
public function getOverviewList($transactionList = null, $merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null)
{
$totalOverview = array();
$valuesFromExport = Oara_Utilities::cloneArray($this->_exportOverviewParameters);
$valuesFromExport[] = new Oara_Curl_Parameter('campaignID', self::getAdvertisersCampaigns($merchantList));
$valuesFromExport[] = new Oara_Curl_Parameter('fromDate', $dStartDate->toString("dd/MM/yyyy"));
$valuesFromExport[] = new Oara_Curl_Parameter('toDate', $dEndDate->toString("dd/MM/yyyy"));
$urls = array();
$urls[] = new Oara_Curl_Request('http://www.dgmpro.com/affiliates/cfc/dgmreports.cfc?method=getSummaryCSV', $valuesFromExport);
$exportReport = $this->_curlClient->post($urls);
$reportUrl = null;
if (preg_match("/<filelocation>(.*)<\\/filelocation>/", $exportReport[0], $matches)) {
$reportUrl = trim($matches[1]);
} else {
throw new Exception('No transaction report found');
}
$urls = array();
$urls[] = new Oara_Curl_Request($reportUrl, array());
$exportReport = $this->_curlClient->get($urls);
$exportData = str_getcsv($exportReport[0], "\n");
if (self::checkOverview($exportData)) {
$transactionArray = Oara_Utilities::transactionMapPerDay($transactionList);
$iteration = self::calculeIterationNumber(count($merchantList), $this->_pageSize);
for ($it = 0; $it < $iteration; $it++) {
$merchantStartIndex = $this->_pageSize * $it;
if (count($merchantList) > $this->_pageSize * ($it + 1)) {
$merchantEndIndex = $this->_pageSize * ($it + 1);
} else {
$merchantEndIndex = count($merchantList);
}
$urls = array();
for ($merchantIndex = $merchantStartIndex; $merchantIndex < $merchantEndIndex; $merchantIndex++) {
$valuesFromExport = Oara_Utilities::cloneArray($this->_exportOverviewParameters);
$valuesFromExport[] = new Oara_Curl_Parameter('campaignID', self::getAdvertisersCampaigns(array($merchantList[$merchantIndex])));
$valuesFromExport[] = new Oara_Curl_Parameter('fromDate', $dStartDate->toString("dd/MM/yyyy"));
$valuesFromExport[] = new Oara_Curl_Parameter('toDate', $dEndDate->toString("dd/MM/yyyy"));
$urls[] = new Oara_Curl_Request('http://www.dgmpro.com/affiliates/cfc/dgmreports.cfc?method=getSummaryCSV', $valuesFromExport);
}
$exportReportUrl = $this->_curlClient->post($urls);
$urls = array();
for ($i = 0; $i < count($exportReportUrl); $i++) {
$reportUrl = null;
if (preg_match("/<filelocation>(.*)<\\/filelocation>/", $exportReportUrl[$i], $matches)) {
$reportUrl = trim($matches[1]);
$urls[] = new Oara_Curl_Request($reportUrl, array());
} else {
throw new Exception('No transaction report found');
}
}
$overviewRegisters = $this->_curlClient->get($urls);
for ($i = 0; $i < count($overviewRegisters); $i++) {
$exportData = str_getcsv($overviewRegisters[$i], "\n");
for ($j = 7; $j < count($exportData) - 2; $j++) {
$overviewExportArray = str_getcsv($exportData[$j], ",");
$overview = array();
$overview['merchantId'] = $merchantList[$i];
$transactionDate = new Zend_Date($overviewExportArray[0], 'dd-MMM-yyyy HH:mm:ss', 'en_GB');
$overview['date'] = $transactionDate->toString("yyyy-MM-dd HH:mm:ss");
$overview['click_number'] = (int) $overviewExportArray[2];
$overview['impression_number'] = (int) $overviewExportArray[1];
$overview['transaction_number'] = 0;
$overview['transaction_confirmed_value'] = 0;
$overview['transaction_confirmed_commission'] = 0;
$overview['transaction_pending_value'] = 0;
$overview['transaction_pending_commission'] = 0;
$overview['transaction_declined_value'] = 0;
$overview['transaction_declined_commission'] = 0;
$transactionDateArray = Oara_Utilities::getDayFromArray($overview['merchantId'], $transactionArray, $transactionDate);
foreach ($transactionDateArray as $transaction) {
$overview['transaction_number']++;
if ($transaction['status'] == Oara_Utilities::STATUS_CONFIRMED) {
$overview['transaction_confirmed_value'] += $transaction['amount'];
$overview['transaction_confirmed_commission'] += $transaction['commission'];
} else {
if ($transaction['status'] == Oara_Utilities::STATUS_PENDING) {
$overview['transaction_pending_value'] += $transaction['amount'];
$overview['transaction_pending_commission'] += $transaction['commission'];
} else {
if ($transaction['status'] == Oara_Utilities::STATUS_DECLINED) {
$overview['transaction_declined_value'] += $transaction['amount'];
$overview['transaction_declined_commission'] += $transaction['commission'];
}
}
}
}
if (Oara_Utilities::checkRegister($overview)) {
$totalOverview[] = $overview;
}
}
}
}
}
return $totalOverview;
}
示例13: getOverviewList
/**
* (non-PHPdoc)
* @see library/Oara/Network/Oara_Network_Base#getOverviewList($merchantId,$dStartDate,$dEndDate)
*/
public function getOverviewList($transactionList = null, $merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null)
{
$totalOverview = array();
//At first, we need to be sure that there are some data.
$auxStartDate = clone $dStartDate;
$auxStartDate->setHour("00");
$auxStartDate->setMinute("00");
$auxStartDate->setSecond("00");
$auxEndDate = clone $dEndDate;
$auxEndDate->setHour("23");
$auxEndDate->setMinute("59");
$auxEndDate->setSecond("59");
$auxEndDate->addDay(1);
$transactionArray = Oara_Utilities::transactionMapPerDay($transactionList);
foreach ($merchantList as $merchantId) {
$overviewList = $this->_apiClient->getReportBasic($auxStartDate->toString("yyyy-MM-dd"), $auxEndDate->toString("yyyy-MM-dd"), 'trackingDate', null, $merchantId, null, null, null, null, array('day'));
if ($overviewList->total > 0) {
foreach ($overviewList->reportItems->reportItem as $overview) {
$obj = array();
$obj['merchantId'] = $merchantId;
$overviewDate = new Zend_Date($overview->day, "yyyy-MM-dd");
$obj['date'] = $overviewDate->toString("yyyy-MM-dd HH:mm:ss");
$obj['impression_number'] = $overview->total->viewCount;
$obj['click_number'] = $overview->total->clickCount;
$obj['transaction_number'] = 0;
$obj['transaction_confirmed_commission'] = 0;
$obj['transaction_confirmed_value'] = 0;
$obj['transaction_pending_commission'] = 0;
$obj['transaction_pending_value'] = 0;
$obj['transaction_declined_commission'] = 0;
$obj['transaction_declined_value'] = 0;
$transactionDateArray = Oara_Utilities::getDayFromArray($obj['merchantId'], $transactionArray, $overviewDate);
foreach ($transactionDateArray as $transaction) {
$obj['transaction_number']++;
if ($transaction['status'] == Oara_Utilities::STATUS_CONFIRMED) {
$obj['transaction_confirmed_value'] += $transaction['amount'];
$obj['transaction_confirmed_commission'] += $transaction['commission'];
} else {
if ($transaction['status'] == Oara_Utilities::STATUS_PENDING) {
$obj['transaction_pending_value'] += $transaction['amount'];
$obj['transaction_pending_commission'] += $transaction['commission'];
} else {
if ($transaction['status'] == Oara_Utilities::STATUS_DECLINED) {
$obj['transaction_declined_value'] += $transaction['amount'];
$obj['transaction_declined_commission'] += $transaction['commission'];
}
}
}
}
if (Oara_Utilities::checkRegister($obj)) {
$totalOverview[] = $obj;
}
}
}
unset($overviewList);
gc_collect_cycles();
}
return $totalOverview;
}
示例14: getOverviewList
/**
* (non-PHPdoc)
* @see library/Oara/Network/Oara_Network_Base#getOverviewList($merchantId, $dStartDate, $dEndDate)
*/
public function getOverviewList($transactionList = null, $merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null)
{
$overviewArray = array();
$transactionArray = Oara_Utilities::transactionMapPerDay($transactionList);
$urls = array();
foreach ($merchantList as $merchantId) {
$overviewExport = Oara_Utilities::cloneArray($this->_exportOverviewParameters);
$overviewExport[] = new Oara_Curl_Parameter('program', $merchantId);
$overviewExport[] = new Oara_Curl_Parameter('period', $dStartDate->toString("yyyyMMdd") . "-" . $dEndDate->toString("yyyyMMdd"));
$urls[] = new Oara_Curl_Request('http://publisher.daisycon.com/en/affiliatemarketing/stats/month/?', $overviewExport);
}
$exportReport = $this->_client->get($urls);
for ($i = 1; $i < count($exportReport); $i++) {
$exportData = str_getcsv($exportReport[$i], "\r\n");
$num = count($exportData);
$overviewDate = clone $dStartDate;
$overviewDate->setHour(0);
$overviewDate->setMinute(0);
$overviewDate->setSecond(0);
for ($j = 1; $j < $num; $j++) {
$overviewExportArray = str_getcsv($exportData[$j], ";");
$obj = array();
$urlParams = $urls[$i]->getParameters();
$obj['merchantId'] = $urlParams[6]->getValue();
$overviewDate->setDay($overviewExportArray[0]);
$obj['date'] = $overviewDate->toString("yyyy-MM-dd HH:mm:ss");
$obj['impression_number'] = 0;
$obj['click_number'] = $overviewExportArray[1];
$obj['transaction_number'] = 0;
$obj['transaction_confirmed_commission'] = 0;
$obj['transaction_confirmed_value'] = 0;
$obj['transaction_pending_commission'] = 0;
$obj['transaction_pending_value'] = 0;
$obj['transaction_declined_commission'] = 0;
$obj['transaction_declined_value'] = 0;
$transactionDateArray = Oara_Utilities::getDayFromArray($obj['merchantId'], $transactionArray, $overviewDate);
foreach ($transactionDateArray as $transaction) {
$obj['transaction_number']++;
if ($transaction['status'] == Oara_Utilities::STATUS_CONFIRMED) {
$obj['transaction_confirmed_value'] += $transaction['amount'];
$obj['transaction_confirmed_commission'] += $transaction['commission'];
} else {
if ($transaction['status'] == Oara_Utilities::STATUS_PENDING) {
$obj['transaction_pending_value'] += $transaction['amount'];
$obj['transaction_pending_commission'] += $transaction['commission'];
} else {
if ($transaction['status'] == Oara_Utilities::STATUS_DECLINED) {
$obj['transaction_declined_value'] += $transaction['amount'];
$obj['transaction_declined_commission'] += $transaction['commission'];
}
}
}
}
if (Oara_Utilities::checkRegister($obj)) {
$overviewArray[] = $obj;
}
}
}
return $overviewArray;
}
示例15: getOverviewList
/**
* (non-PHPdoc)
* @see library/Oara/Network/Oara_Network_Base#getOverviewList($merchantId, $dStartDate, $dEndDate)
*/
public function getOverviewList($transactionList = null, $merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null)
{
$overviewArray = array();
$transactionArray = Oara_Utilities::transactionMapPerDay($transactionList);
$mothOverviewUrls = array();
foreach (array_keys($this->_websiteList) as $websiteId) {
$dateArray = Oara_Utilities::daysOfDifference($dStartDate, $dEndDate);
$dateArraySize = sizeof($dateArray);
for ($i = 0; $i < $dateArraySize; $i++) {
$overviewExport = Oara_Utilities::cloneArray($this->_exportOverviewParameters);
$overviewExport[] = new Oara_Curl_Parameter('AfID', $websiteId);
$overviewExport[] = new Oara_Curl_Parameter('RptDate', $dateArray[$i]->toString("dd-MM-yyyy"));
$mothOverviewUrls[] = new Oara_Curl_Request('http://www.clixgalore.co.uk/AffiliateSummaryStatsPopup.asp?', $overviewExport);
}
}
$exportReport = $this->_client->get($mothOverviewUrls);
for ($i = 0; $i < count($exportReport); $i++) {
if (!preg_match("/No clicks\\/transactions have been sent!/", $exportReport[$i])) {
$dom = new Zend_Dom_Query($exportReport[$i]);
$results = $dom->query('table');
$count = count($results);
$tableNode = null;
for ($j = 0; $j < $count; $j++) {
$node = $results->next();
if ($j == 1) {
$tableNode = $node;
break;
}
}
$exportData = self::htmlToCsv(self::DOMinnerHTML($tableNode));
for ($j = 1; $j < count($exportData); $j++) {
$overviewExportArray = str_getcsv($exportData[$j], ";");
if (isset($this->_merchantMap[$overviewExportArray[0]]) && in_array((int) $this->_merchantMap[$overviewExportArray[0]], $merchantList)) {
$obj = array();
$obj['merchantId'] = $this->_merchantMap[$overviewExportArray[0]];
$overviewDate = new Zend_Date($mothOverviewUrls[$i]->getParameter(2)->getValue(), "dd-MM-yyyy HH:mm:ss");
$obj['date'] = $overviewDate->toString("yyyy-MM-dd HH:mm:ss");
$obj['impression_number'] = $overviewExportArray[4];
$obj['click_number'] = $overviewExportArray[6];
$obj['transaction_number'] = 0;
$obj['transaction_confirmed_commission'] = 0;
$obj['transaction_confirmed_value'] = 0;
$obj['transaction_pending_commission'] = 0;
$obj['transaction_pending_value'] = 0;
$obj['transaction_declined_commission'] = 0;
$obj['transaction_declined_value'] = 0;
$transactionDateArray = Oara_Utilities::getDayFromArray($obj['merchantId'], $transactionArray, $overviewDate);
foreach ($transactionDateArray as $transaction) {
$obj['transaction_number']++;
if ($transaction['status'] == Oara_Utilities::STATUS_CONFIRMED) {
$obj['transaction_confirmed_value'] += $transaction['amount'];
$obj['transaction_confirmed_commission'] += $transaction['commission'];
} else {
if ($transaction['status'] == Oara_Utilities::STATUS_PENDING) {
$obj['transaction_pending_value'] += $transaction['amount'];
$obj['transaction_pending_commission'] += $transaction['commission'];
} else {
if ($transaction['status'] == Oara_Utilities::STATUS_DECLINED) {
$obj['transaction_declined_value'] += $transaction['amount'];
$obj['transaction_declined_commission'] += $transaction['commission'];
}
}
}
}
if (Oara_Utilities::checkRegister($obj)) {
$overviewArray[] = $obj;
}
}
}
}
}
return $overviewArray;
}