message.table.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /**
  3. * [WeEngine System] Copyright (c) 2014 WE7.CC
  4. * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
  5. */
  6. defined('IN_IA') or exit('Access Denied');
  7. class MessageTable extends We7Table {
  8. protected $tableName = 'message_notice_log';
  9. protected $field = array('id', 'message', 'is_read', 'uid', 'sign', 'type', 'status', 'create_time', 'end_time');
  10. public function messageList($type = '') {
  11. global $_W;
  12. if (!user_is_founder($_W['uid']) || user_is_vice_founder($_W['uid'])) {
  13. $this->query->where('uid', $_W['uid']);
  14. }
  15. if (user_is_founder($_W['uid']) && !user_is_vice_founder() && empty($type)) {
  16. $this->query->where('type !=', array(MESSAGE_USER_EXPIRE_TYPE));
  17. }
  18. return $this->query->from($this->tableName)->orderby('id', 'DESC')->getall();
  19. }
  20. public function messageRecord() {
  21. return $this->query->from($this->tableName)->orderby('id', 'DESC')->get();
  22. }
  23. public function messageNoReadCount() {
  24. global $_W;
  25. if (!user_is_founder($_W['uid']) || user_is_vice_founder($_W['uid'])) {
  26. $this->query->where('uid', $_W['uid']);
  27. }
  28. if (user_is_founder($_W['uid']) && !user_is_vice_founder()) {
  29. $this->query->where('type !=', array(MESSAGE_USER_EXPIRE_TYPE));
  30. }
  31. $list = $this->query->from($this->tableName)->orderby('id', 'DESC')->getall();
  32. return count($list);
  33. }
  34. public function messageExists($message) {
  35. return $this->query->from($this->tableName)->where($message)->get();
  36. }
  37. }