diff --git a/admin/settings.php b/admin/settings.php index ed1eab9..19d8108 100644 --- a/admin/settings.php +++ b/admin/settings.php @@ -8,31 +8,50 @@ if (!isset($_SESSION['admin_logged_in'])) { } $message = ''; +$db = db(); -if ($_SERVER['REQUEST_METHOD'] === 'POST') { - $db = db(); +if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['update_settings'])) { foreach ($_POST['settings'] as $key => $value) { $stmt = $db->prepare("UPDATE settings SET key_value = ? WHERE key_name = ?"); $stmt->execute([$value, $key]); } - $message = '设置已更新'; + $message = '设置已成功更新'; } -$settings = db()->query("SELECT * FROM settings")->fetchAll(); +$settings_raw = $db->query("SELECT * FROM settings ORDER BY id ASC")->fetchAll(); +$settings = []; +foreach ($settings_raw as $s) { + $settings[$s['key_name']] = $s; +} + +// Group settings for better UI +$groups = [ + '基础信息' => ['site_name', 'site_logo', 'site_description', 'footer_text', 'notice', 'tg_channel'], + '外观样式 (PC端)' => ['primary_color', 'accent_color'], + '外观样式 (手机端)' => ['mobile_primary_color', 'mobile_accent_color'], + '支付与联系' => ['usdt_address', 'qr_code_custom', 'tg_link'], + 'API 与 通知' => ['tg_bot_token', 'tg_chat_id'] +]; ?> - 系统设置 - 管理后台 + 系统全域设置 - 管理后台 @@ -41,32 +60,70 @@ $settings = db()->query("SELECT * FROM settings")->fetchAll(); -
-

系统设置

+
+
+

全域系统配置

+
您可以从这里全面掌控前端展示效果
+
-
+ -
-
-
- -
- - - - - - + + + + $keys): ?> +
+
+
+
+ + +
+ + + + + +
+ + +
+ +
+ + +
+ + + +
+
- - - +
-
+ + +
+ +

所有更改将实时反映在 PC 端和手机端前端页面上。

