|  |  |  | 
|---|
|  |  |  | public function __construct(){ | 
|---|
|  |  |  | //DI()->redis = new Redis_Lite(DI()->config->get('app.redis.servers')); | 
|---|
|  |  |  | $this->model = new Model_DataDaily(); | 
|---|
|  |  |  | $this->hourly_model = new Model_DataHourly(); | 
|---|
|  |  |  | $this->data_three_hourly_model = new Model_DataThreeHourly(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | 
|---|
|  |  |  | $result = $this->model->getList(array('user_id' => $user_id, 'date' => array('$in' => $days_arr))); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else{ | 
|---|
|  |  |  | $result = $this->hourly_model->getList(array('user_id' => $user_id, 'date' => date('Y-m-d', $start_time)), array(), array('time_level' => 1)); | 
|---|
|  |  |  | $result = $this->data_three_hourly_model->get(array('user_id' => $user_id, 'date' => date('Y-m-d', $start_time))); | 
|---|
|  |  |  | $_result = array(); | 
|---|
|  |  |  | if($result){ | 
|---|
|  |  |  | for($i = 1; $i <=8 ; $i++){ | 
|---|
|  |  |  | array_push($_result, array('hour_avg' => $result['time_slot_'.$i], 'time_level' => $i)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else{ | 
|---|
|  |  |  | $_result = null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return $_result; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return $result; | 
|---|