diff --git a/admin/products.php b/admin/products.php index 640c732..de1c48c 100644 --- a/admin/products.php +++ b/admin/products.php @@ -20,13 +20,14 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $stock = $_POST['stock']; $img = $_POST['image_url']; $is_hot = isset($_POST['is_hot']) ? 1 : 0; + $is_active = isset($_POST['is_active']) ? 1 : 0; if ($id) { - $stmt = $db->prepare("UPDATE products SET name=?, category_id=?, description=?, content=?, price_usdt=?, stock=?, image_url=?, is_hot=? WHERE id=?"); - $stmt->execute([$name, $cat_id, $desc, $content, $price, $stock, $img, $is_hot, $id]); + $stmt = $db->prepare("UPDATE products SET name=?, category_id=?, description=?, content=?, price_usdt=?, stock=?, image_url=?, is_hot=?, is_active=? WHERE id=?"); + $stmt->execute([$name, $cat_id, $desc, $content, $price, $stock, $img, $is_hot, $is_active, $id]); } else { - $stmt = $db->prepare("INSERT INTO products (name, category_id, description, content, price_usdt, stock, image_url, is_hot) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"); - $stmt->execute([$name, $cat_id, $desc, $content, $price, $stock, $img, $is_hot]); + $stmt = $db->prepare("INSERT INTO products (name, category_id, description, content, price_usdt, stock, image_url, is_hot, is_active) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"); + $stmt->execute([$name, $cat_id, $desc, $content, $price, $stock, $img, $is_hot, $is_active]); } header("Location: products.php"); exit; @@ -105,11 +106,15 @@ if (isset($_GET['edit'])) { -
+
>
+
+ > + +
@@ -158,6 +163,11 @@ if (isset($_GET['edit'])) { 热门 + + 隐藏 + + 显示 + 编辑 diff --git a/admin/settings.php b/admin/settings.php index 19d8108..d5dd5f2 100644 --- a/admin/settings.php +++ b/admin/settings.php @@ -1,14 +1,7 @@ $value) { @@ -29,9 +22,27 @@ $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'], + '支付与联系' => ['usdt_address', 'qr_code_custom', 'tg_link', 'customer_service_email', 'payment_info'], 'API 与 通知' => ['tg_bot_token', 'tg_chat_id'] ]; + +// Check if new settings exist, if not, create them (idempotent) +$check_new_settings = ['customer_service_email', 'payment_info']; +foreach ($check_new_settings as $new_key) { + if (!isset($settings[$new_key])) { + $desc = ($new_key == 'customer_service_email') ? '客服邮箱' : '收款信息/备注'; + $stmt = $db->prepare("INSERT IGNORE INTO settings (key_name, key_value, description) VALUES (?, '', ?)"); + $stmt->execute([$new_key, $desc]); + + // Refresh settings + $settings_raw = $db->query("SELECT * FROM settings ORDER BY id ASC")->fetchAll(); + $settings = []; + foreach ($settings_raw as $s) { + $settings[$s['key_name']] = $s; + } + } +} + ?> @@ -91,11 +102,11 @@ $groups = [ - +
- +
@@ -117,7 +128,7 @@ $groups = [ -

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

+

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

diff --git a/category.php b/category.php index e9fc19e..8d6432e 100644 --- a/category.php +++ b/category.php @@ -12,7 +12,7 @@ if (!$cat) { } // Fetch products for this category -$stmt = db()->prepare("SELECT p.*, c.name as category_name FROM products p JOIN categories c ON p.category_id = c.id WHERE p.category_id = ? ORDER BY p.id DESC"); +$stmt = db()->prepare("SELECT p.*, c.name as category_name FROM products p JOIN categories c ON p.category_id = c.id WHERE p.category_id = ? AND p.is_active = 1 ORDER BY p.id DESC"); $stmt->execute([$id]); $cat_products = $stmt->fetchAll(); ?> diff --git a/includes/footer.php b/includes/footer.php index 490bace..d1fd9a0 100644 --- a/includes/footer.php +++ b/includes/footer.php @@ -1,6 +1,7 @@ @@ -38,7 +39,7 @@ $current_page = basename($_SERVER['PHP_SELF']); 官方客服:点击跳转

- 售后邮箱:support@hao-soft.world + 售后邮箱:

USDT @@ -89,4 +90,4 @@ $current_page = basename($_SERVER['PHP_SELF']); - + \ No newline at end of file diff --git a/index.php b/index.php index f76a23f..5b704e3 100644 --- a/index.php +++ b/index.php @@ -5,11 +5,11 @@ include 'includes/header.php'; $db = db(); // Fetch hot products (Popular Recommendations) - 8 items -$hot_products = $db->query("SELECT p.*, c.name as category_name FROM products p JOIN categories c ON p.category_id = c.id WHERE p.is_hot = 1 LIMIT 8")->fetchAll(); +$hot_products = $db->query("SELECT p.*, c.name as category_name FROM products p JOIN categories c ON p.category_id = c.id WHERE p.is_hot = 1 AND p.is_active = 1 LIMIT 8")->fetchAll(); // Function to fetch products by category ID with limit function getProductsByCategory($db, $cat_id, $limit) { - $stmt = $db->prepare("SELECT p.*, c.name as category_name FROM products p JOIN categories c ON p.category_id = c.id WHERE p.category_id = :cat_id LIMIT :limit"); + $stmt = $db->prepare("SELECT p.*, c.name as category_name FROM products p JOIN categories c ON p.category_id = c.id WHERE p.category_id = :cat_id AND p.is_active = 1 LIMIT :limit"); $stmt->bindValue(':cat_id', $cat_id, PDO::PARAM_INT); $stmt->bindValue(':limit', $limit, PDO::PARAM_INT); $stmt->execute(); @@ -163,6 +163,18 @@ $categories = $db->query("SELECT * FROM categories")->fetchAll();
+ + +
+
邮箱展示区
+
+ +
+ +
+ +
+
diff --git a/payment.php b/payment.php index 765652b..f761b08 100644 --- a/payment.php +++ b/payment.php @@ -22,6 +22,7 @@ $total_qty = $qty_data['total_qty'] ?? 1; $usdt_address = $settings['usdt_address'] ?? 'Txxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; $qr_code_custom = $settings['qr_code_custom'] ?? ''; $qr_src = !empty($qr_code_custom) ? $qr_code_custom : "https://api.qrserver.com/v1/create-qr-code/?size=300x300&data=" . urlencode($usdt_address); +$payment_info = $settings['payment_info'] ?? ''; ?>
@@ -72,6 +73,15 @@ $qr_src = !empty($qr_code_custom) ? $qr_code_custom : "https://api.qrserver.com/
+ +
+
收款备注:
+
+ +
+
+ +
支付说明:
- + \ No newline at end of file