+
+
+ + - + \ No newline at end of file diff --git a/admin/sidebar.php b/admin/sidebar.php index e4e8b5c..a215ed2 100644 --- a/admin/sidebar.php +++ b/admin/sidebar.php @@ -1,15 +1,26 @@ +query("SELECT key_name, key_value FROM settings WHERE key_name IN ('site_name', 'site_logo')"); + $sidebar_settings = $stmt->fetchAll(PDO::FETCH_KEY_PAIR); +} catch (Exception $e) { + $sidebar_settings = []; +} +$s_name = $sidebar_settings['site_name'] ?? '豪软后台'; +$s_logo = $sidebar_settings['site_logo'] ?? '../assets/pasted-20260208-082111-302e08e2.png'; +?>
-
- Logo -
豪软后台
+
+ Logo +
\ No newline at end of file + diff --git a/assets/css/custom.css b/assets/css/custom.css index 145a4d3..7f5c79d 100644 --- a/assets/css/custom.css +++ b/assets/css/custom.css @@ -1,12 +1,14 @@ :root { - --primary-color: #ff3399; + --primary-color: #ff3399; /* Default pink */ --secondary-color: #ff66b2; --accent-color: #0088cc; --bg-light: #fff5f7; --card-bg: #ffffff; --glass-border: rgba(255, 51, 153, 0.1); - --text-dark: #334155; - --text-muted: #64748b; + --text-dark: #1a202c; + --text-muted: #4a5568; + --mobile-primary: #e1251b; + --mobile-accent: #ff9900; } body { @@ -17,6 +19,7 @@ body { radial-gradient(at 0% 0%, rgba(255, 0, 122, 0.05) 0px, transparent 50%), radial-gradient(at 100% 100%, rgba(255, 51, 153, 0.05) 0px, transparent 50%); background-attachment: fixed; + margin-bottom: 0; } .glass-card { @@ -55,7 +58,7 @@ body { .btn-primary { background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%); border: none; - color: white; + color: white !important; font-weight: 700; } @@ -100,7 +103,7 @@ body { top: 10px; right: 10px; background: var(--primary-color); - color: white; + color: white !important; font-size: 0.7rem; font-weight: 800; padding: 4px 8px; @@ -129,40 +132,124 @@ body { /* Carousel Custom Styles */ .carousel-inner { - height: 600px !important; - border-radius: 1.5rem; + height: 500px !important; + border-radius: 1rem; /* Slightly reduced for better fill */ +} + +@media (max-width: 768px) { + .carousel-inner { + height: 250px !important; /* Slightly taller for mobile */ + } +} + +.carousel-section { + margin-top: 60px; /* Increased to move down further as requested */ + padding: 0; /* Remove side padding to fill the area fully */ } .carousel-item { - transition: transform 0.6s ease-in-out, opacity 0.6s ease-in-out; + height: 100% !important; + transition: transform 0.8s ease-in-out, opacity 0.8s ease-in-out; } .carousel-bg { - padding-top: 50px; - padding-bottom: 50px; + width: 100%; + height: 100%; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + position: relative; + padding: 40px 20px; } -.category-hover-card { - cursor: pointer; +/* Personalised Carousel Fonts */ +.carousel-title { + font-family: 'Inter', sans-serif; + font-weight: 800; + text-shadow: 0 2px 10px rgba(0,0,0,0.1); + color: #1a1a1a !important; + margin-top: 20px; } -.category-hover-card:hover { - background: rgba(255, 51, 153, 0.05) !important; - border-color: var(--primary-color); -} - -.category-accent { - width: 4px; - height: 24px; - background: var(--primary-color); - border-radius: 2px; +.carousel-subtitle { + font-weight: 500; + color: #4a4a4a !important; + background: rgba(255,255,255,0.85); display: inline-block; + padding: 6px 20px; + border-radius: 20px; + box-shadow: 0 4px 12px rgba(0,0,0,0.08); } -.hover-primary:hover { +/* Category Improvements */ +.category-item { + transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); +} + +.category-item:hover { + transform: translateY(-8px); +} + +.category-icon-wrapper { + width: 60px; + height: 60px; + background: linear-gradient(135deg, #ffffff 0%, #fff0f5 100%); + border-radius: 20px; + display: flex; + align-items: center; + justify-content: center; + margin: 0 auto 10px; + box-shadow: 0 4px 15px rgba(0,0,0,0.05); + transition: all 0.3s ease; + position: relative; + overflow: hidden; + border: 1px solid rgba(255, 51, 153, 0.1); +} + +.category-item:hover .category-icon-wrapper { + background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%); + color: white !important; + box-shadow: 0 10px 25px rgba(255, 51, 153, 0.2); + border-color: transparent; +} + +.category-item:hover .category-icon-wrapper i { + color: white !important; + transform: scale(1.1); +} + +.category-icon-wrapper i { + font-size: 1.5rem; + color: var(--primary-color); + z-index: 1; + transition: all 0.3s ease; +} + +.category-name { + font-size: 0.85rem; + font-weight: 700; + color: #1a202c !important; /* Fixed contrast */ +} + +/* Contrast Fixes */ +.text-dark { color: #1a202c !important; } +.text-secondary { color: #2d3748 !important; } +.text-muted { color: #4a5568 !important; } + +/* Ensure text on white/light backgrounds is visible */ +.bg-light .text-muted { color: #4a5568 !important; } + +/* Accordion Specific Contrast */ +.accordion-button:not(.collapsed) { + background-color: rgba(255, 51, 153, 0.05) !important; color: var(--primary-color) !important; } +.accordion-button:after { + filter: brightness(0.5); +} + .floating-tg { position: fixed; bottom: 30px; @@ -182,6 +269,27 @@ body { text-decoration: none; } +@media (max-width: 768px) { + .floating-tg { + bottom: 80px; + right: 20px; + width: 50px; + height: 50px; + font-size: 24px; + } + + .carousel-section { + margin-top: 30px; + padding: 0; + } + + .category-icon-wrapper { + width: 55px; + height: 55px; + border-radius: 18px; + } +} + .floating-tg:hover { transform: scale(1.1) rotate(10deg); color: white; @@ -197,7 +305,7 @@ body { .announcement-content { display: inline-block; padding-left: 100%; - animation: marquee 20s linear infinite; + animation: marquee 25s linear infinite; } @keyframes marquee { @@ -205,18 +313,149 @@ body { 100% { transform: translate(-100%, 0); } } -.announcement-container:hover .announcement-content { - animation-play-state: paused; -} +/* --- MOBILE JD/TAOBAO STYLE --- */ +@media (max-width: 768px) { + :root { + --primary-color: var(--mobile-primary); + --accent-color: var(--mobile-accent); + --bg-light: #f4f4f4; + } -.alert.glass-card { - background: white; - color: var(--text-dark) !important; -} + body { + background-image: none; + padding-bottom: 60px; + } -.text-white { - color: var(--text-dark) !important; + .pc-only { display: none !important; } + + .navbar { + background: var(--primary-color); + padding: 10px 15px !important; + } + + .navbar-brand { + color: #ffffff !important; + } + + .mobile-search-bar { + background: #ffffff; + border-radius: 20px; + padding: 5px 15px; + display: flex; + align-items: center; + margin-top: 10px; + box-shadow: 0 2px 5px rgba(0,0,0,0.1); + } + + .mobile-search-bar input { + border: none; + outline: none; + width: 100%; + margin-left: 10px; + font-size: 0.9rem; + } + + /* Bottom Navigation */ + .mobile-bottom-nav { + position: fixed; + bottom: 0; + left: 0; + right: 0; + background: #ffffff; + display: flex; + justify-content: space-around; + padding: 8px 0; + box-shadow: 0 -2px 10px rgba(0,0,0,0.05); + z-index: 1050; + } + + .mobile-nav-item { + text-align: center; + color: #666; + text-decoration: none; + font-size: 0.7rem; + display: flex; + flex-direction: column; + align-items: center; + } + + .mobile-nav-item i { + font-size: 1.4rem; + margin-bottom: 2px; + } + + .mobile-nav-item.active { + color: var(--primary-color); + } + + /* Product Grid Taobao Style */ + .product-grid-mobile { + display: flex; + flex-wrap: wrap; + padding: 5px; + } + + .product-item-mobile { + width: 50%; + padding: 5px; + } + + .product-card-mobile { + background: #fff; + border-radius: 8px; + overflow: hidden; + height: 100%; + display: flex; + flex-direction: column; + box-shadow: 0 2px 4px rgba(0,0,0,0.05); + } + + .product-img-mobile { + width: 100%; + aspect-ratio: 1/1; + object-fit: contain; + background: #f8f8f8; + padding: 10px; + } + + .product-info-mobile { + padding: 8px; + display: flex; + flex-direction: column; + flex-grow: 1; + } + + .product-title-mobile { + font-size: 0.85rem; + color: #333; + margin-bottom: 5px; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + overflow: hidden; + height: 2.4rem; + line-height: 1.2rem; + } + + .product-price-mobile { + color: var(--primary-color); + font-weight: bold; + font-size: 1.1rem; + margin-top: auto; + } + + .product-tag-mobile { + background: var(--primary-color); + color: #fff; + font-size: 0.6rem; + padding: 1px 4px; + border-radius: 3px; + margin-right: 4px; + } + + /* Buttons */ + .btn-primary { + background: var(--primary-color); + border-radius: 20px; + } } -.text-white-50 { - color: var(--text-muted) !important; -} \ No newline at end of file diff --git a/assets/js/main.js b/assets/js/main.js index b4069a6..6ce092d 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -17,8 +17,9 @@ function addToCart(id, name, price, img) { function updateCartBadge() { let cart = JSON.parse(localStorage.getItem('cart') || '[]'); let count = cart.reduce((acc, item) => acc + item.qty, 0); - let badge = document.getElementById('cart-badge'); + // Update PC Badge + let badge = document.getElementById('cart-badge'); if (badge) { if (count > 0) { badge.textContent = count; @@ -27,6 +28,17 @@ function updateCartBadge() { badge.classList.add('d-none'); } } + + // Update Mobile Badge + let mobileBadge = document.getElementById('cart-badge-mobile'); + if (mobileBadge) { + if (count > 0) { + mobileBadge.textContent = count; + mobileBadge.classList.remove('d-none'); + } else { + mobileBadge.classList.add('d-none'); + } + } } // Toast Notification @@ -100,4 +112,4 @@ document.addEventListener('DOMContentLoaded', function() { card.style.transition = 'all 0.6s cubic-bezier(0.23, 1, 0.32, 1)'; observer.observe(card); }); -}); \ No newline at end of file +}); diff --git a/assets/pasted-20260208-114738-f0f7e8f4.png b/assets/pasted-20260208-114738-f0f7e8f4.png new file mode 100644 index 0000000..6c514ca Binary files /dev/null and b/assets/pasted-20260208-114738-f0f7e8f4.png differ diff --git a/checkout.php b/checkout.php index dd0d66c..bc951a0 100644 --- a/checkout.php +++ b/checkout.php @@ -1,9 +1,18 @@ prepare("SELECT * FROM products WHERE id = ?"); + $stmt->execute([$direct_id]); + $direct_product = $stmt->fetch(); +} + +$redirect_url = ''; // Handle POST request to create order if ($_SERVER['REQUEST_METHOD'] === 'POST') { @@ -11,78 +20,83 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $payment_method = $_POST['payment_method'] ?? 'USDT (TRC20)'; $cart_data = json_decode($_POST['cart_data'], true); - if (empty($cart_data)) { - header("Location: cart.php"); + if (!empty($cart_data)) { + // Calculate total + $total = 0; + foreach ($cart_data as $item) { + $total += $item['price'] * $item['qty']; + } + + // Generate order number + $order_no = 'HR' . date('YmdHis') . rand(100, 999); + + // Create order + $stmt = $db->prepare("INSERT INTO orders (order_no, total_amount, payment_method, contact_info, status) VALUES (?, ?, ?, '', 'pending')"); + $stmt->execute([$order_no, $total, $payment_method]); + $order_id = $db->lastInsertId(); + + // Create order items + foreach ($cart_data as $item) { + $stmt = $db->prepare("INSERT INTO order_items (order_id, product_id, quantity, price_usdt) VALUES (?, ?, ?, ?)"); + $stmt->execute([$order_id, $item['id'], $item['qty'], $item['price']]); + } + + // Send Telegram notification + if (function_exists('sendTelegramMessage')) { + $msg = "🔔 *New Order Created*\n\n"; + $msg .= "Order No: `{$order_no}`\n"; + $msg .= "Total Amount: `{$total} USDT`\n"; + $msg .= "Status: Pending Payment"; + sendTelegramMessage($msg); + } + + $redirect_url = "payment.php?order_no=" . $order_no; + header("Location: " . $redirect_url); exit; } - - // Calculate total - $total = 0; - foreach ($cart_data as $item) { - $total += $item['price'] * $item['qty']; - } - - // Generate order number - $order_no = 'HR' . date('YmdHis') . rand(100, 999); - - // Create order - contact_info is now optional or empty - $stmt = $db->prepare("INSERT INTO orders (order_no, total_amount, payment_method, contact_info, status) VALUES (?, ?, ?, '', 'pending')"); - $stmt->execute([$order_no, $total, $payment_method]); - $order_id = $db->lastInsertId(); - - // Create order items - foreach ($cart_data as $item) { - $stmt = $db->prepare("INSERT INTO order_items (order_id, product_id, quantity, price_usdt) VALUES (?, ?, ?, ?)"); - $stmt->execute([$order_id, $item['id'], $item['qty'], $item['price']]); - } - - // Redirect to payment - header("Location: payment.php?order_no=" . $order_no); - exit; } ?> -
+
-
-
-

确认订单信息

-

请核对您的订单商品,确认无误后点击下方按钮进入支付页面。

+
+
+

确认订单信息

-
- -
+
+ +
-
- +
+
-
USDT (TRC20)
-
推荐使用,区块链自动确认
+
USDT (TRC20)
+
推荐使用,区块链自动确认
- +
-
-
订单详情
+
+
订单详情
-
+
- 应付总额 - 0.00 USDT + 应付总额 + 0.00 USDT
- @@ -94,14 +108,23 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { - - - \ No newline at end of file + \ No newline at end of file diff --git a/db/config.php b/db/config.php index 2d5dd58..5877f1b 100644 --- a/db/config.php +++ b/db/config.php @@ -15,3 +15,41 @@ function db() { } return $pdo; } + +/** + * Send message to Telegram Bot + */ +function sendTelegramMessage($message) { + $db = db(); + try { + $stmt = $db->query("SELECT key_name, key_value FROM settings WHERE key_name IN ('tg_bot_token', 'tg_chat_id')"); + $settings = $stmt->fetchAll(PDO::FETCH_KEY_PAIR); + + $token = $settings['tg_bot_token'] ?? ''; + $chat_id = $settings['tg_chat_id'] ?? ''; + + if (empty($token) || empty($chat_id)) { + return false; + } + + $url = "https://api.telegram.org/bot{$token}/sendMessage"; + $data = [ + 'chat_id' => $chat_id, + 'text' => $message, + 'parse_mode' => 'Markdown' + ]; + + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data)); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_TIMEOUT, 10); + $response = curl_exec($ch); + curl_close($ch); + + return $response; + } catch (Exception $e) { + return false; + } +} \ No newline at end of file diff --git a/db/migrations/20260209_add_settings.sql b/db/migrations/20260209_add_settings.sql new file mode 100644 index 0000000..d1fd3a6 --- /dev/null +++ b/db/migrations/20260209_add_settings.sql @@ -0,0 +1,9 @@ +-- Add missing settings keys +INSERT IGNORE INTO settings (key_name, key_value, description) VALUES +('tg_bot_token', '', 'Telegram机器人Token'), +('tg_chat_id', '', 'Telegram接收通知ID'), +('usdt_address', 'Txxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'USDT收款地址(TRC20)'), +('qr_code_custom', '', '自定义收款二维码URL (留空则自动生成)'), +('tg_channel', '', '官方频道链接'), +('site_logo', 'assets/pasted-20260208-082111-302e08e2.png', '网站Logo路径'), +('site_name', '豪软世界', '网站名称'); diff --git a/faq.php b/faq.php index 1786ceb..b2d2401 100644 --- a/faq.php +++ b/faq.php @@ -5,7 +5,7 @@ include 'includes/header.php';
-

常见问题

+

常见问题

您可能遇到的一些疑问,我们在这里为您解答

@@ -14,7 +14,7 @@ include 'includes/header.php';

-

@@ -27,7 +27,7 @@ include 'includes/header.php';

-

@@ -40,7 +40,7 @@ include 'includes/header.php';

-

@@ -53,7 +53,7 @@ include 'includes/header.php';

-

@@ -66,8 +66,8 @@ include 'includes/header.php';
-
-

没找到您要的答案?

+
+

没找到您要的答案?

咨询在线客服
diff --git a/includes/footer.php b/includes/footer.php index ea1d9db..490bace 100644 --- a/includes/footer.php +++ b/includes/footer.php @@ -1,18 +1,19 @@ +
-