public function detailTrackURL($id)
 {
     $urlTrackGA = new URLTrackGAModel();
     $this->data['id'] = $id;
     if (Request::isMethod('GET')) {
         $this->data['lists'] = $urlTrackGA->getListTrackURL($id, Request::all());
     } else {
         $this->data['lists'] = $urlTrackGA->getListTrackURL($id);
     }
     $this->layout->content = View::make('detailTrackGA', $this->data);
 }
Exemplo n.º 2
0
 public function getListTrackURL($id, $inputs = '')
 {
     $redis = new RedisBaseModel(Config::get('redis.redis_3.host'), Config::get('redis.redis_3.port'), false);
     $cacheKey = "URLTrack3rd." . $id;
     $data = array();
     $end = date('Y-m-d');
     $start = strtotime('-7 days', strtotime($end));
     if (isset($inputs['start']) && isset($inputs['end']) && $inputs['start'] != '' && $inputs['end'] != '') {
         $start = strtotime($inputs['start']);
         $end = $inputs['end'];
     }
     if (URLTrackGAModel::sum($id) > 0) {
         while (strtotime($end) >= $start) {
             $total = $redis->get($cacheKey . "." . date('Ymd', strtotime($end)));
             if ($total > 0) {
                 $item['date'] = $end;
                 $item['total'] = $total;
                 $data[] = $item;
             }
             $end = date('Y-m-d', strtotime("-1 day" . $end));
         }
     }
     return $data;
 }