- URL 하드코딩 → .env APP_URL 기반 동적 URL로 변경 - DB 연결 하드코딩 → .env 기반으로 변경 - MySQL strict mode DATE 오류 수정
62 lines
1.7 KiB
PHP
62 lines
1.7 KiB
PHP
<?php
|
|
// 출력 버퍼링 시작 및 에러 리포팅 비활성화
|
|
error_reporting(0);
|
|
ob_start();
|
|
|
|
require_once($_SERVER['DOCUMENT_ROOT'] . "/session.php");
|
|
require_once($_SERVER['DOCUMENT_ROOT'] . "/lib/mydb.php");
|
|
|
|
// 출력 버퍼 비우기
|
|
ob_clean();
|
|
|
|
header('Content-Type: application/json; charset=utf-8');
|
|
|
|
// 권한 체크
|
|
if (!isset($user_id) || $level > 5) {
|
|
echo json_encode(['success' => false, 'message' => '접근 권한이 없습니다.']);
|
|
exit;
|
|
}
|
|
|
|
$consultation_id = isset($_GET['id']) ? intval($_GET['id']) : 0;
|
|
$manager_id = $user_id;
|
|
|
|
if ($consultation_id <= 0) {
|
|
echo json_encode(['success' => false, 'message' => '잘못된 요청입니다.']);
|
|
exit;
|
|
}
|
|
|
|
try {
|
|
$pdo = db_connect();
|
|
|
|
$sql = "SELECT id, manager_id, step_id, audio_file_path, transcript_text,
|
|
file_expiry_date, created_at
|
|
FROM manager_consultations
|
|
WHERE id = ? AND manager_id = ?";
|
|
$stmt = $pdo->prepare($sql);
|
|
$stmt->execute([$consultation_id, $manager_id]);
|
|
$consultation = $stmt->fetch(PDO::FETCH_ASSOC);
|
|
|
|
if (!$consultation) {
|
|
echo json_encode(['success' => false, 'message' => '녹음 파일을 찾을 수 없습니다.']);
|
|
exit;
|
|
}
|
|
|
|
// 날짜 포맷팅
|
|
$consultation['created_at_formatted'] = date('Y-m-d H:i:s', strtotime($consultation['created_at']));
|
|
$consultation['is_gcs'] = strpos($consultation['audio_file_path'], 'gs://') === 0;
|
|
|
|
echo json_encode([
|
|
'success' => true,
|
|
'data' => $consultation
|
|
]);
|
|
|
|
} catch (Exception $e) {
|
|
error_log('조회 오류: ' . $e->getMessage());
|
|
echo json_encode([
|
|
'success' => false,
|
|
'message' => '조회 실패: ' . $e->getMessage()
|
|
]);
|
|
}
|
|
?>
|
|
|