周公解梦专业版主题 V1.0
主题分类: 传统文化
演示地址: 暂无演示,查看截图
CMS版本: 最低 V 7.5
主题价格: 免费
发布日期: 2026-10-25 11:14:20
下载安装 提示:下载为默认主题,必须登后台--主题中心--安装周公解梦专业版主题方可。

周公解梦专业版主题 主题说明

简介:周公解梦主题风格静谧幽深,以深蓝夜空为主色调,包含梦境解析、AI解梦、文章展示等。由逗号API提供AI解梦能力,录入姓名、性别、出生日期与梦境,一键生成五大维度解析报告,速度快,结果好。

主题截图

首页截图
首页截图
订单详情页截图
订单详情页截图
文章详情页截图
文章详情页截图

安装方法

  1. 下载逗号CMS → 登录后台 → 主题管理 → 主题列表,找到「周公解梦主题模板」主题,点击免费安装
  2. 进入后台 → 网站设置 → SEO 设置,配置首页、文章分类列表页、文章详情页的 SEO 信息。
  3. 进入 后台 → 网站设置 → 顶部导航,配置顶部导航及链接。
  4. 可选:进入后台 → 支付管理 → 支付配置,开启配置后即可让用户付费后才能查看。

配置 API

周公解梦依赖「逗号API」接口,各功能接口如下:

核心功能接口

  • AI 周公解梦 — 输入姓名、性别、出生日期与时辰、梦境描述,生成五大维度解析报告
    调用API接口:https://api.douhao.com/jie/73.html,按次计费,2积分/次(约等于2分钱)

获取 API 密钥

  1. 访问 逗号API网站 注册账号
  2. 登录后台首页,复制「API密钥」

配置 API 密钥

  1. 您的网站后台 → 网站设置(或主题中心)
  2. 在「逗号API密钥」输入框粘贴密钥--保存设置

积分获取方式

可以 充值积分 还可以 推广获积分

接口参数一览

功能api_id入参字段
AI 周公解梦73name / gender / birthday / dream
如积分不足,请前往逗号API网站充值。账户积分与价格可在逗号API后台查看。

功能特色

AI 智能解梦

输入姓名、性别、出生日期与时辰、梦境描述,一键生成五大维度解析报告,速度快,结果好。

五大解析维度

心境解读、运势启示、象征预兆、个性解梦、周公建议,多角度解读梦境背后的启示。

进度动画体验

点击立即解梦,展示 5 个维度的进度条动画,AI 解析与动画并行进行,体验流畅不卡顿。

PC/手机自适应

一套模板自动适配各种屏幕尺寸,手机端支付弹窗改为底部抽屉式,操作更舒适。

深蓝夜空配色

深蓝色主色调,配合柔和的渐变与卡片阴影,营造静谧、神秘的解梦氛围。

付费解析开启

点击立即解梦即开始 AI 解析,结果缓存到订单中;支付成功后才展示结果。

页面列表

配置前端路由后,以下页面均可正常访问:

页面 URL 说明
首页 / 解梦主题首页(解梦表单)
全部文章 /list.html 文章列表
文章分类 /category-{id}.html 分类文章列表
文章详情 /article-{id}.html 文章内容详情
搜索页 /rs/{关键词} 站内搜索
热搜标签 /rs 热搜标签聚合页
留言本 /ubb 留言本首页

广告位配置

本主题为配置广告位。如需要,请自行配置,可以点击此处查看配置方法:https://cmss.douhao.com/manual#sec-20 查看【前台调用广告位】

前端路由规则

