本文整理汇总了PHP中Oara_Utilities::getDayFromArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Oara_Utilities::getDayFromArray方法的具体用法?PHP Oara_Utilities::getDayFromArray怎么用?PHP Oara_Utilities::getDayFromArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Oara_Utilities
的用法示例。
在下文中一共展示了Oara_Utilities::getDayFromArray方法的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)
{
$overviewArray = array();
$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->_exportTransactionParameters);
$valuesFormExport[] = new Oara_Curl_Parameter('datefrom', $dateArray[$i]->toString("yyyy-MM-dd"));
$valuesFormExport[] = new Oara_Curl_Parameter('dateto', $dateArray[$i]->toString("yyyy-MM-dd"));
$mothUrls[] = new Oara_Curl_Request('https://accounts.skimlinks.com/reports_export.php?', $valuesFormExport);
}
$exportReport = $this->_client->get($mothUrls);
$exportReportNumber = count($exportReport);
for ($i = 0; $i < $exportReportNumber; $i++) {
$exportData = str_getcsv($exportReport[$i], "\n");
$num = count($exportData);
for ($j = 1; $j < $num - 5; $j++) {
$overviewExportArray = str_getcsv($exportData[$j], ",");
if (Oara_Utilities::parseDouble($overviewExportArray[2]) != 0 && isset($this->_merchantMap[$overviewExportArray[0]]) && in_array($this->_merchantMap[$overviewExportArray[0]], $merchantList)) {
$overview = array();
$overview['merchantId'] = $this->_merchantMap[$overviewExportArray[0]];
$overviewDate = new Zend_Date($mothUrls[$i]->getParameter(5)->getValue(), 'yyyy-MM-dd', 'en');
$overview['date'] = $overviewDate->toString("yyyy-MM-dd HH:mm:ss");
$overview['click_number'] = (int) $overviewExportArray[1];
$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;
}
示例2: getOverviewReportRecursive
private function getOverviewReportRecursive($transactionArray, $id, $dStartDate, $dEndDate)
{
$overviewArray = array();
$overviewExport = Oara_Utilities::cloneArray($this->_exportOverviewParameters);
$overviewExport[] = new Oara_Curl_Parameter('startDay', $dStartDate->toString("d"));
$overviewExport[] = new Oara_Curl_Parameter('startMonth', (int) $dStartDate->toString("M") - 1);
$overviewExport[] = new Oara_Curl_Parameter('startYear', $dStartDate->toString("yyyy"));
$overviewExport[] = new Oara_Curl_Parameter('endDay', $dEndDate->toString("d"));
$overviewExport[] = new Oara_Curl_Parameter('endMonth', (int) $dEndDate->toString("M") - 1);
$overviewExport[] = new Oara_Curl_Parameter('endYear', $dEndDate->toString("yyyy"));
$overviewExport[] = new Oara_Curl_Parameter('idbox_store_id', $id);
$urls = array();
$urls[] = new Oara_Curl_Request($this->_networkServer . "/gp/associates/network/reports/report.html?", $overviewExport);
$exportReport = $this->_client->get($urls);
$exportData = str_getcsv($exportReport[0], "\n");
$num = count($exportData);
for ($j = 2; $j < $num; $j++) {
$overviewExportArray = str_getcsv($exportData[$j], "\t");
$obj = array();
$obj['merchantId'] = 1;
$overviewDate = new Zend_Date($overviewExportArray[0], "yyyy/MM/dd HH:mm:ss");
$obj['date'] = $overviewDate->toString("yyyy-MM-dd HH:mm:ss");
$obj['impression_number'] = 0;
if (!isset($overviewExportArray[1])) {
throw new Exception("Request failed");
}
$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);
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;
}
}
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)
{
$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;
}
示例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)
{
$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;
}
}
//.........这里部分代码省略.........
示例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)
{
$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;
}
示例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();
$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;
}
示例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)
{
$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;
}
示例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)
{
$totalOverviews = array();
$transactionArray = Oara_Utilities::transactionMapPerDay($transactionList);
$affjetNetClickDao = Dao_Factory_Doctrine::createDoctrineDaoInstance('AffjetNetClick');
$criteriaList = array();
$criteriaList[] = new Dao_Doctrine_Criteria_Restriction_Select('AffjetNetUserRAffjetNetMerchant->AffjetNetMerchant->id', "_merchantId");
$criteriaList[] = new Dao_Doctrine_Criteria_Restriction_Select('date', "_date");
$criteriaList[] = new Dao_Doctrine_Criteria_Restriction_Select('COUNT(*)', "_clickNumber", true);
$criteriaList[] = new Dao_Doctrine_Criteria_Restriction_In('AffjetNetUserRAffjetNetMerchant->AffjetNetMerchant->id', $merchantList, false);
$criteriaList[] = new Dao_Doctrine_Criteria_Restriction_Eq('AffjetNetUserRAffjetNetMerchant->AffjetNetMerchant->AffjetNetPartner->id', $this->_partnerId);
if (!$this->_isAdmin) {
$criteriaList[] = new Dao_Doctrine_Criteria_Restriction_Eq('AffjetNetUserRAffjetNetMerchant->AffjetNetUser->id', $this->_userId);
}
$criteriaList[] = new Dao_Doctrine_Criteria_Restriction_Ge('date', $dStartDate->toString("yyyy-MM-dd HH:mm:ss"));
$criteriaList[] = new Dao_Doctrine_Criteria_Restriction_Le('date', $dEndDate->toString("yyyy-MM-dd HH:mm:ss"));
$criteriaList[] = new Dao_Doctrine_Criteria_Restriction_Groupby('AffjetNetUserRAffjetNetMerchant->AffjetNetMerchant->id');
$criteriaList[] = new Dao_Doctrine_Criteria_Restriction_Groupby('date', 'DAY');
$criteriaList[] = new Dao_Doctrine_Criteria_Restriction_Groupby('date', 'MONTH');
$criteriaList[] = new Dao_Doctrine_Criteria_Restriction_Groupby('date', 'YEAR');
$affjetNetClickList = $affjetNetClickDao->findBy($criteriaList);
foreach ($affjetNetClickList as $affjetNetClick) {
$overview = array();
$overviewDate = new Zend_Date($affjetNetClick->_date, "yyyy-MM-dd HH:mm:ss");
$overviewDate->setHour(0);
$overviewDate->setMinute(0);
$overviewDate->setSecond(0);
$overview['merchantId'] = $affjetNetClick->_merchantId;
$overview['date'] = $overviewDate->toString("yyyy-MM-dd HH:mm:ss");
$overview['click_number'] = $affjetNetClick->_clickNumber;
$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;
$transactionList = Oara_Utilities::getDayFromArray($affjetNetClick->_merchantId, $transactionArray, $overviewDate);
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;
}
示例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: getOverview
/**
*
* Get the overview for this affiliates due that maybe we have to retrieve the data twice
* @param array $matches
* @param array $totalTransactions
*/
private function getOverview($matches, $totalOverview, $merchantList, $parameter, $transactionArray)
{
$matches[1] = preg_replace(array("/\\\\x25/", "/&/"), array('%', '&'), $matches[1]);
$overviewDate = $parameter->getValue();
$overviewDate = new Zend_Date($overviewDate, "M/d/yyyy");
$urls = array();
$urls[] = new Oara_Curl_Request('https://analytics.linksynergy.com/SynergyAnalytics/' . $matches[1], array());
$exportReport = $this->_client->get($urls);
$exportData = str_getcsv(iconv('UTF-16', 'UTF-8', $exportReport[0]), "\n");
$num = count($exportData);
for ($j = 1; $j < $num; $j++) {
$overviewData = str_getcsv($exportData[$j], "\t");
if (in_array((int) $overviewData[0], $merchantList)) {
$overview = array();
$overview['merchantId'] = (int) $overviewData[0];
$overview['date'] = $overviewDate->toString("yyyy-MM-dd HH:mm:ss");
$overview['click_number'] = (int) $overviewData[3];
$overview['impression_number'] = (int) $overviewData[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)) {
$totalOverview[] = $overview;
}
}
}
return $totalOverview;
}
示例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)
{
$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;
}
示例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)
{
$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;
}
示例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)
{
$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;
}
示例15: getOverviewList
//.........这里部分代码省略.........
$exportData = str_getcsv($exportReport[0], "\r\n");
$num = count($exportData);
if ($num > 3) {
$dateArray = Oara_Utilities::daysOfDifference($dStartDate, $dEndDate);
$dateArraySize = sizeof($dateArray);
for ($i = 0; $i < $dateArraySize; $i++) {
$valuesFormExport = Oara_Utilities::cloneArray($this->_exportOverviewParameters);
if ($this->_dateFormat == 'dd/MM/yy') {
$valuesFormExport[] = new Oara_Curl_Parameter('startDate', $dateArray[$i]->toString('dd/MM/yy'));
$valuesFormExport[] = new Oara_Curl_Parameter('endDate', $dateArray[$i]->toString('dd/MM/yy'));
} else {
if ($this->_dateFormat == 'M/d/yy') {
$valuesFormExport[] = new Oara_Curl_Parameter('startDate', $dateArray[$i]->toString('M/d/yy'));
$valuesFormExport[] = new Oara_Curl_Parameter('endDate', $dateArray[$i]->toString('M/d/yy'));
} else {
if ($this->_dateFormat == 'd/MM/yy') {
$valuesFormExport[] = new Oara_Curl_Parameter('startDate', $dateArray[$i]->toString('d/MM/yy'));
$valuesFormExport[] = new Oara_Curl_Parameter('endDate', $dateArray[$i]->toString('d/MM/yy'));
} else {
if ($this->_dateFormat == 'tt.MM.uu') {
$valuesFormExport[] = new Oara_Curl_Parameter('startDate', $dateArray[$i]->toString('dd.MM.yy'));
$valuesFormExport[] = new Oara_Curl_Parameter('endDate', $dateArray[$i]->toString('dd.MM.yy'));
} else {
throw new Exception("\n Date Format not supported " . $this->_dateFormat . "\n");
}
}
}
}
$mothOverviewUrls[] = new Oara_Curl_Request('http://www.tradedoubler.com/pan/aReport3Internal.action?', $valuesFormExport);
}
}
$exportReport = $this->_client->get($mothOverviewUrls);
$exportReportNumber = count($exportReport);
for ($i = 0; $i < $exportReportNumber; $i++) {
$exportReport[$i] = self::checkReportError($exportReport[$i], $mothOverviewUrls[$i]);
$exportData = str_getcsv($exportReport[$i], "\r\n");
$num = count($exportData);
for ($j = 2; $j < $num - 1; $j++) {
$overviewExportArray = str_getcsv($exportData[$j], ";");
$parameter = $mothOverviewUrls[$i]->getParameter(39);
$overviewDate = $parameter->getValue();
if ($this->_dateFormat == 'dd/MM/yy') {
$overviewDate = new Zend_Date($overviewDate, "dd/MM/yy");
} else {
if ($this->_dateFormat == 'M/d/yy') {
$overviewDate = new Zend_Date($overviewDate, "M/d/yy");
} else {
if ($this->_dateFormat == 'd/MM/yy') {
$overviewDate = new Zend_Date($overviewDate, "d/MM/yy");
} else {
if ($this->_dateFormat == 'tt.MM.uu') {
$overviewDate = new Zend_Date($overviewDate, "dd.MM.yy");
} else {
throw new Exception("\n Date Format not supported " . $this->_dateFormat . "\n");
}
}
}
}
if (!isset($overviewExportArray[2])) {
throw new Exception('Problem getting overview\\n\\n');
}
if ($overviewDate->compare($dStartDate) >= 0 && $overviewDate->compare($dEndDate) <= 0 && isset($overviewExportArray[2]) && in_array((int) $overviewExportArray[2], $merchantList)) {
$overview = array();
$overview['merchantId'] = (int) $overviewExportArray[2];
$overview['date'] = $overviewDate->toString("yyyy-MM-dd HH:mm:ss");
$overview['click_number'] = (int) $overviewExportArray[4];
$overview['impression_number'] = (int) $overviewExportArray[3];
$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)) {
$totalOverviews[] = $overview;
}
}
}
}
return $totalOverviews;
}