/** * @param $affiliateId * @param $start * @param $end * @return array */ public function getAffiliateEarningForPeriod($affiliateId, $start, $end) { if (!$affiliateId) { return null; } $stat = $this->clickDao->getAffiliateEarningStat($affiliateId, $start, $end); $result = array(); $period = 24 * 60 * 60; $timestamp = $start; while ($timestamp < $end) { $pStart = $timestamp; $pEnd = $timestamp + $period; $result[$timestamp] = $this->getStatForTimestamps($pStart, $pEnd, $stat); $timestamp += $period; } return $result; }