当前位置: 首页>>代码示例>>PHP>>正文


PHP Oara_Utilities::daysOfDifference方法代码示例

本文整理汇总了PHP中Oara_Utilities::daysOfDifference方法的典型用法代码示例。如果您正苦于以下问题:PHP Oara_Utilities::daysOfDifference方法的具体用法?PHP Oara_Utilities::daysOfDifference怎么用?PHP Oara_Utilities::daysOfDifference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Oara_Utilities的用法示例。


在下文中一共展示了Oara_Utilities::daysOfDifference方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getTransactionList

 /**
  * (non-PHPdoc)
  * @see library/Oara/Network/Oara_Network_Publisher_Base#getTransactionList($merchantId, $dStartDate, $dEndDate)
  */
 public function getTransactionList($merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null, $merchantMap = null)
 {
     $totalTransactions = array();
     $transactionNumber = rand(1, 200);
     $twoMonthsAgoDate = new Zend_Date();
     $twoMonthsAgoDate->subMonth(2);
     $dateArray = Oara_Utilities::daysOfDifference($dStartDate, $dEndDate);
     for ($i = 0; $i < $transactionNumber; $i++) {
         $dateIndex = rand(0, count($dateArray) - 1);
         $merchantIndex = rand(0, count($merchantList) - 1);
         $transaction = array();
         $transaction['unique_id'] = md5(mt_rand() . $dateArray[$dateIndex]->toString("yyyy-MM-dd HH:mm:ss"));
         $transaction['custom_id'] = "my_custom_id";
         $transaction['merchantId'] = $merchantList[$merchantIndex];
         $transaction['date'] = $dateArray[$dateIndex]->toString("yyyy-MM-dd HH:mm:ss");
         $transactionAmount = rand(1, 1000);
         $transaction['amount'] = $transactionAmount;
         $transaction['commission'] = $transactionAmount / 10;
         //$transaction['link'] = $this->_linkList[rand(0, count($this->_linkList)-1)];
         //$transaction['website'] = $this->_websiteList[rand(0, count($this->_websiteList)-1)];
         //$transaction['page'] = $this->_pageList[rand(0, count($this->_pageList)-1)];
         $transactionStatusChances = rand(1, 100);
         if ($dateArray[$dateIndex]->compare($twoMonthsAgoDate) >= 0) {
             if ($transactionStatusChances < 60) {
                 $transaction['status'] = Oara_Utilities::STATUS_CONFIRMED;
             } else {
                 if ($transactionStatusChances < 70) {
                     $transaction['status'] = Oara_Utilities::STATUS_DECLINED;
                 } else {
                     $transaction['status'] = Oara_Utilities::STATUS_PENDING;
                 }
             }
         } else {
             if ($transactionStatusChances < 80) {
                 $transaction['status'] = Oara_Utilities::STATUS_CONFIRMED;
             } else {
                 $transaction['status'] = Oara_Utilities::STATUS_DECLINED;
             }
         }
         $totalTransactions[] = $transaction;
     }
     return $totalTransactions;
 }
开发者ID:garygarside,项目名称:php-oara,代码行数:47,代码来源:Demo.php

