Backend: - New Logger utility (app/utils/Logger.php) with category-based log files (connect/game/bet/error/frontend under runtime/log/) - Log WebSocket connect/close events (WsConnect, WsClose) - Log dealer auth success/failure (SpaceConnectService) - Log all game events: startBet, endBet, changeBoot, opening for all 7 game types - Log unhandled exceptions (ExceptionHandle) - Separate SQL/error logs via apart_level, enable realtime_write for Swoole - Add /log/report POST endpoint for frontend error ingestion Frontend: - New error-report.js with window.onerror + unhandledrejection auto-reporting - Added to all 12 dealer HTML templates - Bump VERSION_V to v10.1.0
34 lines
1.4 KiB
PHP
34 lines
1.4 KiB
PHP
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
|
// +----------------------------------------------------------------------
|
|
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
|
|
// +----------------------------------------------------------------------
|
|
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
|
// +----------------------------------------------------------------------
|
|
// | Author: liu21st <liu21st@gmail.com>
|
|
// +----------------------------------------------------------------------
|
|
use think\facade\Route;
|
|
|
|
Route::get('think', function () {
|
|
return 'hello,ThinkPHP6!';
|
|
});
|
|
|
|
Route::get('hello/:name', 'index/hello');
|
|
|
|
Route::post('log/report', function () {
|
|
$data = request()->post();
|
|
\app\utils\Logger::error(\app\utils\Logger::CAT_FRONTEND, $data['message'] ?? 'unknown', [
|
|
'source' => $data['source'] ?? 'unknown',
|
|
'type' => $data['type'] ?? 'error',
|
|
'stack' => isset($data['stack']) ? substr($data['stack'], 0, 2000) : '',
|
|
'file' => $data['file'] ?? '',
|
|
'url' => $data['url'] ?? '',
|
|
'line' => $data['line'] ?? '',
|
|
'col' => $data['col'] ?? '',
|
|
'ua' => request()->header('user-agent', ''),
|
|
'ip' => request()->ip(),
|
|
]);
|
|
return json(['status' => 1]);
|
|
});
|