<?php
if (!defined('_GNUBOARD_')) exit;
add_stylesheet('<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">', 0);
add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.view.css">', 0);
add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0);
include_once(G5_LIB_PATH.'/thumbnail.lib.php');
$view_content = get_view_thumbnail($view['content']);
if (!function_exists('daemon_day_upbit_extract_wr_id')) {
function daemon_day_upbit_extract_wr_id($href) {
if (!$href) return 0;
$query = parse_url($href, PHP_URL_QUERY);
if ($query) {
parse_str($query, $params);
if (!empty($params['wr_id'])) {
return (int)$params['wr_id'];
}
}
if (preg_match('/\/(\d+)(?:\/?(?:\?.*)?)?$/', $href, $m)) {
return (int)$m[1];
}
if (preg_match('/wr_id=(\d+)/', $href, $m)) {
return (int)$m[1];
}
return 0;
}
}
if (!function_exists('daemon_day_upbit_build_meta')) {
function daemon_day_upbit_build_meta($row) {
$is_run = ((string)$row['x2_run'] === '1' || strtolower((string)$row['x2_run']) === 'run' || (string)$row['x2_run'] === '실행');
$yoils = array("일", "월", "화", "수", "목", "금", "토");
$date_parts = array();
if (!empty($row['x2_month'])) $date_parts[] = $row['x2_month']."월";
if (!empty($row['x2_day'])) $date_parts[] = $row['x2_day']."일";
if (isset($row['x2_week']) && $row['x2_week'] !== '') {
$week_index = (int)$row['x2_week'];
$date_parts[] = (isset($yoils[$week_index]) ? $yoils[$week_index] : $row['x2_week'])."요일";
}
$schedule_info = !empty($date_parts) ? implode(" / ", $date_parts) : "-";
$is_all_day_1 = ((string)$row['x2_all_day_1'] === '1');
$is_all_day_2 = ((string)$row['x2_all_day_2'] === '1');
$is_all_day_3 = ((string)$row['x2_all_day_3'] === '1');
$trigger_mode = '기본 모드';
if ($is_all_day_1) {
$interval = trim((string)$row['x2_interval']);
$trigger_mode = '기본 옵션'.($interval !== '' ? ' · '.$interval.'분' : '');
} elseif ($is_all_day_2) {
$interval = trim((string)$row['x2_interval_2']);
$trigger_mode = '시간 옵션'.($interval !== '' ? ' · '.$interval.'분' : '');
} elseif ($is_all_day_3) {
$interval = trim((string)$row['x2_interval_3']);
$trigger_mode = '하락 옵션'.($interval !== '' ? ' · '.$interval.'분' : '');
}
$is_sell = ((string)$row['x2_sell'] === '1');
$ratio_val = '';
if (!empty($row['x2_profit_ratio']) && (string)$row['x2_profit_ratio'] !== '0') {
$ratio_val = $row['x2_profit_ratio'].'%';
} elseif (!empty($row['x2_loss_ratio']) && (string)$row['x2_loss_ratio'] !== '0') {
$ratio_val = $row['x2_loss_ratio'].'%';
}
return array(
'run' => $is_run ? 'ON' : 'OFF',
'run_class' => $is_run ? 'run' : 'stop',
'sell' => $is_sell,
'trade_type' => $is_sell ? '매도' : '매수',
'ratio' => !empty($ratio_val) ? $ratio_val : '-',
'coin' => !empty($row['x2_coin']) ? $row['x2_coin'] : '-',
'amount' => number_format((int)$row['wr_subject']).'원',
'category' => !empty($row['ca_name']) ? $row['ca_name'] : '-',
'type' => !empty($row['x2_ca2']) ? $row['x2_ca2'] : '-',
'period' => !empty($row['x2_ca3']) ? $row['x2_ca3'] : '-',
'schedule' => $schedule_info,
'trigger' => $trigger_mode
);
}
}
$current_meta = daemon_day_upbit_build_meta($view);
$prev_meta = null;
$next_meta = null;
if (!empty($prev_href)) {
$prev_wr_id = daemon_day_upbit_extract_wr_id($prev_href);
if ($prev_wr_id > 0) {
$prev_row = sql_fetch(" select wr_subject, ca_name, x2_run, x2_sell, x2_coin, x2_ca2, x2_ca3, x2_month, x2_day, x2_week, x2_all_day_1, x2_all_day_2, x2_all_day_3, x2_interval, x2_interval_2, x2_interval_3, x2_profit_ratio, x2_loss_ratio from {$write_table} where wr_id = '{$prev_wr_id}' ");
if ($prev_row && isset($prev_row['wr_subject'])) {
$prev_meta = daemon_day_upbit_build_meta($prev_row);
}
}
}
if (!empty($next_href)) {
$next_wr_id = daemon_day_upbit_extract_wr_id($next_href);
if ($next_wr_id > 0) {
$next_row = sql_fetch(" select wr_subject, ca_name, x2_run, x2_sell, x2_coin, x2_ca2, x2_ca3, x2_month, x2_day, x2_week, x2_all_day_1, x2_all_day_2, x2_all_day_3, x2_interval, x2_interval_2, x2_interval_3, x2_profit_ratio, x2_loss_ratio from {$write_table} where wr_id = '{$next_wr_id}' ");
if ($next_row && isset($next_row['wr_subject'])) {
$next_meta = daemon_day_upbit_build_meta($next_row);
}
}
}
?>
<div id="CYBER_LOADER">
<div class="load-text">데이터 로딩 중</div>
<div class="load-bar-wrap"><div class="load-bar"></div></div>
</div>
<div id="VIEW_WRAP">
<canvas id="space-canvas"></canvas>
<article class="view-container">
<div id="v_frame">
<div class="view-header">
<h2><i class="fa-solid fa-layer-group"></i> 상세 보기</h2>
<div class="view-meta">
ID: <?php echo $view['wr_id']; ?> | <i class="fa-regular fa-eye"></i> <?php echo number_format($view['wr_hit']); ?>
<a href="<?php echo $list_href; ?>" class="btn-action">목록</a>
<?php if ($update_href) { ?><a href="<?php echo $update_href; ?>" class="btn-action highlight">수정</a><?php } ?>
</div>
</div>
<div class="hero-panel">
<?php
$hero_symbol = !empty($view['x2_coin']) ? str_replace('KRW-', '', $view['x2_coin']) : '-';
$hero_is_sell = ((string)$view['x2_sell'] === '1');
$hero_trade_class = $hero_is_sell ? 'hero-sell' : 'hero-buy';
$hero_trade_label = $hero_is_sell ? '매도' : '매수';
$hero_opts = [];
if (!empty($view['x2_ca2'])) $hero_opts[] = ['label' => '주문형태', 'val' => $view['x2_ca2']];
if (!empty($view['x2_ca3'])) $hero_opts[] = ['label' => '전략기간', 'val' => $view['x2_ca3']];
if (!empty($view['x2_down_price']) && (string)$view['x2_down_price'] !== '0') {
$hero_opts[] = ['label' => '특정금액', 'val' => number_format($view['x2_down_price']).'원'];
}
if (!empty($view['x2_profit_ratio']) && (string)$view['x2_profit_ratio'] !== '0') {
$hero_opts[] = ['label' => '수익비율', 'val' => $view['x2_profit_ratio'].'%'];
} elseif (!empty($view['x2_loss_ratio']) && (string)$view['x2_loss_ratio'] !== '0') {
$hero_opts[] = ['label' => '손실비율', 'val' => $view['x2_loss_ratio'].'%'];
}
if (!empty($view['x2_ver'])) $hero_opts[] = ['label' => 'VER', 'val' => $view['x2_ver']];
?>
<div class="hero-coin-wrap">
<i class="fa-solid fa-coins hero-coin-icon"></i>
<span class="hero-coin-name"><?php echo get_text($hero_symbol); ?></span>
</div>
<div class="hero-trade-badge <?php echo $hero_trade_class; ?>"><?php echo $hero_trade_label; ?></div>
<?php if (!empty($hero_opts)) { ?>
<div class="hero-options-wrap">
<?php foreach ($hero_opts as $opt) { ?>
<span class="hero-opt-item">
<span class="hero-opt-label"><?php echo $opt['label']; ?></span>
<span class="hero-opt-val"><?php echo get_text($opt['val']); ?></span>
</span>
<?php } ?>
</div>
<?php } ?>
</div>
<div class="data-grid-system">
<div class="data-box metric-run">
<span class="data-label">실행 상태</span>
<div class="data-value"><span class="status-badge <?php echo $current_meta['run_class']; ?>"><?php echo $current_meta['run']; ?></span></div>
</div>
<div class="data-box metric-trade">
<span class="data-label">매매 형태</span>
<div class="data-value"><span class="trade-badge <?php echo $current_meta['sell'] ? 'trade-sell' : 'trade-buy'; ?>"><?php echo $current_meta['trade_type']; ?></span></div>
</div>
<div class="data-box metric-coin">
<span class="data-label">코인 종목</span>
<span class="data-value value-strong coin-value"><i class="fa-solid fa-coins"></i> <?php echo get_text($current_meta['coin']); ?></span>
</div>
<div class="data-box metric-amount">
<span class="data-label">목표 금액</span>
<span class="data-value price-value"><?php echo $current_meta['amount']; ?></span>
</div>
<div class="data-box">
<span class="data-label">카테고리</span>
<span class="data-value value-strong"><?php echo get_text($current_meta['category']); ?></span>
</div>
<div class="data-box">
<span class="data-label">주문 형태</span>
<span class="data-value value-strong"><?php echo get_text($current_meta['type']); ?></span>
</div>
<div class="data-box">
<span class="data-label">전략 기간</span>
<span class="data-value value-strong"><?php echo get_text($current_meta['period']); ?></span>
</div>
<div class="data-box">
<span class="data-label">일정 정보</span>
<span class="data-value data-value-small"><?php echo get_text($current_meta['schedule']); ?></span>
</div>
<div class="data-box">
<span class="data-label">매매 간격</span>
<?php
if ($view['x2_interval']) {
$x2_interval = $view['x2_interval']."분";
} else if ($view['x2_interval_2']) {
$x2_interval = $view['x2_interval_2']."분";
} else if ($view['x2_interval_3']) {
$x2_interval = $view['x2_interval_3']."분";
} else {
$x2_interval = '-';
}
?>
<span class="data-value data-value-small"><?php echo $x2_interval; ?></span>
</div>
<div class="data-box">
<span class="data-label">특정 금액</span>
<span class="data-value data-value-small"><?php if (!empty($view['x2_down_price']) && (string)$view['x2_down_price'] !== '0') echo number_format($view['x2_down_price']).'원'; else echo '-'; ?></span>
</div>
<div class="data-box">
<span class="data-label">특정 비율</span>
<span class="data-value data-value-small"><?php echo get_text($current_meta['ratio']); ?></span>
</div>
<div class="data-box metric-amount">
<span class="data-label">트리거 모드</span>
<span class="data-value"><?php echo get_text($current_meta['trigger']); ?></span>
</div>
</div>
<div class="view-subject">
등록 일시: <?php echo $view['wr_datetime']; ?>
</div>
<div class="view-content">
<div id="bo_v_atc">
<?php
if ($view['file']['count']) {
echo '<div id="bo_v_img">';
for ($i=0; $i<count($view['file']); $i++) {
if (isset($view['file'][$i]['view']) && $view['file'][$i]['view']) {
echo get_view_thumbnail($view['file'][$i]['view']);
}
}
echo '</div>';
}
?>
<div id="bo_v_con">
<?php echo $view_content; ?>
</div>
</div>
</div>
<div class="same-coin-section">
<?php
$same_coin = !empty($view['x2_coin']) ? $view['x2_coin'] : '';
$same_coin_rows = [];
if ($same_coin) {
$same_coin_esc = sql_real_escape_string($same_coin);
$same_result = sql_query(" SELECT wr_id, wr_subject, x2_coin, x2_run, x2_sell, x2_ca2, x2_ca3, x2_all_day_1, x2_all_day_2, x2_all_day_3, x2_all_day_4, x2_all_day_5, x2_all_day_6, x2_all_day_7, x2_interval, x2_interval_2, x2_interval_3, x2_interval_4, x2_interval_5, x2_interval_6, x2_interval_7, x2_down_price, x2_profit_ratio, x2_loss_ratio, x2_ver FROM {$write_table} WHERE x2_coin = '{$same_coin_esc}' AND wr_is_comment = 0 AND wr_id != '{$view['wr_id']}' ORDER BY x2_run DESC, wr_id DESC LIMIT 20 ");
if ($same_result) {
while ($same_r = sql_fetch_array($same_result)) {
$same_coin_rows[] = $same_r;
}
}
}
?>
<div class="same-coin-title"><i class="fa-solid fa-link"></i> 동일 종목코인</div>
<?php if (!empty($same_coin_rows)) { ?>
<ul class="same-coin-list">
<?php foreach ($same_coin_rows as $sr) {
$sr_symbol = str_replace('KRW-', '', $sr['x2_coin']);
$sr_is_run = ((string)$sr['x2_run'] === '1');
$sr_is_sell = ((string)$sr['x2_sell'] === '1');
$sr_opts = [];
if (!empty($sr['x2_ca2'])) $sr_opts[] = $sr['x2_ca2'];
if (!empty($sr['x2_ca3'])) $sr_opts[] = $sr['x2_ca3'];
// 트리거 모드
$sr_trigger = '';
for ($ad=1; $ad<=7; $ad++) {
if ((string)$sr['x2_all_day_'.$ad] === '1') {
$iv_key = 'x2_interval'.($ad > 1 ? '_'.$ad : '');
$iv_val = !empty($sr[$iv_key]) ? $sr[$iv_key].'분' : '';
$mode_labels = ['1'=>'시간','2'=>'하락','3'=>'금액','4'=>'손실','5'=>'수익구간','6'=>'수익비율','7'=>'손실비율'];
$sr_trigger = ($mode_labels[(string)$ad] ?? '#'.$ad).($iv_val ? ' '.$iv_val : '');
break;
}
}
if (!empty($sr['x2_down_price']) && (string)$sr['x2_down_price'] !== '0') $sr_opts[] = number_format($sr['x2_down_price']).'원';
if (!empty($sr['x2_profit_ratio']) && (string)$sr['x2_profit_ratio'] !== '0') $sr_opts[] = '수익'.$sr['x2_profit_ratio'].'%';
elseif (!empty($sr['x2_loss_ratio']) && (string)$sr['x2_loss_ratio'] !== '0') $sr_opts[] = '손실'.$sr['x2_loss_ratio'].'%';
if ($sr_trigger) $sr_opts[] = $sr_trigger;
if (!empty($sr['x2_ver'])) $sr_opts[] = 'v'.$sr['x2_ver'];
$sr_href = get_pretty_url($bo_table, '', 'wr_id='.$sr['wr_id']);
?>
<li class="same-coin-item">
<a href="<?php echo $sr_href; ?>" class="same-coin-link">
<span class="sc-run-dot <?php echo $sr_is_run ? 'sc-run-on' : 'sc-run-off'; ?>"></span>
<span class="sc-symbol"><?php echo get_text($sr_symbol); ?></span>
<span class="sc-trade <?php echo $sr_is_sell ? 'sc-sell' : 'sc-buy'; ?>"><?php echo $sr_is_sell ? '매도' : '매수'; ?></span>
<span class="sc-amount"><?php echo number_format((int)$sr['wr_subject']); ?>원</span>
<?php if (!empty($sr_opts)) { ?>
<span class="sc-opts"><?php echo implode(' · ', array_map('get_text', $sr_opts)); ?></span>
<?php } ?>
</a>
</li>
<?php } ?>
</ul>
<?php } else { ?>
<p class="same-coin-empty">동일 종목의 다른 설정이 없습니다.</p>
<?php } ?>
</div>
<section class="view-tags-section">
<div class="tag-chip-wrap">
<span class="tags-title"><i class="fa-solid fa-tag"></i> 태그 : </span>
<?php
$raw_tags = trim((string)$view['x2_tag']);
$tag_items = array_filter(array_map('trim', preg_split('/\s*,\s*/u', $raw_tags)));
$tag_items = array_values(array_unique($tag_items));
if (count($tag_items) > 0) {
foreach ($tag_items as $tag) {
$tag_text = ltrim($tag, '#');
if ($tag_text === '') continue;
$tag_href = get_pretty_url($bo_table, '', 'sfl=x2_tag&stx='.urlencode($tag_text));
echo '<a href="'.$tag_href.'" class="tag-chip">#'.get_text($tag_text).'</a>';
}
} else {
echo '<span class="tag-empty">등록된 태그 없음</span>';
}
?>
</div>
</section>
<div class="view-footer">
<div class="btn-group">
<a href="<?php echo $list_href; ?>" class="btn-action btn-w200">목록</a>
<?php if ($write_href) { ?><a href="<?php echo $write_href; ?>" class="btn-action highlight btn-w200">등록</a><?php } ?>
</div>
<div class="btn-group">
<?php if ($update_href) { ?><a href="<?php echo $update_href; ?>" class="btn-action highlight btn-w200">수정</a><?php } ?>
<?php if ($delete_href) { ?><a href="<?php echo $delete_href; ?>" class="btn-action" onclick="return confirm('정말 삭제하시겠습니까?');">삭제</a><?php } ?>
</div>
</div>
<nav class="view-nav">
<?php if ($prev_href) { ?>
<a href="<?php echo $prev_href; ?>" class="nav-card nav-prev">
<span class="nav-label"><i class="fa-solid fa-arrow-left"></i> 이전 글</span>
<div class="nav-subject"><?php echo $prev_wr_subject; ?></div>
<div class="nav-meta-grid">
<span><b>실행 상태</b> <?php echo $prev_meta ? get_text($prev_meta['run']) : '-'; ?></span>
<span><b>코인 종목</b> <?php echo $prev_meta ? get_text($prev_meta['coin']) : '-'; ?></span>
<span><b>목표 금액</b> <?php echo $prev_meta ? get_text($prev_meta['amount']) : '-'; ?></span>
<span><b>카테고리</b> <?php echo $prev_meta ? get_text($prev_meta['category']) : '-'; ?></span>
<span><b>주문 형태</b> <?php echo $prev_meta ? get_text($prev_meta['type']) : '-'; ?></span>
<span><b>전략 기간</b> <?php echo $prev_meta ? get_text($prev_meta['period']) : '-'; ?></span>
<span><b>일정 정보</b> <?php echo $prev_meta ? get_text($prev_meta['schedule']) : '-'; ?></span>
<span><b>트리거 모드</b> <?php echo $prev_meta ? get_text($prev_meta['trigger']) : '-'; ?></span>
</div>
</a>
<?php } ?>
<?php if ($next_href) { ?>
<a href="<?php echo $next_href; ?>" class="view-nav-next nav-card nav-next">
<span class="nav-label">다음 글 <i class="fa-solid fa-arrow-right"></i></span>
<div class="nav-subject"><?php echo $next_wr_subject; ?></div>
<div class="nav-meta-grid">
<span><b>실행 상태</b> <?php echo $next_meta ? get_text($next_meta['run']) : '-'; ?></span>
<span><b>코인 종목</b> <?php echo $next_meta ? get_text($next_meta['coin']) : '-'; ?></span>
<span><b>목표 금액</b> <?php echo $next_meta ? get_text($next_meta['amount']) : '-'; ?></span>
<span><b>카테고리</b> <?php echo $next_meta ? get_text($next_meta['category']) : '-'; ?></span>
<span><b>주문 형태</b> <?php echo $next_meta ? get_text($next_meta['type']) : '-'; ?></span>
<span><b>전략 기간</b> <?php echo $next_meta ? get_text($next_meta['period']) : '-'; ?></span>
<span><b>일정 정보</b> <?php echo $next_meta ? get_text($next_meta['schedule']) : '-'; ?></span>
<span><b>트리거 모드</b> <?php echo $next_meta ? get_text($next_meta['trigger']) : '-'; ?></span>
</div>
</a>
<?php } ?>
</nav>
</div>
</article>
</div>
<script src="<?php echo G5_JS_URL; ?>/viewimageresize.js"></script>
<script>
window.addEventListener('load', function() {
const loader = document.getElementById('CYBER_LOADER');
setTimeout(() => {
loader.style.opacity = '0';
setTimeout(() => loader.style.visibility = 'hidden', 500);
}, 800);
});
$(function() {
$(".view-content img").viewimageresize();
function updateLiveClock() {
const target = document.getElementById('LIVE_CLOCK_TIME');
if (!target) return;
const now = new Date();
const hh = String(now.getHours()).padStart(2, '0');
const mm = String(now.getMinutes()).padStart(2, '0');
const ss = String(now.getSeconds()).padStart(2, '0');
target.textContent = hh + ':' + mm + ':' + ss;
}
updateLiveClock();
setInterval(updateLiveClock, 1000);
const canvas = document.getElementById('space-canvas');
const ctx = canvas.getContext('2d');
let stars = [];
function initSpace() {
canvas.width = window.innerWidth; canvas.height = window.innerHeight; stars = [];
for(let i=0; i<80; i++) stars.push({ x: Math.random() * canvas.width, y: Math.random() * canvas.height, size: Math.random() * 1.2, speed: Math.random() * 0.15 });
}
function animateSpace() {
ctx.clearRect(0, 0, canvas.width, canvas.height); ctx.fillStyle = "rgba(148, 163, 184, 0.3)";
stars.forEach(star => {
ctx.beginPath(); ctx.arc(star.x, star.y, star.size, 0, Math.PI*2); ctx.fill();
star.y += star.speed; if(star.y > canvas.height) star.y = 0;
});
requestAnimationFrame(animateSpace);
}
window.addEventListener('resize', initSpace);
initSpace(); animateSpace();
});
</script>