hasMany('flashProduct', 'flash_id', 'id'); } /** * 获取离开始时间的倒计时 * @param $targetTime * @return bool */ public static function countdown($targetTime) { $time = $targetTime - time(); if ($time > 0) { // 如果time等于0,那么时间是从1970-01-01 08:00:00开始的 $countdown['day'] = intval(date('d', $time) - 1); $countdown['hour'] = intval(date('H', $time) - 8); $countdown['minute'] = intval(date('i', $time)); $countdown['second'] = intval(date('s', $time)); foreach ($countdown as &$item) { if ($item < 0) $item = 0; } return $countdown; } return false; } }