public function API_crontab() { $timeline = iCMS::timeline(); //var_dump($timeline); $pieces = array(); foreach ($timeline as $key => $bool) { $field = "hits_{$key}"; if ($key == 'yday') { if ($bool == 1) { $pieces[] = "`hits_yday` = hits_today"; } elseif ($bool > 1) { $pieces[] = "`hits_yday` = 0"; } } else { $bool or $pieces[] = "`{$field}` = 0"; } } $pieces && ($sql = implode(',', $pieces)); if ($sql) { //点击初始化 iDB::query("UPDATE `#iCMS@__article` SET {$sql}"); iDB::query("UPDATE `#iCMS@__user` SET {$sql}"); } }