Esempio n. 1
0
 public function get_match($id, $ticket_type, $play_type, $ds = false)
 {
     $return = array();
     $obj = ORM::factory('match_data');
     if ($ticket_type == 1) {
         $obj->select('match_details.*,match_datas.*');
         $obj->join('match_details', 'match_details.index_id', 'match_datas.match_id', 'LEFT');
         $obj->where('match_datas.match_id', $id);
         $obj->where('match_datas.ticket_type', $ticket_type);
         $obj->where('match_datas.play_type', $play_type);
     } else {
         $obj->select('match_bk_details.*,match_datas.*');
         $obj->join('match_bk_details', 'match_bk_details.index_id', 'match_datas.match_id', 'LEFT');
         $obj->where('match_datas.match_id', $id);
         $obj->where('match_datas.ticket_type', $ticket_type);
         $obj->where('match_datas.play_type', $play_type);
     }
     $result = $obj->find();
     if ($obj->loaded) {
         $matchtime_set = Kohana::config('site_config.match');
         $return = $result->as_array();
         $timeend_stamp = strtotime($return['time']);
         //赛事开始时间
         $weekday = substr($return['match_info'], 0, 6);
         $return['groups_date'] = date("Y-m-d", strtotime(tool::get_date_byweek($weekday, 1, $return['time'])));
         $return['end_date'] = $this->count_end_time($return['groups_date']);
         $return['time_beg'] = date("Y-m-d H:i:s", $timeend_stamp + 60);
         $return['time_end'] = $this->get_end_time($return['time'], $return['end_date'], $matchtime_set['jczq_endtime']);
         if ($ds == true) {
             $return['time_end'] = $this->get_end_time($return['time'], $return['end_date'], $matchtime_set['jczq_endtime_ds']);
         }
         $return['match_end'] = 0;
         //赛事结束或开始
         if (strtotime($return['time_end']) < time() || time() > strtotime($return['time_beg'])) {
             $return['match_end'] = 1;
         }
         return $this->get_comb($return);
     } else {
         return $return;
     }
 }