<?php
function parse_rewrite_url($uri, $setting, $db, $prefix) {
    if ($uri === '/ubb' || $uri === '/ubb/') {
        return 'ubb_index';
    }
    if (preg_match('/^\/ubb\/([a-zA-Z0-9_\-]+)\/?$/', $uri, $m)) {
        $_GET['slug'] = $m[1];
        return 'ubb_page';
    }

    if ($uri === '/rs' || $uri === '/rs/') {
        return 'search_rs_index';
    }
    if (preg_match('/^\/rs\/(.+?)\/?$/', $uri, $m)) {
        $kw = trim(urldecode($m[1]));
        if ($kw !== '') {
            $_GET['keyword'] = $kw;
            return 'search';
        }
    }

    if ($uri === '/list.html' || preg_match('/^\/list-([0-9]+)\.html$/', $uri, $m)) {
        if (isset($m[1])) $_GET['page'] = intval($m[1]);
        return 'list';
    }

    if ($uri === '/product.html') {
        return 'product_list';
    }

    if ($uri === '/' || $uri === '/index.php') {
        return 'index';
    }

    $query_one = function($sql, $param) use ($db) {
        $stmt = $db->prepare($sql);
        if (!$stmt) return null;
        $stmt->bind_param('s', $param);
        $stmt->execute();
        $res = $stmt->get_result();
        $row = ($res && $res->num_rows > 0) ? $res->fetch_assoc() : null;
        $stmt->close();
        return $row;
    };

    $not_found = function() {
        http_response_code(404);
        require_once ROOT_PATH . '/set/404.php';
        exit;
    };

    $product_category_prefix = preg_quote($setting['product_category_prefix'] ?? 'product-category-', '/');
    if (preg_match('/^\/' . $product_category_prefix . '([0-9a-zA-Z]+)\.html$/', $uri, $m)) {
        $mode = intval($setting['product_category_url_mode'] ?? 1);
        if ($mode == 1) {
            $_GET['id'] = intval($m[1]);
        } else {
            $field = ($mode == 2) ? 'hash_id' : 'md5_id';
            $row = $query_one("SELECT id FROM {$prefix}product_category WHERE $field = ? LIMIT 1", $m[1]);
            if (!$row) $not_found();
            $_GET['id'] = intval($row['id']);
        }
        return 'product_list';
    }

    $product_prefix = preg_quote($setting['product_prefix'] ?? 'product-', '/');
    if (preg_match('/^\/' . $product_prefix . '([0-9a-zA-Z]+)\.html$/', $uri, $m)) {
        $mode = intval($setting['product_url_mode'] ?? 1);
        if ($mode == 1) {
            $_GET['id'] = intval($m[1]);
        } else {
            $field = ($mode == 2) ? 'hash_id' : 'md5_id';
            $row = $query_one("SELECT id FROM {$prefix}product WHERE $field = ? LIMIT 1", $m[1]);
            if (!$row) $not_found();
            $_GET['id'] = intval($row['id']);
        }
        return 'product_detail';
    }

    $article_prefix_raw = $setting['article_prefix'] ?? 'article-';
    if (strpos($article_prefix_raw, '{category_en_name}') !== false) {
        $article_prefix_regex = str_replace(
            preg_quote('{category_en_name}', '/'),
            '([a-zA-Z0-9_-]+)',
            preg_quote($article_prefix_raw, '/')
        );
        if (preg_match('/^\/' . $article_prefix_regex . '([0-9a-zA-Z]+)\.html$/', $uri, $m)) {
            $mode = intval($setting['url_mode'] ?? 1);
            if ($mode == 1) {
                $_GET['id'] = intval($m[2]);
            } else {
                $field = ($mode == 2) ? 'hash_id' : 'md5_id';
                $row = $query_one("SELECT id FROM {$prefix}article WHERE $field = ? LIMIT 1", $m[2]);
                if (!$row) $not_found();
                $_GET['id'] = intval($row['id']);
            }
            return 'article';
        }
    } else {
        $article_prefix = preg_quote($article_prefix_raw, '/');
        if (preg_match('/^\/' . $article_prefix . '([0-9a-zA-Z]+)\.html$/', $uri, $m)) {
            $mode = intval($setting['url_mode'] ?? 1);
            if ($mode == 1) {
                $_GET['id'] = intval($m[1]);
            } else {
                $field = ($mode == 2) ? 'hash_id' : 'md5_id';
                $row = $query_one("SELECT id FROM {$prefix}article WHERE $field = ? LIMIT 1", $m[1]);
                if (!$row) $not_found();
                $_GET['id'] = intval($row['id']);
            }
            return 'article';
        }
    }

    $category_prefix = preg_quote($setting['category_prefix'] ?? 'category-', '/');
    if (preg_match('/^\/' . $category_prefix . '([0-9a-zA-Z_-]+)\.html$/', $uri, $m)) {
        $mode = intval($setting['category_url_mode'] ?? 1);
        if ($mode == 1) {
            $_GET['id'] = intval($m[1]);
        } elseif ($mode == 4) {
            $row = $query_one("SELECT id FROM {$prefix}category WHERE en_name = ? LIMIT 1", $m[1]);
            if (!$row) $not_found();
            $_GET['id'] = intval($row['id']);
        } else {
            $field = ($mode == 2) ? 'hash_id' : 'md5_id';
            $row = $query_one("SELECT id FROM {$prefix}category WHERE $field = ? LIMIT 1", $m[1]);
            if (!$row) $not_found();
            $_GET['id'] = intval($row['id']);
        }
        return 'category';
    }

    return '404';
}

