前后完整

This commit is contained in:
Flatlogic Bot 2026-02-26 12:39:58 +00:00
parent 0da7358bbb
commit a32842e568
19 changed files with 1798 additions and 43 deletions

120
admin/admins.php Normal file
View File

@ -0,0 +1,120 @@
<?php
require_once __DIR__ . '/header.php';
$pdo = db();
$action = $_GET['action'] ?? 'list';
$id = $_GET['id'] ?? null;
// Handle Delete
if ($action === 'delete' && $id) {
// Prevent deleting self
if ($id == $_SESSION['admin_user']['id']) {
header('Location: admins.php?msg=err_self');
exit;
}
$stmt = $pdo->prepare("DELETE FROM admin_users WHERE id = ?");
$stmt->execute([$id]);
header('Location: admins.php?msg=deleted');
exit;
}
// Handle Save
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$username = $_POST['username'];
$nickname = $_POST['nickname'];
$password = $_POST['password'];
if ($id) {
if (!empty($password)) {
$stmt = $pdo->prepare("UPDATE admin_users SET username=?, nickname=?, password=? WHERE id=?");
$stmt->execute([$username, $nickname, password_hash($password, PASSWORD_DEFAULT), $id]);
} else {
$stmt = $pdo->prepare("UPDATE admin_users SET username=?, nickname=? WHERE id=?");
$stmt->execute([$username, $nickname, $id]);
}
} else {
$stmt = $pdo->prepare("INSERT INTO admin_users (username, nickname, password) VALUES (?, ?, ?)");
$stmt->execute([$username, $nickname, password_hash($password, PASSWORD_DEFAULT)]);
}
header('Location: admins.php?msg=saved');
exit;
}
// Fetch list
$admins = $pdo->query("SELECT * FROM admin_users ORDER BY id DESC")->fetchAll();
// Fetch for edit
$item = null;
if ($action === 'edit' && $id) {
$stmt = $pdo->prepare("SELECT * FROM admin_users WHERE id = ?");
$stmt->execute([$id]);
$item = $stmt->fetch();
}
?>
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<span><?= $action === 'edit' ? '编辑管理员' : ($action === 'add' ? '新增管理员' : '管理员列表') ?></span>
<?php if ($action === 'list'): ?>
<a href="admins.php?action=add" class="btn btn-sm btn-primary">新增管理员</a>
<?php else: ?>
<a href="admins.php" class="btn btn-sm btn-secondary">返回列表</a>
<?php endif; ?>
</div>
<div class="card-body">
<?php if ($action === 'list'): ?>
<div class="table-responsive">
<table class="table align-middle">
<thead>
<tr>
<th>ID</th>
<th>用户名</th>
<th>昵称</th>
<th>创建时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php foreach ($admins as $a): ?>
<tr>
<td><?= $a['id'] ?></td>
<td><strong><?= htmlspecialchars($a['username']) ?></strong></td>
<td><?= htmlspecialchars($a['nickname']) ?></td>
<td><?= $a['created_at'] ?></td>
<td>
<a href="admins.php?action=edit&id=<?= $a['id'] ?>" class="btn btn-sm btn-outline-primary"><i class="fas fa-edit"></i></a>
<?php if ($a['id'] != $_SESSION['admin_user']['id']): ?>
<a href="admins.php?action=delete&id=<?= $a['id'] ?>" class="btn btn-sm btn-outline-danger" onclick="return confirm('确定删除吗?')"><i class="fas fa-trash"></i></a>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php else: ?>
<form method="POST">
<div class="row">
<div class="col-md-6 mb-3">
<label class="form-label">用户名</label>
<input type="text" name="username" class="form-control" value="<?= htmlspecialchars($item['username'] ?? '') ?>" required>
</div>
<div class="col-md-6 mb-3">
<label class="form-label">昵称</label>
<input type="text" name="nickname" class="form-control" value="<?= htmlspecialchars($item['nickname'] ?? '') ?>" required>
</div>
<div class="col-md-12 mb-3">
<label class="form-label">密码 <?= $id ? '(留空不修改)' : '' ?></label>
<input type="password" name="password" class="form-control" <?= $id ? '' : 'required' ?>>
</div>
</div>
<div class="mt-4">
<button type="submit" class="btn btn-primary">保存修改</button>
<a href="admins.php" class="btn btn-light ms-2">取消</a>
</div>
</form>
<?php endif; ?>
</div>
</div>
<?php require_once __DIR__ . '/footer.php'; ?>

40
admin/auth.php Normal file
View File

@ -0,0 +1,40 @@
<?php
session_start();
require_once __DIR__ . '/../db/config.php';
function is_logged_in() {
return isset($_SESSION['admin_user']);
}
function require_login() {
if (!is_logged_in()) {
header('Location: login.php');
exit;
}
}
function login($username, $password) {
$pdo = db();
$stmt = $pdo->prepare("SELECT * FROM admin_users WHERE username = ?");
$stmt->execute([$username]);
$user = $stmt->fetch();
if ($user && password_verify($password, $user['password'])) {
$_SESSION['admin_user'] = [
'id' => $user['id'],
'username' => $user['username'],
'nickname' => $user['nickname'],
'avatar' => $user['avatar']
];
// Update last login
$stmt = $pdo->prepare("UPDATE admin_users SET last_login = NOW() WHERE id = ?");
$stmt->execute([$user['id']]);
return true;
}
return false;
}
function logout() {
unset($_SESSION['admin_user']);
session_destroy();
}

192
admin/cases.php Normal file
View File

