142 lines
5.6 KiB
PHP
142 lines
5.6 KiB
PHP
<?php
|
|
require_once './_common.php';
|
|
|
|
// 관리자 권한 체크
|
|
if (!$is_admin) {
|
|
die('관리자만 접근 가능합니다.');
|
|
}
|
|
|
|
echo "<h2>견적서 시스템 기능 테스트</h2>";
|
|
|
|
// 1. 데이터베이스 테이블 확인
|
|
echo "<h3>1. 데이터베이스 테이블 확인</h3>";
|
|
$tables_to_check = ['order_config', 'order_mail_templates', 'order_sms_templates', 'estimate'];
|
|
|
|
foreach ($tables_to_check as $table) {
|
|
$full_table_name = ($table === 'estimate') ? $table : G5_TABLE_PREFIX . $table;
|
|
$result = sql_query("SHOW TABLES LIKE '{$full_table_name}'", false);
|
|
if ($result && sql_num_rows($result) > 0) {
|
|
echo "<p style='color: green;'>✓ {$table} 테이블 존재</p>";
|
|
|
|
// 데이터 개수 확인
|
|
$count_result = sql_query("SELECT COUNT(*) as cnt FROM {$full_table_name}", false);
|
|
if ($count_result) {
|
|
$count_row = sql_fetch_array($count_result);
|
|
echo "<p style='margin-left: 20px;'>- 데이터 개수: {$count_row['cnt']}개</p>";
|
|
}
|
|
} else {
|
|
echo "<p style='color: red;'>✗ {$table} 테이블 없음</p>";
|
|
}
|
|
}
|
|
|
|
// 2. notification_helper.php 함수 테스트
|
|
echo "<h3>2. 알림 시스템 함수 테스트</h3>";
|
|
include_once G5_LIB_PATH . '/notification_helper.php';
|
|
|
|
// get_order_config 함수 테스트
|
|
$timer_enabled = get_order_config('timer_enabled', '1');
|
|
$visit_fee = get_order_config('expert_visit_fee', '50000');
|
|
echo "<p>타이머 활성화: " . ($timer_enabled ? '예' : '아니오') . "</p>";
|
|
echo "<p>전문가 방문 비용: " . number_format($visit_fee) . "원</p>";
|
|
|
|
// 3. 템플릿 시스템 테스트
|
|
echo "<h3>3. 템플릿 시스템 테스트</h3>";
|
|
$mail_templates = sql_query("SELECT template_key, template_name FROM order_mail_templates LIMIT 5");
|
|
if ($mail_templates && sql_num_rows($mail_templates) > 0) {
|
|
echo "<p style='color: green;'>✓ 메일 템플릿 로드 성공</p>";
|
|
echo "<ul>";
|
|
while ($row = sql_fetch_array($mail_templates)) {
|
|
echo "<li>{$row['template_key']}: {$row['template_name']}</li>";
|
|
}
|
|
echo "</ul>";
|
|
} else {
|
|
echo "<p style='color: red;'>✗ 메일 템플릿 없음</p>";
|
|
}
|
|
|
|
$sms_templates = sql_query("SELECT template_key, template_name FROM order_sms_templates LIMIT 5");
|
|
if ($sms_templates && sql_num_rows($sms_templates) > 0) {
|
|
echo "<p style='color: green;'>✓ SMS 템플릿 로드 성공</p>";
|
|
echo "<ul>";
|
|
while ($row = sql_fetch_array($sms_templates)) {
|
|
echo "<li>{$row['template_key']}: {$row['template_name']}</li>";
|
|
}
|
|
echo "</ul>";
|
|
} else {
|
|
echo "<p style='color: red;'>✗ SMS 템플릿 없음</p>";
|
|
}
|
|
|
|
// 4. estimate 테이블 구조 확인
|
|
echo "<h3>4. estimate 테이블 구조 확인</h3>";
|
|
$result = sql_query("DESCRIBE estimate", false);
|
|
if ($result) {
|
|
echo "<table border='1' style='border-collapse: collapse;'>";
|
|
echo "<tr><th>컬럼명</th><th>타입</th><th>설명</th></tr>";
|
|
while ($row = sql_fetch_array($result)) {
|
|
$description = '';
|
|
if (strpos($row['Field'], 'temp_') === 0) {
|
|
switch ($row['Field']) {
|
|
case 'temp_1':
|
|
$description = '전문가 방문 요청 여부 (Y/N)';
|
|
break;
|
|
case 'temp_2':
|
|
$description = '전문가 방문 상태';
|
|
break;
|
|
case 'temp_3':
|
|
$description = '전문가 방문 비용';
|
|
break;
|
|
case 'temp_4':
|
|
$description = '전문가 방문 일정';
|
|
break;
|
|
case 'temp_5':
|
|
$description = '전문가 방문 메모';
|
|
break;
|
|
}
|
|
} elseif (strpos($row['Field'], 'extra_') === 0) {
|
|
switch ($row['Field']) {
|
|
case 'extra_1':
|
|
$description = '고객 연락처';
|
|
break;
|
|
case 'extra_2':
|
|
$description = '결제 상태';
|
|
break;
|
|
case 'extra_3':
|
|
$description = '추가 요청사항';
|
|
break;
|
|
case 'extra_4':
|
|
$description = '관리자 메모';
|
|
break;
|
|
case 'extra_5':
|
|
$description = '예비 필드';
|
|
break;
|
|
}
|
|
}
|
|
echo "<tr><td>{$row['Field']}</td><td>{$row['Type']}</td><td>{$description}</td></tr>";
|
|
}
|
|
echo "</table>";
|
|
} else {
|
|
echo "<p style='color: red;'>✗ estimate 테이블 구조 확인 실패</p>";
|
|
}
|
|
|
|
// 5. 24시간 타이머 계산 테스트
|
|
echo "<h3>5. 24시간 타이머 계산 테스트</h3>";
|
|
$now = time();
|
|
$test_time = date('Y-m-d H:i:s', $now - 3600); // 1시간 전
|
|
$test_timestamp = strtotime($test_time);
|
|
$elapsed = $now - $test_timestamp;
|
|
$limit_seconds = 24 * 60 * 60; // 24시간
|
|
$remain = $limit_seconds - $elapsed;
|
|
|
|
echo "<p>현재 시간: " . date('Y-m-d H:i:s', $now) . "</p>";
|
|
echo "<p>테스트 시작 시간: {$test_time}</p>";
|
|
echo "<p>경과 시간: " . gmdate('H:i:s', $elapsed) . "</p>";
|
|
echo "<p>남은 시간: " . gmdate('H:i:s', $remain) . "</p>";
|
|
echo "<p>타이머 활성화: " . ($remain > 0 ? '예' : '아니오') . "</p>";
|
|
|
|
echo "<hr>";
|
|
echo "<h3>테스트 완료</h3>";
|
|
echo "<p><a href='./execute_update.php'>데이터베이스 업데이트 실행</a></p>";
|
|
echo "<p><a href='./config_manager.php'>시스템 설정 관리</a></p>";
|
|
echo "<p><a href='./expert_visits.php'>전문가 방문 관리</a></p>";
|
|
echo "<p><a href='./mail_templates.php'>메일 템플릿 관리</a></p>";
|
|
echo "<p><a href='./sms_templates.php'>SMS 템플릿 관리</a></p>";
|
|
?>
|