mirror of
https://github.com/kuaifan/dootask.git
synced 2026-03-17 19:23:26 +00:00
perf: 优化消息列表数据
This commit is contained in:
parent
ca4f45ce0e
commit
4dee17983a
@ -79,12 +79,14 @@ class WebSocketDialog extends AbstractModel
|
|||||||
$unreadBuilder = WebSocketDialogMsgRead::whereDialogId($this->id)->whereUserid($userid)->whereReadAt(null);
|
$unreadBuilder = WebSocketDialogMsgRead::whereDialogId($this->id)->whereUserid($userid)->whereReadAt(null);
|
||||||
$this->unread = $unreadBuilder->count();
|
$this->unread = $unreadBuilder->count();
|
||||||
$this->mention = 0;
|
$this->mention = 0;
|
||||||
$this->first_umid = 0; // 第一条未读消息
|
|
||||||
$this->last_umid = 0;
|
$this->last_umid = 0;
|
||||||
|
$this->first_umid = 0; // 第一条未读消息
|
||||||
if ($this->unread > 0) {
|
if ($this->unread > 0) {
|
||||||
$this->mention = $unreadBuilder->clone()->whereMention(1)->count();
|
$this->mention = $unreadBuilder->clone()->whereMention(1)->count();
|
||||||
$this->first_umid = intval($unreadBuilder->clone()->orderBy('msg_id')->value('msg_id'));
|
|
||||||
$this->last_umid = intval($unreadBuilder->clone()->orderByDesc('msg_id')->value('msg_id'));
|
$this->last_umid = intval($unreadBuilder->clone()->orderByDesc('msg_id')->value('msg_id'));
|
||||||
|
if ($hasData === true) {
|
||||||
|
$this->first_umid = intval($unreadBuilder->clone()->orderBy('msg_id')->value('msg_id'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$this->mark_unread = $this->mark_unread ?? $dialogUserFun('mark_unread');
|
$this->mark_unread = $this->mark_unread ?? $dialogUserFun('mark_unread');
|
||||||
// 是否免打扰
|
// 是否免打扰
|
||||||
|
|||||||
@ -1064,7 +1064,7 @@ export default {
|
|||||||
|
|
||||||
getMsgs(data) {
|
getMsgs(data) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
setTimeout(_ => this.msgLoadIng++, 600)
|
setTimeout(_ => this.msgLoadIng++, 2000)
|
||||||
this.$store.dispatch("getDialogMsgs", data)
|
this.$store.dispatch("getDialogMsgs", data)
|
||||||
.then(resolve)
|
.then(resolve)
|
||||||
.catch(reject)
|
.catch(reject)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user