$sql = "select count(tid) from ".DB::table("forum_post")." where `fid`={$fid} and `first`=1 and `invisible`=0 and `dateline`>'".$day_beforet."' and `dateline`<'". time() ."'";
DB::query("UPDATE ".DB::table($this->_table)." SET ".implode(', ', $addsql)." WHERE ".DB::field('fid', $fid), 'UNBUFFERED');
}
}
复制代码
(2) function clear_todayposts()
public function clear_todayposts() {
//这里改写成一周的数据
$res = DB::fetch_all("select * from ". DB::table($this->_table) ." where status=1 and type='forum'");
$day_beforet = time() - 7*86400;
foreach($res as $k=>$v){
$seven_posts = DB::result_first("select count(tid) from ".DB::table("forum_post")." where `fid`=".$v['fid']." and `first`=1 and `invisible`=0 and `dateline`>'$day_beforet' and `dateline`<'".time()."'");
DB::query("UPDATE ".DB::table($this->_table)." SET todayposts='{$seven_posts}'where fid=".$v['fid']);
}
//DB::query("UPDATE ".DB::table($this->_table)." SET todayposts='0'");