function route_dispatch($action, $db, $prefix, $setting, $template_path) {
    if ($action === '404') {
        http_response_code(404);
        require_once ROOT_PATH . 'set/404.php';
        exit;
    }

    if ($action === 'ubb_index') {
        $seo = get_seo('ubb_index');
        include $template_path . 'header.php';
        require ROOT_PATH . 'set/ubb/index.php';
        include $template_path . 'footer.php';
        return true;
    }

    if ($action === 'ubb_page') {
        $slug = isset($_GET['slug']) ? trim($_GET['slug']) : '';
        $page_row = $db->query("SELECT * FROM {$prefix}ubb_pages WHERE slug = '" . $db->real_escape_string($slug) . "' AND status = 1 LIMIT 1")->fetch_assoc();
        $seo = get_seo('ubb_page', [
            'page_name' => $page_row['name'] ?? '',
            'page_description' => $page_row['description'] ?? '',
        ]);
        include $template_path . 'header.php';
        require ROOT_PATH . 'set/ubb/page.php';
        include $template_path . 'footer.php';
        return true;
    }

    if ($action === 'search_rs_index') {
        $seo = get_seo('search_rs_index');
        include $template_path . 'header.php';
        include $template_path . 'search_rs.php';
        include $template_path . 'footer.php';
        return true;
    }

    if ($action === 'search') {
        $_GET['action'] = 'search';
        $keyword = isset($_GET['keyword']) ? trim($_GET['keyword']) : '';
        if ($keyword !== '' && !check_sensitive_words($keyword)) {
            http_response_code(404);
            require_once ROOT_PATH . 'set/404.php';
            exit;
        }
        if ($keyword !== '') {
            record_hot_search($keyword);
            save_search_keyword(str_replace(['%', '_'], ['\\%', '\\_'], $keyword));
            $keywords = split_search_keywords_by_api($keyword);
            if (empty($keywords)) $keywords = split_search_keywords($keyword);
            $page = isset($_GET['page']) ? max(1, intval($_GET['page'])) : 1;
            $result = search_articles_by_keywords($keywords, $page, 20);
            $articles = $result['articles'];
            $total = $result['total'];
            $pagination = pagination($total, 20, $page, "/rs/" . rawurlencode($keyword) . "?");
        } else {
            $articles = [];
            $total = 0;
            $pagination = '';
        }
        $seo = get_seo('search', ['keyword' => $keyword]);
        include $template_path . 'header.php';
        include $template_path . 'category.php';
        include $template_path . 'footer.php';
        return true;
    }

    if ($action === 'list') {
        $page = isset($_GET['page']) ? max(1, intval($_GET['page'])) : 1;
        $total = get_article_count();
        $offset = ($page - 1) * 20;
        $articles = get_articles('', "$offset, 20");
        $pagination = pagination($total, 20, $page, "/list.html?");
        $seo = get_seo('category', ['category_name' => '全部文章']);
        include $template_path . 'header.php';
        include $template_path . 'category.php';
        include $template_path . 'footer.php';
        return true;
    }

    if ($action === 'category') {
        $id = isset($_GET['id']) ? intval($_GET['id']) : 0;
        $page = isset($_GET['page']) ? max(1, intval($_GET['page'])) : 1;
        $category_name = '';
        foreach (get_categories() as $cat) {
            if ($cat['id'] == $id) { $category_name = $cat['name']; break; }
        }
        if (!$category_name) {
            http_response_code(404);
            require_once ROOT_PATH . 'set/404.php';
            exit;
        }
        $seo = get_seo('category', ['category_name' => $category_name]);
        $where = "category_id = $id";
        $total = get_article_count($where);
        $offset = ($page - 1) * 20;
        $articles = get_articles($where, "$offset, 20");
        $pagination = pagination($total, 20, $page, "/" . ($setting['category_prefix'] ?? 'category-') . build_url_id('category', $id) . ".html?");
        include $template_path . 'header.php';
        include $template_path . 'category.php';
        include $template_path . 'footer.php';
        return true;
    }

    if ($action === 'article') {
        $id = isset($_GET['id']) ? intval($_GET['id']) : 0;
        $article = get_article($id);
        if (!$article) {
            http_response_code(404);
            require_once ROOT_PATH . 'set/404.php';
            exit;
        }
        update_views($id);
        $category_name = '';
        foreach (get_categories() as $cat) {
            if ($cat['id'] == $article['category_id']) { $category_name = $cat['name']; break; }
        }
        $seo = get_seo('article', [
            'article_title' => $article['title'],
            'article_description' => $article['description'] ?: mb_substr(strip_tags($article['content']), 0, 150),
            'category_name' => $category_name,
        ]);
        include $template_path . 'header.php';
        include $template_path . 'article.php';
        include $template_path . 'footer.php';
        return true;
    }

    if ($action === 'product_list') {
        $id = isset($_GET['id']) ? intval($_GET['id']) : 0;
        $page = isset($_GET['page']) ? max(1, intval($_GET['page'])) : 1;
        $category_name = '全部产品';
        if ($id > 0) {
            foreach ($db->query("SELECT * FROM {$prefix}product_category ORDER BY sort ASC") as $cat) {
                if ($cat['id'] == $id) { $category_name = $cat['name']; break; }
            }
        }
        $seo = get_seo('product_list', ['category_name' => $category_name]);
        $where = $id > 0 ? "WHERE category_id = $id" : '';
        $total = $db->query("SELECT COUNT(*) as t FROM {$prefix}product $where")->fetch_assoc()['t'];
        $offset = ($page - 1) * 12;
        $products = $db->query("SELECT * FROM {$prefix}product $where ORDER BY id DESC LIMIT $offset, 12");
        $product_cats = $db->query("SELECT * FROM {$prefix}product_category ORDER BY sort ASC");
        include $template_path . 'header.php';
        include $template_path . 'product_list.php';
        include $template_path . 'footer.php';
        return true;
    }

    if ($action === 'product_detail') {
        $id = isset($_GET['id']) ? intval($_GET['id']) : 0;
        $product = $db->query("SELECT p.*, c.name as category_name FROM {$prefix}product p LEFT JOIN {$prefix}product_category c ON p.category_id = c.id WHERE p.id = $id")->fetch_assoc();
        if (!$product) {
            http_response_code(404);
            require_once ROOT_PATH . 'set/404.php';
            exit;
        }
        $db->query("UPDATE {$prefix}product SET views = views + 1 WHERE id = $id");
        $gallery = json_decode($product['gallery'], true);
        if (!is_array($gallery)) $gallery = [];
        $seo = get_seo('product_detail', [
            'product_title' => $product['title'],
            'product_description' => $product['description'],
            'category_name' => $product['category_name'] ?? '',
        ]);
        include $template_path . 'header.php';
        include $template_path . 'product_detail.php';
        include $template_path . 'footer.php';
        return true;
    }

    if ($action === 'index') {
        $seo = get_seo('index');
        $ads = get_ads(5);
        $recommend_articles = get_articles('is_recommend = 1', $seo['recommend_count']);
        $latest_articles = get_articles('', $seo['latest_count']);
        $latest_searches = get_latest_search(5);
        include $template_path . 'header.php';
        include $template_path . 'index.php';
        include $template_path . 'footer.php';
        return true;
    }

    return false;
}

常见问题

主题截图 1 / 1