示例2: getTransactionList

 /**
  * (non-PHPdoc)
  * @see library/Oara/Network/Oara_Network_Publisher_Interface#getTransactionList($aMerchantIds, $dStartDate, $dEndDate, $sTransactionStatus)
  */
 public function getTransactionList($merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null, $merchantMap = null)
 {
     $totalTransactions = array();
     $valuesFormExport = array();
     $dateArray = Oara_Utilities::daysOfDifference($dStartDate, $dEndDate);
     $dateArraySize = sizeof($dateArray);
     for ($j = 0; $j < $dateArraySize; $j++) {
         $valuesFormExport = array();
         $valuesFormExport[] = new Oara_Curl_Parameter('date1', $dateArray[$j]->toString("yyyy-MM-dd"));
         $valuesFormExport[] = new Oara_Curl_Parameter('date2', $dateArray[$j]->toString("yyyy-MM-dd"));
         $valuesFormExport[] = new Oara_Curl_Parameter('prerange', '0');
         $urls = array();
         $urls[] = new Oara_Curl_Request('https://affiliate.btguard.com/reports?', $valuesFormExport);
         $exportReport = $this->_client->get($urls);
         $dom = new Zend_Dom_Query($exportReport[0]);
         $results = $dom->query('.title table[cellspacing="12"]');
         if (count($results) > 0) {
             $exportData = self::htmlToCsv(self::DOMinnerHTML($results->current()));
             for ($z = 1; $z < count($exportData); $z++) {
                 $transactionLineArray = str_getcsv($exportData[$z], ";");
                 $numberTransactions = (int) $transactionLineArray[2];
                 if ($numberTransactions != 0) {
                     $commission = preg_replace("/[^0-9\\.,]/", "", $transactionLineArray[3]);
                     $commission = (double) $commission / $numberTransactions;
                     for ($y = 0; $y < $numberTransactions; $y++) {
                         $transaction = array();
                         $transaction['merchantId'] = "1";
                         $transaction['date'] = $dateArray[$j]->toString("yyyy-MM-dd HH:mm:ss");
                         $transaction['status'] = Oara_Utilities::STATUS_CONFIRMED;
                         $transaction['amount'] = $commission;
                         $transaction['commission'] = $commission;
                         $totalTransactions[] = $transaction;
                     }
                 }
             }
         }
     }
     return $totalTransactions;
 }
开发者ID:netzkind,项目名称:php-oara,代码行数:43,代码来源:BTGuard.php

示例3: getTransactionList

 /**
  * (non-PHPdoc)
  * @see library/Oara/Network/Oara_Network_Publisher_Interface#getTransactionList($aMerchantIds, $dStartDate, $dEndDate, $sTransactionStatus)
  */
 public function getTransactionList($merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null, $merchantMap = null)
 {
     $totalTransactions = array();
     $dateArray = Oara_Utilities::daysOfDifference($dStartDate, $dEndDate);
     $dateArraySize = sizeof($dateArray);
     for ($j = 0; $j < $dateArraySize; $j++) {
         $date = $dateArray[$j];
         $url = "https://partner-int-api.groupon.com/reporting/v2/order.csv?clientId={$this->_credentials['apiPassword']}&group=order&date={$date->toString("yyyy-MM-dd")}";
         $rch = curl_init();
         $options = $this->_options;
         curl_setopt($rch, CURLOPT_URL, $url);
         curl_setopt_array($rch, $options);
         $result = curl_exec($rch);
         curl_close($rch);
         $exportData = str_getcsv($result, "\n");
         $num = count($exportData);
         for ($i = 1; $i < $num; $i++) {
             $transactionExportArray = str_getcsv($exportData[$i], ",");
             $transaction = array();
             $transaction['merchantId'] = "1";
             $transaction['date'] = $date->toString("yyyy-MM-dd HH:mm:ss");
             $transaction['unique_id'] = $transactionExportArray[0];
             $transaction['currency'] = $transactionExportArray[4];
             if ($transactionExportArray[1] != null) {
                 $transaction['custom_id'] = $transactionExportArray[1];
             }
             if ($transactionExportArray[5] == 'VALID' || $transactionExportArray[5] == 'REFUNDED') {
                 $transaction['status'] = Oara_Utilities::STATUS_CONFIRMED;
             } else {
                 if ($transactionExportArray[5] == 'INVALID') {
                     $transaction['status'] = Oara_Utilities::STATUS_DECLINED;
                 } else {
                     throw new Exception("Status {$transactionExportArray[5]} unknown");
                 }
             }
             if (preg_match("/[-+]?[0-9]*\\.?[0-9]+/", $transactionExportArray[8], $match)) {
                 $transaction['amount'] = (double) $match[0];
             }
             if (preg_match("/[-+]?[0-9]*\\.?[0-9]+/", $transactionExportArray[12], $match)) {
                 $transaction['commission'] = (double) $match[0];
             }
             $totalTransactions[] = $transaction;
         }
     }
     return $totalTransactions;
 }
开发者ID:karptonite,项目名称:php-oara,代码行数:50,代码来源:Groupon.php

