diff --git a/app/Models/User.php b/app/Models/User.php index 830c0c19..e7df0a36 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -69,7 +69,7 @@ class User extends AbstractModel parent::updateInstance($param); // if (isset($param['line_at']) && $this->userid) { - Cache::put("User::online:" . $this->userid, time(), Carbon::now()->addSeconds(60)); + Cache::put("User::online:" . $this->userid, time(), Carbon::now()->addSeconds(30)); } } diff --git a/app/Models/WebSocketDialogMsg.php b/app/Models/WebSocketDialogMsg.php index a107eead..5b82717a 100644 --- a/app/Models/WebSocketDialogMsg.php +++ b/app/Models/WebSocketDialogMsg.php @@ -90,6 +90,7 @@ class WebSocketDialogMsg extends AbstractModel 'userid' => $sender ?: User::token2userid(), 'type' => $type, 'msg' => $msg, + 'read' => 0, 'extra_int' => $extra_int, 'extra_str' => $extra_str, ]); @@ -109,7 +110,6 @@ class WebSocketDialogMsg extends AbstractModel 'userid' => $userids, 'msg' => [ 'type' => 'dialog', - 'msgId' => $dialogMsg->id, 'data' => $dialogMsg->toArray(), ] ]); @@ -135,6 +135,7 @@ class WebSocketDialogMsg extends AbstractModel 'userid' => $sender ?: User::token2userid(), 'type' => $type, 'msg' => $msg, + 'read' => 0, 'extra_int' => $extra_int, 'extra_str' => $extra_str, ]); @@ -152,7 +153,6 @@ class WebSocketDialogMsg extends AbstractModel 'userid' => $userid, 'msg' => [ 'type' => 'dialog', - 'msgId' => $dialogMsg->id, 'data' => $dialogMsg->toArray(), ] ]); diff --git a/app/Services/WebSocketService.php b/app/Services/WebSocketService.php index b6861b92..f6e5daa8 100644 --- a/app/Services/WebSocketService.php +++ b/app/Services/WebSocketService.php @@ -10,6 +10,7 @@ use App\Models\WebSocketDialogMsg; use App\Module\Base; use App\Tasks\PushTask; use Cache; +use Carbon\Carbon; use Hhxsv5\LaravelS\Swoole\WebSocketHandlerInterface; use Swoole\Http\Request; use Swoole\WebSocket\Frame; @@ -166,6 +167,7 @@ class WebSocketService implements WebSocketHandlerInterface 'fd' => $fd, 'userid' => $userid, ]); + Cache::put("User::online:" . $userid, time(), Carbon::now()->addSeconds(30)); } /** diff --git a/resources/assets/js/pages/manage/components/project-list.vue b/resources/assets/js/pages/manage/components/project-list.vue index e04ddd06..6687e436 100644 --- a/resources/assets/js/pages/manage/components/project-list.vue +++ b/resources/assets/js/pages/manage/components/project-list.vue @@ -1154,19 +1154,22 @@ export default { return string || ''; }, - formatBit: function formatBit(val) { + formatBit(val) { val = +val return val > 9 ? val : '0' + val }, - formatSeconds: function formatSeconds(second) { + formatSeconds(second) { let duration let days = Math.floor(second / 86400); let hours = Math.floor((second % 86400) / 3600); let minutes = Math.floor(((second % 86400) % 3600) / 60); let seconds = Math.floor(((second % 86400) % 3600) % 60); if (days > 0) { - return days + "d," + this.formatBit(hours) + "h"; + if (hours > 0) duration = days + "d," + this.formatBit(hours) + "h."; + else if (minutes > 0) duration = days + "d," + this.formatBit(minutes) + "min"; + else if (seconds > 0) duration = days + "d," + this.formatBit(seconds) + "s"; + else duration = days + "d"; } else if (hours > 0) duration = this.formatBit(hours) + ":" + this.formatBit(minutes) + ":" + this.formatBit(seconds); else if (minutes > 0) duration = this.formatBit(minutes) + ":" + this.formatBit(seconds); diff --git a/resources/assets/js/pages/manage/components/project-message.vue b/resources/assets/js/pages/manage/components/project-message.vue index 76bad3ce..f1d36b09 100644 --- a/resources/assets/js/pages/manage/components/project-message.vue +++ b/resources/assets/js/pages/manage/components/project-message.vue @@ -11,7 +11,7 @@ -
Group Chat
+
{{$L('群聊')}}