@ -0,0 +1,192 @@
<?php
require_once __DIR__ . '/header.php';
$pdo = db();
$action = $_GET['action'] ?? 'list';
$id = $_GET['id'] ?? null;
// Handle Delete
if ($action === 'delete' && $id) {
$stmt = $pdo->prepare("DELETE FROM cases WHERE id = ?");
$stmt->execute([$id]);
header('Location: cases.php?msg=deleted');
exit;
}
// Handle Save (Add/Edit)
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$data = [
'title' => $_POST['title'],
'slug' => $_POST['slug'] ?: strtolower(preg_replace('/[^A-Za-z0-9-]+/', '-', $_POST['title'])),
'tag' => $_POST['tag'],
'category' => $_POST['category'],
'img' => $_POST['img'],
'description' => $_POST['description'],
'content' => $_POST['content'],
'challenge' => $_POST['challenge'],
'solution' => $_POST['solution'],
'result_stability' => $_POST['result_stability'],
'result_throughput' => $_POST['result_throughput'],
'result_cost' => $_POST['result_cost'],
'tech' => $_POST['tech'],
'is_featured' => isset($_POST['is_featured']) ? 1 : 0,
'sort_order' => (int)$_POST['sort_order']
];
if ($id) {
$sql = "UPDATE cases SET title=:title, slug=:slug, tag=:tag, category=:category, img=:img, description=:description, content=:content, challenge=:challenge, solution=:solution, result_stability=:result_stability, result_throughput=:result_throughput, result_cost=:result_cost, tech=:tech, is_featured=:is_featured, sort_order=:sort_order WHERE id=:id";
$data['id'] = $id;
} else {
$sql = "INSERT INTO cases (title, slug, tag, category, img, description, content, challenge, solution, result_stability, result_throughput, result_cost, tech, is_featured, sort_order) VALUES (:title, :slug, :tag, :category, :img, :description, :content, :challenge, :solution, :result_stability, :result_throughput, :result_cost, :tech, :is_featured, :sort_order)";
}
$stmt = $pdo->prepare($sql);
$stmt->execute($data);
header('Location: cases.php?msg=saved');
exit;
}
// Fetch cases for list
$cases = $pdo->query("SELECT * FROM cases ORDER BY sort_order ASC, created_at DESC")->fetchAll();
// Fetch case for edit
$case = null;
if ($action === 'edit' && $id) {
$stmt = $pdo->prepare("SELECT * FROM cases WHERE id = ?");
$stmt->execute([$id]);
$case = $stmt->fetch();
}
?>
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<span><?= $action === 'edit' ? '编辑案例' : ($action === 'add' ? '新增案例' : '案例列表') ?></span>
<?php if ($action === 'list'): ?>
<a href="cases.php?action=add" class="btn btn-sm btn-primary">新增案例</a>
<?php else: ?>
<a href="cases.php" class="btn btn-sm btn-secondary">返回列表</a>
<?php endif; ?>
</div>
<div class="card-body">
<?php if ($action === 'list'): ?>
<div class="table-responsive">
<table class="table align-middle">
<thead>
<tr>
<th>预览</th>
<th>标题 / 分类</th>
<th>标签</th>
<th>精选</th>
<th>排序</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php foreach ($cases as $c): ?>
<tr>
<td><img src="<?= htmlspecialchars($c['img']) ?>" width="60" class="rounded"></td>
<td>
<div><strong><?= htmlspecialchars($c['title']) ?></strong></div>
<div class="small text-muted"><?= htmlspecialchars($c['category']) ?></div>
</td>
<td><span class="badge badge-soft-primary"><?= htmlspecialchars($c['tag']) ?></span></td>
<td>
<?php if ($c['is_featured']): ?>
<span class="badge bg-success"></span>
<?php else: ?>
<span class="badge bg-light text-dark"></span>
<?php endif; ?>
</td>
<td><?= $c['sort_order'] ?></td>
<td>
<a href="cases.php?action=edit&id=<?= $c['id'] ?>" class="btn btn-sm btn-outline-primary"><i class="fas fa-edit"></i></a>
<a href="cases.php?action=delete&id=<?= $c['id'] ?>" class="btn btn-sm btn-outline-danger" onclick="return confirm('确定删除吗?')"><i class="fas fa-trash"></i></a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php else: ?>
<form method="POST">
<div class="row">
<div class="col-md-6 mb-3">
<label class="form-label">标题</label>
<input type="text" name="title" class="form-control" value="<?= htmlspecialchars($case['title'] ?? '') ?>" required>
</div>
<div class="col-md-6 mb-3">
<label class="form-label">Slug (URL标识)</label>
<input type="text" name="slug" class="form-control" value="<?= htmlspecialchars($case['slug'] ?? '') ?>" placeholder="留空自动生成">
</div>
<div class="col-md-4 mb-3">
<label class="form-label">分类</label>
<select name="category" class="form-select">
<?php
$categories = ['海外资金盘', '点赞盘', '刷单盘', '商城盘', '云矿机', '新能源', '投资理财', '反波胆', '微交易', '时间盘', '交易所', '各类小程序', '机器人', '落地页定制', '远控系统', '授权系统', '在线客服', '获取通讯录'];
foreach ($categories as $cat):
?>
<option value="<?= $cat ?>" <?= ($case['category'] ?? '') == $cat ? 'selected' : '' ?>><?= $cat ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="col-md-4 mb-3">
<label class="form-label">标签</label>
<input type="text" name="tag" class="form-control" value="<?= htmlspecialchars($case['tag'] ?? '') ?>">
</div>
<div class="col-md-4 mb-3">
<label class="form-label">排序</label>
<input type="number" name="sort_order" class="form-control" value="<?= $case['sort_order'] ?? 0 ?>">
</div>
<div class="col-md-12 mb-3">
<label class="form-label">预览图 URL</label>
<input type="text" name="img" class="form-control" value="<?= htmlspecialchars($case['img'] ?? '') ?>" required>
</div>
<div class="col-md-12 mb-3">
<label class="form-label">简短描述</label>
<textarea name="description" class="form-control" rows="2"><?= htmlspecialchars($case['description'] ?? '') ?></textarea>
</div>
<div class="col-md-12 mb-3">
<label class="form-label">详细内容</label>
<textarea name="content" class="form-control" rows="4"><?= htmlspecialchars($case['content'] ?? '') ?></textarea>
</div>
<div class="col-md-6 mb-3">
<label class="form-label">核心挑战</label>
<textarea name="challenge" class="form-control" rows="3"><?= htmlspecialchars($case['challenge'] ?? '') ?></textarea>
</div>
<div class="col-md-6 mb-3">
<label class="form-label">解决方案</label>
<textarea name="solution" class="form-control" rows="3"><?= htmlspecialchars($case['solution'] ?? '') ?></textarea>
</div>
<div class="col-md-4 mb-3">
<label class="form-label">稳定性指标</label>
<input type="text" name="result_stability" class="form-control" value="<?= htmlspecialchars($case['result_stability'] ?? '') ?>">
</div>
<div class="col-md-4 mb-3">
<label class="form-label">吞吐量指标</label>
<input type="text" name="result_throughput" class="form-control" value="<?= htmlspecialchars($case['result_throughput'] ?? '') ?>">
</div>
<div class="col-md-4 mb-3">
<label class="form-label">成本指标</label>
<input type="text" name="result_cost" class="form-control" value="<?= htmlspecialchars($case['result_cost'] ?? '') ?>">
</div>
<div class="col-md-12 mb-3">
<label class="form-label">技术栈 (逗号分隔)</label>
<input type="text" name="tech" class="form-control" value="<?= htmlspecialchars($case['tech'] ?? '') ?>">
</div>
<div class="col-md-12 mb-3">
<div class="form-check">
<input class="form-check-input" type="checkbox" name="is_featured" id="is_featured" <?= ($case['is_featured'] ?? 0) ? 'checked' : '' ?>>
<label class="form-check-label" for="is_featured">设置为精选 (首页显示)</label>
</div>
</div>
</div>
<div class="mt-4">
<button type="submit" class="btn btn-primary">保存修改</button>
<a href="cases.php" class="btn btn-light ms-2">取消</a>
</div>
</form>
<?php endif; ?>
</div>
</div>
<?php require_once __DIR__ . '/footer.php'; ?>

11
admin/footer.php Normal file
View File

@ -0,0 +1,11 @@
</div>
</div>
<!-- Bootstrap 5 JS Bundle -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
// Optional: Global JS for admin panel
</script>
</body>
</html>

327
admin/header.php Normal file
View File

