38271-vm/index.php
Flatlogic Bot 7174e34e88 财神
2026-02-07 13:55:25 +00:00

195 lines
8.9 KiB
PHP

<?php
require_once __DIR__ . '/db/config.php';
require_once __DIR__ . '/db/init.php'; // Run init on first load
$pdo = db();
// Get settings
$settings = [];
$stmt = $pdo->query("SELECT setting_key, setting_value FROM settings");
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
$settings[$row['setting_key']] = $row['setting_value'];
}
$site_title = $settings['site_title'] ?? '财神组聊天框架';
$tg_link = $settings['tg_link'] ?? 'https://t.me/zhangshihao818';
$footer_copy = $settings['footer_copy'] ?? '© 2026 财神组聊天框架构造. 内部资料,翻版必究。';
$watermark_text = $settings['watermark_text'] ?? '财神组专用字体';
$site_logo = $settings['site_logo'] ?? 'assets/pasted-20260207-134833-7329dc42.jpg';
// Get current day from URL
$current_day = isset($_GET['day']) ? (int)$_GET['day'] : 1;
if ($current_day < 1 || $current_day > 7) $current_day = 1;
// Fetch step data
$stmt = $pdo->prepare("SELECT * FROM steps WHERE day_number = ?");
$stmt->execute([$current_day]);
$step = $stmt->fetch(PDO::FETCH_ASSOC);
if (!$step) {
$step = [
'day_number' => $current_day,
'title' => "{$current_day}天:步骤加载中",
'what_to_chat' => '暂无内容',
'how_to_chat' => '暂无内容',
'why_to_chat' => '暂无内容',
'correct_example' => '暂无内容',
'wrong_example' => '暂无内容',
'correct_explanation' => '暂无内容',
'wrong_explanation' => '暂无内容',
'image_url' => ''
];
}
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?php echo htmlspecialchars($site_title); ?></title>
<link rel="icon" type="image/jpeg" href="<?php echo htmlspecialchars($site_logo); ?>">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
</head>
<body>
<!-- Watermark -->
<div class="watermark-container">
<div class="watermark-text">
<?php for($i=0; $i<100; $i++): ?>
<span class="watermark-item"><?php echo htmlspecialchars($watermark_text); ?></span>
<?php endfor; ?>
</div>
</div>
<!-- Floating TG -->
<div class="tg-float">
<a href="<?php echo htmlspecialchars($tg_link); ?>" target="_blank" class="tg-btn">
<i class="bi bi-telegram"></i>
</a>
<span class="tg-text">联系客服</span>
</div>
<!-- Back to Top -->
<button id="back-to-top" class="btn btn-warning rounded-circle shadow">
<i class="bi bi-arrow-up"></i>
</button>
<div class="wrapper">
<!-- Sidebar -->
<nav id="sidebar">
<div class="sidebar-header">
<?php if($site_logo): ?>
<img src="<?php echo htmlspecialchars($site_logo); ?>" alt="Logo" class="img-fluid mb-2" style="max-height: 80px; border-radius: 10px;">
<?php endif; ?>
<h3><?php echo htmlspecialchars($site_title); ?></h3>
</div>
<ul class="list-unstyled components">
<?php for($i=1; $i<=7; $i++): ?>
<li class="<?php echo $current_day == $i ? 'active' : ''; ?>">
<a href="index.php?day=<?php echo $i; ?>">
<i class="bi bi-calendar-check"></i> 第 <?php echo $i; ?> 天:步骤
</a>
</li>
<?php endfor; ?>
<hr class="mx-3 opacity-25">
<li>
<a href="login.php"><i class="bi bi-shield-lock"></i> 管理后台</a>
</li>
</ul>
</nav>
<!-- Page Content -->
<div id="content">
<div class="container-fluid">
<div class="d-flex justify-content-between align-items-center mb-4">
<h2><?php echo htmlspecialchars($step['title']); ?> <span class="step-badge">Day <?php echo $current_day; ?></span></h2>
<button type="button" id="sidebarCollapse" class="btn btn-dark d-md-none">
<i class="bi bi-list"></i>
</button>
</div>
<div class="row">
<div class="col-lg-8">
<div class="card">
<div class="card-header"><i class="bi bi-chat-quote-fill me-2 text-warning"></i> 聊什么 (Content)</div>
<div class="card-body">
<p><?php echo nl2br(htmlspecialchars($step['what_to_chat'] ?? '')); ?></p>
</div>
</div>
<div class="card">
<div class="card-header"><i class="bi bi-info-circle-fill me-2 text-info"></i> 为什么要这样聊 (Reasoning)</div>
<div class="card-body">
<p><?php echo nl2br(htmlspecialchars($step['why_to_chat'] ?? '')); ?></p>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="card border-success">
<div class="card-header bg-success text-white"><i class="bi bi-check-circle-fill me-2"></i> 正确做法</div>
<div class="card-body">
<div class="example-box correct-box">
<strong>示例:</strong><br>
<?php echo nl2br(htmlspecialchars($step['correct_example'] ?? '')); ?>
</div>
<strong>解释:</strong><br>
<?php echo nl2br(htmlspecialchars($step['correct_explanation'] ?? '')); ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="card border-danger">
<div class="card-header bg-danger text-white"><i class="bi bi-x-circle-fill me-2"></i> 错误做法</div>
<div class="card-body">
<div class="example-box wrong-box">
<strong>示例:</strong><br>
<?php echo nl2br(htmlspecialchars($step['wrong_example'] ?? '')); ?>
</div>
<strong>解释:</strong><br>
<?php echo nl2br(htmlspecialchars($step['wrong_explanation'] ?? '')); ?>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-4">
<div class="card">
<div class="card-header"><i class="bi bi-lightning-fill me-2 text-warning"></i> 怎么去聊 (Technique)</div>
<div class="card-body">
<p><?php echo nl2br(htmlspecialchars($step['how_to_chat'] ?? '')); ?></p>
</div>
</div>
<div class="card">
<div class="card-header"><i class="bi bi-image me-2 text-primary"></i> 聊天示例图</div>
<div class="card-body text-center">
<?php if(!empty($step['image_url'])): ?>
<img src="<?php echo htmlspecialchars($step['image_url']); ?>" class="img-fluid rounded border" alt="Example">
<?php else: ?>
<div class="py-5 bg-light text-muted rounded">
<i class="bi bi-image" style="font-size: 3rem;"></i><br>
示例图片后续上传
</div>
<?php endif; ?>
</div>
</div>
</div>
</div>
<footer>
<p class="text-muted"><?php echo $footer_copy; ?></p>
</footer>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
</body>
</html>