OneBot: Leantime 改造版源码(BOM/Univer 表格/AI 接管/品牌替换等)

This commit is contained in:
wangruiguo
2026-09-03 18:49:20 +08:00
commit d647428529
3501 changed files with 1988906 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
<?php
namespace Leantime\Domain\Cron\Controllers;
use Leantime\Core\Controller\Controller;
use Leantime\Core\Events\EventDispatcher;
use Leantime\Domain\Cron\Services\Cron as CronService;
use PHPMailer\PHPMailer\Exception;
use Symfony\Component\HttpFoundation\Response;
class Run extends Controller
{
private CronService $cronService;
/**
* Initializes dependencies.
*/
public function init(CronService $cronService): void
{
$this->cronService = $cronService;
}
/**
* The Poor Man's Cron Endpoint.
*
* Registers a terminate listener that runs the scheduled tasks after the response is sent,
* then immediately returns an empty response so the client connection can close.
*
* @param array $params Request parameters
*
* @throws Exception
*/
public function get(array $params): Response
{
EventDispatcher::add_event_listener(
'leantime.core.http.httpkernel.terminate.request_terminated',
fn () => $this->cronService->runScheduledTasks()
);
return tap(new Response, function ($response) {
$response->headers->set('Content-Length', '0');
$response->headers->set('Connection', 'close');
});
}
}