优化已读/未读消息
This commit is contained in:
@@ -35,6 +35,8 @@ use Carbon\Carbon;
|
||||
*/
|
||||
class WebSocketDialogUser extends AbstractModel
|
||||
{
|
||||
protected $dateFormat = 'Y-m-d H:i:s.v';
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne
|
||||
*/
|
||||
@@ -42,17 +44,4 @@ class WebSocketDialogUser extends AbstractModel
|
||||
{
|
||||
return $this->hasOne(WebSocketDialog::class, 'id', 'dialog_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 转时间戳加上现在的毫秒
|
||||
* @param $time
|
||||
* @return int
|
||||
*/
|
||||
public static function userMs($time = 0)
|
||||
{
|
||||
if (empty($time)) {
|
||||
return Carbon::now()->getPreciseTimestamp(3);
|
||||
}
|
||||
return intval(Carbon::parse($time)->timestamp . substr(Carbon::now()->getPreciseTimestamp(3), -3));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user