table_common_devicetoken.php 904 B

1234567891011121314151617181920212223242526272829303132333435363738
  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_devicetoken.php 31700 2012-09-24 03:46:59Z zhangjie $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. class table_common_devicetoken extends discuz_table {
  12. public function __construct() {
  13. $this->_table = 'common_devicetoken';
  14. $this->_pk = 'token';
  15. parent::__construct();
  16. }
  17. public function loginToken($deviceToken, $uid) {
  18. return DB::insert($this->_table, array(
  19. 'uid' => $uid,
  20. 'token' => $deviceToken,
  21. ), false, true);
  22. }
  23. public function logoutToken($deviceToken, $uid) {
  24. return DB::query('DELETE FROM %t WHERE uid=%d AND token=%s', array($this->_table, $uid, $deviceToken));
  25. }
  26. public function clearToken($deviceToken) {
  27. return DB::query('DELETE FROM %t WHERE token=%s', array($this->_table, $deviceToken));
  28. }
  29. }