diff --git a/telegram_ai_qa.php b/telegram_ai_qa.php index 9700b34f..91b7cee5 100644 --- a/telegram_ai_qa.php +++ b/telegram_ai_qa.php @@ -28,9 +28,9 @@ $data = json_decode($str, true); // Проверяем обязательные поля if (!isset($data['tgid']) || !isset($data['question']) || !isset($data['answer'])) { $error = array('status' => 'error', 'message' => 'Не переданы обязательные поля: tgid, question, answer'); - $logstring = date('Y-m-d H:i:s').' ОШИБКА: '.json_encode($error).PHP_EOL; + $logstring = date('Y-m-d H:i:s').' ОШИБКА: '.json_encode($error, JSON_UNESCAPED_UNICODE).PHP_EOL; file_put_contents('logs/tg_ai_qa.log', $logstring, FILE_APPEND); - echo json_encode($error); + echo json_encode($error, JSON_UNESCAPED_UNICODE); exit; } @@ -108,9 +108,9 @@ $result = $adb->pquery($query, array($tgid)); if ($adb->num_rows($result) == 0) { $error = array('status' => 'error', 'message' => 'Контакт с tgid='.$tgid.' не найден'); - $logstring = date('Y-m-d H:i:s').' ОШИБКА: '.json_encode($error).PHP_EOL; + $logstring = date('Y-m-d H:i:s').' ОШИБКА: '.json_encode($error, JSON_UNESCAPED_UNICODE).PHP_EOL; file_put_contents('logs/tg_ai_qa.log', $logstring, FILE_APPEND); - echo json_encode($error); + echo json_encode($error, JSON_UNESCAPED_UNICODE); exit; } @@ -134,9 +134,9 @@ if (empty($projectid)) { if ($adb->num_rows($result) == 0) { $error = array('status' => 'error', 'message' => 'Не найден активный проект для контакта ID='.$contactid); - $logstring = date('Y-m-d H:i:s').' ОШИБКА: '.json_encode($error).PHP_EOL; + $logstring = date('Y-m-d H:i:s').' ОШИБКА: '.json_encode($error, JSON_UNESCAPED_UNICODE).PHP_EOL; file_put_contents('logs/tg_ai_qa.log', $logstring, FILE_APPEND); - echo json_encode($error); + echo json_encode($error, JSON_UNESCAPED_UNICODE); exit; } @@ -153,9 +153,9 @@ if (empty($projectid)) { if ($adb->num_rows($result) == 0) { $error = array('status' => 'error', 'message' => 'Проект ID='.$projectid.' не найден или не связан с контактом'); - $logstring = date('Y-m-d H:i:s').' ОШИБКА: '.json_encode($error).PHP_EOL; + $logstring = date('Y-m-d H:i:s').' ОШИБКА: '.json_encode($error, JSON_UNESCAPED_UNICODE).PHP_EOL; file_put_contents('logs/tg_ai_qa.log', $logstring, FILE_APPEND); - echo json_encode($error); + echo json_encode($error, JSON_UNESCAPED_UNICODE); exit; } @@ -238,9 +238,9 @@ $response = array( 'botname' => $botname ); -$logstring = date('Y-m-d H:i:s').' ✅ SUCCESS: '.json_encode($response).PHP_EOL.PHP_EOL; +$logstring = date('Y-m-d H:i:s').' ✅ SUCCESS: '.json_encode($response, JSON_UNESCAPED_UNICODE).PHP_EOL.PHP_EOL; file_put_contents('logs/tg_ai_qa.log', $logstring, FILE_APPEND); -echo json_encode($response); +echo json_encode($response, JSON_UNESCAPED_UNICODE); ?>