mirror of
https://github.com/kuaifan/dootask.git
synced 2026-03-18 03:33:24 +00:00
perf: 优化任务修改时间通知
This commit is contained in:
parent
8a41730b63
commit
96e7913ae4
@ -764,10 +764,11 @@ class ProjectTask extends AbstractModel
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
$newStringAt = $this->start_at ? ($this->start_at->toDateTimeString() . '~' . $this->end_at->toDateTimeString()) : '';
|
$newStringAt = $this->start_at ? ($this->start_at->toDateTimeString() . '~' . $this->end_at->toDateTimeString()) : '';
|
||||||
$this->addLog("修改{任务}时间" . ($desc ? "(备注:{$desc})" : ""), [
|
$newDesc = $desc ? "(备注:{$desc})" : "";
|
||||||
|
$this->addLog("修改{任务}时间" . $newDesc, [
|
||||||
'change' => [$oldStringAt, $newStringAt]
|
'change' => [$oldStringAt, $newStringAt]
|
||||||
]);
|
]);
|
||||||
$this->taskPush(null, 3);
|
$this->taskPush(null, 3, $newDesc);
|
||||||
}
|
}
|
||||||
// 以下仅顶级任务可修改
|
// 以下仅顶级任务可修改
|
||||||
if ($this->parent_id === 0) {
|
if ($this->parent_id === 0) {
|
||||||
@ -1435,12 +1436,13 @@ class ProjectTask extends AbstractModel
|
|||||||
* 任务提醒
|
* 任务提醒
|
||||||
* @param $userids
|
* @param $userids
|
||||||
* @param int $type 0-新任务、1-即将超时、2-已超时、3-修改时间
|
* @param int $type 0-新任务、1-即将超时、2-已超时、3-修改时间
|
||||||
|
* @param string $suffix 描述后缀
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function taskPush($userids, int $type)
|
public function taskPush($userids, int $type, string $suffix = "")
|
||||||
{
|
{
|
||||||
if ($userids === null) {
|
if ($userids === null) {
|
||||||
$userids = $this->taskUser->where('owner', 1)->pluck('userid')->toArray();
|
$userids = $this->taskUser->pluck('userid')->toArray();
|
||||||
}
|
}
|
||||||
if (empty($userids)) {
|
if (empty($userids)) {
|
||||||
return;
|
return;
|
||||||
@ -1471,8 +1473,7 @@ class ProjectTask extends AbstractModel
|
|||||||
'userid' => $user->userid,
|
'userid' => $user->userid,
|
||||||
'task_id' => $this->id,
|
'task_id' => $this->id,
|
||||||
];
|
];
|
||||||
$pushLog = ProjectTaskPushLog::where($data)->exists();
|
if (in_array($type, [1, 2]) && ProjectTaskPushLog::where($data)->exists()) {
|
||||||
if ($pushLog) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
@ -1481,7 +1482,7 @@ class ProjectTask extends AbstractModel
|
|||||||
if ($dialog) {
|
if ($dialog) {
|
||||||
ProjectTaskPushLog::createInstance($data)->save();
|
ProjectTaskPushLog::createInstance($data)->save();
|
||||||
WebSocketDialogMsg::sendMsg(null, $dialog->id, 'text', [
|
WebSocketDialogMsg::sendMsg(null, $dialog->id, 'text', [
|
||||||
'text' => str_replace("您的任务", $replace, $text)
|
'text' => str_replace("您的任务", $replace, $text) . $suffix
|
||||||
], $botUser->userid);
|
], $botUser->userid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user