message.table.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. public function messageList($type = '') {
  9. global $_W;
  10. if (!user_is_founder($_W['uid']) || user_is_vice_founder($_W['uid'])) {
  11. $this->query->where('uid', $_W['uid']);
  12. }
  13. if (user_is_founder($_W['uid']) && !user_is_vice_founder() && empty($type)) {
  14. $this->query->where('type !=', array(MESSAGE_USER_EXPIRE_TYPE));
  15. }
  16. return $this->query->from('message_notice_log')->orderby('id', 'DESC')->getall();
  17. }
  18. public function messageRecord() {
  19. return $this->query->from('message_notice_log')->orderby('id', 'DESC')->get();
  20. }
  21. public function searchWithType($type) {
  22. $this->query->where('type', $type);
  23. return $this;
  24. }
  25. public function searchWithIsRead($is_read) {
  26. $this->query->where('is_read', $is_read);
  27. return $this;
  28. }
  29. public function messageNoReadCount() {
  30. global $_W;
  31. if (!user_is_founder($_W['uid']) || user_is_vice_founder($_W['uid'])) {
  32. $this->query->where('uid', $_W['uid']);
  33. }
  34. if (user_is_founder($_W['uid']) && !user_is_vice_founder()) {
  35. $this->query->where('type !=', array(MESSAGE_USER_EXPIRE_TYPE));
  36. }
  37. $list = $this->query->from('message_notice_log')->orderby('id', 'DESC')->getall();
  38. return count($list);
  39. }
  40. }