コード例 #1
0
 /**
  * 显示录播节目单
  */
 function show()
 {
     $sql = "SELECT week_day, id, start_time, toff\n\t\t\t\t\tFROM " . DB_PREFIX . "program_record \n\t\t\t\tWHERE (start_time + toff) < " . (TIMENOW - 1200);
     $q = $this->db->query($sql);
     while ($row = $this->db->fetch_array($q)) {
         $week_day = unserialize($row['week_day']);
         if (is_array($week_day) && $week_day) {
             $start_time = hg_update_time($row['start_time'], $week_day);
             $is_record = 0;
             $sql_update = "UPDATE " . DB_PREFIX . "program_record SET is_record=" . $is_record . ",start_time=" . $start_time . " WHERE id=" . $row['id'];
             $this->db->query($sql_update);
         } else {
             $sql_update = "UPDATE " . DB_PREFIX . "program_record SET is_record=2 WHERE id=" . $row['id'];
             $this->db->query($sql_update);
         }
     }
 }
コード例 #2
0
ファイル: functions.php プロジェクト: h3len/Project
function hg_update_time($start, $week_day)
{
    $week_now = date('N', $start);
    $new_arr = array_flip($week_day);
    if (count($week_day) > $new_arr[$week_now] + 1) {
        $ks = $new_arr[$week_now] + 1;
    } else {
        $ks = 0;
    }
    $week_day = array_flip($new_arr);
    $next_week = $week_day[$ks] - $week_now > 0 ? $week_day[$ks] - $week_now : $week_day[$ks] - $week_now + 7;
    $start_time = $start + $next_week * 86400;
    if ($start_time < TIMENOW) {
        return hg_update_time($start_time, $week_day);
    } else {
        return $start_time;
    }
}