示例4: getOverviewList

 /**
  * (non-PHPdoc)
  * @see library/Oara/Network/Oara_Network_Base#getOverviewList($merchantId,$dStartDate,$dEndDate)
  */
 public function getOverviewList($transactionList = array(), $merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null)
 {
     $totalOverview = array();
     //At first, we need to be sure that there are some data.
     $transactionList = self::transactionMapPerDay($transactionList);
     $dateArray = Oara_Utilities::daysOfDifference($dStartDate, $dEndDate);
     $dateArraySize = count($dateArray);
     $auxStartDate = clone $dStartDate;
     $auxStartDate->setHour("00");
     $auxStartDate->setMinute("00");
     $auxStartDate->setSecond("00");
     $auxEndDate = clone $dEndDate;
     $auxEndDate->setHour("23");
     $auxEndDate->setMinute("59");
     $auxEndDate->setSecond("59");
     $groupMap = array();
     foreach ($this->_campaignMap as $campaignKey => $campaignValue) {
         $overviewList = $this->_soapClient->getProgramReport($auxStartDate->getIso(), $auxEndDate->getIso(), $campaignKey, $this->_exportOverviewParameters['username'], $this->_exportOverviewParameters['password']);
         $exist = false;
         $j = 0;
         while ($j < count($overviewList) && !$exist) {
             if (in_array($overviewList[$j]->programID, $merchantList)) {
                 $exist = true;
             }
             $j++;
         }
         if ($exist) {
             for ($i = 0; $i < $dateArraySize; $i++) {
                 $auxStartDayDate = clone $dateArray[$i];
                 $auxStartDayDate->setHour("00");
                 $auxStartDayDate->setMinute("00");
                 $auxStartDayDate->setSecond("00");
                 $auxEndDayDate = clone $dateArray[$i];
                 $auxEndDayDate->setHour("23");
                 $auxEndDayDate->setMinute("59");
                 $auxEndDayDate->setSecond("59");
                 $overviewList = $this->_soapClient->getProgramReport($auxStartDayDate->getIso(), $auxEndDayDate->getIso(), $campaignKey, $this->_exportOverviewParameters['username'], $this->_exportOverviewParameters['password']);
                 for ($j = 0; $j < count($overviewList); $j++) {
                     if (in_array($overviewList[$j]->programID, $merchantList)) {
                         $overviewArray = array();
                         $overviewArray['merchantId'] = $overviewList[$j]->programID;
                         $overviewArray['date'] = $auxStartDayDate->toString("yyyy-MM-dd HH:mm:ss");
                         $overviewArray['click_number'] = $overviewList[$j]->clickTotals;
                         $overviewArray['impression_number'] = $overviewList[$j]->viewTotals;
                         $transactionDateArray = self::getDayFromArray($overviewArray['merchantId'], $campaignKey, $transactionList, $auxStartDayDate);
                         $overviewArray['transaction_number'] = 0;
                         $overviewArray['transaction_confirmed_value'] = 0;
                         $overviewArray['transaction_confirmed_commission'] = 0;
                         $overviewArray['transaction_pending_value'] = 0;
                         $overviewArray['transaction_pending_commission'] = 0;
                         $overviewArray['transaction_declined_value'] = 0;
                         $overviewArray['transaction_declined_commission'] = 0;
                         foreach ($transactionDateArray as $transaction) {
                             if (!isset($transaction['amount'])) {
                                 $transaction['amount'] = 0;
                             }
                             if (!isset($transaction['commission'])) {
                                 $transaction['commission'] = 0;
                             }
                             $overviewArray['transaction_number']++;
                             if ($transaction['status'] == Oara_Utilities::STATUS_CONFIRMED) {
                                 $overviewArray['transaction_confirmed_value'] += $transaction['amount'];
                                 $overviewArray['transaction_confirmed_commission'] += $transaction['commission'];
                             } else {
                                 if ($transaction['status'] == Oara_Utilities::STATUS_PENDING) {
                                     $overviewArray['transaction_pending_value'] += $transaction['amount'];
                                     $overviewArray['transaction_pending_commission'] += $transaction['commission'];
                                 } else {
                                     if ($transaction['status'] == Oara_Utilities::STATUS_DECLINED) {
                                         $overviewArray['transaction_declined_value'] += $transaction['amount'];
                                         $overviewArray['transaction_declined_commission'] += $transaction['commission'];
                                     }
                                 }
                             }
                         }
                         $groupMap = self::groupOverview($groupMap, $overviewArray);
                     }
                 }
             }
         }
     }
     foreach ($groupMap as $merchant => $overviewPerDate) {
         foreach ($overviewPerDate as $date => $overview) {
             if (Oara_Utilities::checkRegister($overview)) {
                 $totalOverview[] = $overview;
             }
         }
     }
     return $totalOverview;
 }
