將 DEDECMS(織夢)軟體下載模組的「普通下載」改為「迅雷高速下載聯盟」模式,賺取推廣收益並提升用戶下載體驗。
編輯 /plus/download.php,在 <?php 標籤之前插入:
<script src="https://static.xunlei.com/js/webThunderDetect.js"></script>
<?php
require_once "encode.inc"; // 迅雷聯盟提供的編碼類別
?>
找到原本的 $open==1 直接跳轉區塊:
<?php
// 原始碼
else if ($open == 1) {
$link = base64_decode($link);
echo "<script language='javascript'>location.href='$link';</script>";
exit();
}
?>
替換為:
<?php
else if ($open == 1) {
$link = base64_decode($link);
// 組合聯盟推廣連結(需替換為您的聯盟 ID)
$promoUrl = "https://asqq8.net/url" . $link;
$thunderUrl = ThunderEncode($promoUrl); // encode.inc 提供的編碼函數
// 輸出迅雷下載調用 JS
echo "<script>OnDownloadClick('$thunderUrl', '', location.href, '您的聯盟ID', 2, '')</script>";
exit();
}
?>
encode.inc 放置於 /plus/ 目錄webThunderDetect.js 可正常載入(官方 CDN 或本地備份)您的聯盟IDdownload.php?open=1&link=...ThunderEncode() 生成 thunder:// 協議連結OnDownloadClick() JS 呼叫 → 瀏覽器喚起迅雷客戶端或網頁版下載download.php 調整