mainAll(array('info_id' => $info_id)); if ($data) { $child = Dever::db('collection/times')->childAll(array('info_id' => $info_id)); foreach ($data as $k => $v) { if (isset($child[$k])) { $data[$k]['child'] = $child[$k]; } } } return $data; } public function getName($id, $parent_id) { $parent = Dever::db('collection/times')->one($parent_id); $info = Dever::db('collection/times')->one($id); return $parent['name'] . '·' . $info['name']; } # 获取当前时间 public function getDate($day, $cdate, $times = false, $array = false) { if (!$this->times && $times && $times > 0) { $this->times = Dever::db('collection/times')->one($times); } if ($day > 0) { if ($this->times && $this->times['year']) { $year = $this->times['year']; } else { $year = substr($day,0,4); } $month = substr($day,4,2); $day = substr($day,6,2); $string = $year . '-' . $month . '-' . $day; } elseif ($this->times && $this->times['year']) { $string = $this->times['year'] . '-m-d'; } else { $string = 'Y-m-d'; } $cdate = date($string . ' H:i', $cdate); if ($array) { $temp = explode(' ', $cdate); $cdate = array ( $temp[0], $temp[1] ); } return $cdate; } }