feat: 发布智能体版

This commit is contained in:
augushong
2026-03-26 20:22:34 +08:00
parent 7ee9e102a5
commit 8cc08bcb8c
138 changed files with 7964 additions and 660 deletions

View File

@@ -110,32 +110,39 @@ class DebugMysql implements LogHandlerInterface
$log_key = uniqid();
}
foreach ($log as $log_level => $log_list) {
foreach ($log_list as $key => $log_item) {
if (!is_string($log_item)) {
$log_item = print_r($log_item, true);
}
foreach ($log as $log_item) {
// 适配 ThinkPHP 8.x 的 LogRecord 对象格式
// 兼容旧格式:包含 type 和 message 属性的对象
if (is_object($log_item) && isset($log_item->type) && isset($log_item->message)) {
$log_level = $log_item->type;
$log_content = $log_item->message;
} else {
continue;
}
$log_data = [
'level' => $log_level,
'content' => $log_item,
'create_time' => $create_time,
'create_time_title' => $create_time_title,
'uid' => $log_key,
'app_name' => $app_name,
'controller_name' => $controller_name,
'action_name' => $action_name,
];
if (!is_string($log_content)) {
$log_content = print_r($log_content, true);
}
try {
if (!is_null($this->pdo)) {
$this->saveByConnect($log_data);
} else {
$this->saveByFile($log_data);
}
} catch (\Throwable $th) {
$log_data = [
'level' => $log_level,
'content' => $log_content,
'create_time' => $create_time,
'create_time_title' => $create_time_title,
'uid' => $log_key,
'app_name' => $app_name,
'controller_name' => $controller_name,
'action_name' => $action_name,
];
try {
if (!is_null($this->pdo)) {
$this->saveByConnect($log_data);
} else {
$this->saveByFile($log_data);
}
} catch (\Throwable $th) {
$this->saveByFile($log_data);
}
}
@@ -242,7 +249,7 @@ class DebugMysql implements LogHandlerInterface
$dirname = dirname($log_path);
if (!is_dir($dirname)) {
mkdir($log_path, 0777, true);
mkdir($dirname, 0777, true);
}
$first_line = false;