no message
This commit is contained in:
parent
3670e2ce2c
commit
8cd0f1521d
@ -69,7 +69,7 @@ class User extends AbstractModel
|
|||||||
parent::updateInstance($param);
|
parent::updateInstance($param);
|
||||||
//
|
//
|
||||||
if (isset($param['line_at']) && $this->userid) {
|
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(),
|
'userid' => $sender ?: User::token2userid(),
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
'msg' => $msg,
|
'msg' => $msg,
|
||||||
|
'read' => 0,
|
||||||
'extra_int' => $extra_int,
|
'extra_int' => $extra_int,
|
||||||
'extra_str' => $extra_str,
|
'extra_str' => $extra_str,
|
||||||
]);
|
]);
|
||||||
@ -109,7 +110,6 @@ class WebSocketDialogMsg extends AbstractModel
|
|||||||
'userid' => $userids,
|
'userid' => $userids,
|
||||||
'msg' => [
|
'msg' => [
|
||||||
'type' => 'dialog',
|
'type' => 'dialog',
|
||||||
'msgId' => $dialogMsg->id,
|
|
||||||
'data' => $dialogMsg->toArray(),
|
'data' => $dialogMsg->toArray(),
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
@ -135,6 +135,7 @@ class WebSocketDialogMsg extends AbstractModel
|
|||||||
'userid' => $sender ?: User::token2userid(),
|
'userid' => $sender ?: User::token2userid(),
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
'msg' => $msg,
|
'msg' => $msg,
|
||||||
|
'read' => 0,
|
||||||
'extra_int' => $extra_int,
|
'extra_int' => $extra_int,
|
||||||
'extra_str' => $extra_str,
|
'extra_str' => $extra_str,
|
||||||
]);
|
]);
|
||||||
@ -152,7 +153,6 @@ class WebSocketDialogMsg extends AbstractModel
|
|||||||
'userid' => $userid,
|
'userid' => $userid,
|
||||||
'msg' => [
|
'msg' => [
|
||||||
'type' => 'dialog',
|
'type' => 'dialog',
|
||||||
'msgId' => $dialogMsg->id,
|
|
||||||
'data' => $dialogMsg->toArray(),
|
'data' => $dialogMsg->toArray(),
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
|
@ -10,6 +10,7 @@ use App\Models\WebSocketDialogMsg;
|
|||||||
use App\Module\Base;
|
use App\Module\Base;
|
||||||
use App\Tasks\PushTask;
|
use App\Tasks\PushTask;
|
||||||
use Cache;
|
use Cache;
|
||||||
|
use Carbon\Carbon;
|
||||||
use Hhxsv5\LaravelS\Swoole\WebSocketHandlerInterface;
|
use Hhxsv5\LaravelS\Swoole\WebSocketHandlerInterface;
|
||||||
use Swoole\Http\Request;
|
use Swoole\Http\Request;
|
||||||
use Swoole\WebSocket\Frame;
|
use Swoole\WebSocket\Frame;
|
||||||
@ -166,6 +167,7 @@ class WebSocketService implements WebSocketHandlerInterface
|
|||||||
'fd' => $fd,
|
'fd' => $fd,
|
||||||
'userid' => $userid,
|
'userid' => $userid,
|
||||||
]);
|
]);
|
||||||
|
Cache::put("User::online:" . $userid, time(), Carbon::now()->addSeconds(30));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1154,19 +1154,22 @@ export default {
|
|||||||
return string || '';
|
return string || '';
|
||||||
},
|
},
|
||||||
|
|
||||||
formatBit: function formatBit(val) {
|
formatBit(val) {
|
||||||
val = +val
|
val = +val
|
||||||
return val > 9 ? val : '0' + val
|
return val > 9 ? val : '0' + val
|
||||||
},
|
},
|
||||||
|
|
||||||
formatSeconds: function formatSeconds(second) {
|
formatSeconds(second) {
|
||||||
let duration
|
let duration
|
||||||
let days = Math.floor(second / 86400);
|
let days = Math.floor(second / 86400);
|
||||||
let hours = Math.floor((second % 86400) / 3600);
|
let hours = Math.floor((second % 86400) / 3600);
|
||||||
let minutes = Math.floor(((second % 86400) % 3600) / 60);
|
let minutes = Math.floor(((second % 86400) % 3600) / 60);
|
||||||
let seconds = Math.floor(((second % 86400) % 3600) % 60);
|
let seconds = Math.floor(((second % 86400) % 3600) % 60);
|
||||||
if (days > 0) {
|
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 (hours > 0) duration = this.formatBit(hours) + ":" + this.formatBit(minutes) + ":" + this.formatBit(seconds);
|
||||||
else if (minutes > 0) duration = this.formatBit(minutes) + ":" + this.formatBit(seconds);
|
else if (minutes > 0) duration = this.formatBit(minutes) + ":" + this.formatBit(seconds);
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</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">
|
<ScrollerY ref="groupChat" class="group-chat message-scroller" @on-scroll="groupChatScroll">
|
||||||
<div ref="manageList" class="message-list">
|
<div ref="manageList" class="message-list">
|
||||||
<ul>
|
<ul>
|
||||||
@ -185,11 +185,13 @@ export default {
|
|||||||
},
|
},
|
||||||
success: ({ret, data, msg}) => {
|
success: ({ret, data, msg}) => {
|
||||||
if (ret === 1) {
|
if (ret === 1) {
|
||||||
let index = this.dialogList.findIndex(({id}) => id == mid);
|
if (!this.dialogList.find(({id}) => id == data.id)) {
|
||||||
if (index > -1) this.dialogList.splice(index, 1, data);
|
let index = this.dialogList.findIndex(({id}) => id == mid);
|
||||||
} else {
|
if (index > -1) this.dialogList.splice(index, 1, data);
|
||||||
this.dialogList = this.dialogList.filter(({id}) => id != mid);
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
this.dialogList = this.dialogList.filter(({id}) => id != mid);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//
|
//
|
||||||
|
Loading…
x
Reference in New Issue
Block a user