table_forum_threadaddviews.php 935 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: table_forum_threadaddviews.php 36296 2016-12-14 07:48:12Z nemohou $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. class table_forum_threadaddviews extends discuz_table {
  12. public function __construct() {
  13. $this->_table = 'forum_threadaddviews';
  14. $this->_pk = 'tid';
  15. $this->_pre_cache_key = 'forum_threadaddviews_';
  16. $this->_cache_ttl = 0;
  17. parent::__construct();
  18. }
  19. public function update_by_tid($tid) {
  20. $ret = DB::query('UPDATE %t SET `addviews`=`addviews`+1 WHERE tid=%d', array($this->_table, $tid));
  21. $this->increase_cache(array($tid), array('addviews' => 1));
  22. return $ret;
  23. }
  24. public function fetch_all_order_by_tid($start = 0, $limit = 0) {
  25. return DB::fetch_all('SELECT * FROM %t ORDER BY tid'.DB::limit($start, $limit), array($this->_table), $this->_pk);
  26. }
  27. }
  28. ?>