mirror of
https://github.com/kuaifan/dootask.git
synced 2026-03-18 03:33:24 +00:00
perf: 优化任务提醒
This commit is contained in:
parent
81e4220367
commit
d5d9eb93a3
@ -769,7 +769,7 @@ class ProjectTask extends AbstractModel
|
|||||||
]);
|
]);
|
||||||
$this->taskPush(null, 3);
|
$this->taskPush(null, 3);
|
||||||
}
|
}
|
||||||
// 以下紧顶级任务可修改
|
// 以下仅顶级任务可修改
|
||||||
if ($this->parent_id === 0) {
|
if ($this->parent_id === 0) {
|
||||||
// 重复周期
|
// 重复周期
|
||||||
$loopAt = $this->loop_at;
|
$loopAt = $this->loop_at;
|
||||||
@ -1444,6 +1444,7 @@ class ProjectTask extends AbstractModel
|
|||||||
if (empty($userids)) {
|
if (empty($userids)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
$owners = $this->taskUser->pluck('owner', 'userid')->toArray();
|
||||||
$users = User::whereIn('userid', $userids)->whereNull('disable_at')->get();
|
$users = User::whereIn('userid', $userids)->whereNull('disable_at')->get();
|
||||||
if (empty($users)) {
|
if (empty($users)) {
|
||||||
return;
|
return;
|
||||||
@ -1454,10 +1455,13 @@ class ProjectTask extends AbstractModel
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$text = view('push.task', [
|
$taskHtml = "<span class=\"mention task\" data-id=\"{$this->id}\">#{$this->name}</span>";
|
||||||
'type' => str_replace([0, 1, 2, 3], ['start', 'before', 'after', 'times'], $type),
|
$text = match ($type) {
|
||||||
'task' => $this,
|
1 => "您的任务 {$taskHtml} 即将超时。",
|
||||||
])->render();
|
2 => "您的任务 {$taskHtml} 已经超时。",
|
||||||
|
3 => "您的任务 {$taskHtml} 时间已修改。",
|
||||||
|
default => "您有一个新任务 {$taskHtml}。",
|
||||||
|
};
|
||||||
|
|
||||||
/** @var User $user */
|
/** @var User $user */
|
||||||
foreach ($users as $user) {
|
foreach ($users as $user) {
|
||||||
@ -1471,10 +1475,13 @@ class ProjectTask extends AbstractModel
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
$replace = $owners[$user->userid] ? "您负责的任务" : "您协助的任务";
|
||||||
$dialog = WebSocketDialog::checkUserDialog($botUser->userid, $data['userid']);
|
$dialog = WebSocketDialog::checkUserDialog($botUser->userid, $data['userid']);
|
||||||
if ($dialog) {
|
if ($dialog) {
|
||||||
ProjectTaskPushLog::createInstance($data)->save();
|
ProjectTaskPushLog::createInstance($data)->save();
|
||||||
WebSocketDialogMsg::sendMsg(null, $dialog->id, 'text', ['text' => $text], $botUser->userid);
|
WebSocketDialogMsg::sendMsg(null, $dialog->id, 'text', [
|
||||||
|
'text' => str_replace("您的任务", $replace, $text)
|
||||||
|
], $botUser->userid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +0,0 @@
|
|||||||
@if ($type === 'before')
|
|
||||||
您的任务 <span class="mention task" data-id="{{ $task->id }}">#{{ $task->name }}</span> 即将超时,请及时处理。
|
|
||||||
@elseif ($type === 'after')
|
|
||||||
您的任务 <span class="mention task" data-id="{{ $task->id }}">#{{ $task->name }}</span> 已经超时,请及时处理。
|
|
||||||
@elseif ($type === 'times')
|
|
||||||
您的任务 <span class="mention task" data-id="{{ $task->id }}">#{{ $task->name }}</span> 时间已修改,请注意查看。
|
|
||||||
@else
|
|
||||||
您有一个新任务 <span class="mention task" data-id="{{ $task->id }}">#{{ $task->name }}</span>。
|
|
||||||
@endif
|
|
||||||
Loading…
x
Reference in New Issue
Block a user