table_common_member_action_log.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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_common_member_action_log.php 28389 2012-02-28 10:27:38Z monkey $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. class table_common_member_action_log extends discuz_table
  12. {
  13. public function __construct() {
  14. $this->_table = 'common_member_action_log';
  15. $this->_pk = 'id';
  16. parent::__construct();
  17. }
  18. public function delete_by_dateline($timestamp) {
  19. DB::delete($this->_table, 'dateline < '.dintval($timestamp));
  20. }
  21. public function count_day_hours($action, $uid) {
  22. return DB::result_first('SELECT COUNT(*) FROM %t WHERE dateline>%d AND action=%d AND uid=%d', array($this->_table, TIMESTAMP - 86400, $action, $uid));
  23. }
  24. public function count_per_hour($uid, $type) {
  25. return DB::result_first('SELECT COUNT(*) FROM %t WHERE dateline>%d AND `action`=%d AND uid=%d', array($this->_table, TIMESTAMP - 3600, getuseraction($type), $uid));
  26. }
  27. public function delete_by_uid($uids) {
  28. DB::delete($this->_table, 'uid IN ('.dimplode($uids).')');
  29. }
  30. }
  31. ?>