28 lines
566 B
PHP
28 lines
566 B
PHP
|
<?php
|
||
|
namespace app\user\model;
|
||
|
|
||
|
use think\Model;
|
||
|
|
||
|
/**
|
||
|
* 角色模型
|
||
|
* @package app\admin\model
|
||
|
*/
|
||
|
class Message extends Model
|
||
|
{
|
||
|
// 设置当前模型对应的完整数据表名称
|
||
|
protected $name = 'admin_message';
|
||
|
|
||
|
// 自动写入时间戳
|
||
|
protected $autoWriteTimestamp = true;
|
||
|
|
||
|
/**
|
||
|
* 获取当前用户未读消息数量
|
||
|
* @author 蔡伟明 <314013107@qq.com>
|
||
|
* @return int|string
|
||
|
*/
|
||
|
public static function getMessageCount()
|
||
|
{
|
||
|
return self::where(['status' => 0, 'uid_receive' => UID])->count();
|
||
|
}
|
||
|
}
|