开发者ID:robryanx,项目名称:php-oara,代码行数:94,代码来源:WebGains.php

示例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)
 {
     $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;
 }
开发者ID:robryanx,项目名称:php-oara,代码行数:64,代码来源:Skimlinks.php

示例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);
     $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;
 }
开发者ID:robryanx,项目名称:php-oara,代码行数:77,代码来源:ClixGalore.php

示例7: getTransactionList

 /**
  * (non-PHPdoc)
  * @see library/Oara/Network/Oara_Network_Publisher_Base#getTransactionList($merchantId, $dStartDate, $dEndDate)
  */
 public function getTransactionList($merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null, $merchantMap = null)
 {
     $totalTransactions = array();
     $totalOverviews = array();
     $urls = array();
     $urls[] = new Oara_Curl_Request('http://book.terravision.eu/partner/my/stats', array());
     $exportReport = $this->_client->get($urls);
     $dom = new Zend_Dom_Query($exportReport[0]);
     $results = $dom->query('input[name="form[_token]"]');
     $token = null;
     foreach ($results as $result) {
         $token = $result->getAttribute("value");
     }
     $valuesFormExport = array();
     $valuesFormExport[] = new Oara_Curl_Parameter('form[year]', $dStartDate->toString("yyyy"));
     $valuesFormExport[] = new Oara_Curl_Parameter('fform[_token]', $token);
     $valuesFormExport[] = new Oara_Curl_Parameter('show', 'Show');
     $urls = array();
     $urls[] = new Oara_Curl_Request('http://book.terravision.eu/partner/my/stats?', $valuesFormExport);
     $exportReport = $this->_client->post($urls);
     $stringToFind = $dStartDate->toString("MM-yyyy");
     /*** load the html into the object ***/
     $dom = new Zend_Dom_Query($exportReport[0]);
     $results = $dom->query('.frame > table');
     $exportData = self::htmlToCsv(self::DOMinnerHTML($results->current()));
     $num = count($exportData);
     $transactionCounter = 0;
     $valueCounter = 0;
     $commissionCounter = 0;
     for ($i = 1; $i < $num - 1; $i++) {
         $transactionArray = str_getcsv($exportData[$i], ";");
         if ($transactionArray[0] == $stringToFind) {
             $transactionCounter = $transactionArray[12];
             $valueCounter += $transactionArray[14];
             $commissionCounter += $transactionArray[16];
         }
     }
     if ($transactionCounter > 0) {
         $dateList = Oara_Utilities::daysOfDifference($dStartDate, $dEndDate);
         for ($i = 0; $i < count($dateList); $i++) {
             $transaction = array();
             $transaction['merchantId'] = 1;
             $transaction['status'] = Oara_Utilities::STATUS_CONFIRMED;
             $transaction['date'] = $dateList[$i]->toString("yyyy-MM-dd HH:mm:ss");
             $transaction['amount'] = $valueCounter / count($dateList);
             $transaction['commission'] = $commissionCounter / count($dateList);
             $totalTransactions[] = $transaction;
         }
     }
     return $totalTransactions;
 }
开发者ID:netzkind,项目名称:php-oara,代码行数:55,代码来源:TerraVision.php

