mirror of
https://github.com/kuaifan/dootask.git
synced 2026-01-27 21:28:12 +00:00
perf: 优化子任务上下文
This commit is contained in:
parent
a8c890ba51
commit
25be9c0fef
@ -621,6 +621,24 @@ class BotReceiveMsgTask extends AbstractTask
|
||||
EOF;
|
||||
}
|
||||
}
|
||||
$subTask = ProjectTask::select(['id', 'name', 'complete_at', 'end_at'])->whereParentId($taskInfo->id)->get();
|
||||
if ($subTask->isNotEmpty()) {
|
||||
$subTaskContent = $subTask->map(function($item) {
|
||||
$status = "";
|
||||
if ($item->complete_at) {
|
||||
$status = " (已完成)";
|
||||
} elseif ($item->end_at && Carbon::parse($item->end_at)->lt(Carbon::now())) {
|
||||
$status = " (已过期)";
|
||||
}
|
||||
return " - {$item->name} {$status}";
|
||||
})->join("\n");
|
||||
if ($subTaskContent) {
|
||||
$before_text[] = <<<EOF
|
||||
子任务列表:
|
||||
{$subTaskContent}
|
||||
EOF;
|
||||
}
|
||||
}
|
||||
$before_text[] = <<<EOF
|
||||
如果你判断我想要添加子任务,请按照以下格式回复:
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user