OneBot: Leantime 改造版源码(BOM/Univer 表格/AI 接管/品牌替换等)
This commit is contained in:
49
app/Domain/Reports/register.php
Normal file
49
app/Domain/Reports/register.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Leantime\Domain\Reports;
|
||||
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Leantime\Core\Events\EventDispatcher;
|
||||
|
||||
EventDispatcher::add_event_listener('leantime.core.console.consolekernel.schedule.cron', function ($params) {
|
||||
|
||||
if (get_class($scheduler = $params['schedule']) !== Schedule::class) {
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var Services\Reports $reportService */
|
||||
$reportService = app()->make(Services\Reports::class);
|
||||
|
||||
$scheduler->call(function () use ($reportService) {
|
||||
|
||||
$telemetry = $reportService->sendAnonymousTelemetry();
|
||||
|
||||
if ($telemetry === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
$response = $telemetry->wait();
|
||||
|
||||
} catch (\Throwable $e) {
|
||||
Log::error($e);
|
||||
}
|
||||
|
||||
})->name('reports:telemetry')->daily();
|
||||
|
||||
$scheduler->call(function () use ($reportService) {
|
||||
$reportService->cronDailyIngestion();
|
||||
})->name('reports:dailyIngestion')->daily();
|
||||
|
||||
// Safety net behind the goal-repository write hooks: records value changes that bypassed
|
||||
// the repository so KPI trend history stays complete.
|
||||
$scheduler->call(function () {
|
||||
try {
|
||||
app()->make(\Leantime\Domain\Goalcanvas\Repositories\Goalcanvas::class)->snapshotGoalValues();
|
||||
} catch (\Throwable $e) {
|
||||
Log::error($e);
|
||||
}
|
||||
})->name('reports:goalValueSnapshot')->daily();
|
||||
});
|
||||
Reference in New Issue
Block a user