示例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)
 {
     $totalOverviews = array();
     $transactionArray = Oara_Utilities::transactionMapPerDay($transactionList);
     $mothOverviewUrls = array();
     $valuesFormExport = Oara_Utilities::cloneArray($this->_exportOverviewParameters);
     if ($this->_dateFormat == 'dd/MM/yy') {
         $valuesFormExport[] = new Oara_Curl_Parameter('startDate', $dStartDate->toString('dd/MM/yy'));
         $valuesFormExport[] = new Oara_Curl_Parameter('endDate', $dEndDate->toString('dd/MM/yy'));
     } else {
         if ($this->_dateFormat == 'M/d/yy') {
             $valuesFormExport[] = new Oara_Curl_Parameter('startDate', $dStartDate->toString('M/d/yy'));
             $valuesFormExport[] = new Oara_Curl_Parameter('endDate', $dEndDate->toString('M/d/yy'));
         } else {
             if ($this->_dateFormat == 'd/MM/yy') {
                 $valuesFormExport[] = new Oara_Curl_Parameter('startDate', $dStartDate->toString('d/MM/yy'));
                 $valuesFormExport[] = new Oara_Curl_Parameter('endDate', $dEndDate->toString('d/MM/yy'));
             } else {
                 if ($this->_dateFormat == 'tt.MM.uu') {
                     $valuesFormExport[] = new Oara_Curl_Parameter('startDate', $dStartDate->toString('dd.MM.yy'));
                     $valuesFormExport[] = new Oara_Curl_Parameter('endDate', $dEndDate->toString('dd.MM.yy'));
                 } else {
                     throw new Exception("\n Date Format not supported " . $this->_dateFormat . "\n");
                 }
             }
         }
     }
     $urls = array();
     $urls[] = new Oara_Curl_Request('http://www.tradedoubler.com/pan/aReport3Internal.action?', $valuesFormExport);
     $exportReport = $this->_client->get($urls);
     $exportReport[0] = self::checkReportError($exportReport[0], $urls[0]);
     $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");
//.........这里部分代码省略.........
开发者ID:robryanx,项目名称:php-oara,代码行数:101,代码来源:TradeDoubler.php

示例9: getTransactionList

 /**
  * (non-PHPdoc)
  * @see library/Oara/Network/Oara_Network_Interface#getTransactionList($aMerchantIds, $dStartDate, $dEndDate, $sTransactionStatus)
  */
 public function getTransactionList($merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null)
 {
     $totalTransactions = array();
     foreach ($this->_idBox as $id) {
         $dateArray = Oara_Utilities::daysOfDifference($dStartDate, $dEndDate);
         $dateArraySize = sizeof($dateArray);
         for ($j = 0; $j < $dateArraySize; $j++) {
             echo "day " . $dateArray[$j]->toString("d") . "\n";
             echo round(memory_get_usage(true) / 1048576, 2) . " megabytes \n";
             $try = 0;
             $done = false;
             while (!$done && $try < 5) {
                 try {
                     $totalTransactions = array_merge($totalTransactions, self::getTransactionReportRecursive($id, $dateArray[$j]));
                     $done = true;
                 } catch (Exception $e) {
                     $try++;
                 }
             }
             if ($try == 5) {
                 throw new Exception("Couldn't get data for the date " . $dateArray[$j]->toString("dd-MM-yyyy"));
             }
         }
     }
     return $totalTransactions;
 }
开发者ID:robryanx,项目名称:php-oara,代码行数:30,代码来源:Amazon.php

示例10: getTransactionList

 /**
  * (non-PHPdoc)
  * @see library/Oara/Network/Oara_Network_Publisher_Interface#getTransactionList($aMerchantIds, $dStartDate, $dEndDate)
  */
 public function getTransactionList($merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null, $merchantMap = null)
 {
     $totalTransactions = array();
     $filter = new Zend_Filter_LocalizedToNormalized(array('precision' => 2, 'locale' => 'fr'));
     $dateArray = Oara_Utilities::daysOfDifference($dStartDate, $dEndDate);
     $dateArraySize = sizeof($dateArray);
     //foreach ($merchantList as $merchantId) {
     $urls = array();
     for ($i = 0; $i < $dateArraySize; $i++) {
         $valuesFromExport = array();
         $valuesFromExport[] = new Oara_Curl_Parameter('action', "myresume");
         $valuesFromExport[] = new Oara_Curl_Parameter('progid', 0);
         $valuesFromExport[] = new Oara_Curl_Parameter('dD', $dateArray[$i]->toString("dd/MM/yyyy"));
         $valuesFromExport[] = new Oara_Curl_Parameter('dF', $dateArray[$i]->toString("dd/MM/yyyy"));
         $valuesFromExport[] = new Oara_Curl_Parameter('periode', "0");
         $valuesFromExport[] = new Oara_Curl_Parameter('expAct', "1");
         $valuesFromExport[] = new Oara_Curl_Parameter('tabid', "0");
         $valuesFromExport[] = new Oara_Curl_Parameter('Submit', "Voir");
         $urls[] = new Oara_Curl_Request('http://affilie.publicidees.com/index.php?', $valuesFromExport);
     }
     $exportReport = $this->_client->get($urls);
     $numExport = count($exportReport);
     for ($i = 0; $i < $numExport; $i++) {
         $exportData = str_getcsv(utf8_decode($exportReport[$i]), "\n");
         $num = count($exportData);
         $headerArray = str_getcsv($exportData[0], ";");
         $headerMap = array();
         if (count($headerArray) > 1) {
             for ($j = 0; $j < count($headerArray); $j++) {
                 if ($headerArray[$j] == "" && $headerArray[$j - 1] == "Ventes") {
                     $headerMap["pendingVentes"] = $j;
                 } else {
                     if ($headerArray[$j] == "" && $headerArray[$j - 1] == "CA") {
                         $headerMap["pendingCA"] = $j;
                     } else {
                         $headerMap[$headerArray[$j]] = $j;
                     }
                 }
             }
         }
         for ($j = 1; $j < $num; $j++) {
             $transactionExportArray = str_getcsv($exportData[$j], ";");
             if (isset($headerMap["Ventes"]) && isset($headerMap["pendingVentes"])) {
                 $confirmedTransactions = (int) $transactionExportArray[$headerMap["Ventes"]];
                 $pendingTransactions = (int) $transactionExportArray[$headerMap["pendingVentes"]];
                 for ($z = 0; $z < $confirmedTransactions; $z++) {
                     $transaction = array();
                     $transaction['merchantId'] = 1;
                     $parameters = $urls[$i]->getParameters();
                     $transactionDate = new Zend_Date($parameters[2]->getValue(), "dd/MM/yyyy");
                     $transaction['date'] = $transactionDate->toString("yyyy-MM-dd HH:mm:ss");
                     $transaction['amount'] = (double) $filter->filter(substr($transactionExportArray[$headerMap["CA"]], 0, -2)) / $confirmedTransactions;
                     $transaction['commission'] = (double) $filter->filter(substr($transactionExportArray[$headerMap["CA"]], 0, -2)) / $confirmedTransactions;
                     $transaction['status'] = Oara_Utilities::STATUS_CONFIRMED;
                     $totalTransactions[] = $transaction;
                 }
                 for ($z = 0; $z < $pendingTransactions; $z++) {
                     $transaction = array();
                     $transaction['merchantId'] = 1;
                     $transaction['date'] = $dateArray[$i]->toString("yyyy-MM-dd HH:mm:ss");
                     $transaction['amount'] = (double) $transactionExportArray[$headerMap["pendingCA"]] / $pendingTransactions;
                     $transaction['commission'] = (double) $transactionExportArray[$headerMap["pendingCA"]] / $pendingTransactions;
                     $transaction['status'] = Oara_Utilities::STATUS_PENDING;
                     $totalTransactions[] = $transaction;
                 }
             }
         }
     }
     //}
     return $totalTransactions;
 }
开发者ID:netzkind,项目名称:php-oara,代码行数:75,代码来源:Publicidees.php

示例11: getTransactionList

 /**
  * (non-PHPdoc)
  *
  * @see library/Oara/Network/Oara_Network_Publisher_Base#getTransactionList($merchantId,$dStartDate,$dEndDate)
  */
 public function getTransactionList($merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null, $merchantMap = null)
 {
     $totalTransactions = array();
     $dateArray = Oara_Utilities::daysOfDifference($dStartDate, $dEndDate);
     foreach ($dateArray as $date) {
         $apiURL = "https://{$this->_domain}/apifleet/rest/{$this->_clientId}/{$this->_accessId}/statCampaign/quick/{$date->toString("yyyy-MM-dd")}";
         $response = self::call($apiURL);
         if (isset($response["resource"]["numSales"])) {
             $transaction = array();
             $transaction['merchantId'] = "1";
             $transaction['date'] = $date->toString("yyyy-MM-dd HH:mm:ss");
             $transaction['status'] = Oara_Utilities::STATUS_CONFIRMED;
             $transaction['amount'] = $response["resource"]["saleAmount"];
             $transaction['commission'] = $response["resource"]["theyGet"];
             $transaction['currency'] = $response["resource"]["currency"];
             if ($transaction['amount'] != 0 && $transaction['commission'] != 0) {
                 $totalTransactions[] = $transaction;
             }
         }
     }
     return $totalTransactions;
 }
开发者ID:netzkind,项目名称:php-oara,代码行数:27,代码来源:DirectTrack.php

示例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();
     //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");
     $dStartDate = clone $dStartDate;
     $dStartDate->setHour("00");
     $dStartDate->setMinute("00");
     $dStartDate->setSecond("00");
     $dEndDate = clone $dEndDate;
     $dEndDate->setHour("23");
     $dEndDate->setMinute("59");
     $dEndDate->setSecond("59");
     $params = $this->_credentialsParameters;
     $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");
         $overviewList = $this->_apiClient->getAffiliateAggregateStatistics($params['client'], $params['password'], $params['add_code'], $auxStartDate->toString("yyyy-MM-dd"), $auxStartDate->toString("yyyy-MM-dd"));
         if (!preg_match("/No Results found/", $overviewList, $matches)) {
             $overviewList = str_replace(array("&pound;"), array("£"), $overviewList);
             $xmlObj = simplexml_load_string($overviewList);
             foreach ($xmlObj->children() as $overview) {
                 $merchantId = (string) $overview->campaign_id;
                 if (in_array($merchantId, $merchantList)) {
                     $obj = array();
                     $obj['merchantId'] = $merchantId;
                     $obj['date'] = $auxStartDate->toString("yyyy-MM-dd HH:mm:ss");
                     $obj['status'] = Oara_Utilities::STATUS_CONFIRMED;
                     $obj['click_number'] = 0;
                     if ((string) $overview->clicks != null) {
                         $obj['click_number'] = (string) $overview->clicks;
                     }
                     $obj['impression_number'] = 0;
                     if ((string) $overview->impressions != null) {
                         $obj['impression_number'] = (string) $overview->impressions;
                     }
                     $obj['transaction_number'] = 0;
                     $obj['transaction_confirmed_value'] = 0;
                     $obj['transaction_confirmed_commission'] = 0;
                     $obj['transaction_pending_value'] = 0;
                     $obj['transaction_pending_commission'] = 0;
                     $obj['transaction_declined_value'] = 0;
                     $obj['transaction_declined_commission'] = 0;
                     $obj['transaction_confirmed_value'] = Oara_Utilities::parseDouble((string) $overview->sales);
                     $obj['transaction_confirmed_commission'] = Oara_Utilities::parseDouble((string) $overview->payout);
                     if ($obj['transaction_confirmed_value'] != 0 || $obj['transaction_confirmed_commission'] != 0) {
                         $obj['transaction_number']++;
                     }
                     if (Oara_Utilities::checkRegister($obj)) {
                         $totalOverview[] = $obj;
                     }
                 }
             }
         }
     }
     return $totalOverview;
 }
