Message.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 海豚PHP框架 [ DolphinPHP ]
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2016~2019 广东卓锐软件有限公司 [ http://www.zrthink.com ]
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: http://dolphinphp.com
  8. // +----------------------------------------------------------------------
  9. namespace app\user\model;
  10. use think\Model;
  11. /**
  12. * 角色模型
  13. * @package app\admin\model
  14. */
  15. class Message extends Model
  16. {
  17. // 设置当前模型对应的完整数据表名称
  18. protected $name = 'admin_message';
  19. // 自动写入时间戳
  20. protected $autoWriteTimestamp = true;
  21. /**
  22. * 获取当前用户未读消息数量
  23. * @author 蔡伟明 <314013107@qq.com>
  24. * @return int|string
  25. */
  26. public static function getMessageCount()
  27. {
  28. return self::where(['status' => 0, 'uid_receive' => UID])->count();
  29. }
  30. }