_table = 'mobile_wechat_authcode'; $this->_pk = 'sid'; parent::__construct(); } public function fetch_by_code($code) { return DB::fetch_first('SELECT * FROM %t WHERE code=%d', array($this->_table, $code)); } public function delete_history() { $time = TIMESTAMP - 3600; return DB::delete($this->_table, "createtime<$time"); } }