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() ]); } ?>