perf: 优化阅读消息
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
|
||||
/**
|
||||
* App\Models\WebSocketDialogUser
|
||||
*
|
||||
@@ -40,4 +42,17 @@ 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