feat: initial commit

This commit is contained in:
root
2026-06-14 14:00:24 +08:00
commit 72d388f642
118 changed files with 39015 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
<?php
/**
* 访客日志异步队列 Worker(建议 cron 每分钟执行)
*
* php tools/visitor_log_worker.php
*/
$root = dirname(__DIR__);
require_once $root . '/cong.php';
require_once $root . '/lib/Cloak/VisitorLogWorker.php';
$limit = 100;
$rounds = 10;
$total = ['processed' => 0, 'failed' => 0];
for ($i = 0; $i < $rounds; $i++) {
$result = VisitorLogWorker::processBatch($limit);
$total['processed'] += $result['processed'];
$total['failed'] += $result['failed'];
if ($result['processed'] === 0) {
break;
}
}
if (PHP_SAPI === 'cli') {
echo json_encode([
'ok' => true,
'processed' => $total['processed'],
'failed' => $total['failed'],
], JSON_UNESCAPED_UNICODE) . "\n";
}