mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-12 11:19:56 +00:00
perf: 优化待办列表
This commit is contained in:
parent
12b3c14299
commit
0579a73c1c
@ -249,7 +249,7 @@ class DialogController extends AbstractController
|
||||
* @apiGroup dialog
|
||||
* @apiName todo
|
||||
*
|
||||
* @apiParam {Number} dialog_id 会话ID
|
||||
* @apiParam {Number} [dialog_id] 会话ID
|
||||
*
|
||||
* @apiSuccess {Number} ret 返回状态码(1正确、0错误)
|
||||
* @apiSuccess {String} msg 返回信息(错误描述)
|
||||
@ -261,9 +261,13 @@ class DialogController extends AbstractController
|
||||
//
|
||||
$dialog_id = intval(Request::input('dialog_id'));
|
||||
//
|
||||
WebSocketDialog::checkDialog($dialog_id);
|
||||
$builder = WebSocketDialogMsgTodo::whereUserid($user->userid)->whereDoneAt(null);
|
||||
if ($dialog_id > 0) {
|
||||
WebSocketDialog::checkDialog($dialog_id);
|
||||
$builder->whereDialogId($dialog_id);
|
||||
}
|
||||
//
|
||||
$list = WebSocketDialogMsgTodo::whereDialogId($dialog_id)->whereUserid($user->userid)->whereDoneAt(null)->orderByDesc('id')->take(50)->get();
|
||||
$list = $builder->orderByDesc('id')->take(50)->get();
|
||||
return Base::retSuccess("success", $list);
|
||||
}
|
||||
|
||||
|
||||
23
resources/assets/js/store/actions.js
vendored
23
resources/assets/js/store/actions.js
vendored
@ -551,6 +551,7 @@ export default {
|
||||
//
|
||||
dispatch("getProjects").catch(() => {});
|
||||
dispatch("getDialogs").catch(() => {});
|
||||
dispatch("getDialogTodo", 0).catch(() => {});
|
||||
dispatch("getReportUnread", 1000);
|
||||
dispatch("getApproveUnread", 1000);
|
||||
dispatch("getTaskForDashboard");
|
||||
@ -2479,17 +2480,21 @@ export default {
|
||||
},
|
||||
}).then(({data}) => {
|
||||
if ($A.arrayLength(data) > 0) {
|
||||
dispatch("saveDialog", {
|
||||
id: dialog_id,
|
||||
todo_num: $A.arrayLength(data)
|
||||
});
|
||||
state.dialogTodos = state.dialogTodos.filter(item => item.dialog_id != dialog_id)
|
||||
if (dialog_id > 0) {
|
||||
dispatch("saveDialog", {
|
||||
id: dialog_id,
|
||||
todo_num: $A.arrayLength(data)
|
||||
});
|
||||
state.dialogTodos = state.dialogTodos.filter(item => item.dialog_id != dialog_id)
|
||||
}
|
||||
dispatch("saveDialogTodo", data)
|
||||
} else {
|
||||
dispatch("saveDialog", {
|
||||
id: dialog_id,
|
||||
todo_num: 0
|
||||
});
|
||||
if (dialog_id > 0) {
|
||||
dispatch("saveDialog", {
|
||||
id: dialog_id,
|
||||
todo_num: 0
|
||||
});
|
||||
}
|
||||
}
|
||||
}).catch(console.warn);
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user