Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Commit

Permalink
Merge pull request #106 from yuantuo666/dev
Browse files Browse the repository at this point in the history
准备更新2.1.6
  • Loading branch information
yuantuo666 authored May 1, 2021
2 parents 42f47bd + 0a66d42 commit 2b88534
Show file tree
Hide file tree
Showing 9 changed files with 261 additions and 198 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,20 @@ PanDownload 网页复刻版,PHP 语言版<br/>
**SVIP账号**中可设置**SVIP账号****BDUSS****STOKEN**,添加账号后记得进入**会员账号切换模式**将模式改成**顺序模式****轮换模式**。<br />

## 📦New Changes
- 当前版本:`2.1.5`
- 更新日期:2021-04-03
- 当前版本:`2.1.6`
- 更新日期:2021-05-01
- 修改内容:
- 💥新增功能
- 账号状态检查
- Aria2在线管理页面
- 新增Motrix下载方式
- 新增全账号轮换模式(无视是否限速,轮换数据库中账号)
- ⚠错误修复
- 修复未开启数据库情况下无法正常获取文件下载地址 Thanks to kwxiaozhu
- 修复GetDir()支持PHP8 Thanks to zzjin
- 改用WebSocket推送下载链接到aria2
- 修复aria2推送token问题
- ♻代码优化
- 增加账号失效提示
- 版权信息改为Github项目页面
- 删除不必要的版本检测和版本号
- 隐藏未启用数据库时奇怪的提示
- 增加推送错误提示
- 处理一些文字格式
- ws(s)链接时检测是否有效
- aira存储信息方式修改为localStorage

[查看更多](Update.md)

Expand Down
23 changes: 19 additions & 4 deletions Update.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
# Update
### `2.1.6` 版本:
- 当前版本:`2.1.6`
- 更新日期:2021-05-01
- 修改内容:
- 💥新增功能
- 新增Motrix下载方式
- ⚠错误修复
- 修复aria2推送token问题
- ♻代码优化
- 隐藏未启用数据库时奇怪的提示
- 增加推送错误提示
- 处理一些文字格式
- ws(s)链接时检测是否有效
- aira存储信息方式修改为localStorage

### `2.1.5` 版本:
- 更新日期:2021-04-03
- 修改内容:
- 💥新增功能
- 账号状态检查
- Aria2在线管理页面
- ⚠错误修复
- 修复未开启数据库情况下无法正常获取文件下载地址 Thanks to kwxiaozhu
- 修复GetDir()支持PHP8 Thanks to zzjin
- 修复未开启数据库情况下无法正常获取文件下载地址 GitHub: @kwxiaozhu
- 修复GetDir()支持PHP8 GitHub: @zzjin
- 改用WebSocket推送下载链接到aria2
- ♻代码优化
- 增加账号失效提示
Expand All @@ -27,7 +42,7 @@
- 修改内容:
- 💥新增功能
- 兼容老方法获取randsk(BDCLND) #84
- aria2推送时附上文件名 #78 Thanks to @kwxiaozhu
- aria2推送时附上文件名 #78 GitHub: @kwxiaozhu
- ⚠错误修复
- 安装页面未处理默认情况丢失前缀 #76
- ♻代码优化
Expand Down Expand Up @@ -133,7 +148,7 @@ http://www.dupan.cc/ (站长QQ33703259) 所发布的源码已被篡改,添
### `1.3.6` 版本:
- 更新日期:2020-08-19
- 修改内容
- 修改了因为浮点数精度造成下载未知错误的问题 Thanks to @apiee (因为合并的问题,导致丢失了贡献者信息)
- 修改了因为浮点数精度造成下载未知错误的问题 GitHub: @apiee (因为合并的问题,导致丢失了贡献者信息)

### `1.3.5` 版本:
- 更新日期:2020-08-17
Expand Down
175 changes: 101 additions & 74 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,33 @@ function GetDBBDUSS()
$id = "-1";
}
break;
case 4:
//模式4:轮番上(无视限速)
// 时间顺序输出第一项限速账号
$sql = "SELECT `id`,`svip_bduss`,`svip_stoken` FROM `" . $dbtable . "_svip` ORDER BY `is_using` ASC,`id` DESC LIMIT 0,1";

