mirror of
https://github.com/lkeme/BiliHelper-personal.git
synced 2025-12-20 18:40:05 +08:00
[fix] Sleep
This commit is contained in:
parent
72c31446cc
commit
ae89011c58
@ -27,6 +27,7 @@
|
|||||||
- 修复抽奖数据异常
|
- 修复抽奖数据异常
|
||||||
- 修复部分已知BUG
|
- 修复部分已知BUG
|
||||||
- 修复获奖推送通知
|
- 修复获奖推送通知
|
||||||
|
- 修复休眠中心异常
|
||||||
-
|
-
|
||||||
|
|
||||||
## v0.0.5.191223 alpha (2019-12-23)
|
## v0.0.5.191223 alpha (2019-12-23)
|
||||||
|
|||||||
@ -28,24 +28,33 @@ class Sleep
|
|||||||
{
|
{
|
||||||
if (getenv('USE_SLEEP') == 'false' || self::getLock() > time()) {
|
if (getenv('USE_SLEEP') == 'false' || self::getLock() > time()) {
|
||||||
return;
|
return;
|
||||||
}
|
};
|
||||||
self::isPause();
|
if (!self::isPause() && !self::isRefuse()) {
|
||||||
self::isRefuse();
|
|
||||||
self::setLock(5 * 60);
|
self::setLock(5 * 60);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static function isPause()
|
/**
|
||||||
|
* @use 检查休眠
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
private static function isPause(): bool
|
||||||
{
|
{
|
||||||
self::$sleep_section = empty(self::$filter_type) ? explode(',', getenv('SLEEP_SECTION')) : self::$sleep_section;
|
self::$sleep_section = empty(self::$filter_type) ? explode(',', getenv('SLEEP_SECTION')) : self::$sleep_section;
|
||||||
if (in_array(date('H'), self::$sleep_section)) {
|
if (in_array(date('H'), self::$sleep_section)) {
|
||||||
$unlock_time = 60 * 60;
|
$unlock_time = 60 * 60;
|
||||||
self::stopProc($unlock_time);
|
self::stopProc($unlock_time);
|
||||||
Log::warning('进入自定义休眠时间范围,暂停非必要任务,自动开启!');
|
Log::warning('进入自定义休眠时间范围,暂停非必要任务,自动开启!');
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function isRefuse()
|
/**
|
||||||
|
* @use 检查封禁
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
private static function isRefuse(): bool
|
||||||
{
|
{
|
||||||
$payload = [];
|
$payload = [];
|
||||||
$raw = Curl::get('https://api.live.bilibili.com/mobile/freeSilverAward', Sign::api($payload));
|
$raw = Curl::get('https://api.live.bilibili.com/mobile/freeSilverAward', Sign::api($payload));
|
||||||
@ -56,8 +65,9 @@ class Sleep
|
|||||||
Log::warning('账号拒绝访问,暂停非必要任务,自动开启!');
|
Log::warning('账号拒绝访问,暂停非必要任务,自动开启!');
|
||||||
// 推送被ban信息
|
// 推送被ban信息
|
||||||
Notice::push('banned', floor($unlock_time / 60 / 60));
|
Notice::push('banned', floor($unlock_time / 60 / 60));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user