_table = 'common_devicetoken'; $this->_pk = 'token'; parent::__construct(); } public function loginToken($deviceToken, $uid) { return DB::insert($this->_table, array( 'uid' => $uid, 'token' => $deviceToken, ), false, true); } public function logoutToken($deviceToken, $uid) { return DB::query('DELETE FROM %t WHERE uid=%d AND token=%s', array($this->_table, $uid, $deviceToken)); } public function clearToken($deviceToken) { return DB::query('DELETE FROM %t WHERE token=%s', array($this->_table, $deviceToken)); } }