no message
This commit is contained in:
parent
3670e2ce2c
commit
8cd0f1521d
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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(),
|
||||
]
|
||||
]);
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
|
@ -11,7 +11,7 @@
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="group-title">Group Chat</div>
|
||||
<div class="group-title">{{$L('群聊')}}</div>
|
||||
<ScrollerY ref="groupChat" class="group-chat message-scroller" @on-scroll="groupChatScroll">
|
||||
<div ref="manageList" class="message-list">
|
||||
<ul>
|
||||
@ -185,11 +185,13 @@ export default {
|
||||
},
|
||||
success: ({ret, data, msg}) => {
|
||||
if (ret === 1) {
|
||||
let index = this.dialogList.findIndex(({id}) => id == mid);
|
||||
if (index > -1) this.dialogList.splice(index, 1, data);
|
||||
} else {
|
||||
this.dialogList = this.dialogList.filter(({id}) => id != mid);
|
||||
if (!this.dialogList.find(({id}) => id == data.id)) {
|
||||
let index = this.dialogList.findIndex(({id}) => id == mid);
|
||||
if (index > -1) this.dialogList.splice(index, 1, data);
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.dialogList = this.dialogList.filter(({id}) => id != mid);
|
||||
}
|
||||
});
|
||||
//
|
||||
|
Loading…
x
Reference in New Issue
Block a user