first commit 2
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/**
|
||||
* 상담 예약 시스템 테스트 페이지
|
||||
*/
|
||||
|
||||
// 오류 표시 활성화
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 1);
|
||||
|
||||
echo "<h1>상담 예약 시스템 테스트</h1>";
|
||||
|
||||
// 1. 그누보드 기본 파일 로드 테스트
|
||||
echo "<h3>1. 그누보드 기본 파일 로드 테스트</h3>";
|
||||
try {
|
||||
include_once('./_common_con.php');
|
||||
echo "✅ common.php 로드 성공<br>";
|
||||
echo "✅ 데이터베이스 연결: " . (isset($connect_db) ? "성공" : "실패") . "<br>";
|
||||
echo "✅ 관리자 권한: " . ($is_admin ? "있음" : "없음") . "<br>";
|
||||
echo "✅ G5_PATH: " . (defined('G5_PATH') ? G5_PATH : "정의되지 않음") . "<br>";
|
||||
} catch (Exception $e) {
|
||||
echo "❌ common.php 로드 실패: " . $e->getMessage() . "<br>";
|
||||
}
|
||||
|
||||
// 2. 함수 존재 확인
|
||||
echo "<h3>2. 필수 함수 존재 확인</h3>";
|
||||
$functions = ['sql_query', 'sql_fetch', 'sql_real_escape_string', 'alert'];
|
||||
foreach ($functions as $func) {
|
||||
echo (function_exists($func) ? "✅" : "❌") . " {$func}<br>";
|
||||
}
|
||||
|
||||
// 3. 상수 확인
|
||||
echo "<h3>3. 필수 상수 확인</h3>";
|
||||
$constants = ['G5_PATH', 'G5_ADMIN_PATH', 'G5_DATA_PATH'];
|
||||
foreach ($constants as $const) {
|
||||
echo (defined($const) ? "✅" : "❌") . " {$const}: " . (defined($const) ? constant($const) : "정의되지 않음") . "<br>";
|
||||
}
|
||||
|
||||
// 4. 데이터베이스 연결 테스트
|
||||
echo "<h3>4. 데이터베이스 연결 테스트</h3>";
|
||||
try {
|
||||
$sql = "SELECT 1 as test";
|
||||
$result = sql_query($sql);
|
||||
if ($result) {
|
||||
echo "✅ 데이터베이스 쿼리 성공<br>";
|
||||
} else {
|
||||
echo "❌ 데이터베이스 쿼리 실패<br>";
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
echo "❌ 데이터베이스 오류: " . $e->getMessage() . "<br>";
|
||||
}
|
||||
|
||||
// 5. 테이블 존재 확인
|
||||
echo "<h3>5. 상담 시스템 테이블 확인</h3>";
|
||||
$tables = ['consultant_config', 'consultant_schedule', 'consultant_reservations'];
|
||||
foreach ($tables as $table) {
|
||||
$sql = "SHOW TABLES LIKE '{$table}'";
|
||||
$result = sql_query($sql, false);
|
||||
$exists = $result && sql_num_rows($result) > 0;
|
||||
echo ($exists ? "✅" : "❌") . " {$table}<br>";
|
||||
}
|
||||
|
||||
echo "<hr>";
|
||||
echo "<p><a href='install_simple.php'>간단 설치 페이지로 이동</a></p>";
|
||||
echo "<p><a href='../install.php'>원본 설치 페이지로 이동</a></p>";
|
||||
?>
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/**
|
||||
* 상담 예약 시스템 설치 테스트
|
||||
*/
|
||||
|
||||
// 오류 표시 활성화
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 1);
|
||||
|
||||
echo "<h1>상담 예약 시스템 설치 테스트</h1>";
|
||||
|
||||
// 1. 그누보드 기본 파일 로드 테스트
|
||||
echo "<h3>1. 그누보드 기본 파일 로드 테스트</h3>";
|
||||
try {
|
||||
include_once('../../common.php');
|
||||
echo "✅ common.php 로드 성공<br>";
|
||||
echo "✅ 데이터베이스 연결: " . (isset($connect_db) ? "성공" : "실패") . "<br>";
|
||||
echo "✅ 관리자 권한: " . ($is_admin ? "있음" : "없음") . "<br>";
|
||||
} catch (Exception $e) {
|
||||
echo "❌ common.php 로드 실패: " . $e->getMessage() . "<br>";
|
||||
}
|
||||
|
||||
// 2. _common.php 로드 테스트
|
||||
echo "<h3>2. _common.php 로드 테스트</h3>";
|
||||
try {
|
||||
include_once('./_common.php');
|
||||
echo "✅ _common.php 로드 성공<br>";
|
||||
echo "✅ 상담 시스템 버전: " . (defined('G5_CONSULTANT_VERSION') ? G5_CONSULTANT_VERSION : "정의되지 않음") . "<br>";
|
||||
} catch (Exception $e) {
|
||||
echo "❌ _common.php 로드 실패: " . $e->getMessage() . "<br>";
|
||||
}
|
||||
|
||||
// 3. 함수 존재 확인
|
||||
echo "<h3>3. 필수 함수 존재 확인</h3>";
|
||||
$functions = ['sql_query', 'sql_fetch', 'sql_real_escape_string', 'alert'];
|
||||
foreach ($functions as $func) {
|
||||
echo (function_exists($func) ? "✅" : "❌") . " {$func}<br>";
|
||||
}
|
||||
|
||||
// 4. 상수 확인
|
||||
echo "<h3>4. 필수 상수 확인</h3>";
|
||||
$constants = ['G5_PATH', 'G5_ADMIN_PATH', 'G5_DATA_PATH'];
|
||||
foreach ($constants as $const) {
|
||||
echo (defined($const) ? "✅" : "❌") . " {$const}: " . (defined($const) ? constant($const) : "정의되지 않음") . "<br>";
|
||||
}
|
||||
|
||||
// 5. 데이터베이스 연결 테스트
|
||||
echo "<h3>5. 데이터베이스 연결 테스트</h3>";
|
||||
try {
|
||||
$sql = "SELECT 1 as test";
|
||||
$result = sql_query($sql);
|
||||
if ($result) {
|
||||
echo "✅ 데이터베이스 쿼리 성공<br>";
|
||||
} else {
|
||||
echo "❌ 데이터베이스 쿼리 실패<br>";
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
echo "❌ 데이터베이스 오류: " . $e->getMessage() . "<br>";
|
||||
}
|
||||
|
||||
echo "<hr>";
|
||||
echo "<p><a href='../install.php'>설치 페이지로 이동</a></p>";
|
||||
?>
|
||||
@@ -0,0 +1,191 @@
|
||||
<?php
|
||||
/**
|
||||
* 스케줄 생성 테스트 페이지
|
||||
*/
|
||||
|
||||
include_once('./_common.php');
|
||||
|
||||
// 관리자 권한 확인
|
||||
if (!$is_admin) {
|
||||
alert('관리자만 접근할 수 있습니다.');
|
||||
}
|
||||
|
||||
// 설치 확인
|
||||
if (!is_consultant_installed()) {
|
||||
alert('상담 예약 시스템이 설치되지 않았습니다.', 'install.php');
|
||||
}
|
||||
|
||||
$g5['title'] = '스케줄 생성 테스트';
|
||||
|
||||
// 테스트 실행
|
||||
if ($_POST['action'] == 'test_generation') {
|
||||
$year = (int) ($_POST['year'] ?? date('Y'));
|
||||
$month = (int) ($_POST['month'] ?? date('n'));
|
||||
|
||||
try {
|
||||
require_once('classes/ScheduleGenerator.class.php');
|
||||
$generator = new ScheduleGenerator();
|
||||
|
||||
echo "<h3>테스트 결과</h3>";
|
||||
echo "<p><strong>대상:</strong> {$year}년 {$month}월</p>";
|
||||
|
||||
// 기존 스케줄 확인
|
||||
$existing = sql_fetch("SELECT COUNT(*) as count FROM consultant_schedule WHERE YEAR(specific_date) = {$year} AND MONTH(specific_date) = {$month}");
|
||||
echo "<p><strong>기존 스케줄:</strong> {$existing['count']}개</p>";
|
||||
|
||||
// 충돌 검사
|
||||
// 💡 [수정] 최신 충돌 검사 로직으로 변경
|
||||
$conflicts = $generator->findConflictsWithNewSettings($year, $month);
|
||||
echo "<p><strong>충돌 검사:</strong> " . count($conflicts) . "건</p>";
|
||||
|
||||
if (!empty($conflicts)) {
|
||||
echo "<ul>";
|
||||
foreach ($conflicts as $conflict) {
|
||||
echo "<li>{$conflict['date']} {$conflict['time']} - {$conflict['customer']} ({$conflict['reason']})</li>";
|
||||
}
|
||||
echo "</ul>";
|
||||
}
|
||||
|
||||
// 스케줄 생성
|
||||
$result = $generator->generateMonth($year, $month);
|
||||
|
||||
if ($result) {
|
||||
$new_count = sql_fetch("SELECT COUNT(*) as count FROM consultant_schedule WHERE YEAR(specific_date) = {$year} AND MONTH(specific_date) = {$month}");
|
||||
echo "<p style='color: green;'><strong>✅ 성공:</strong> {$new_count['count']}개 스케줄 생성 완료</p>";
|
||||
|
||||
// 생성된 스케줄 샘플 표시
|
||||
$samples = sql_query("SELECT * FROM consultant_schedule WHERE YEAR(specific_date) = {$year} AND MONTH(specific_date) = {$month} ORDER BY specific_date, start_time LIMIT 10");
|
||||
echo "<h4>생성된 스케줄 샘플 (최대 10개)</h4>";
|
||||
echo "<table border='1' style='border-collapse: collapse; width: 100%;'>";
|
||||
echo "<tr><th>날짜</th><th>시작시간</th><th>종료시간</th><th>최대인원</th><th>사용가능</th><th>타입</th></tr>";
|
||||
while ($row = sql_fetch_array($samples)) {
|
||||
$available = $row['is_available'] ? '가능' : '불가능';
|
||||
$type = $row['temp_1'] ?? '일반';
|
||||
echo "<tr>";
|
||||
echo "<td>{$row['specific_date']}</td>";
|
||||
echo "<td>{$row['start_time']}</td>";
|
||||
echo "<td>{$row['end_time']}</td>";
|
||||
echo "<td>{$row['max_persons']}</td>";
|
||||
echo "<td>{$available}</td>";
|
||||
echo "<td>{$type}</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
} else {
|
||||
echo "<p style='color: red;'><strong>❌ 실패:</strong> 스케줄 생성에 실패했습니다.</p>";
|
||||
}
|
||||
|
||||
} catch (Exception $e) {
|
||||
echo "<p style='color: red;'><strong>오류:</strong> " . htmlspecialchars($e->getMessage()) . "</p>";
|
||||
}
|
||||
|
||||
echo "<hr>";
|
||||
}
|
||||
|
||||
include_once(G5_ADMIN_PATH . '/admin.head.php');
|
||||
?>
|
||||
|
||||
<style>
|
||||
.test-container {
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.test-form {
|
||||
background: white;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 8px;
|
||||
padding: 30px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.form-group {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.form-group label {
|
||||
display: block;
|
||||
margin-bottom: 5px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.form-group input,
|
||||
.form-group select {
|
||||
padding: 8px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
.btn {
|
||||
padding: 10px 20px;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background: #007bff;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.btn-secondary {
|
||||
background: #6c757d;
|
||||
color: white;
|
||||
}
|
||||
|
||||
table {
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
th,
|
||||
td {
|
||||
padding: 8px;
|
||||
text-align: left;
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
|
||||
th {
|
||||
background-color: #fff;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="test-container">
|
||||
<h2><?php echo $g5['title']; ?></h2>
|
||||
|
||||
<div class="test-form">
|
||||
<h3>스케줄 생성 테스트</h3>
|
||||
<p>선택한 년월의 스케줄을 생성하고 결과를 확인합니다.</p>
|
||||
|
||||
<form method="post">
|
||||
<input type="hidden" name="action" value="test_generation">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="year">년도</label>
|
||||
<input type="number" id="year" name="year" value="<?php echo date('Y'); ?>" min="2024" max="2030">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="month">월</label>
|
||||
<select id="month" name="month">
|
||||
<?php for ($i = 1; $i <= 12; $i++): ?>
|
||||
<option value="<?php echo $i; ?>" <?php echo $i == date('n') ? 'selected' : ''; ?>>
|
||||
<?php echo $i; ?>월
|
||||
</option>
|
||||
<?php endfor; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div style="margin-top: 20px;">
|
||||
<button type="submit" class="btn btn-primary">스케줄 생성 테스트</button>
|
||||
<a href="../settings.php" class="btn btn-secondary">설정으로 돌아가기</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include_once(G5_ADMIN_PATH . '/admin.tail.php');
|
||||
?>
|
||||
@@ -0,0 +1,136 @@
|
||||
<?php
|
||||
/**
|
||||
* ScheduleGenerator 테스트 스크립트
|
||||
*/
|
||||
|
||||
// 기본 설정
|
||||
define('G5_PATH', realpath('../../'));
|
||||
include_once(G5_PATH . '/common.php');
|
||||
include_once('./_common.php');
|
||||
|
||||
// 관리자 권한 확인
|
||||
if (!$is_admin) {
|
||||
die('관리자만 접근할 수 있습니다.');
|
||||
}
|
||||
|
||||
// 설치 확인
|
||||
if (!is_consultant_installed()) {
|
||||
die('상담 예약 시스템이 설치되지 않았습니다.');
|
||||
}
|
||||
|
||||
echo "<h2>ScheduleGenerator 테스트</h2>";
|
||||
|
||||
try {
|
||||
require_once('classes/ScheduleGenerator.class.php');
|
||||
$generator = new ScheduleGenerator();
|
||||
|
||||
// 테스트할 년월
|
||||
$year = 2024;
|
||||
$month = 12;
|
||||
|
||||
echo "<h3>1. 기본 설정 확인</h3>";
|
||||
|
||||
// 기본 설정 확인
|
||||
$duration = consultant_get_config('consultation_duration', 60);
|
||||
$maxPersons = consultant_get_config('max_persons_per_slot', 2);
|
||||
|
||||
echo "- 상담 시간: {$duration}분<br>";
|
||||
echo "- 최대 인원: {$maxPersons}명<br>";
|
||||
|
||||
echo "<h3>2. 요일별 설정 확인</h3>";
|
||||
|
||||
$days = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'];
|
||||
$dayNames = ['월요일', '화요일', '수요일', '목요일', '금요일', '토요일', '일요일'];
|
||||
|
||||
foreach ($days as $i => $day) {
|
||||
$enabled = consultant_get_config($day . '_enabled', '1');
|
||||
$start = consultant_get_config($day . '_start', '09:00');
|
||||
$end = consultant_get_config($day . '_end', '18:00');
|
||||
$lunchStart = consultant_get_config($day . '_lunch_start', '12:00');
|
||||
$lunchEnd = consultant_get_config($day . '_lunch_end', '13:00');
|
||||
|
||||
echo "- {$dayNames[$i]}: ";
|
||||
if ($enabled == '1') {
|
||||
echo "운영 ({$start}~{$end}, 점심: {$lunchStart}~{$lunchEnd})";
|
||||
} else {
|
||||
echo "휴무";
|
||||
}
|
||||
echo "<br>";
|
||||
}
|
||||
|
||||
echo "<h3>3. 기존 스케줄 확인</h3>";
|
||||
|
||||
$existingCount = sql_fetch("SELECT COUNT(*) as count FROM consultant_schedule WHERE YEAR(specific_date) = {$year} AND MONTH(specific_date) = {$month}");
|
||||
echo "- 기존 스케줄: {$existingCount['count']}개<br>";
|
||||
|
||||
echo "<h3>4. 충돌 검사</h3>";
|
||||
|
||||
$conflicts = $generator->checkScheduleConflicts($year, $month);
|
||||
echo "- 충돌 건수: " . count($conflicts) . "건<br>";
|
||||
|
||||
if (!empty($conflicts)) {
|
||||
echo "<ul>";
|
||||
foreach ($conflicts as $conflict) {
|
||||
echo "<li>{$conflict['date']} {$conflict['time']} - {$conflict['customer']} ({$conflict['reason']})</li>";
|
||||
}
|
||||
echo "</ul>";
|
||||
}
|
||||
|
||||
echo "<h3>5. 스케줄 생성 테스트</h3>";
|
||||
|
||||
$result = $generator->generateMonth($year, $month);
|
||||
|
||||
if ($result) {
|
||||
$newCount = sql_fetch("SELECT COUNT(*) as count FROM consultant_schedule WHERE YEAR(specific_date) = {$year} AND MONTH(specific_date) = {$month}");
|
||||
echo "<p style='color: green;'>✅ 성공: {$newCount['count']}개 스케줄 생성 완료</p>";
|
||||
|
||||
// 생성된 스케줄 샘플 표시
|
||||
echo "<h4>생성된 스케줄 샘플 (첫 5일)</h4>";
|
||||
$samples = sql_query("SELECT * FROM consultant_schedule WHERE YEAR(specific_date) = {$year} AND MONTH(specific_date) = {$month} ORDER BY specific_date, start_time LIMIT 20");
|
||||
|
||||
echo "<table border='1' style='border-collapse: collapse; width: 100%;'>";
|
||||
echo "<tr><th>날짜</th><th>요일</th><th>시작시간</th><th>종료시간</th><th>최대인원</th><th>사용가능</th><th>타입</th><th>메모</th></tr>";
|
||||
|
||||
while ($row = sql_fetch_array($samples)) {
|
||||
$dayOfWeek = date('N', strtotime($row['specific_date']));
|
||||
$dayName = $dayNames[$dayOfWeek - 1];
|
||||
$available = $row['is_available'] ? '가능' : '불가능';
|
||||
$type = $row['temp_1'] ?? '일반';
|
||||
$memo = $row['temp_2'] ?? '';
|
||||
|
||||
echo "<tr>";
|
||||
echo "<td>{$row['specific_date']}</td>";
|
||||
echo "<td>{$dayName}</td>";
|
||||
echo "<td>{$row['start_time']}</td>";
|
||||
echo "<td>{$row['end_time']}</td>";
|
||||
echo "<td>{$row['max_persons']}</td>";
|
||||
echo "<td>{$available}</td>";
|
||||
echo "<td>{$type}</td>";
|
||||
echo "<td>{$memo}</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
|
||||
// 타입별 통계
|
||||
echo "<h4>생성된 스케줄 통계</h4>";
|
||||
$stats = sql_query("SELECT temp_1, COUNT(*) as count FROM consultant_schedule WHERE YEAR(specific_date) = {$year} AND MONTH(specific_date) = {$month} GROUP BY temp_1");
|
||||
|
||||
echo "<ul>";
|
||||
while ($stat = sql_fetch_array($stats)) {
|
||||
$type = $stat['temp_1'] ?? '일반';
|
||||
echo "<li>{$type}: {$stat['count']}개</li>";
|
||||
}
|
||||
echo "</ul>";
|
||||
|
||||
} else {
|
||||
echo "<p style='color: red;'>❌ 실패: 스케줄 생성에 실패했습니다.</p>";
|
||||
}
|
||||
|
||||
} catch (Exception $e) {
|
||||
echo "<p style='color: red;'>오류: " . htmlspecialchars($e->getMessage()) . "</p>";
|
||||
echo "<pre>" . htmlspecialchars($e->getTraceAsString()) . "</pre>";
|
||||
}
|
||||
|
||||
echo "<hr>";
|
||||
echo "<p><a href='../settings.php'>설정으로 돌아가기</a> | <a href='../schedule.php'>스케줄 관리</a></p>";
|
||||
?>
|
||||
@@ -0,0 +1,345 @@
|
||||
<?php
|
||||
/**
|
||||
* 상담 예약 시스템 테스트 페이지
|
||||
*/
|
||||
|
||||
$sub_menu = '850900';
|
||||
include_once('./_common.php');
|
||||
|
||||
// 권한 확인
|
||||
auth_check_menu($auth, $sub_menu, 'r');
|
||||
|
||||
$g5['title'] = '시스템 테스트';
|
||||
|
||||
// 테스트 결과
|
||||
$test_results = [];
|
||||
|
||||
// 1. 테이블 존재 확인
|
||||
$tables_to_check = [
|
||||
'consultant_config' => '설정 테이블',
|
||||
'consultant_schedule' => '스케줄 테이블',
|
||||
'consultant_reservations' => '예약 테이블',
|
||||
'consultant_mail_templates' => '메일 템플릿 테이블',
|
||||
'consultant_sms_templates' => 'SMS 템플릿 테이블'
|
||||
];
|
||||
|
||||
foreach ($tables_to_check as $table => $description) {
|
||||
$sql = "SHOW TABLES LIKE '{$table}'";
|
||||
$result = sql_query($sql, false);
|
||||
$exists = $result && sql_num_rows($result) > 0;
|
||||
|
||||
$test_results['tables'][$table] = [
|
||||
'name' => $description,
|
||||
'status' => $exists,
|
||||
'message' => $exists ? '존재함' : '존재하지 않음'
|
||||
];
|
||||
}
|
||||
|
||||
// 2. 기본 설정값 확인
|
||||
$config_keys = [
|
||||
'consultation_duration' => '1회 상담시간',
|
||||
'max_persons_per_slot' => '최대 인원',
|
||||
'consultation_fee' => '상담비',
|
||||
'account_info' => '계좌정보',
|
||||
'monday_enabled' => '월요일 운영여부',
|
||||
'monday_start' => '월요일 시작시간'
|
||||
];
|
||||
|
||||
foreach ($config_keys as $key => $description) {
|
||||
$value = consultant_get_config($key);
|
||||
$test_results['config'][$key] = [
|
||||
'name' => $description,
|
||||
'value' => $value,
|
||||
'status' => $value !== null
|
||||
];
|
||||
}
|
||||
|
||||
// 3. 함수 테스트
|
||||
$function_tests = [
|
||||
'is_consultant_installed' => is_consultant_installed(),
|
||||
'consultant_get_config' => consultant_get_config('consultation_duration', '60'),
|
||||
'consultant_format_time' => consultant_format_time('14:30'),
|
||||
'consultant_format_date' => consultant_format_date('2024-12-02')
|
||||
];
|
||||
|
||||
// 4. 스케줄 생성 테스트 (현재 월)
|
||||
$current_year = date('Y');
|
||||
$current_month = date('m');
|
||||
|
||||
try {
|
||||
include_once('./schedule_generator.php');
|
||||
$generator = new ScheduleGenerator();
|
||||
$schedule_status = $generator->checkScheduleStatus($current_year, $current_month);
|
||||
$test_results['schedule_status'] = $schedule_status;
|
||||
} catch (Exception $e) {
|
||||
$test_results['schedule_error'] = $e->getMessage();
|
||||
}
|
||||
|
||||
include_once(G5_ADMIN_PATH . '/admin.head.php');
|
||||
?>
|
||||
|
||||
<style>
|
||||
.test-container {
|
||||
max-width: 1000px;
|
||||
margin: 0 auto;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.test-section {
|
||||
background: white;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 8px;
|
||||
padding: 20px;
|
||||
margin-bottom: 20px;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.test-section h3 {
|
||||
margin: 0 0 15px 0;
|
||||
color: #333;
|
||||
border-bottom: 2px solid #007bff;
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
|
||||
.test-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 10px 0;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
}
|
||||
|
||||
.test-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.test-name {
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.test-value {
|
||||
color: #666;
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
.test-status {
|
||||
padding: 4px 8px;
|
||||
border-radius: 12px;
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.status-ok {
|
||||
background: #d4edda;
|
||||
color: #155724;
|
||||
}
|
||||
|
||||
.status-error {
|
||||
background: #f8d7da;
|
||||
color: #721c24;
|
||||
}
|
||||
|
||||
.status-warning {
|
||||
background: #fff3cd;
|
||||
color: #856404;
|
||||
}
|
||||
|
||||
.btn {
|
||||
padding: 8px 16px;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background: #007bff;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.btn-success {
|
||||
background: #28a745;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.btn-warning {
|
||||
background: #ffc107;
|
||||
color: #212529;
|
||||
}
|
||||
|
||||
.summary-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
||||
gap: 15px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.summary-card {
|
||||
background: #fff;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 8px;
|
||||
padding: 15px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.summary-number {
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.summary-label {
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="test-container">
|
||||
<h2><?php echo $g5['title']; ?></h2>
|
||||
|
||||
<!-- 전체 요약 -->
|
||||
<div class="summary-grid">
|
||||
<div class="summary-card">
|
||||
<div class="summary-number" style="color: <?php echo is_consultant_installed() ? '#28a745' : '#dc3545'; ?>">
|
||||
<?php echo is_consultant_installed() ? '✓' : '✗'; ?>
|
||||
</div>
|
||||
<div class="summary-label">시스템 설치</div>
|
||||
</div>
|
||||
|
||||
<div class="summary-card">
|
||||
<div class="summary-number" style="color: #007bff;">
|
||||
<?php echo count(array_filter($test_results['tables'], function ($t) {
|
||||
return $t['status']; })); ?>/<?php echo count($test_results['tables']); ?>
|
||||
</div>
|
||||
<div class="summary-label">테이블 상태</div>
|
||||
</div>
|
||||
|
||||
<div class="summary-card">
|
||||
<div class="summary-number" style="color: #17a2b8;">
|
||||
<?php echo count(array_filter($test_results['config'], function ($c) {
|
||||
return $c['status']; })); ?>/<?php echo count($test_results['config']); ?>
|
||||
</div>
|
||||
<div class="summary-label">설정 상태</div>
|
||||
</div>
|
||||
|
||||
<div class="summary-card">
|
||||
<div class="summary-number" style="color: #6f42c1;">
|
||||
<?php echo isset($test_results['schedule_status']) ? number_format($test_results['schedule_status']['total_slots']) : '0'; ?>
|
||||
</div>
|
||||
<div class="summary-label">현재 월 스케줄</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 테이블 상태 -->
|
||||
<div class="test-section">
|
||||
<h3>📋 데이터베이스 테이블 상태</h3>
|
||||
<?php foreach ($test_results['tables'] as $table => $info): ?>
|
||||
<div class="test-item">
|
||||
<div class="test-name"><?php echo $info['name']; ?> (<?php echo $table; ?>)</div>
|
||||
<div class="test-status <?php echo $info['status'] ? 'status-ok' : 'status-error'; ?>">
|
||||
<?php echo $info['message']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<!-- 설정 상태 -->
|
||||
<div class="test-section">
|
||||
<h3>⚙️ 기본 설정 상태</h3>
|
||||
<?php foreach ($test_results['config'] as $key => $info): ?>
|
||||
<div class="test-item">
|
||||
<div class="test-name"><?php echo $info['name']; ?> (<?php echo $key; ?>)</div>
|
||||
<div class="test-value"><?php echo htmlspecialchars($info['value'] ?? 'NULL'); ?></div>
|
||||
<div class="test-status <?php echo $info['status'] ? 'status-ok' : 'status-warning'; ?>">
|
||||
<?php echo $info['status'] ? '설정됨' : '미설정'; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<!-- 함수 테스트 -->
|
||||
<div class="test-section">
|
||||
<h3>🔧 함수 테스트</h3>
|
||||
<?php foreach ($function_tests as $func_name => $result): ?>
|
||||
<div class="test-item">
|
||||
<div class="test-name"><?php echo $func_name; ?>()</div>
|
||||
<div class="test-value">
|
||||
<?php echo is_bool($result) ? ($result ? 'true' : 'false') : htmlspecialchars($result); ?></div>
|
||||
<div class="test-status status-ok">정상</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<!-- 스케줄 상태 -->
|
||||
<div class="test-section">
|
||||
<h3>📅 현재 월 스케줄 상태 (<?php echo $current_year; ?>년 <?php echo $current_month; ?>월)</h3>
|
||||
|
||||
<?php if (isset($test_results['schedule_status'])): ?>
|
||||
<?php $status = $test_results['schedule_status']; ?>
|
||||
<div class="test-item">
|
||||
<div class="test-name">전체 슬롯</div>
|
||||
<div class="test-value"><?php echo number_format($status['total_slots']); ?>개</div>
|
||||
<div class="test-status <?php echo $status['total_slots'] > 0 ? 'status-ok' : 'status-warning'; ?>">
|
||||
<?php echo $status['total_slots'] > 0 ? '생성됨' : '미생성'; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="test-item">
|
||||
<div class="test-name">상담 가능 슬롯</div>
|
||||
<div class="test-value"><?php echo number_format($status['auto_slots']); ?>개</div>
|
||||
<div class="test-status status-ok">정상</div>
|
||||
</div>
|
||||
|
||||
<div class="test-item">
|
||||
<div class="test-name">점심시간 슬롯</div>
|
||||
<div class="test-value"><?php echo number_format($status['lunch_slots']); ?>개</div>
|
||||
<div class="test-status status-ok">정상</div>
|
||||
</div>
|
||||
|
||||
<div class="test-item">
|
||||
<div class="test-name">휴무일 슬롯</div>
|
||||
<div class="test-value"><?php echo number_format($status['holiday_slots']); ?>개</div>
|
||||
<div class="test-status status-ok">정상</div>
|
||||
</div>
|
||||
|
||||
<?php elseif (isset($test_results['schedule_error'])): ?>
|
||||
<div class="test-item">
|
||||
<div class="test-name">스케줄 조회 오류</div>
|
||||
<div class="test-value"><?php echo htmlspecialchars($test_results['schedule_error']); ?></div>
|
||||
<div class="test-status status-error">오류</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<!-- 액션 버튼 -->
|
||||
<div class="test-section">
|
||||
<h3>🚀 빠른 액션</h3>
|
||||
<div style="text-align: center;">
|
||||
<?php if (!is_consultant_installed()): ?>
|
||||
<a href="../install.php" class="btn btn-warning">시스템 설치</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<a href="../settings.php" class="btn btn-primary">설정 관리</a>
|
||||
<a href="../schedule_generate.php" class="btn btn-success">스케줄 생성</a>
|
||||
<a href="../dashboard.php" class="btn btn-primary">대시보드</a>
|
||||
|
||||
<button onclick="location.reload()" class="btn btn-secondary">새로고침</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// 자동 새로고침 (30초마다)
|
||||
setTimeout(function () {
|
||||
location.reload();
|
||||
}, 30000);
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once(G5_ADMIN_PATH . '/admin.tail.php');
|
||||
?>
|
||||
Reference in New Issue
Block a user