MessageModule.class.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. /**
  3. * @name eolinker ams open source,eolinker开源版本
  4. * @link https://www.eolinker.com/
  5. * @package eolinker
  6. * @author www.eolinker.com 广州银云信息科技有限公司 ©2015-2018
  7. * eoLinker是目前全球领先、国内最大的在线API接口管理平台,提供自动生成API文档、API自动化测试、Mock测试、团队协作等功能,旨在解决由于前后端分离导致的开发效率低下问题。
  8. * 如在使用的过程中有任何问题,欢迎加入用户讨论群进行反馈,我们将会以最快的速度,最好的服务态度为您解决问题。
  9. *
  10. * eoLinker AMS开源版的开源协议遵循Apache License 2.0,如需获取最新的eolinker开源版以及相关资讯,请访问:https://www.eolinker.com/#/os/download
  11. *
  12. * 官方网站:https://www.eolinker.com/
  13. * 官方博客以及社区:http://blog.eolinker.com/
  14. * 使用教程以及帮助:http://help.eolinker.com/
  15. * 商务合作邮箱:market@eolinker.com
  16. * 用户讨论QQ群:284421832
  17. */
  18. class MessageModule
  19. {
  20. public function __construct()
  21. {
  22. @session_start();
  23. }
  24. /**
  25. * 获取消息列表
  26. * @param $page int 页码
  27. * @return bool|array
  28. */
  29. public function getMessageList(&$page)
  30. {
  31. $dao = new MessageDao;
  32. $result = $dao->getMessageList($_SESSION['userID'], $page);
  33. if ($result) {
  34. $result['pageCount'] = ceil($result['msgCount'] / 15);
  35. $result['pageNow'] = $page;
  36. return $result;
  37. } else
  38. return FALSE;
  39. }
  40. /**
  41. * 已阅消息
  42. * @param $msgID int 消息ID
  43. * @return bool
  44. */
  45. public function readMessage(&$msgID)
  46. {
  47. $dao = new MessageDao;
  48. return $dao->readMessage($msgID);
  49. }
  50. /**
  51. * 删除消息
  52. * @param $msgID int 消息ID
  53. * @return bool
  54. */
  55. public function delMessage(&$msgID)
  56. {
  57. $dao = new MessageDao;
  58. return $dao->delMessage($msgID);
  59. }
  60. /**
  61. * 清空消息
  62. */
  63. public function cleanMessage()
  64. {
  65. $dao = new MessageDao;
  66. return $dao->cleanMessage($_SESSION['userID']);
  67. }
  68. /**
  69. * 获取消息列表
  70. */
  71. public function getUnreadMessageNum()
  72. {
  73. $dao = new MessageDao;
  74. return $dao->getUnreadMessageNum($_SESSION['userID']);
  75. }
  76. }
  77. ?>