$Result = mysqli_query($conn, $sql);
if ($Result = mysqli_fetch_assoc($Result)) {
$SVIP_BDUSS = $Result["svip_bduss"];
$SVIP_STOKEN = $Result["svip_stoken"];
$id = $Result["id"];
//不论解析成功与否,将当前账号更新时间,下一次使用另一账号
// 开始处理
// 这里最新的时间表示可用账号,按顺序排序
$is_using = date("Y-m-d H:i:s");
$sql = "UPDATE `" . $dbtable . "_svip` SET `is_using`= '$is_using' WHERE `id`=$id";
$mysql_query = mysqli_query($conn, $sql);
if ($mysql_query == false) {
// 失败 但可继续解析
dl_error("数据库错误", "请联系站长修复无法自动切换账号问题!");
}
} else {
// 数据库中所有SVIP账号已经用完,启用本地SVIP账号
$SVIP_BDUSS = SVIP_BDUSS;
$SVIP_STOKEN = SVIP_STOKEN;
$id = "-1";
}
break;
case 0:
//模式0:使用本地解析
default:
Expand All @@ -548,57 +575,57 @@ function GetDBBDUSS()
*/
function AccountStatus(string $BDUSS, string $STOKEN)
{
$Url = "https://pan.baidu.com/api/gettemplatevariable?channel=chunlei&web=1&app_id=250528&clienttype=0";
$Header = [
"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.514.1919.810 Safari/537.36",
"Cookie: BDUSS=$BDUSS;STOKEN=$STOKEN;"
];
$Data = "fields=[%22username%22,%22loginstate%22,%22is_vip%22,%22is_svip%22,%22is_evip%22]";
$Result = post($Url, $Data, $Header);
$Result = json_decode($Result, true);
if (DEBUG) {
echo '<pre>账号状态:';
var_dump($Result);
echo '</pre>';
}
if ($Result["errno"] == 0) {
// 正常
$Username = $Result["result"]["username"];
$LoginStatus = $Result["result"]["loginstate"];
if ($Result["result"]["is_vip"] == 1) {
$SVIP = 1; //会员账号
} elseif ($Result["result"]["is_svip"] == 1 or $Result["result"]["is_evip"] == 1) {
$SVIP = 2; //超级会员账号
} else {
$SVIP = 0; //普通账号
return array(0, $SVIP, $Username, $LoginStatus, 0);
}
$Url = "https://pan.baidu.com/api/gettemplatevariable?channel=chunlei&web=1&app_id=250528&clienttype=0";
$Header = [
"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.514.1919.810 Safari/537.36",
"Cookie: BDUSS=$BDUSS;STOKEN=$STOKEN;"
];
$Data = "fields=[%22username%22,%22loginstate%22,%22is_vip%22,%22is_svip%22,%22is_evip%22]";
$Result = post($Url, $Data, $Header);
$Result = json_decode($Result, true);
if (DEBUG) {
echo '<pre>账号状态:';
var_dump($Result);
echo '</pre>';
}
if ($Result["errno"] == 0) {
// 正常
$Username = $Result["result"]["username"];
$LoginStatus = $Result["result"]["loginstate"];
if ($Result["result"]["is_vip"] == 1) {
$SVIP = 1; //会员账号
} elseif ($Result["result"]["is_svip"] == 1 or $Result["result"]["is_evip"] == 1) {
$SVIP = 2; //超级会员账号
} else {
$SVIP = 0; //普通账号
return array(0, $SVIP, $Username, $LoginStatus, 0);
}

$Url = "https://pan.baidu.com/rest/2.0/membership/user?channel=chunlei&web=1&app_id=250528&clienttype=0";
$Header = [
"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.514.1919.810 Safari/537.36",
"Cookie: BDUSS=$BDUSS;STOKEN=$STOKEN;"
];
$Data = "method=query";
$Result = post($Url, $Data, $Header);
$Result = json_decode($Result, true);
if (DEBUG) {
echo '<pre>会员状态:';
var_dump($Result);
echo '</pre>';
}
if (isset($Result["reminder"]["svip"])) {
//存在会员信息
$LeftSeconds = $Result["reminder"]["svip"]["leftseconds"];
return array(0, $SVIP, $Username, $LoginStatus, $LeftSeconds);
}
} elseif ($Result["errno"] == -6) {
// 账号失效
return array(-6);
} else {
//未知错误
return array($Result["errno"]);
}
$Url = "https://pan.baidu.com/rest/2.0/membership/user?channel=chunlei&web=1&app_id=250528&clienttype=0";
$Header = [
"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.514.1919.810 Safari/537.36",
"Cookie: BDUSS=$BDUSS;STOKEN=$STOKEN;"
];
$Data = "method=query";
$Result = post($Url, $Data, $Header);
$Result = json_decode($Result, true);
if (DEBUG) {
echo '<pre>会员状态:';
var_dump($Result);
echo '</pre>';
}
if (isset($Result["reminder"]["svip"])) {
//存在会员信息
$LeftSeconds = $Result["reminder"]["svip"]["leftseconds"];
return array(0, $SVIP, $Username, $LoginStatus, $LeftSeconds);
}
} elseif ($Result["errno"] == -6) {
// 账号失效
return array(-6);
} else {
//未知错误
return array($Result["errno"]);
}
}
/**
* 时间差计算
Expand All @@ -610,30 +637,30 @@ function AccountStatus(string $BDUSS, string $STOKEN)
*/
function time2Units(int $time)
{
$year = floor($time / 60 / 60 / 24 / 365);
$time -= $year * 60 * 60 * 24 * 365;
$month = floor($time / 60 / 60 / 24 / 30);
$time -= $month * 60 * 60 * 24 * 30;
$day = floor($time / 60 / 60 / 24);
$time -= $day * 60 * 60 * 24;
$hour = floor($time / 60 / 60);
$time -= $hour * 60 * 60;
$minute = floor($time / 60);
$time -= $minute * 60;
$second = $time;
$elapse = '';
$year = floor($time / 60 / 60 / 24 / 365);
$time -= $year * 60 * 60 * 24 * 365;
$month = floor($time / 60 / 60 / 24 / 30);
$time -= $month * 60 * 60 * 24 * 30;
$day = floor($time / 60 / 60 / 24);
$time -= $day * 60 * 60 * 24;
$hour = floor($time / 60 / 60);
$time -= $hour * 60 * 60;
$minute = floor($time / 60);
$time -= $minute * 60;
$second = $time;
$elapse = '';

$unitArr = array(
'' => 'year', '个月' => 'month', '' => 'day',
'小时' => 'hour', '分钟' => 'minute', '' => 'second'
);
$unitArr = array(
'' => 'year', '个月' => 'month', '' => 'day',
'小时' => 'hour', '分钟' => 'minute', '' => 'second'
);

foreach ($unitArr as $cn => $u) {
if ($$u > 0) {
$elapse = $$u . $cn;
break;
}
}
foreach ($unitArr as $cn => $u) {
if ($$u > 0) {
$elapse = $$u . $cn;
break;
}
}

return $elapse;
}
return $elapse;
}
Loading

0 comments on commit 2b88534

Please sign in to comment.