@ -0,0 +1,327 @@
<?php
require_once __DIR__ . '/auth.php';
require_login();
$admin = $_SESSION['admin_user'];
$pdo = db();
// Fetch Website Settings for Logo & Favicon
$stmt = $pdo->query("SELECT * FROM website_settings");
$settings = [];
while ($row = $stmt->fetch()) {
$settings[$row['key']] = $row['value'];
}
$site_logo = $settings['site_logo'] ?? 'assets/images/logo.png';
$site_name = $settings['site_name'] ?? '智域科技';
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?= htmlspecialchars($site_name) ?> - 后台管理系统</title>
<!-- Favicon -->
<link rel="icon" href="../<?= htmlspecialchars($site_logo) ?>" type="image/x-icon">
<!-- Bootstrap 5 CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- Font Awesome -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<!-- Google Fonts: Ma Shan Zheng -->
<link href="https://fonts.googleapis.com/css2?family=Ma+Shan+Zheng&display=swap" rel="stylesheet">
<style>
:root {
--sidebar-bg: #ffffff;
--sidebar-text: #4b5563;
--sidebar-active-bg: #f3f4f6;
--sidebar-active-text: #0d6efd;
--sidebar-active-border: #0d6efd;
--main-bg: #f8f9fa;
--card-border-radius: 12px;
}
body {
font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
background-color: var(--main-bg);
margin: 0;
display: flex;
min-height: 100vh;
}
/* Sidebar Style */
.sidebar {
width: 260px;
background-color: var(--sidebar-bg);
color: var(--sidebar-text);
flex-shrink: 0;
display: flex;
flex-direction: column;
position: sticky;
top: 0;
height: 100vh;
z-index: 1000;
transition: all 0.3s;
border-right: 1px solid #edf2f9;
}
.sidebar-header {
padding: 24px;
border-bottom: 1px solid #edf2f9;
display: flex;
align-items: center;
}
.sidebar-brand {
font-family: 'Ma Shan Zheng', cursive;
font-size: 1.5rem;
color: #333;
text-decoration: none;
display: flex;
align-items: center;
}
.sidebar-brand span:nth-child(1) { color: #3b82f6; }
.sidebar-brand span:nth-child(2) { color: #10b981; }
.sidebar-brand span:nth-child(3) { color: #f59e0b; }
.sidebar-brand span:nth-child(4) { color: #ef4444; }
.sidebar-nav {
padding: 16px 0;
flex-grow: 1;
overflow-y: auto;
}
.nav-item {
list-style: none;
padding: 4px 16px;
}
.nav-link {
display: flex;
align-items: center;
padding: 12px 16px;
color: var(--sidebar-text);
text-decoration: none;
border-radius: 8px;
transition: all 0.2s;
font-size: 0.95rem;
}
.nav-link i {
width: 20px;
margin-right: 12px;
font-size: 1.1rem;
text-align: center;
}
.nav-link:hover {
background-color: #f9fafb;
color: var(--sidebar-active-text);
}
.nav-link.active {
background-color: var(--sidebar-active-bg);
color: var(--sidebar-active-text);
font-weight: 600;
}
.nav-link.active i {
color: var(--sidebar-active-border);
}
.nav-group-title {
padding: 16px 32px 8px;
font-size: 0.75rem;
text-transform: uppercase;
letter-spacing: 1px;
color: #9ca3af;
}
/* Main Content */
.content-wrapper {
flex-grow: 1;
display: flex;
flex-direction: column;
overflow-x: hidden;
}
.top-navbar {
height: 70px;
background: #fff;
padding: 0 24px;
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 1px solid #edf2f9;
position: sticky;
top: 0;
z-index: 999;
}
.main-content {
padding: 24px;
}
/* UI Components */
.card {
border: none;
border-radius: var(--card-border-radius);
box-shadow: 0 0.75rem 1.5rem rgba(18, 38, 63, 0.03);
margin-bottom: 24px;
}
.card-header {
background-color: transparent;
border-bottom: 1px solid #edf2f9;
padding: 16px 24px;
font-weight: 600;
}
.btn-primary {
background-color: #0d6efd;
border-color: #0d6efd;
padding: 8px 20px;
border-radius: 8px;
}
.table thead th {
background-color: #f8f9fa;
font-weight: 600;
text-transform: uppercase;
font-size: 0.75rem;
letter-spacing: 0.5px;
color: #7c8db5;
padding: 12px 24px;
}
.table tbody td {
padding: 16px 24px;
vertical-align: middle;
}
.badge-soft-success { background-color: #d1e7dd; color: #0f5132; }
.badge-soft-primary { background-color: #cfe2ff; color: #084298; }
/* Animation */
.fade-in {
animation: fadeIn 0.5s ease-in-out;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
</style>
</head>
<body>
<div class="sidebar">
<div class="sidebar-header">
<a href="index.php" class="sidebar-brand">
<img src="../<?= htmlspecialchars($site_logo) ?>" alt="Logo" height="30" class="me-2">
<span></span><span></span><span></span><span></span>
</a>
</div>
<div class="sidebar-nav">
<ul class="nav flex-column">
<li class="nav-item">
<a href="index.php" class="nav-link <?= basename($_SERVER['PHP_SELF']) == 'index.php' ? 'active' : '' ?>">
<i class="fas fa-chart-line"></i> 仪表盘
</a>
</li>
<li class="nav-group-title">内容管理</li>
<li class="nav-item">
<a href="cases.php" class="nav-link <?= basename($_SERVER['PHP_SELF']) == 'cases.php' ? 'active' : '' ?>">
<i class="fas fa-briefcase"></i> 声誉作品 (案例)
</a>
</li>
<li class="nav-item">
<a href="services.php" class="nav-link <?= basename($_SERVER['PHP_SELF']) == 'services.php' ? 'active' : '' ?>">
<i class="fas fa-cube"></i> 核心能力 (服务)
</a>
</li>
<li class="nav-item">
<a href="tech_stack.php" class="nav-link <?= basename($_SERVER['PHP_SELF']) == 'tech_stack.php' ? 'active' : '' ?>">
<i class="fas fa-layer-group"></i> 技术底座
</a>
</li>
<li class="nav-item">
<a href="pricing.php" class="nav-link <?= basename($_SERVER['PHP_SELF']) == 'pricing.php' ? 'active' : '' ?>">
<i class="fas fa-tags"></i> 报价方案
</a>
</li>
<li class="nav-item">
<a href="transformations.php" class="nav-link <?= basename($_SERVER['PHP_SELF']) == 'transformations.php' ? 'active' : '' ?>">
<i class="fas fa-rocket"></i> 转型实践
</a>
</li>
<li class="nav-group-title">咨询与联系</li>
<li class="nav-item">
<a href="leads.php" class="nav-link <?= basename($_SERVER['PHP_SELF']) == 'leads.php' ? 'active' : '' ?>">
<i class="fas fa-headset"></i> 咨询记录 (Leads)
</a>
</li>
<li class="nav-item">
<a href="settings.php?group=contact" class="nav-link <?= ($_GET['group'] ?? '') == 'contact' ? 'active' : '' ?>">
<i class="fas fa-address-book"></i> 联系方式
</a>
</li>
<li class="nav-group-title">系统管理</li>
<li class="nav-item">
<a href="settings.php?group=general" class="nav-link <?= ($_GET['group'] ?? '') == 'general' ? 'active' : '' ?>">
<i class="fas fa-cog"></i> 基础设置
</a>
</li>
<li class="nav-item">
<a href="settings.php?group=seo" class="nav-link <?= ($_GET['group'] ?? '') == 'seo' ? 'active' : '' ?>">
<i class="fas fa-search"></i> SEO设置
</a>
</li>
<li class="nav-item">
<a href="admins.php" class="nav-link <?= basename($_SERVER['PHP_SELF']) == 'admins.php' ? 'active' : '' ?>">
<i class="fas fa-users-cog"></i> 管理员
</a>
</li>
</ul>
</div>
<div class="sidebar-footer p-3 border-top">
<a href="logout.php" class="btn btn-outline-danger w-100 btn-sm">
<i class="fas fa-sign-out-alt"></i> 退出登录
</a>
</div>
</div>
<div class="content-wrapper">
<div class="top-navbar">
<div class="d-flex align-items-center">
<h4 class="mb-0 fw-bold"><?php
$titles = [
'index.php' => '仪表盘',
'cases.php' => '案例管理',
'services.php' => '服务管理',
'tech_stack.php' => '技术底座',
'pricing.php' => '报价方案',
'transformations.php' => '转型实践',
'leads.php' => '咨询记录',
'settings.php' => '网站设置',
'admins.php' => '管理员管理',
'profile.php' => '个人资料'
];
echo $titles[basename($_SERVER['PHP_SELF'])] ?? '后台管理';
?></h4>
</div>
<div class="d-flex align-items-center">
<div class="dropdown">
<a href="#" class="d-flex align-items-center text-dark text-decoration-none dropdown-toggle" data-bs-toggle="dropdown">
<img src="../<?= htmlspecialchars($site_logo) ?>" alt="" width="32" height="32" class="rounded-circle me-2">
<strong><?= htmlspecialchars($admin['nickname'] ?? $admin['username']) ?></strong>
</a>
<ul class="dropdown-menu dropdown-menu-end shadow border-0">
<li><a class="dropdown-item" href="profile.php"><i class="fas fa-user-edit me-2"></i> 个人资料</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item text-danger" href="logout.php"><i class="fas fa-sign-out-alt me-2"></i> 退出登录</a></li>
</ul>
</div>
</div>
</div>
<div class="main-content fade-in">

126
admin/index.php Normal file
View File

@ -0,0 +1,126 @@
<?php
require_once __DIR__ . '/header.php';
$pdo = db();
// Get counts for dashboard
$case_count = $pdo->query("SELECT COUNT(*) FROM cases")->fetchColumn();
$service_count = $pdo->query("SELECT COUNT(*) FROM services")->fetchColumn();
$lead_count = $pdo->query("SELECT COUNT(*) FROM leads")->fetchColumn();
$tech_count = $pdo->query("SELECT COUNT(*) FROM tech_stack")->fetchColumn();
// Get recent leads
$recent_leads = $pdo->query("SELECT * FROM leads ORDER BY created_at DESC LIMIT 5")->fetchAll();
?>
<div class="row mb-4">
<div class="col-md-3">
<div class="card stats-card h-100">
<div class="stats-icon icon-blue">
<i class="fas fa-briefcase"></i>
</div>
<div>
<h3 class="mb-0 fw-bold"><?= $case_count ?></h3>
<p class="text-muted mb-0">声誉作品</p>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card stats-card h-100">
<div class="stats-icon icon-green">
<i class="fas fa-cube"></i>
</div>
<div>
<h3 class="mb-0 fw-bold"><?= $service_count ?></h3>
<p class="text-muted mb-0">核心能力</p>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card stats-card h-100">
<div class="stats-icon icon-orange">
<i class="fas fa-headset"></i>
</div>
<div>
<h3 class="mb-0 fw-bold"><?= $lead_count ?></h3>
<p class="text-muted mb-0">咨询记录</p>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card stats-card h-100">
<div class="stats-icon icon-red">
<i class="fas fa-layer-group"></i>
</div>
<div>
<h3 class="mb-0 fw-bold"><?= $tech_count ?></h3>
<p class="text-muted mb-0">技术底座</p>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-8">
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<span>最新咨询记录</span>
<a href="leads.php" class="btn btn-sm btn-link">查看全部</a>
</div>
<div class="card-body p-0">
<div class="table-responsive">
<table class="table table-hover mb-0">
<thead>
<tr>
<th>客户姓名</th>
<th>联系方式</th>
<th>咨询时间</th>
<th>状态</th>
</tr>
</thead>
<tbody>
<?php foreach ($recent_leads as $lead): ?>
<tr>
<td><?= htmlspecialchars($lead['name']) ?></td>
<td><?= htmlspecialchars($lead['email'] ?: $lead['phone']) ?></td>
<td><?= date('Y-m-d H:i', strtotime($lead['created_at'])) ?></td>
<td><span class="badge badge-soft-primary">待处理</span></td>
</tr>
<?php endforeach; if (empty($recent_leads)): ?>
<tr>
<td colspan="4" class="text-center py-4">暂无数据</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="col-lg-4">
<div class="card">
<div class="card-header">系统信息</div>
<div class="card-body">
<ul class="list-group list-group-flush">
<li class="list-group-item d-flex justify-content-between align-items-center px-0">
<span>PHP 版本</span>
<span class="badge bg-light text-dark"><?= PHP_VERSION ?></span>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center px-0">
<span>数据库</span>
<span class="badge bg-light text-dark">MySQL 5.7+</span>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center px-0">
<span>服务器时间</span>
<span class="badge bg-light text-dark"><?= date('Y-m-d H:i:s') ?></span>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center px-0">
<span>登录用户</span>
<span class="badge bg-light text-dark"><?= htmlspecialchars($admin['username']) ?></span>
</li>
</ul>
</div>
</div>
</div>
</div>
<?php require_once __DIR__ . '/footer.php'; ?>

86
admin/leads.php Normal file
View File

@ -0,0 +1,86 @@
<?php
require_once __DIR__ . '/header.php';
$pdo = db();
$action = $_GET['action'] ?? 'list';
$id = $_GET['id'] ?? null;
// Handle Delete
if ($action === 'delete' && $id) {
$stmt = $pdo->prepare("DELETE FROM leads WHERE id = ?");
$stmt->execute([$id]);
header('Location: leads.php?msg=deleted');
exit;
}
// Fetch leads
$leads = $pdo->query("SELECT * FROM leads ORDER BY created_at DESC")->fetchAll();
?>
<div class="card">
<div class="card-header">咨询记录列表</div>
<div class="card-body">
<div class="table-responsive">
<table class="table align-middle">
<thead>
<tr>
<th>ID</th>
<th>姓名</th>
<th>邮箱</th>
<th>电话</th>
<th>时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php foreach ($leads as $l): ?>
<tr>
<td><?= $l['id'] ?></td>
<td><strong><?= htmlspecialchars($l['name']) ?></strong></td>
<td><?= htmlspecialchars($l['email']) ?></td>
<td><?= htmlspecialchars($l['phone']) ?></td>
<td><?= date('Y-m-d H:i:s', strtotime($l['created_at'])) ?></td>
<td>
<button type="button" class="btn btn-sm btn-outline-primary" data-bs-toggle="modal" data-bs-target="#leadModal<?= $l['id'] ?>">
<i class="fas fa-eye"></i> 详情
</button>
<a href="leads.php?action=delete&id=<?= $l['id'] ?>" class="btn btn-sm btn-outline-danger" onclick="return confirm('确定删除此咨询记录吗?')">
<i class="fas fa-trash"></i>
</a>
<!-- Modal -->
<div class="modal fade" id="leadModal<?= $l['id'] ?>" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">咨询详情 - <?= htmlspecialchars($l['name']) ?></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
<div class="mb-3"><strong>姓名:</strong> <?= htmlspecialchars($l['name']) ?></div>
<div class="mb-3"><strong>邮箱:</strong> <?= htmlspecialchars($l['email']) ?></div>
<div class="mb-3"><strong>电话:</strong> <?= htmlspecialchars($l['phone']) ?></div>
<div class="mb-3"><strong>留言内容:</strong><br><div class="p-3 bg-light rounded mt-2"><?= nl2br(htmlspecialchars($l['message'])) ?></div></div>
<div class="mb-3"><strong>咨询时间:</strong> <?= date('Y-m-d H:i:s', strtotime($l['created_at'])) ?></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
<a href="mailto:<?= htmlspecialchars($l['email']) ?>" class="btn btn-primary">邮件回复</a>
</div>
</div>
</div>
</div>
</td>
</tr>
<?php endforeach; if (empty($leads)): ?>
<tr>
<td colspan="6" class="text-center py-5">暂无咨询记录</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
</div>
</div>
<?php require_once __DIR__ . '/footer.php'; ?>

99
admin/login.php Normal file
View File

@ -0,0 +1,99 @@
<?php
require_once __DIR__ . '/auth.php';
if (is_logged_in()) {
header('Location: index.php');
exit;
}
$error = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$username = $_POST['username'] ?? '';
$password = $_POST['password'] ?? '';
if (login($username, $password)) {
header('Location: index.php');
exit;
} else {
$error = '用户名或密码错误';
}
}
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>登录 - 智域科技后台管理</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Ma+Shan+Zheng&display=swap" rel="stylesheet">
<style>
body {
background-color: #f8f9fa;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
font-family: 'Inter', sans-serif;
}
.login-card {
width: 100%;
max-width: 400px;
padding: 40px;
background: #fff;
border-radius: 16px;
box-shadow: 0 10px 25px rgba(0,0,0,0.05);
}
.login-brand {
font-family: 'Ma+Shan+Zheng', cursive;
font-size: 2.5rem;
text-align: center;
margin-bottom: 30px;
}
.login-brand span:nth-child(1) { color: #3b82f6; }
.login-brand span:nth-child(2) { color: #10b981; }
.login-brand span:nth-child(3) { color: #f59e0b; }
.login-brand span:nth-child(4) { color: #ef4444; }
.form-control {
padding: 12px;
border-radius: 8px;
border: 1px solid #dee2e6;
}
.btn-primary {
padding: 12px;
border-radius: 8px;
width: 100%;
font-weight: 600;
}
</style>
</head>
<body>
<div class="login-card shadow-lg">
<div class="login-brand">
<span></span><span></span><span></span><span></span>
</div>
<h5 class="text-center mb-4 text-muted">后台管理登录</h5>
<?php if ($error): ?>
<div class="alert alert-danger py-2 small"><?= $error ?></div>
<?php endif; ?>
<form method="POST">
<div class="mb-3">
<label class="form-label small text-muted">用户名</label>
<input type="text" name="username" class="form-control" required autofocus>
</div>
<div class="mb-4">
<label class="form-label small text-muted">密码</label>
<input type="password" name="password" class="form-control" required>
</div>
<button type="submit" class="btn btn-primary">立即登录</button>
</form>
<div class="text-center mt-4">
<a href="../index.php" class="text-decoration-none small text-muted">返回网站首页</a>
</div>
</div>
</body>
</html>

5
admin/logout.php Normal file
View File

@ -0,0 +1,5 @@
<?php
require_once __DIR__ . '/auth.php';
logout();
header('Location: login.php');
exit;

119
admin/pricing.php Normal file
View File

@ -0,0 +1,119 @@
<?php
require_once __DIR__ . '/header.php';
$pdo = db();
$action = $_GET['action'] ?? 'list';
$id = $_GET['id'] ?? null;
if ($action === 'delete' && $id) {
$stmt = $pdo->prepare("DELETE FROM pricing_plans WHERE id = ?");
$stmt->execute([$id]);
header('Location: pricing.php?msg=deleted');
exit;
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$data = [
'name' => $_POST['name'],
'price_range' => $_POST['price_range'],
'features' => $_POST['features'],
'is_featured' => isset($_POST['is_featured']) ? 1 : 0,
'sort_order' => (int)$_POST['sort_order']
];
if ($id) {
$sql = "UPDATE pricing_plans SET name=:name, price_range=:price_range, features=:features, is_featured=:is_featured, sort_order=:sort_order WHERE id=:id";
$data['id'] = $id;
} else {
$sql = "INSERT INTO pricing_plans (name, price_range, features, is_featured, sort_order) VALUES (:name, :price_range, :features, :is_featured, :sort_order)";
}
$stmt = $pdo->prepare($sql);
$stmt->execute($data);
header('Location: pricing.php?msg=saved');
exit;
}
$plans = $pdo->query("SELECT * FROM pricing_plans ORDER BY sort_order ASC, id DESC")->fetchAll();
$plan = null;
if ($action === 'edit' && $id) {
$stmt = $pdo->prepare("SELECT * FROM pricing_plans WHERE id = ?");
$stmt->execute([$id]);
$plan = $stmt->fetch();
}
?>
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<span><?= $action === 'edit' ? '编辑方案' : ($action === 'add' ? '新增方案' : '报价方案列表') ?></span>
<?php if ($action === 'list'): ?>
<a href="pricing.php?action=add" class="btn btn-sm btn-primary">新增方案</a>
<?php else: ?>
<a href="pricing.php" class="btn btn-sm btn-secondary">返回列表</a>
<?php endif; ?>
</div>
<div class="card-body">
<?php if ($action === 'list'): ?>
<div class="table-responsive">
<table class="table align-middle">
<thead>
<tr>
<th>方案名称</th>
<th>价格区间</th>
<th>核心特征</th>
<th>精选</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php foreach ($plans as $p): ?>
<tr>
<td><strong><?= htmlspecialchars($p['name']) ?></strong></td>
<td><span class="text-primary fw-bold"><?= htmlspecialchars($p['price_range']) ?></span></td>
<td class="small text-muted"><?= htmlspecialchars($p['features']) ?></td>
<td><?= $p['is_featured'] ? '<span class="badge bg-success">是</span>' : '<span class="badge bg-light text-dark">否</span>' ?></td>
<td>
<a href="pricing.php?action=edit&id=<?= $p['id'] ?>" class="btn btn-sm btn-outline-primary"><i class="fas fa-edit"></i></a>
<a href="pricing.php?action=delete&id=<?= $p['id'] ?>" class="btn btn-sm btn-outline-danger" onclick="return confirm('确定删除吗?')"><i class="fas fa-trash"></i></a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php else: ?>
<form method="POST">
<div class="row">
<div class="col-md-6 mb-3">
<label class="form-label">方案名称</label>
<input type="text" name="name" class="form-control" value="<?= htmlspecialchars($plan['name'] ?? '') ?>" required>
</div>
<div class="col-md-6 mb-3">
<label class="form-label">价格区间 (: ¥49,900 )</label>
<input type="text" name="price_range" class="form-control" value="<?= htmlspecialchars($plan['price_range'] ?? '') ?>" required>
</div>
<div class="col-md-12 mb-3">
<label class="form-label">核心特征 / 描述</label>
<textarea name="features" class="form-control" rows="3"><?= htmlspecialchars($plan['features'] ?? '') ?></textarea>
</div>
<div class="col-md-6 mb-3">
<label class="form-label">排序</label>
<input type="number" name="sort_order" class="form-control" value="<?= $plan['sort_order'] ?? 0 ?>">
</div>
<div class="col-md-6 mb-3">
<div class="form-check mt-4">
<input class="form-check-input" type="checkbox" name="is_featured" id="is_featured" <?= ($plan['is_featured'] ?? 0) ? 'checked' : '' ?>>
<label class="form-check-label" for="is_featured">设置为精选</label>
</div>
</div>
</div>
<div class="mt-4">
<button type="submit" class="btn btn-primary">保存</button>
<a href="pricing.php" class="btn btn-light ms-2">取消</a>
</div>
</form>
<?php endif; ?>
</div>
</div>
<?php require_once __DIR__ . '/footer.php'; ?>

72
admin/profile.php Normal file
View File

@ -0,0 +1,72 @@
<?php
require_once __DIR__ . '/header.php';
$pdo = db();
$admin_id = $_SESSION['admin_user']['id'];
$msg = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$nickname = $_POST['nickname'];
$password = $_POST['password'];
try {
if (!empty($password)) {
$stmt = $pdo->prepare("UPDATE admin_users SET nickname=?, password=? WHERE id=?");
$stmt->execute([$nickname, password_hash($password, PASSWORD_DEFAULT), $admin_id]);
} else {
$stmt = $pdo->prepare("UPDATE admin_users SET nickname=? WHERE id=?");
$stmt->execute([$nickname, $admin_id]);
}
// Update session
$_SESSION['admin_user']['nickname'] = $nickname;
$msg = '<div class="alert alert-success">个人资料已更新</div>';
} catch (Exception $e) {
$msg = '<div class="alert alert-danger">更新失败: ' . $e->getMessage() . '</div>';
}
}
// Re-fetch current data
$stmt = $pdo->prepare("SELECT * FROM admin_users WHERE id = ?");
$stmt->execute([$admin_id]);
$current_admin = $stmt->fetch();
?>
<div class="row justify-content-center">
<div class="col-md-6">
<div class="card">
<div class="card-header">个人资料设置</div>
<div class="card-body">
<?= $msg ?>
<form method="POST">
<div class="mb-3 text-center">
<img src="../<?= htmlspecialchars($site_logo) ?>" alt="Avatar" width="100" height="100" class="rounded-circle border mb-3">
<div>
<span class="badge bg-secondary"><?= htmlspecialchars($current_admin['username']) ?></span>
</div>
</div>
<div class="mb-3">
<label class="form-label">用户名 (不可修改)</label>
<input type="text" class="form-control" value="<?= htmlspecialchars($current_admin['username']) ?>" readonly disabled>
</div>
<div class="mb-3">
<label class="form-label">昵称</label>
<input type="text" name="nickname" class="form-control" value="<?= htmlspecialchars($current_admin['nickname']) ?>" required>
</div>
<div class="mb-3">
<label class="form-label">新密码 (留空不修改)</label>
<input type="password" name="password" class="form-control" placeholder="请输入新密码">
</div>
<div class="d-grid mt-4">
<button type="submit" class="btn btn-primary">保存修改</button>
</div>
</form>
</div>
</div>
</div>
</div>
<?php require_once __DIR__ . '/footer.php'; ?>

112
admin/services.php Normal file
View File

@ -0,0 +1,112 @@
<?php
require_once __DIR__ . '/header.php';
$pdo = db();
$action = $_GET['action'] ?? 'list';
$id = $_GET['id'] ?? null;
if ($action === 'delete' && $id) {
$stmt = $pdo->prepare("DELETE FROM services WHERE id = ?");
$stmt->execute([$id]);
header('Location: services.php?msg=deleted');
exit;
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$data = [
'title' => $_POST['title'],
'icon' => $_POST['icon'],
'description' => $_POST['description'],
'sort_order' => (int)$_POST['sort_order']
];
if ($id) {
$sql = "UPDATE services SET title=:title, icon=:icon, description=:description, sort_order=:sort_order WHERE id=:id";
$data['id'] = $id;
} else {
$sql = "INSERT INTO services (title, icon, description, sort_order) VALUES (:title, :icon, :description, :sort_order)";
}
$stmt = $pdo->prepare($sql);
$stmt->execute($data);
header('Location: services.php?msg=saved');
exit;
}
$services = $pdo->query("SELECT * FROM services ORDER BY sort_order ASC, id DESC")->fetchAll();
$service = null;
if ($action === 'edit' && $id) {
$stmt = $pdo->prepare("SELECT * FROM services WHERE id = ?");
$stmt->execute([$id]);
$service = $stmt->fetch();
}
?>
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<span><?= $action === 'edit' ? '编辑服务' : ($action === 'add' ? '新增服务' : '服务列表') ?></span>
<?php if ($action === 'list'): ?>
<a href="services.php?action=add" class="btn btn-sm btn-primary">新增服务</a>
<?php else: ?>
<a href="services.php" class="btn btn-sm btn-secondary">返回列表</a>
<?php endif; ?>
</div>
<div class="card-body">
<?php if ($action === 'list'): ?>
<div class="table-responsive">
<table class="table align-middle">
<thead>
<tr>
<th>图标</th>
<th>服务名称</th>
<th>描述</th>
<th>排序</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php foreach ($services as $s): ?>
<tr>
<td><i class="bi bi-<?= htmlspecialchars($s['icon']) ?> fs-3"></i></td>
<td><strong><?= htmlspecialchars($s['title']) ?></strong></td>
<td class="small text-muted"><?= htmlspecialchars($s['description']) ?></td>
<td><?= $s['sort_order'] ?></td>
<td>
<a href="services.php?action=edit&id=<?= $s['id'] ?>" class="btn btn-sm btn-outline-primary"><i class="fas fa-edit"></i></a>
<a href="services.php?action=delete&id=<?= $s['id'] ?>" class="btn btn-sm btn-outline-danger" onclick="return confirm('确定删除吗?')"><i class="fas fa-trash"></i></a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php else: ?>
<form method="POST">
<div class="row">
<div class="col-md-6 mb-3">
<label class="form-label">服务名称</label>
<input type="text" name="title" class="form-control" value="<?= htmlspecialchars($service['title'] ?? '') ?>" required>
</div>
<div class="col-md-6 mb-3">
<label class="form-label">图标 (Bootstrap Icon 类名,如 hdd-network)</label>
<input type="text" name="icon" class="form-control" value="<?= htmlspecialchars($service['icon'] ?? '') ?>" required>
</div>
<div class="col-md-12 mb-3">
<label class="form-label">描述</label>
<textarea name="description" class="form-control" rows="3"><?= htmlspecialchars($service['description'] ?? '') ?></textarea>
</div>
<div class="col-md-4 mb-3">
<label class="form-label">排序</label>
<input type="number" name="sort_order" class="form-control" value="<?= $service['sort_order'] ?? 0 ?>">
</div>
</div>
<div class="mt-4">
<button type="submit" class="btn btn-primary">保存</button>
<a href="services.php" class="btn btn-light ms-2">取消</a>
</div>
</form>
<?php endif; ?>
</div>
</div>
<?php require_once __DIR__ . '/footer.php'; ?>

63
admin/settings.php Normal file
View File

@ -0,0 +1,63 @@
<?php
require_once __DIR__ . '/header.php';
$pdo = db();
$group = $_GET['group'] ?? 'general';
// Handle Save
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
foreach ($_POST['settings'] as $key => $value) {
$stmt = $pdo->prepare("UPDATE website_settings SET `value` = ? WHERE `key` = ?");
$stmt->execute([$value, $key]);
}
header("Location: settings.php?group=$group&msg=saved");
exit;
}
// Fetch settings
$stmt = $pdo->prepare("SELECT * FROM website_settings WHERE `group` = ?");
$stmt->execute([$group]);
$settings = $stmt->fetchAll();
$group_titles = [
'general' => '基础设置',
'contact' => '联系方式',
'seo' => 'SEO设置'
];
?>
<div class="card">
<div class="card-header"><?= $group_titles[$group] ?? '网站设置' ?></div>
<div class="card-body">
<form method="POST">
<div class="row">
<?php foreach ($settings as $s): ?>
<div class="col-md-12 mb-4">
<label class="form-label fw-bold"><?= htmlspecialchars($s['label']) ?></label>
<div class="small text-muted mb-2">配置键: <code><?= htmlspecialchars($s['key']) ?></code></div>
<?php if ($s['type'] === 'textarea'): ?>
<textarea name="settings[<?= $s['key'] ?>]" class="form-control" rows="4"><?= htmlspecialchars($s['value']) ?></textarea>
<?php elseif ($s['type'] === 'image'): ?>
<div class="input-group">
<input type="text" name="settings[<?= $s['key'] ?>]" id="input_<?= $s['key'] ?>" class="form-control" value="<?= htmlspecialchars($s['value']) ?>">
<button class="btn btn-outline-secondary" type="button" onclick="window.open('../<?= htmlspecialchars($s['value']) ?>')">查看预览</button>
</div>
<div class="mt-2">
<img src="../<?= htmlspecialchars($s['value']) ?>" style="max-height: 50px;" class="border rounded bg-light p-1">
</div>
<?php else: ?>
<input type="text" name="settings[<?= $s['key'] ?>]" class="form-control" value="<?= htmlspecialchars($s['value']) ?>">
<?php endif; ?>
</div>
<?php endforeach; ?>
</div>
<div class="mt-4 pt-4 border-top">
<button type="submit" class="btn btn-primary px-5">保存所有更改</button>
</div>
</form>
</div>
</div>
<?php require_once __DIR__ . '/footer.php'; ?>

112
admin/tech_stack.php Normal file
View File

@ -0,0 +1,112 @@
<?php
require_once __DIR__ . '/header.php';
$pdo = db();
$action = $_GET['action'] ?? 'list';
$id = $_GET['id'] ?? null;
if ($action === 'delete' && $id) {
$stmt = $pdo->prepare("DELETE FROM tech_stack WHERE id = ?");
$stmt->execute([$id]);
header('Location: tech_stack.php?msg=deleted');
exit;
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$data = [
'title' => $_POST['title'],
'category' => $_POST['category'],
'icon' => $_POST['icon'],
'sort_order' => (int)$_POST['sort_order']
];
if ($id) {
$sql = "UPDATE tech_stack SET title=:title, category=:category, icon=:icon, sort_order=:sort_order WHERE id=:id";
$data['id'] = $id;
} else {
$sql = "INSERT INTO tech_stack (title, category, icon, sort_order) VALUES (:title, :category, :icon, :sort_order)";
}
$stmt = $pdo->prepare($sql);
$stmt->execute($data);
header('Location: tech_stack.php?msg=saved');
exit;
}
$techs = $pdo->query("SELECT * FROM tech_stack ORDER BY sort_order ASC, id DESC")->fetchAll();
$tech = null;
if ($action === 'edit' && $id) {
$stmt = $pdo->prepare("SELECT * FROM tech_stack WHERE id = ?");
$stmt->execute([$id]);
$tech = $stmt->fetch();
}
?>
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<span><?= $action === 'edit' ? '编辑技术' : ($action === 'add' ? '新增技术' : '技术底座列表') ?></span>
<?php if ($action === 'list'): ?>
<a href="tech_stack.php?action=add" class="btn btn-sm btn-primary">新增技术</a>
<?php else: ?>
<a href="tech_stack.php" class="btn btn-sm btn-secondary">返回列表</a>
<?php endif; ?>
</div>
<div class="card-body">
<?php if ($action === 'list'): ?>
<div class="table-responsive">
<table class="table align-middle">
<thead>
<tr>
<th>图标</th>
<th>技术名称</th>
<th>分类</th>
<th>排序</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php foreach ($techs as $t): ?>
<tr>
<td><i class="bi bi-<?= htmlspecialchars($t['icon']) ?> fs-3"></i></td>
<td><strong><?= htmlspecialchars($t['title']) ?></strong></td>
<td><?= htmlspecialchars($t['category']) ?></td>
<td><?= $t['sort_order'] ?></td>
<td>
<a href="tech_stack.php?action=edit&id=<?= $t['id'] ?>" class="btn btn-sm btn-outline-primary"><i class="fas fa-edit"></i></a>
<a href="tech_stack.php?action=delete&id=<?= $t['id'] ?>" class="btn btn-sm btn-outline-danger" onclick="return confirm('确定删除吗?')"><i class="fas fa-trash"></i></a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php else: ?>
<form method="POST">
<div class="row">
<div class="col-md-6 mb-3">
<label class="form-label">技术名称</label>
<input type="text" name="title" class="form-control" value="<?= htmlspecialchars($tech['title'] ?? '') ?>" required>
</div>
<div class="col-md-6 mb-3">
<label class="form-label">分类</label>
<input type="text" name="category" class="form-control" value="<?= htmlspecialchars($tech['category'] ?? '') ?>" required>
</div>
<div class="col-md-6 mb-3">
<label class="form-label">图标 (Bootstrap Icon 类名)</label>
<input type="text" name="icon" class="form-control" value="<?= htmlspecialchars($tech['icon'] ?? '') ?>" required>
</div>
<div class="col-md-6 mb-3">
<label class="form-label">排序</label>
<input type="number" name="sort_order" class="form-control" value="<?= $tech['sort_order'] ?? 0 ?>">
</div>
</div>
<div class="mt-4">
<button type="submit" class="btn btn-primary">保存</button>
<a href="tech_stack.php" class="btn btn-light ms-2">取消</a>
</div>
</form>
<?php endif; ?>
</div>
</div>
<?php require_once __DIR__ . '/footer.php'; ?>

132
admin/transformations.php Normal file
View File

@ -0,0 +1,132 @@
<?php
require_once __DIR__ . '/header.php';
$pdo = db();
$action = $_GET['action'] ?? 'list';
$id = $_GET['id'] ?? null;
// Handle Delete
if ($action === 'delete' && $id) {
$stmt = $pdo->prepare("DELETE FROM transformations WHERE id = ?");
$stmt->execute([$id]);
header('Location: transformations.php?msg=deleted');
exit;
}
// Handle Save (Add/Edit)
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$data = [
'title' => $_POST['title'],
'results_data' => $_POST['results_data'],
'description' => $_POST['description'],
'img' => $_POST['img'],
'video_url' => $_POST['video_url'],
'sort_order' => (int)$_POST['sort_order']
];
if ($id) {
$sql = "UPDATE transformations SET title=:title, results_data=:results_data, description=:description, img=:img, video_url=:video_url, sort_order=:sort_order WHERE id=:id";
$data['id'] = $id;
} else {
$sql = "INSERT INTO transformations (title, results_data, description, img, video_url, sort_order) VALUES (:title, :results_data, :description, :img, :video_url, :sort_order)";
}
$stmt = $pdo->prepare($sql);
$stmt->execute($data);
header('Location: transformations.php?msg=saved');
exit;
}
// Fetch list
$items = $pdo->query("SELECT * FROM transformations ORDER BY sort_order ASC, id DESC")->fetchAll();
// Fetch for edit
$item = null;
if ($action === 'edit' && $id) {
$stmt = $pdo->prepare("SELECT * FROM transformations WHERE id = ?");
$stmt->execute([$id]);
$item = $stmt->fetch();
}
?>
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<span><?= $action === 'edit' ? '编辑转型实践' : ($action === 'add' ? '新增转型实践' : '转型实践列表') ?></span>
<?php if ($action === 'list'): ?>
<a href="transformations.php?action=add" class="btn btn-sm btn-primary">新增</a>
<?php else: ?>
<a href="transformations.php" class="btn btn-sm btn-secondary">返回列表</a>
<?php endif; ?>
</div>
<div class="card-body">
<?php if ($action === 'list'): ?>
<div class="table-responsive">
<table class="table align-middle">
<thead>
<tr>
<th>图片</th>
<th>标题</th>
<th>数据/成果</th>
<th>排序</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php foreach ($items as $i): ?>
<tr>
<td><img src="../<?= htmlspecialchars($i['img'] ?: 'assets/images/placeholder.jpg') ?>" width="60" class="rounded"></td>
<td><strong><?= htmlspecialchars($i['title']) ?></strong></td>
<td><?= htmlspecialchars($i['results_data']) ?></td>
<td><?= $i['sort_order'] ?></td>
<td>
<a href="transformations.php?action=edit&id=<?= $i['id'] ?>" class="btn btn-sm btn-outline-primary"><i class="fas fa-edit"></i></a>
<a href="transformations.php?action=delete&id=<?= $i['id'] ?>" class="btn btn-sm btn-outline-danger" onclick="return confirm('确定删除吗?')"><i class="fas fa-trash"></i></a>
</td>
</tr>
<?php endforeach; ?>
<?php if (empty($items)): ?>
<tr>
<td colspan="5" class="text-center py-4 text-muted">暂无数据</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
<?php else: ?>
<form method="POST">
<div class="row">
<div class="col-md-8 mb-3">
<label class="form-label">标题</label>
<input type="text" name="title" class="form-control" value="<?= htmlspecialchars($item['title'] ?? '') ?>" required>
</div>
<div class="col-md-4 mb-3">
<label class="form-label">排序</label>
<input type="number" name="sort_order" class="form-control" value="<?= $item['sort_order'] ?? 0 ?>">
</div>
<div class="col-md-6 mb-3">
<label class="form-label">核心数据/成果 (例如: 效率提升 200%)</label>
<input type="text" name="results_data" class="form-control" value="<?= htmlspecialchars($item['results_data'] ?? '') ?>">
</div>
<div class="col-md-6 mb-3">
<label class="form-label">图片 URL</label>
<input type="text" name="img" class="form-control" value="<?= htmlspecialchars($item['img'] ?? '') ?>">
</div>
<div class="col-md-12 mb-3">
<label class="form-label">视频 URL (可选)</label>
<input type="text" name="video_url" class="form-control" value="<?= htmlspecialchars($item['video_url'] ?? '') ?>">
</div>
<div class="col-md-12 mb-3">
<label class="form-label">详细描述</label>
<textarea name="description" class="form-control" rows="5"><?= htmlspecialchars($item['description'] ?? '') ?></textarea>
</div>
</div>
<div class="mt-4">
<button type="submit" class="btn btn-primary">保存修改</button>
<a href="transformations.php" class="btn btn-light ms-2">取消</a>
</div>
</form>
<?php endif; ?>
</div>
</div>
<?php require_once __DIR__ . '/footer.php'; ?>

View File

@ -1,12 +1,25 @@
<?php
require_once __DIR__ . '/db/config.php';
require_once __DIR__ . '/includes/cases_data.php';
$project_name = '智域科技';
$logo_path = '/assets/pasted-20260226-073317-a8105f30.png';
$pdo = db();
$settings_res = $pdo->query("SELECT `key`, `value` FROM website_settings")->fetchAll();
$settings = [];
foreach ($settings_res as $row) {
$settings[$row['key']] = $row['value'];
}
$case_id = $_GET['id'] ?? 'erp-upgrade';
$case = $all_cases[$case_id] ?? $all_cases['erp-upgrade'];
$project_name = $settings['site_name'] ?? '智域科技';
$logo_path = $settings['site_logo'] ?? '/assets/pasted-20260226-073317-a8105f30.png';
$case_slug = $_GET['id'] ?? '';
$stmt = $pdo->prepare("SELECT * FROM cases WHERE slug = ? OR id = ?");
$stmt->execute([$case_slug, (int)$case_slug]);
$case = $stmt->fetch();
if (!$case) {
header('Location: cases.php');
exit;
}
?>
<!DOCTYPE html>
<html lang="zh-CN">
@ -50,7 +63,7 @@ $case = $all_cases[$case_id] ?? $all_cases['erp-upgrade'];
</p>
<div class="case-detail-image-wrapper mb-5 rounded-4 shadow-sm overflow-hidden">
<img src="<?= $case['img'] ?>" class="img-fluid w-100" alt="<?= htmlspecialchars($case['title']) ?>" style="max-height: 500px; object-fit: cover;">
<img src="<?= htmlspecialchars($case['img']) ?>" class="img-fluid w-100" alt="<?= htmlspecialchars($case['title']) ?>" style="max-height: 500px; object-fit: cover;">
</div>
<div class="row g-5 mb-5">
@ -101,7 +114,7 @@ $case = $all_cases[$case_id] ?? $all_cases['erp-upgrade'];
</div>
<div class="text-center mt-5">
<a href="https://t.me/zhangshihao818" class="btn btn-primary btn-lg px-5 py-3 shadow">
<a href="<?= $settings['tg_link'] ?? 'https://t.me/zhangshihao818' ?>" class="btn btn-primary btn-lg px-5 py-3 shadow">
我也要定制类似的数字化方案 <i class="bi bi-chevron-right ms-2"></i>
</a>
</div>
@ -131,7 +144,7 @@ $case = $all_cases[$case_id] ?? $all_cases['erp-upgrade'];
<i class="bi bi-tags"></i>
<span>报价</span>
</a>
<a href="https://t.me/zhangshihao818" class="mobile-nav-item highlight">
<a href="<?= $settings['tg_link'] ?? 'https://t.me/zhangshihao818' ?>" class="mobile-nav-item highlight">
<i class="bi bi-telegram"></i>
<span>咨询</span>
</a>

View File

@ -1,12 +1,26 @@
<?php
require_once __DIR__ . '/db/config.php';
require_once __DIR__ . '/includes/cases_data.php';
$project_name = '智域科技';
$logo_path = '/assets/pasted-20260226-073317-a8105f30.png';
$pdo = db();
$settings_res = $pdo->query("SELECT `key`, `value` FROM website_settings")->fetchAll();
$settings = [];
foreach ($settings_res as $row) {
$settings[$row['key']] = $row['value'];
}
$project_name = $settings['site_name'] ?? '智域科技';
$logo_path = $settings['site_logo'] ?? '/assets/pasted-20260226-073317-a8105f30.png';
$selected_category = $_GET['category'] ?? 'all';
$filtered_cases = get_cases_by_category($selected_category);
// Fetch cases from DB
if ($selected_category === 'all') {
$stmt = $pdo->prepare("SELECT * FROM cases WHERE is_visible = 1 ORDER BY sort_order ASC, created_at DESC");
$stmt->execute();
} else {
$stmt = $pdo->prepare("SELECT * FROM cases WHERE is_visible = 1 AND category = ? ORDER BY sort_order ASC, created_at DESC");
$stmt->execute([$selected_category]);
}
$filtered_cases = $stmt->fetchAll();
$scope_items = [
'海外资金盘', '点赞盘', '刷单盘', '商城盘', '云矿机', '新能源',
@ -104,7 +118,7 @@ $view = 'works';
</div>
<h5>暂无该类别的公开案例</h5>
<p class="text-muted">您可以联系我们的专家,获取更多未公开的定制化方案细节。</p>
<a href="https://t.me/zhangshihao818" class="btn btn-primary mt-3 px-4">立即咨询专家</a>
<a href="<?= $settings['tg_link'] ?? 'https://t.me/zhangshihao818' ?>" class="btn btn-primary mt-3 px-4">立即咨询专家</a>
</div>
<?php else: ?>
<div class="row g-4">
@ -112,16 +126,16 @@ $view = 'works';
<div class="col-md-6 col-lg-4 col-xl-3">
<div class="case-card h-100 shadow-sm border-0">
<div class="case-image-wrapper">
<img src="<?= $case['img'] ?>" alt="<?= $case['title'] ?>" class="case-image">
<img src="<?= htmlspecialchars($case['img']) ?>" alt="<?= htmlspecialchars($case['title']) ?>" class="case-image">
</div>
<div class="case-content p-4 d-flex flex-column">
<div class="d-flex justify-content-between align-items-start mb-2">
<span class="badge bg-primary bg-opacity-10 text-primary"><?= $case['tag'] ?></span>
<span class="x-small text-muted"><?= $case['category'] ?></span>
<span class="badge bg-primary bg-opacity-10 text-primary"><?= htmlspecialchars($case['tag']) ?></span>
<span class="x-small text-muted"><?= htmlspecialchars($case['category']) ?></span>
</div>
<h6 class="fw-bold mb-3"><?= $case['title'] ?></h6>
<p class="x-small text-muted mb-4 flex-grow-1"><?= $case['desc'] ?></p>
<a href="case-detail.php?id=<?= $case['id'] ?>" class="text-primary small text-decoration-none fw-bold mt-auto">查看案例细节 <i class="bi bi-chevron-right"></i></a>
<h6 class="fw-bold mb-3"><?= htmlspecialchars($case['title']) ?></h6>
<p class="x-small text-muted mb-4 flex-grow-1"><?= htmlspecialchars($case['description']) ?></p>
<a href="case-detail.php?id=<?= $case['slug'] ?>" class="text-primary small text-decoration-none fw-bold mt-auto">查看案例细节 <i class="bi bi-chevron-right"></i></a>
</div>
</div>
</div>
@ -136,7 +150,7 @@ $view = 'works';
<div class="tech-card bg-dark text-white p-5 text-center overflow-hidden shadow-lg border-0 rounded-4">
<h3 class="fw-bold mb-3">没有看到您所需的特定案例?</h3>
<p class="lead mb-4 opacity-75">我们的技术储备远超网页展示。请联系我们,为您匹配最接近的实战经验。</p>
<a href="https://t.me/zhangshihao818" class="btn btn-primary btn-lg px-5 py-3 shadow">
<a href="<?= $settings['tg_link'] ?? 'https://t.me/zhangshihao818' ?>" class="btn btn-primary btn-lg px-5 py-3 shadow">
<i class="bi bi-telegram me-2"></i> 立即沟通定制需求
</a>
</div>
@ -162,7 +176,7 @@ $view = 'works';
<i class="bi bi-tags"></i>
<span>报价</span>
</a>
<a href="https://t.me/zhangshihao818" class="mobile-nav-item highlight">
<a href="<?= $settings['tg_link'] ?? 'https://t.me/zhangshihao818' ?>" class="mobile-nav-item highlight">
<i class="bi bi-telegram"></i>
<span>咨询</span>
</a>

View File

@ -0,0 +1,101 @@
-- Admin Users
CREATE TABLE IF NOT EXISTS admin_users (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL,
nickname VARCHAR(50),
avatar VARCHAR(255),
role VARCHAR(20) DEFAULT 'admin',
last_login DATETIME,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Website Settings
CREATE TABLE IF NOT EXISTS website_settings (
`key` VARCHAR(50) PRIMARY KEY,
`value` TEXT,
`label` VARCHAR(100),
`type` VARCHAR(20) DEFAULT 'text', -- text, textarea, image, file
`group` VARCHAR(20) DEFAULT 'general' -- general, contact, seo, footer
);
-- Cases (Reputation Works)
CREATE TABLE IF NOT EXISTS cases (
id INT AUTO_INCREMENT PRIMARY KEY,
slug VARCHAR(100) NOT NULL UNIQUE,
title VARCHAR(255) NOT NULL,
tag VARCHAR(100),
category VARCHAR(100),
img VARCHAR(255),
description TEXT,
content TEXT,
challenge TEXT,
solution TEXT,
result_stability VARCHAR(100),
result_throughput VARCHAR(100),
result_cost VARCHAR(100),
tech VARCHAR(255),
is_featured BOOLEAN DEFAULT FALSE,
sort_order INT DEFAULT 0,
is_visible BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Services (Core Capabilities)
CREATE TABLE IF NOT EXISTS services (
id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(255) NOT NULL,
description TEXT,
icon VARCHAR(100),
content TEXT,
sort_order INT DEFAULT 0,
is_visible BOOLEAN DEFAULT TRUE
);
-- Technical Foundation
CREATE TABLE IF NOT EXISTS tech_stack (
id INT AUTO_INCREMENT PRIMARY KEY,
category VARCHAR(100),
title VARCHAR(255) NOT NULL,
icon VARCHAR(100),
description TEXT,
sort_order INT DEFAULT 0
);
-- Pricing Solutions
CREATE TABLE IF NOT EXISTS pricing_plans (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
price_range VARCHAR(100),
features TEXT, -- JSON or newline separated
is_featured BOOLEAN DEFAULT FALSE,
sort_order INT DEFAULT 0
);
-- Transformation Practices
CREATE TABLE IF NOT EXISTS transformations (
id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(255) NOT NULL,
results_data VARCHAR(255),
description TEXT,
img VARCHAR(255),
video_url VARCHAR(255),
sort_order INT DEFAULT 0
);
-- Insert Default Admin (password: admin123)
INSERT INTO admin_users (username, password, nickname) VALUES ('admin', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', '系统管理员');
-- Insert Initial Settings
INSERT INTO website_settings (`key`, `value`, `label`, `type`, `group`) VALUES
('site_name', '智域科技', '网站名称', 'text', 'general'),
('site_logo', 'assets/images/logo.png', '网站LOGO', 'image', 'general'),
('wechat_id', 'zhiyukj888', '微信号', 'text', 'contact'),
('wechat_qr', 'assets/images/qr.png', '微信二维码', 'image', 'contact'),
('tg_link', 'https://t.me/zhiyukj', 'Telegram链接', 'text', 'contact'),
('contact_email', 'contact@zhiyu.tech', '联系邮箱', 'text', 'contact'),
('contact_phone', '+86 138-0000-0000', '联系电话', 'text', 'contact'),
('company_address', '上海市浦东新区某某大厦', '公司地址', 'text', 'contact'),
('seo_title', '智域科技 - 全球领先的金融技术解决方案提供商', 'SEO标题', 'text', 'seo'),
('seo_keywords', '金融科技,交易所开发,云矿机,远控系统', 'SEO关键词', 'text', 'seo'),
('seo_description', '智域科技提供高端金融技术定制开发,涵盖交易所、资金盘、远控系统等。', 'SEO描述', 'textarea', 'seo');

View File

@ -1,12 +1,20 @@
<?php
require_once __DIR__ . '/db/config.php';
require_once __DIR__ . '/includes/cases_data.php';
$project_name = '智域科技';
$project_description = '全球领先的IT数字化架构与行业解决方案专家';
$logo_path = '/assets/pasted-20260226-073317-a8105f30.png';
$wechat_qr = '/assets/pasted-20260226-110355-12dfa7de.png';
$wechat_id = 'zhaopai0918';
// Fetch settings from DB
$pdo = db();
$settings_res = $pdo->query("SELECT `key`, `value` FROM website_settings")->fetchAll();
$settings = [];
foreach ($settings_res as $row) {
$settings[$row['key']] = $row['value'];
}
$project_name = $settings['site_name'] ?? '智域科技';
$project_description = $settings['seo_description'] ?? '全球领先的IT数字化架构与行业解决方案专家';
$logo_path = $settings['site_logo'] ?? '/assets/pasted-20260226-073317-a8105f30.png';
$wechat_qr = $settings['wechat_qr'] ?? '/assets/pasted-20260226-110355-12dfa7de.png';
$wechat_id = $settings['wechat_id'] ?? 'zhiyukj888';
$tg_link = $settings['tg_link'] ?? 'https://t.me/zhangshihao818';
// 辅助函数:根据颜色生成浅色背景
function get_soft_bg($color, $opacity = '10') {
@ -22,7 +30,9 @@ $body_class = 'view-' . $view;
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?= htmlspecialchars($project_name) ?> - <?= htmlspecialchars($project_description) ?></title>
<title><?= htmlspecialchars($settings['seo_title'] ?? $project_name) ?></title>
<meta name="keywords" content="<?= htmlspecialchars($settings['seo_keywords'] ?? '') ?>">
<meta name="description" content="<?= htmlspecialchars($settings['seo_description'] ?? '') ?>">
<link rel="icon" href="<?= $logo_path ?>" type="image/png">
<!-- Fonts & Icons -->
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800&family=Ma+Shan+Zheng&display=swap" rel="stylesheet">
@ -55,7 +65,7 @@ $body_class = 'view-' . $view;
<li class="nav-item"><a class="nav-link" href="#tech">技术底座</a></li>
<li class="nav-item"><a class="nav-link" href="#pricing">报价方案</a></li>
<li class="nav-item ms-lg-2">
<a class="btn btn-primary px-4 shadow-sm fw-bold" href="https://t.me/zhangshihao818">立即咨询 <i class="bi bi-telegram ms-1"></i></a>
<a class="btn btn-primary px-4 shadow-sm fw-bold" href="<?= $tg_link ?>">立即咨询 <i class="bi bi-telegram ms-1"></i></a>
</li>
</ul>
</div>
@ -76,7 +86,7 @@ $body_class = 'view-' . $view;
智域科技不仅提供系统开发。我们结合行业深度洞察与前沿架构技术,为复杂业务提供稳定、安全、可无限扩展的数字化基座。
</p>
<div class="d-flex flex-wrap gap-3">
<a href="https://t.me/zhangshihao818" class="btn btn-primary px-5 py-3 fw-bold">立即免费咨询 <i class="bi bi-lightning-charge-fill ms-1"></i></a>
<a href="<?= $tg_link ?>" class="btn btn-primary px-5 py-3 fw-bold">立即免费咨询 <i class="bi bi-lightning-charge-fill ms-1"></i></a>
<a href="#capabilities" class="btn btn-outline-dark px-5 py-3 fw-bold">了解核心技术</a>
</div>
</div>
@ -134,18 +144,18 @@ $body_class = 'view-' . $view;
</div>
<div class="grid-4">
<?php
// 只显示前8个案例
$display_cases = array_slice($all_cases, 0, 8);
foreach ($display_cases as $case): ?>
// 从数据库获取精选案例
$featured_cases = $pdo->query("SELECT * FROM cases WHERE is_visible = 1 ORDER BY is_featured DESC, sort_order ASC, created_at DESC LIMIT 8")->fetchAll();
foreach ($featured_cases as $case): ?>
<div class="case-card">
<div class="case-image-wrapper">
<img src="<?= $case['img'] ?>" alt="<?= $case['title'] ?>" class="case-image">
<img src="<?= htmlspecialchars($case['img']) ?>" alt="<?= htmlspecialchars($case['title']) ?>" class="case-image">
</div>
<div class="case-content p-4">
<span class="badge bg-primary bg-opacity-10 text-primary mb-2"><?= $case['tag'] ?></span>
<h6 class="fw-bold mb-3"><?= $case['title'] ?></h6>
<p class="x-small text-muted mb-4"><?= $case['desc'] ?></p>
<a href="case-detail.php?id=<?= $case['id'] ?>" class="text-primary small text-decoration-none fw-bold">查看案例细节 <i class="bi bi-chevron-right"></i></a>
<span class="badge bg-primary bg-opacity-10 text-primary mb-2"><?= htmlspecialchars($case['tag']) ?></span>
<h6 class="fw-bold mb-3"><?= htmlspecialchars($case['title']) ?></h6>
<p class="x-small text-muted mb-4"><?= htmlspecialchars($case['description']) ?></p>
<a href="case-detail.php?id=<?= $case['slug'] ?>" class="text-primary small text-decoration-none fw-bold">查看案例细节 <i class="bi bi-chevron-right"></i></a>
</div>
</div>
<?php endforeach; ?>
@ -165,6 +175,7 @@ $body_class = 'view-' . $view;
<h2 class="section-title">专业核心服务区域</h2>
<div class="grid-4">
<?php
// 可从数据库获取 services 表,目前先保留硬编码或之后在后台添加
$core_services = [
['title' => '搭建写盘', 'icon' => 'hdd-network', 'color' => '#0d6efd'],
['title' => '软件开发', 'icon' => 'code-square', 'color' => '#6610f2'],
@ -326,7 +337,7 @@ $body_class = 'view-' . $view;
<p class="small text-muted mb-4"><?= $p['desc'] ?></p>
<div class="mt-auto">
<span class="h4 fw-bold text-primary"><?= $p['price'] ?></span>
<a href="https://t.me/zhangshihao818" class="btn btn-outline-primary btn-sm w-100 mt-3 fw-bold py-2">获取详细报价单</a>
<a href="<?= $tg_link ?>" class="btn btn-outline-primary btn-sm w-100 mt-3 fw-bold py-2">获取详细报价单</a>
</div>
</div>
<?php endforeach; ?>
@ -420,7 +431,7 @@ $body_class = 'view-' . $view;
<h2 class="fw-bold mb-3">准备好开启数字化转型之旅了吗?</h2>
<p class="lead mb-5 opacity-75">智域科技专家团队 24/7 在线,为您提供免费的初步架构诊断与方案咨询。</p>
<div class="d-flex justify-content-center gap-3 flex-wrap">
<a href="https://t.me/zhangshihao818" class="btn btn-light btn-lg px-5 py-3 shadow">
<a href="<?= $tg_link ?>" class="btn btn-light btn-lg px-5 py-3 shadow">
<i class="bi bi-telegram me-2"></i> 立即通过 Telegram 咨询
</a>
<a href="contact.php" class="btn btn-outline-light btn-lg px-5 py-3">
@ -449,7 +460,7 @@ $body_class = 'view-' . $view;
<div class="d-flex gap-3">
<a href="#" class="text-dark opacity-50 hover-opacity-100"><i class="bi bi-twitter-x"></i></a>
<a href="#" class="text-dark opacity-50 hover-opacity-100"><i class="bi bi-linkedin"></i></a>
<a href="https://t.me/zhangshihao818" class="text-dark opacity-50 hover-opacity-100"><i class="bi bi-telegram"></i></a>
<a href="<?= $tg_link ?>" class="text-dark opacity-50 hover-opacity-100"><i class="bi bi-telegram"></i></a>
</div>
</div>
<div class="col-6 col-lg-2">
@ -505,7 +516,7 @@ $body_class = 'view-' . $view;
<i class="bi bi-tags"></i>
<span>报价</span>
</a>
<a href="https://t.me/zhangshihao818" class="mobile-nav-item highlight">
<a href="<?= $tg_link ?>" class="mobile-nav-item highlight">
<i class="bi bi-telegram"></i>
<span>咨询</span>
</a>
@ -516,7 +527,7 @@ $body_class = 'view-' . $view;
<a href="javascript:void(0)" class="float-btn float-btn-wx" title="微信咨询" data-bs-toggle="modal" data-bs-target="#wechatModal">
<i class="bi bi-wechat"></i>
</a>
<a href="https://t.me/zhangshihao818" target="_blank" class="float-btn float-btn-tg" title="Telegram 咨询">
<a href="<?= $tg_link ?>" target="_blank" class="float-btn float-btn-tg" title="Telegram 咨询">
<i class="bi bi-telegram"></i>
</a>
<button class="float-btn float-btn-up" title="返回顶部">