开发者ID:robryanx,项目名称:php-oara,代码行数:72,代码来源:WowTrk.php

示例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");
     $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;
                 }
             }
//.........这里部分代码省略.........
开发者ID:robryanx,项目名称:php-oara,代码行数:101,代码来源:AffiliateWindow.php

示例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();
     $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;
 }
开发者ID:robryanx,项目名称:php-oara,代码行数:71,代码来源:CommissionJunction.php

示例15: getTransactionList

 /**
  * (non-PHPdoc)
  * @see library/Oara/Network/Oara_Network_Publisher_Interface#getTransactionList($aMerchantIds, $dStartDate, $dEndDate, $sTransactionStatus)
  */
 public function getTransactionList($merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null, $merchantMap = null)
 {
     $totalTransactions = array();
     $dirDestination = realpath(dirname(__FILE__)) . '/../../data/pdf';
     $now = new Zend_Date();
     if ($now->toString("yyyy-MM") != $dStartDate->toString("yyyy-MM")) {
         $fileName = "S_M_{$this->_apiPassword}_" . $dStartDate->toString("yyyyMM") . ".txt.gz";
         // Raising this value may increase performance
         $buffer_size = 4096;
         // read 4kb at a time
         $local_file = $dirDestination . "/" . $fileName;
         $url = "http://affjet.dc.fubra.net/tools/ItunesConnect/ic.php?user=" . urlencode($this->_user) . "&password=" . urlencode($this->_password) . "&apiPassword=" . urlencode($this->_apiPassword) . "&type=M&date=" . $dStartDate->toString("yyyyMM");
         $context = \stream_context_create(array('http' => array('header' => "Authorization: Basic " . base64_encode("{$this->_httpLogin}"))));
         \file_put_contents($local_file, \file_get_contents($url, false, $context));
         $out_file_name = \str_replace('.gz', '', $local_file);
         // Open our files (in binary mode)
         $file = \gzopen($local_file, 'rb');
         if ($file != null) {
             $out_file = \fopen($out_file_name, 'wb');
             // Keep repeating until the end of the input file
             while (!\gzeof($file)) {
                 // Read buffer-size bytes
                 // Both fwrite and gzread and binary-safe
                 \fwrite($out_file, \gzread($file, $buffer_size));
             }
             // Files are done, close files
             \fclose($out_file);
             \gzclose($file);
             unlink($local_file);
             $salesReport = file_get_contents($out_file_name);
             $salesReport = explode("\n", $salesReport);
             for ($i = 1; $i < count($salesReport) - 1; $i++) {
                 $row = str_getcsv($salesReport[$i], "\t");
                 if ($row[15] != 0) {
                     $sub = false;
                     if ($row[7] < 0) {
                         $sub = true;
                         $row[7] = abs($row[7]);
                     }
                     for ($j = 0; $j < $row[7]; $j++) {
                         $obj = array();
                         $obj['merchantId'] = "1";
                         $obj['date'] = $dEndDate->toString("yyyy-MM-dd") . " 00:00:00";
                         $obj['custom_id'] = $row[4];
                         $comission = 0.3;
                         if ($row[2] == "FUBRA1PETROLPRICES1" || $row[2] == "com.fubra.petrolpricespro.subscriptionYear") {
                             $value = 2.99;
                             $obj['amount'] = Oara_Utilities::parseDouble($value);
                             $obj['commission'] = Oara_Utilities::parseDouble($value - $value * $comission);
                         } else {
                             if ($row[2] == "FUBRA1WORLDAIRPORTCODES1") {
                                 if ($obj['date'] < "2013-04-23 00:00:00") {
                                     $value = 0.6899999999999999;
                                     $obj['amount'] = Oara_Utilities::parseDouble($value);
                                     $obj['commission'] = Oara_Utilities::parseDouble($value - $value * $comission);
                                 } else {
                                     $value = 1.49;
                                     $obj['amount'] = Oara_Utilities::parseDouble($value);
                                     $obj['commission'] = Oara_Utilities::parseDouble($value - $value * $comission);
                                 }
                             } else {
                                 throw new Exception("APP not found {$row[2]}");
                             }
                         }
                         if ($sub) {
                             $obj['amount'] = -$obj['amount'];
                             $obj['commission'] = -$obj['commission'];
                         }
                         $obj['status'] = Oara_Utilities::STATUS_CONFIRMED;
                         $totalTransactions[] = $obj;
                     }
                 }
             }
             unlink($out_file_name);
         }
     } else {
         $dateArray = Oara_Utilities::daysOfDifference($dStartDate, $dEndDate);
         $dateArraySize = sizeof($dateArray);
         for ($z = 0; $z < $dateArraySize; $z++) {
             $transactionDate = $dateArray[$z];
             $fileName = "S_D_{$this->_apiPassword}_" . $transactionDate->toString("yyyyMMdd") . ".txt.gz";
             // Raising this value may increase performance
             $buffer_size = 4096;
             // read 4kb at a time
             $local_file = $dirDestination . "/" . $fileName;
             $url = "http://affjet.dc.fubra.net/tools/ItunesConnect/ic.php?user=" . urlencode($this->_user) . "&password=" . urlencode($this->_password) . "&apiPassword=" . urlencode($this->_apiPassword) . "&type=D&date=" . $transactionDate->toString("yyyyMMdd");
             $context = \stream_context_create(array('http' => array('header' => "Authorization: Basic " . base64_encode("{$this->_httpLogin}"))));
             \file_put_contents($local_file, \file_get_contents($url, false, $context));
             $out_file_name = \str_replace('.gz', '', $local_file);
             // Open our files (in binary mode)
             $file = \gzopen($local_file, 'rb');
             if ($file != null) {
                 $out_file = \fopen($out_file_name, 'wb');
                 // Keep repeating until the end of the input file
                 while (!\gzeof($file)) {
                     // Read buffer-size bytes
//.........这里部分代码省略.........
开发者ID:netzkind,项目名称:php-oara,代码行数:101,代码来源:ItunesConnect.php


注:本文中的Oara_Utilities::daysOfDifference方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。