{"id":6740,"url":"https:\/\/web.daaee.cn\/.\/api\/gb.phps","title":"\u5fc5\u5e94\u58c1\u7eb8\u5217\u8868 - \u6309\u5e74\u6708\u5f52\u6863","content":"<?php\n\/\/ ================== \u914d\u7f6e\u533a\u57df ==================\ndefine('BING_CACHE_FILE', 'bing_cache.json');      \/\/ \u58c1\u7eb8\u4fe1\u606f\u7f13\u5b58\u6587\u4ef6\ndefine('BING_CACHE_TIME', 12 * 3600);              \/\/ \u7f13\u5b58\u65f6\u95f412\u5c0f\u65f6\ndefine('DB_FILE', 'bing_wallpaper.db');            \/\/ SQLite\u6570\u636e\u5e93\u6587\u4ef6\n\/\/ =============================================\n\n\/\/ ================== \u521d\u59cb\u5316SQLite ==================\n$need_db_init = !file_exists(DB_FILE);\ntry {\n    $db = new PDO('sqlite:' . DB_FILE);\n    $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);\n    \n    \/\/ \u521b\u5efa\u58c1\u7eb8\u8868 (\u9884\u7559\u5907\u7528\u5b57\u6bb51-3)\n    $db->exec(\"\n        CREATE TABLE IF NOT EXISTS wallpapers (\n            id INTEGER PRIMARY KEY AUTOINCREMENT,\n            hash TEXT UNIQUE,                       -- \u56fe\u7247\u552f\u4e00\u6807\u8bc6\n            title TEXT,\n            copyright TEXT,\n            copyrightlink TEXT,\n            url TEXT,                               -- UHD\u56fe\u7247\u5730\u5740\n            url_1080p TEXT,                          -- 1080P\u56fe\u7247\u5730\u5740\n            date TEXT,                               -- \u65e5\u671f enddate\n            year INTEGER,                             -- \u5e74\u4efd(\u7528\u4e8e\u5206\u7c7b)\n            month INTEGER,                            -- \u6708\u4efd(\u7528\u4e8e\u5206\u7c7b)\n            reserve1 TEXT,                            -- \u5907\u7528\u5b57\u6bb51\n            reserve2 TEXT,                            -- \u5907\u7528\u5b57\u6bb52\n            reserve3 TEXT,                            -- \u5907\u7528\u5b57\u6bb53\n            created_at DATETIME DEFAULT CURRENT_TIMESTAMP\n        )\n    \");\n    \n    \/\/ \u521b\u5efa\u7d22\u5f15\n    $db->exec(\"CREATE INDEX IF NOT EXISTS idx_year_month ON wallpapers (year, month)\");\n    $db->exec(\"CREATE INDEX IF NOT EXISTS idx_date ON wallpapers (date)\");\n    \n} catch (PDOException $e) {\n    die(\"\u6570\u636e\u5e93\u521d\u59cb\u5316\u5931\u8d25: \" . $e->getMessage());\n}\n\/\/ ==================================================\n\n\/\/ \u83b7\u53d6\u5f53\u524d\u811a\u672c\u5b8c\u6574URL\uff08\u7528\u4e8e\u751f\u6210\u94fe\u63a5\uff09\n$self = $_SERVER['PHP_SELF'];\n$base_url = (isset($_SERVER['HTTPS']) ? 'https:\/\/' : 'http:\/\/') . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['SCRIPT_NAME']), '\/') . '\/';\n\n\/\/ ================== \u83b7\u53d6\u5fc5\u5e94\u58c1\u7eb8\u51fd\u6570 ==================\nfunction getBingWallpaper($db, $cache_file, $cache_time) {\n    \/\/ \u68c0\u67e5\u7f13\u5b58\u662f\u5426\u5b58\u5728\u4e14\u672a\u8fc7\u671f\n    $use_cache = false;\n    $bing_data = null;\n    $result = null;\n    \n    if (file_exists($cache_file)) {\n        $cache_mtime = filemtime($cache_file);\n        $current_time = time();\n        \n        \/\/ \u5982\u679c\u7f13\u5b58\u6587\u4ef6\u572812\u5c0f\u65f6\u5185\uff0c\u5219\u4f7f\u7528\u7f13\u5b58\n        if (($current_time - $cache_mtime) < $cache_time) {\n            $cached_content = file_get_contents($cache_file);\n            $cached_data = json_decode($cached_content, true);\n            \n            \/\/ \u9a8c\u8bc1\u7f13\u5b58\u6570\u636e\u662f\u5426\u6709\u6548\n            if (isset($cached_data['success']) && $cached_data['success']) {\n                $result = $cached_data;\n                $use_cache = true;\n            }\n        }\n    }\n    \n    \/\/ \u5982\u679c\u7f13\u5b58\u65e0\u6548\u6216\u8fc7\u671f\uff0c\u5219\u4ece\u5fc5\u5e94\u83b7\u53d6\u65b0\u6570\u636e\n    if (!$use_cache) {\n        \/\/ \u83b7\u53d6bing\u6bcf\u65e5\u58c1\u7eb8\n        $bing_url = 'https:\/\/www.bing.com\/HPImageArchive.aspx?format=js&idx=0&n=1&mkt=zh-CN';\n        \n        \/\/ \u4f7f\u7528curl\u83b7\u53d6bing\u6570\u636e\n        $ch = curl_init();\n        curl_setopt($ch, CURLOPT_URL, $bing_url);\n        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);\n        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);\n        curl_setopt($ch, CURLOPT_TIMEOUT, 10);\n        curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/91.0.4472.124 Safari\/537.36');\n        \n        $bing_raw_data = curl_exec($ch);\n        $curl_error = curl_error($ch);\n        curl_close($ch);\n        \n        if ($bing_raw_data && !$curl_error) {\n            $bing_json = json_decode($bing_raw_data, true);\n            \n            if (isset($bing_json['images'][0])) {\n                $image = $bing_json['images'][0];\n                $base_url = 'https:\/\/www.bing.com';\n                \n                \/\/ \u83b7\u53d6\u9ad8\u6e05\u7248\u56fe\u7247\uff08\u66ff\u6362\u4e3aUHD\u7248\u672c\uff09\n                $image_url = $base_url . $image['url'];\n                $uhd_url = str_replace('1920x1080', 'UHD', $image_url);\n                \n                \/\/ \u89e3\u6790\u5e74\u6708\n                $enddate = $image['enddate'] ?? '';\n                $year = $month = 0;\n                if (strlen($enddate) >= 6) {\n                    $year = intval(substr($enddate, 0, 4));\n                    $month = intval(substr($enddate, 4, 2));\n                } else {\n                    $year = intval(date('Y'));\n                    $month = intval(date('m'));\n                }\n                \n                \/\/ \u6784\u5efa\u8fd4\u56de\u6570\u636e\n                $result = array(\n                    'success' => true,\n                    'title' => $image['title'] ?? '\u5fc5\u5e94\u6bcf\u65e5\u58c1\u7eb8',\n                    'copyright' => $image['copyright'] ?? '',\n                    'copyrightlink' => isset($image['copyrightlink']) ? $base_url . $image['copyrightlink'] : '',\n                    'url' => $uhd_url,\n                    'url_1080p' => $base_url . $image['url'],\n                    'date' => $enddate,\n                    'hash' => $image['hsh'] ?? '',\n                    'cache_time' => date('Y-m-d H:i:s', time()),\n                    'cache_expire' => date('Y-m-d H:i:s', time() + $cache_time)\n                );\n                \n                \/\/ \u4fdd\u5b58\u5230\u7f13\u5b58\u6587\u4ef6\n                file_put_contents($cache_file, json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE), LOCK_EX);\n                \n                \/\/ \u5b58\u5165SQLite\u6570\u636e\u5e93\uff08\u5982\u679c\u4e0d\u5b58\u5728\uff09\n                try {\n                    $stmt = $db->prepare(\"SELECT id FROM wallpapers WHERE hash = ?\");\n                    $stmt->execute([$result['hash']]);\n                    if (!$stmt->fetch()) {\n                        $insert = $db->prepare(\"\n                            INSERT INTO wallpapers (hash, title, copyright, copyrightlink, url, url_1080p, date, year, month, reserve1, reserve2, reserve3)\n                            VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, '', '', '')\n                        \");\n                        $insert->execute([\n                            $result['hash'],\n                            $result['title'],\n                            $result['copyright'],\n                            $result['copyrightlink'],\n                            $result['url'],\n                            $result['url_1080p'],\n                            $result['date'],\n                            $year,\n                            $month\n                        ]);\n                    }\n                } catch (PDOException $e) {\n                    error_log(\"SQLite insert error: \" . $e->getMessage());\n                }\n            } else {\n                $result = array(\n                    'success' => false,\n                    'error' => '\u83b7\u53d6\u5fc5\u5e94\u58c1\u7eb8\u5931\u8d25\uff1a\u6570\u636e\u683c\u5f0f\u9519\u8bef'\n                );\n            }\n        } else {\n            $result = array(\n                'success' => false,\n                'error' => '\u83b7\u53d6\u5fc5\u5e94\u58c1\u7eb8\u5931\u8d25\uff1a' . ($curl_error ?: '\u672a\u77e5\u9519\u8bef')\n            );\n        }\n    }\n    \n    return $result;\n}\n\n\/\/ ================== \u8def\u7531\u5904\u7406 ==================\n$action = isset($_GET['action']) ? $_GET['action'] : '';\n\n\/\/ 1. \u58c1\u7eb8\u5217\u8868\u9875\u9762 (\u5e26\u5e74\u6708\u5206\u7c7b)\nif ($action === 'list') {\n    $page = isset($_GET['page']) ? max(1, intval($_GET['page'])) : 1;\n    $per_page = 20;\n    $offset = ($page - 1) * $per_page;\n    \n    \/\/ \u83b7\u53d6\u5e74\u6708\u7b5b\u9009\n    $selected_year = isset($_GET['year']) ? intval($_GET['year']) : 0;\n    $selected_month = isset($_GET['month']) ? intval($_GET['month']) : 0;\n    \n    \/\/ \u83b7\u53d6\u6240\u6709\u53ef\u7528\u7684\u5e74\u4efd\u6708\u4efd\n    $year_month_list = [];\n    $stmt = $db->query(\"SELECT DISTINCT year, month FROM wallpapers WHERE year IS NOT NULL AND month IS NOT NULL ORDER BY year DESC, month DESC\");\n    while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {\n        $year_month_list[] = $row;\n    }\n    \n    \/\/ \u6784\u5efa\u67e5\u8be2\u6761\u4ef6\n    $where_sql = \"1=1\";\n    $params = [];\n    if ($selected_year > 0) {\n        $where_sql .= \" AND year = :year\";\n        $params[':year'] = $selected_year;\n        if ($selected_month > 0) {\n            $where_sql .= \" AND month = :month\";\n            $params[':month'] = $selected_month;\n        }\n    }\n    \n    \/\/ \u67e5\u8be2\u603b\u6570\n    $count_stmt = $db->prepare(\"SELECT COUNT(*) FROM wallpapers WHERE $where_sql\");\n    foreach ($params as $key => $val) $count_stmt->bindValue($key, $val);\n    $count_stmt->execute();\n    $total = $count_stmt->fetchColumn();\n    $total_pages = ceil($total \/ $per_page);\n    \n    \/\/ \u67e5\u8be2\u5f53\u524d\u9875\u6570\u636e\n    $sql = \"SELECT * FROM wallpapers WHERE $where_sql ORDER BY date DESC, id DESC LIMIT :limit OFFSET :offset\";\n    $stmt = $db->prepare($sql);\n    foreach ($params as $key => $val) $stmt->bindValue($key, $val);\n    $stmt->bindValue(':limit', $per_page, PDO::PARAM_INT);\n    $stmt->bindValue(':offset', $offset, PDO::PARAM_INT);\n    $stmt->execute();\n    $wallpapers = $stmt->fetchAll(PDO::FETCH_ASSOC);\n    \n    ?>\n    <!DOCTYPE html>\n    <html lang=\"zh-CN\">\n    <head>\n        <meta charset=\"UTF-8\">\n        <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.5, user-scalable=yes\">\n        <title>\u5fc5\u5e94\u58c1\u7eb8\u5217\u8868 - \u6309\u5e74\u6708\u5f52\u6863<\/title>\n        <style>\n            * { box-sizing: border-box; margin: 0; padding: 0; }\n            body { font-family: 'Segoe UI', Roboto, sans-serif; background: #f5f7fa; padding: 20px; }\n            .container { max-width: 1400px; margin: 0 auto; }\n            h1 { font-size: 1.8rem; margin-bottom: 20px; color: #2c3e50; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }\n            h1 a { font-size: 1rem; background: #3498db; color: white; padding: 8px 16px; border-radius: 30px; text-decoration: none; }\n            .filter-form { background: white; padding: 15px 20px; border-radius: 40px; box-shadow: 0 4px 10px rgba(0,0,0,0.05); margin-bottom: 30px; display: flex; flex-wrap: wrap; gap: 15px; align-items: center; }\n            .filter-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }\n            select { padding: 10px 18px; border-radius: 40px; border: 1px solid #ddd; background: white; font-size: 1rem; cursor: pointer; outline: none; }\n            .btn { background: #3498db; color: white; border: none; padding: 10px 24px; border-radius: 40px; font-size: 1rem; cursor: pointer; text-decoration: none; display: inline-block; transition: background 0.2s; }\n            .btn:hover { background: #2980b9; }\n            .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }\n            .card { background: white; border-radius: 16px; overflow: hidden; box-shadow: 0 5px 15px rgba(0,0,0,0.08); transition: transform 0.2s; text-decoration: none; color: inherit; display: block; }\n            .card:hover { transform: translateY(-5px); box-shadow: 0 12px 20px rgba(0,0,0,0.15); }\n            .card-img { width: 100%; aspect-ratio: 16\/9; object-fit: cover; display: block; background: #eee; }\n            .card-info { padding: 15px; }\n            .card-title { font-weight: 600; margin-bottom: 6px; color: #2c3e50; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n            .card-copyright { font-size: 0.8rem; color: #7f8c8d; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n            .card-date { font-size: 0.75rem; color: #95a5a6; margin-top: 8px; }\n            .pagination { margin-top: 40px; display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }\n            .pagination a, .pagination span { display: inline-block; padding: 10px 16px; border-radius: 40px; background: white; text-decoration: none; color: #3498db; border: 1px solid #e0e0e0; }\n            .pagination .current { background: #3498db; color: white; border-color: #3498db; }\n            .empty-msg { text-align: center; padding: 60px 20px; color: #7f8c8d; font-size: 1.2rem; }\n            @media (max-width: 600px) {\n                body { padding: 15px; }\n                h1 { font-size: 1.5rem; }\n                .filter-form { border-radius: 24px; flex-direction: column; align-items: stretch; }\n                .btn { text-align: center; }\n            }\n        <\/style>\n    <\/head>\n    <body>\n        <div class=\"container\">\n            <h1>\n                \ud83d\udcc5 \u5fc5\u5e94\u58c1\u7eb8\u5f52\u6863\n                <a href=\"?url=https%3A%2F%2Fweb.daaee.cn%2F%3C%3Fphp+echo+htmlspecialchars%28%24self%29%3B+%3F%3E\" class=\"btn\">\ud83c\udfe0 \u8fd4\u56de\u9996\u9875<\/a>\n            <\/h1>\n            \n            <form method=\"get\" class=\"filter-form\">\n                <input type=\"hidden\" name=\"action\" value=\"list\">\n                <div class=\"filter-group\">\n                    <select name=\"year\" onchange=\"this.form.submit()\">\n                        <option value=\"0\">\u5168\u90e8\u5e74\u4efd<\/option>\n                        <?php\n                        $years = array_unique(array_column($year_month_list, 'year'));\n                        rsort($years);\n                        foreach ($years as $y): ?>\n                            <option value=\"<?php echo $y; ?>\" <?php echo $selected_year == $y ? 'selected' : ''; ?>><?php echo $y; ?>\u5e74<\/option>\n                        <?php endforeach; ?>\n                    <\/select>\n                    \n                    <select name=\"month\" onchange=\"this.form.submit()\" <?php echo $selected_year == 0 ? 'disabled' : ''; ?>>\n                        <option value=\"0\">\u5168\u90e8\u6708\u4efd<\/option>\n                        <?php for ($m = 1; $m <= 12; $m++): ?>\n                            <option value=\"<?php echo $m; ?>\" <?php echo $selected_month == $m ? 'selected' : ''; ?>><?php echo $m; ?>\u6708<\/option>\n                        <?php endfor; ?>\n                    <\/select>\n                <\/div>\n                <noscript><button type=\"submit\" class=\"btn\">\u7b5b\u9009<\/button><\/noscript>\n            <\/form>\n            \n            <?php if (empty($wallpapers)): ?>\n                <div class=\"empty-msg\">\u2728 \u6682\u65e0\u58c1\u7eb8\u8bb0\u5f55\uff0c\u5148\u53bb\u9996\u9875\u83b7\u53d6\u4e00\u5f20\u5427~<\/div>\n            <?php else: ?>\n                <div class=\"grid\">\n                    <?php foreach ($wallpapers as $item): ?>\n                        <a href=\"<?php echo $self; ?>?action=view&id=<?php echo $item['id']; ?>\" class=\"card\">\n                            <img class=\"card-img\" src=\"<?php echo htmlspecialchars($item['url_1080p']); ?>\" loading=\"lazy\" alt=\"<?php echo htmlspecialchars($item['title']); ?>\">\n                            <div class=\"card-info\">\n                                <div class=\"card-title\"><?php echo htmlspecialchars(mb_substr($item['title'], 0, 30)); ?><\/div>\n                                <div class=\"card-copyright\"><?php echo htmlspecialchars(mb_substr($item['copyright'], 0, 40)); ?><\/div>\n                                <div class=\"card-date\"><?php echo $item['year']; ?>\u5e74<?php echo $item['month']; ?>\u6708<\/div>\n                            <\/div>\n                        <\/a>\n                    <?php endforeach; ?>\n                <\/div>\n                \n                <?php if ($total_pages > 1): ?>\n                <div class=\"pagination\">\n                    <?php if ($page > 1): ?>\n                        <a href=\"?url=https%3A%2F%2Fweb.daaee.cn%2F%3Faction%3Dlist%26page%3D%3C%3Fphp+echo+%24page-1%3B+%3F%3E%26year%3D%3C%3Fphp+echo+%24selected_year%3B+%3F%3E%26month%3D%3C%3Fphp+echo+%24selected_month%3B+%3F%3E\">\u4e0a\u4e00\u9875<\/a>\n                    <?php endif; ?>\n                    \n                    <?php\n                    $start = max(1, $page - 2);\n                    $end = min($total_pages, $page + 2);\n                    for ($i = $start; $i <= $end; $i++):\n                    ?>\n                        <?php if ($i == $page): ?>\n                            <span class=\"current\"><?php echo $i; ?><\/span>\n                        <?php else: ?>\n                            <a href=\"?url=https%3A%2F%2Fweb.daaee.cn%2F%3Faction%3Dlist%26page%3D%3C%3Fphp+echo+%24i%3B+%3F%3E%26year%3D%3C%3Fphp+echo+%24selected_year%3B+%3F%3E%26month%3D%3C%3Fphp+echo+%24selected_month%3B+%3F%3E\"><?php echo $i; ?><\/a>\n                        <?php endif; ?>\n                    <?php endfor; ?>\n                    \n                    <?php if ($page < $total_pages): ?>\n                        <a href=\"?url=https%3A%2F%2Fweb.daaee.cn%2F%3Faction%3Dlist%26page%3D%3C%3Fphp+echo+%24page%2B1%3B+%3F%3E%26year%3D%3C%3Fphp+echo+%24selected_year%3B+%3F%3E%26month%3D%3C%3Fphp+echo+%24selected_month%3B+%3F%3E\">\u4e0b\u4e00\u9875<\/a>\n                    <?php endif; ?>\n                <\/div>\n                <?php endif; ?>\n            <?php endif; ?>\n        <\/div>\n    <\/body>\n    <\/html>\n    <?php\n    exit;\n}\n\n\/\/ 2. \u67e5\u770b\u5355\u5f20\u58c1\u7eb8\u8be6\u60c5 (\u70b9\u51fb\u5217\u8868\u8fdb\u5165\u5927\u56fe)\nif ($action === 'view' && isset($_GET['id'])) {\n    $id = intval($_GET['id']);\n    $stmt = $db->prepare(\"SELECT * FROM wallpapers WHERE id = ?\");\n    $stmt->execute([$id]);\n    $item = $stmt->fetch(PDO::FETCH_ASSOC);\n    \n    if (!$item) {\n        header('Location: ' . $self . '?action=list');\n        exit;\n    }\n    \/\/ \u76f4\u63a5\u91cd\u5b9a\u5411\u5230\u9ad8\u6e05\u56fe\u7247\n    header('Location: ' . $item['url']);\n    exit;\n}\n\n\/\/ 3. \u5fc5\u5e94API\u6570\u636e\u63a5\u53e3 (\u539fbz\u903b\u8f91)\nif (isset($_GET['bz'])) {\n    $result = getBingWallpaper($db, BING_CACHE_FILE, BING_CACHE_TIME);\n    \n    \/\/ \u5982\u679c\u8bf7\u6c42\u53c2\u6570\u4e2d\u6709 json\uff0c\u8fd4\u56deJSON\u6570\u636e\n    if (isset($_GET['json'])) {\n        header('Content-Type: application\/json; charset=utf-8');\n        echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);\n        exit;\n    }\n    \n    \/\/ \u9ed8\u8ba4\uff1a\u91cd\u5b9a\u5411\u5230\u56fe\u7247\n    if ($result['success']) {\n        header('Location: ' . $result['url']);\n    } else {\n        header('Content-Type: application\/json; charset=utf-8');\n        echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);\n    }\n    exit;\n}\n\n\/\/ ================== \u9996\u9875\uff1a\u5168\u5c4f\u5c55\u793a\u5f53\u524d\u58c1\u7eb8 ==================\n\/\/ \u83b7\u53d6\u4eca\u65e5\u58c1\u7eb8\uff08\u4f18\u5148\u7f13\u5b58\uff0c\u6ca1\u6709\u5219\u5b9e\u65f6\u83b7\u53d6\uff09\n$wallpaper = getBingWallpaper($db, BING_CACHE_FILE, BING_CACHE_TIME);\n\n\/\/ \u5982\u679c\u83b7\u53d6\u5931\u8d25\uff0c\u5c1d\u8bd5\u4ece\u6570\u636e\u5e93\u83b7\u53d6\u6700\u65b0\u7684\u4e00\u5f20\u4f5c\u4e3a\u5907\u7528\nif (!$wallpaper['success']) {\n    $stmt = $db->query(\"SELECT * FROM wallpapers ORDER BY date DESC, id DESC LIMIT 1\");\n    $latest = $stmt->fetch(PDO::FETCH_ASSOC);\n    if ($latest) {\n        $wallpaper = [\n            'success' => true,\n            'title' => $latest['title'],\n            'copyright' => $latest['copyright'],\n            'url' => $latest['url'],\n            'id' => $latest['id']\n        ];\n    }\n}\n\n\/\/ \u67e5\u8be2\u4e0a\u4e00\u5f20\u58c1\u7eb8 (\u6309id\u5012\u5e8f\uff0c\u53d6\u6bd4\u5f53\u524d\u5c0f\u7684\u6700\u5927id)\n$prev = null;\nif (isset($wallpaper['id']) && $wallpaper['id'] > 0) {\n    $stmt = $db->prepare(\"SELECT * FROM wallpapers WHERE id < ? ORDER BY id DESC LIMIT 1\");\n    $stmt->execute([$wallpaper['id']]);\n    $prev = $stmt->fetch(PDO::FETCH_ASSOC);\n} else {\n    \/\/ \u5982\u679c\u6ca1\u6709id\uff08\u521a\u83b7\u53d6\u8fd8\u6ca1\u5b58\u5165\u6570\u636e\u5e93\uff1f\u4f46getBingWallpaper\u5df2\u7ecf\u5b58\u5165\uff0c\u6240\u4ee5\u5e94\u8be5\u6709id\uff09\n    \/\/ \u6216\u8005\u53d6\u6700\u65b0\u7684\u4e00\u5f20\u4f5c\u4e3a\u5f53\u524d\uff0c\u7136\u540e\u53d6\u4e0a\u4e00\u5f20\n    $stmt = $db->query(\"SELECT * FROM wallpapers ORDER BY id DESC LIMIT 1\");\n    $current = $stmt->fetch(PDO::FETCH_ASSOC);\n    if ($current) {\n        $wallpaper['id'] = $current['id'];\n        $wallpaper['title'] = $current['title'];\n        $wallpaper['copyright'] = $current['copyright'];\n        $wallpaper['url'] = $current['url'];\n        \/\/ \u518d\u67e5\u4e0a\u4e00\u5f20\n        $stmt2 = $db->prepare(\"SELECT * FROM wallpapers WHERE id < ? ORDER BY id DESC LIMIT 1\");\n        $stmt2->execute([$current['id']]);\n        $prev = $stmt2->fetch(PDO::FETCH_ASSOC);\n    }\n}\n\n?>\n<!DOCTYPE html>\n<html lang=\"zh-CN\">\n<head>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no\">\n    <title>\u5fc5\u5e94\u6bcf\u65e5\u58c1\u7eb8 \u00b7 \u5168\u5c4f<\/title>\n    <style>\n        * { margin: 0; padding: 0; box-sizing: border-box; }\n        body, html { width: 100%; height: 100%; overflow: hidden; font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; }\n        .wallpaper-container {\n            position: relative;\n            width: 100vw;\n            height: 100vh;\n            background: #000;\n        }\n        .wallpaper-img {\n            width: 100%;\n            height: 100%;\n            object-fit: cover;\n            display: block;\n        }\n        .info-panel {\n            position: absolute;\n            bottom: 30px;\n            left: 30px;\n            background: rgba(0, 0, 0, 0.6);\n            backdrop-filter: blur(8px);\n            color: white;\n            padding: 18px 28px;\n            border-radius: 60px;\n            max-width: 60%;\n            border: 1px solid rgba(255,255,255,0.2);\n            box-shadow: 0 10px 25px rgba(0,0,0,0.3);\n            line-height: 1.5;\n            pointer-events: none;\n        }\n        .info-panel .title {\n            font-size: 1.4rem;\n            font-weight: 500;\n            margin-bottom: 6px;\n            text-shadow: 0 2px 5px black;\n        }\n        .info-panel .copyright {\n            font-size: 0.9rem;\n            opacity: 0.9;\n            text-shadow: 0 1px 3px black;\n        }\n        .nav-panel {\n            position: absolute;\n            bottom: 30px;\n            right: 30px;\n            display: flex;\n            gap: 15px;\n            pointer-events: auto;\n        }\n        .nav-btn {\n            background: rgba(0, 0, 0, 0.5);\n            backdrop-filter: blur(8px);\n            border: 1px solid rgba(255,255,255,0.3);\n            color: white;\n            padding: 14px 28px;\n            border-radius: 50px;\n            font-size: 1.1rem;\n            font-weight: 500;\n            text-decoration: none;\n            transition: background 0.2s, transform 0.2s;\n            display: inline-flex;\n            align-items: center;\n            justify-content: center;\n            box-shadow: 0 5px 15px rgba(0,0,0,0.3);\n            cursor: pointer;\n        }\n        .nav-btn:hover {\n            background: rgba(30, 30, 30, 0.8);\n            transform: scale(1.05);\n        }\n        @media (max-width: 700px) {\n            .info-panel {\n                left: 15px;\n                bottom: 20px;\n                padding: 12px 20px;\n                max-width: 70%;\n            }\n            .info-panel .title { font-size: 1.1rem; }\n            .info-panel .copyright { font-size: 0.75rem; }\n            .nav-panel {\n                bottom: 20px;\n                right: 15px;\n                gap: 10px;\n            }\n            .nav-btn {\n                padding: 10px 18px;\n                font-size: 0.9rem;\n            }\n        }\n        @media (max-width: 480px) {\n            .info-panel { max-width: 85%; }\n            .nav-panel { flex-direction: column; gap: 8px; }\n        }\n        .error-msg {\n            position: absolute;\n            top: 50%;\n            left: 50%;\n            transform: translate(-50%, -50%);\n            color: white;\n            background: rgba(0,0,0,0.7);\n            padding: 20px 40px;\n            border-radius: 50px;\n            font-size: 1.2rem;\n        }\n    <\/style>\n<\/head>\n<body>\n    <div class=\"wallpaper-container\">\n        <?php if ($wallpaper && $wallpaper['success']): ?>\n            <img class=\"wallpaper-img\" src=\"<?php echo htmlspecialchars($wallpaper['url']); ?>\" alt=\"\u5fc5\u5e94\u58c1\u7eb8\">\n            \n            <div class=\"info-panel\">\n                <div class=\"title\"><?php echo htmlspecialchars($wallpaper['title'] ?: '\u4eca\u65e5\u58c1\u7eb8'); ?><\/div>\n                <div class=\"copyright\"><?php echo htmlspecialchars($wallpaper['copyright'] ?: ''); ?><\/div>\n            <\/div>\n            \n            <div class=\"nav-panel\">\n                <?php if ($prev): ?>\n                    <a href=\"<?php echo $self; ?>?action=view&id=<?php echo $prev['id']; ?>\" class=\"nav-btn\">\u2b05 \u4e0a\u4e00\u5f20<\/a>\n                <?php else: ?>\n                    <span class=\"nav-btn\" style=\"opacity:0.4; pointer-events:none;\">\u2b05 \u4e0a\u4e00\u5f20<\/span>\n                <?php endif; ?>\n                <a href=\"?url=https%3A%2F%2Fweb.daaee.cn%2F%3C%3Fphp+echo+%24self%3B+%3F%3E%3Faction%3Dlist\" class=\"nav-btn\">\ud83d\udccb \u58c1\u7eb8\u5217\u8868<\/a>\n            <\/div>\n        <?php else: ?>\n            <div class=\"error-msg\">\n                \u65e0\u6cd5\u83b7\u53d6\u58c1\u7eb8\uff0c\u8bf7\u7a0d\u540e\u5237\u65b0\u91cd\u8bd5<br>\n                <a href=\"?url=https%3A%2F%2Fweb.daaee.cn%2F%3C%3Fphp+echo+%24self%3B+%3F%3E%3Faction%3Dlist\" style=\"color:white; margin-top:10px; display:inline-block;\">\u67e5\u770b\u5386\u53f2\u58c1\u7eb8<\/a>\n            <\/div>\n        <?php endif; ?>\n    <\/div>\n<\/body>\n<\/html>\n<?php\nexit;\n?>"}