优化已读/未读消息

This commit is contained in:
kuaifan
2023-03-07 14:33:37 +08:00
parent 318effd1ec
commit 144fb5afba
7 changed files with 62 additions and 48 deletions

View File

@@ -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));
}
}