mirror of
https://github.com/ledccn/IYUUPlus.git
synced 2024-09-20 07:05:28 +00:00
fix
This commit is contained in:
parent
cd4218538e
commit
f2459ce819
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -11,3 +11,4 @@
|
||||||
/._.DS_Store
|
/._.DS_Store
|
||||||
/.DS_Store
|
/.DS_Store
|
||||||
/php-cs-fixer.phar
|
/php-cs-fixer.phar
|
||||||
|
.php_cs.cache
|
||||||
|
|
|
@ -245,6 +245,7 @@ class Config
|
||||||
$cron = self::getCrontab();
|
$cron = self::getCrontab();
|
||||||
return array_key_exists($uuid, $cron) ? $cron[$uuid] : [];
|
return array_key_exists($uuid, $cron) ? $cron[$uuid] : [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 禁用用户已经配置过的站点
|
* 禁用用户已经配置过的站点
|
||||||
* @param array $sites
|
* @param array $sites
|
||||||
|
|
|
@ -103,4 +103,4 @@ class FileMonitor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,11 +9,6 @@ use app\domain\Crontab as domainCron;
|
||||||
|
|
||||||
class Task
|
class Task
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* pidFile
|
|
||||||
*/
|
|
||||||
const pidFile = 'IYUUTask.pid';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
|
@ -37,17 +32,12 @@ class Task
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
// 保存当前进程pid
|
|
||||||
if (function_exists('posix_getpid')) {
|
|
||||||
\file_put_contents(runtime_path() . \DIRECTORY_SEPARATOR . self::pidFile, \posix_getpid());
|
|
||||||
}
|
|
||||||
// 初始化cron
|
// 初始化cron
|
||||||
domainCron::onWorkerStart();
|
domainCron::onWorkerStart();
|
||||||
// 初始化计划任务的绝对路径
|
// 初始化计划任务的绝对路径
|
||||||
self::$cron_dir = cron_path() . DIRECTORY_SEPARATOR . domainCron::cron_dir;
|
self::$cron_dir = cron_path() . DIRECTORY_SEPARATOR . domainCron::cron_dir;
|
||||||
//添加扫描器
|
//添加扫描器
|
||||||
Timer::add(self::$interval, array($this, 'startScan'));
|
Timer::add(self::$interval, array($this, 'startScan'));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -55,8 +45,6 @@ class Task
|
||||||
*/
|
*/
|
||||||
public function __destruct()
|
public function __destruct()
|
||||||
{
|
{
|
||||||
// 删除当前进程pid文件
|
|
||||||
is_file(runtime_path() . \DIRECTORY_SEPARATOR . self::pidFile) and @\unlink(runtime_path() . \DIRECTORY_SEPARATOR . self::pidFile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -65,12 +53,12 @@ class Task
|
||||||
public function onWorkerStart()
|
public function onWorkerStart()
|
||||||
{
|
{
|
||||||
// 每10秒执行
|
// 每10秒执行
|
||||||
new Crontab('*/10 * * * * *', function(){
|
new Crontab('*/10 * * * * *', function () {
|
||||||
//echo date('Y-m-d H:i:s')."\n";
|
//echo date('Y-m-d H:i:s')."\n";
|
||||||
});
|
});
|
||||||
|
|
||||||
// 每天的10点10执行,注意这里省略了秒位
|
// 每天的10点10执行,注意这里省略了秒位
|
||||||
new Crontab('10 10 * * *', function(){
|
new Crontab('10 10 * * *', function () {
|
||||||
//echo date('Y-m-d H:i:s')."\n";
|
//echo date('Y-m-d H:i:s')."\n";
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -159,6 +147,7 @@ class Task
|
||||||
public function clearTimer(string $filename = '')
|
public function clearTimer(string $filename = '')
|
||||||
{
|
{
|
||||||
$_instances = Crontab::getAll(); // Crontab对象数组
|
$_instances = Crontab::getAll(); // Crontab对象数组
|
||||||
|
/** @var Crontab $crontab */
|
||||||
foreach ($_instances as $id => $crontab) {
|
foreach ($_instances as $id => $crontab) {
|
||||||
$name = $crontab->getName();
|
$name = $crontab->getName();
|
||||||
// 关键条件
|
// 关键条件
|
||||||
|
|
|
@ -37,5 +37,4 @@ class Websocket
|
||||||
{
|
{
|
||||||
echo "onClose\n";
|
echo "onClose\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1067,13 +1067,19 @@ class AutoReseed
|
||||||
if (!empty($weixin['notify_on_change'])) {
|
if (!empty($weixin['notify_on_change'])) {
|
||||||
switch ($weixin['notify_on_change']) {
|
switch ($weixin['notify_on_change']) {
|
||||||
case 'on':
|
case 'on':
|
||||||
if (self::$wechatMsg['reseedSuccess'] === 0 && self::$wechatMsg['reseedError'] === 0) return '';
|
if (self::$wechatMsg['reseedSuccess'] === 0 && self::$wechatMsg['reseedError'] === 0) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'only_success':
|
case 'only_success':
|
||||||
if (self::$wechatMsg['reseedSuccess'] === 0) return '';
|
if (self::$wechatMsg['reseedSuccess'] === 0) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'only_fails':
|
case 'only_fails':
|
||||||
if (self::$wechatMsg['reseedError'] === 0) return '';
|
if (self::$wechatMsg['reseedError'] === 0) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'off':
|
case 'off':
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -315,13 +315,19 @@ class MoveTorrent extends AutoReseed
|
||||||
if (!empty($weixin['notify_on_change'])) {
|
if (!empty($weixin['notify_on_change'])) {
|
||||||
switch ($weixin['notify_on_change']) {
|
switch ($weixin['notify_on_change']) {
|
||||||
case 'on':
|
case 'on':
|
||||||
if (self::$wechatMsg['MoveSuccess'] === 0 && self::$wechatMsg['MoveError'] === 0) return '';
|
if (self::$wechatMsg['MoveSuccess'] === 0 && self::$wechatMsg['MoveError'] === 0) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'only_success':
|
case 'only_success':
|
||||||
if (self::$wechatMsg['MoveSuccess'] === 0) return '';
|
if (self::$wechatMsg['MoveSuccess'] === 0) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'only_fails':
|
case 'only_fails':
|
||||||
if (self::$wechatMsg['MoveError'] === 0) return '';
|
if (self::$wechatMsg['MoveError'] === 0) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'off':
|
case 'off':
|
||||||
default:
|
default:
|
||||||
|
@ -337,8 +343,7 @@ class MoveTorrent extends AutoReseed
|
||||||
$desp .= '**移动成功:'.static::$wechatMsg['MoveSuccess']. '** [会把hash加入移动缓存]' .$br;
|
$desp .= '**移动成功:'.static::$wechatMsg['MoveSuccess']. '** [会把hash加入移动缓存]' .$br;
|
||||||
$desp .= '**移动失败:'.static::$wechatMsg['MoveError']. '** [解决错误提示,可以重试]' .$br;
|
$desp .= '**移动失败:'.static::$wechatMsg['MoveError']. '** [解决错误提示,可以重试]' .$br;
|
||||||
$desp .= '**如需重新移动,请删除 ./torrent/cachemove 移动缓存。**'.$br;
|
$desp .= '**如需重新移动,请删除 ./torrent/cachemove 移动缓存。**'.$br;
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$desp .= $br.'----------'.$br;
|
$desp .= $br.'----------'.$br;
|
||||||
$desp .= $br.'转移任务完成,未发现种子需要转移'.$br;
|
$desp .= $br.'转移任务完成,未发现种子需要转移'.$br;
|
||||||
$desp .= $br.'----------'.$br;
|
$desp .= $br.'----------'.$br;
|
||||||
|
|
|
@ -21,5 +21,4 @@ use Illuminate\Database\Capsule\Manager;
|
||||||
*/
|
*/
|
||||||
class Db extends Manager
|
class Db extends Manager
|
||||||
{
|
{
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -18,5 +18,4 @@ use Illuminate\Database\Eloquent\Model as BaseModel;
|
||||||
|
|
||||||
class Model extends BaseModel
|
class Model extends BaseModel
|
||||||
{
|
{
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -19,5 +19,4 @@ namespace support;
|
||||||
*/
|
*/
|
||||||
class Request extends \Webman\Http\Request
|
class Request extends \Webman\Http\Request
|
||||||
{
|
{
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -19,5 +19,4 @@ namespace support;
|
||||||
*/
|
*/
|
||||||
class Response extends \Webman\Http\Response
|
class Response extends \Webman\Http\Response
|
||||||
{
|
{
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -58,4 +58,4 @@ class Container implements Bootstrap
|
||||||
{
|
{
|
||||||
return static::$_instance;
|
return static::$_instance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,8 @@ use Monolog\Logger;
|
||||||
* @method static void alert($message, array $context = [])
|
* @method static void alert($message, array $context = [])
|
||||||
* @method static void emergency($message, array $context = [])
|
* @method static void emergency($message, array $context = [])
|
||||||
*/
|
*/
|
||||||
class Log implements Bootstrap {
|
class Log implements Bootstrap
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
|
@ -76,4 +77,4 @@ class Log implements Bootstrap {
|
||||||
{
|
{
|
||||||
return static::channel('default')->{$name}(... $arguments);
|
return static::channel('default')->{$name}(... $arguments);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,7 +197,8 @@ use Illuminate\Redis\RedisManager;
|
||||||
* @method static mixed getPersistentID()
|
* @method static mixed getPersistentID()
|
||||||
* @method static mixed getAuth()
|
* @method static mixed getAuth()
|
||||||
*/
|
*/
|
||||||
class Redis implements Bootstrap {
|
class Redis implements Bootstrap
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var RedisManager
|
* @var RedisManager
|
||||||
|
@ -221,7 +222,8 @@ class Redis implements Bootstrap {
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @return \Illuminate\Redis\Connections\Connection
|
* @return \Illuminate\Redis\Connections\Connection
|
||||||
*/
|
*/
|
||||||
public static function connection($name = 'default') {
|
public static function connection($name = 'default')
|
||||||
|
{
|
||||||
return static::$_manager->connection($name);
|
return static::$_manager->connection($name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,8 @@ use Workerman\Worker;
|
||||||
* Class Session
|
* Class Session
|
||||||
* @package support
|
* @package support
|
||||||
*/
|
*/
|
||||||
class Session implements Bootstrap {
|
class Session implements Bootstrap
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Worker $worker
|
* @param Worker $worker
|
||||||
|
@ -35,4 +36,4 @@ class Session implements Bootstrap {
|
||||||
SessionBase::handlerClass($config['handler'], $config['config'][$config['type']]);
|
SessionBase::handlerClass($config['handler'], $config['config'][$config['type']]);
|
||||||
//session_set_cookie_params(0, $config['path'], $config['domain'], $config['secure'], $config['http_only']);
|
//session_set_cookie_params(0, $config['path'], $config['domain'], $config['secure'], $config['http_only']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,8 @@ use Symfony\Component\Translation\Loader\PhpFileLoader;
|
||||||
* @method static void setLocale(string $locale)
|
* @method static void setLocale(string $locale)
|
||||||
* @method static string getLocale()
|
* @method static string getLocale()
|
||||||
*/
|
*/
|
||||||
class Translation implements Bootstrap {
|
class Translation implements Bootstrap
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
|
|
|
@ -30,7 +30,7 @@ class Heartbeat implements Bootstrap
|
||||||
*/
|
*/
|
||||||
public static function start($worker)
|
public static function start($worker)
|
||||||
{
|
{
|
||||||
\Workerman\Timer::add(55, function (){
|
\Workerman\Timer::add(55, function () {
|
||||||
Db::select('select 1 limit 1');
|
Db::select('select 1 limit 1');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ class Laravel implements Bootstrap
|
||||||
$capsule = new Capsule;
|
$capsule = new Capsule;
|
||||||
$configs = config('database');
|
$configs = config('database');
|
||||||
|
|
||||||
$capsule->getDatabaseManager()->extend('mongodb', function($config, $name) {
|
$capsule->getDatabaseManager()->extend('mongodb', function ($config, $name) {
|
||||||
$config['name'] = $name;
|
$config['name'] = $name;
|
||||||
|
|
||||||
return new Connection($config);
|
return new Connection($config);
|
||||||
|
|
|
@ -21,5 +21,4 @@ use Exception;
|
||||||
*/
|
*/
|
||||||
class BusinessException extends Exception
|
class BusinessException extends Exception
|
||||||
{
|
{
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -37,5 +37,4 @@ class Handler extends ExceptionHandler
|
||||||
{
|
{
|
||||||
return parent::render($request, $exception);
|
return parent::render($request, $exception);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -238,7 +238,8 @@ function locale(string $locale)
|
||||||
* @param $worker
|
* @param $worker
|
||||||
* @param $class
|
* @param $class
|
||||||
*/
|
*/
|
||||||
function worker_bind($worker, $class) {
|
function worker_bind($worker, $class)
|
||||||
|
{
|
||||||
$callback_map = [
|
$callback_map = [
|
||||||
'onConnect',
|
'onConnect',
|
||||||
'onMessage',
|
'onMessage',
|
||||||
|
@ -262,7 +263,8 @@ function worker_bind($worker, $class) {
|
||||||
/**
|
/**
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function cpu_count() {
|
function cpu_count()
|
||||||
|
{
|
||||||
if (strtolower(PHP_OS) === 'darwin') {
|
if (strtolower(PHP_OS) === 'darwin') {
|
||||||
$count = shell_exec('sysctl -n machdep.cpu.core_count');
|
$count = shell_exec('sysctl -n machdep.cpu.core_count');
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -28,4 +28,4 @@ class AuthCheckTest implements MiddlewareInterface
|
||||||
}
|
}
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,4 +41,4 @@ class Blade implements View
|
||||||
}
|
}
|
||||||
return $balde->render($view_path, $vars);
|
return $balde->render($view_path, $vars);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,4 +41,4 @@ class Raw implements View
|
||||||
}
|
}
|
||||||
return \ob_get_clean();
|
return \ob_get_clean();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,4 +47,4 @@ class ThinkPHP implements View
|
||||||
$content = \ob_get_clean();
|
$content = \ob_get_clean();
|
||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,4 +42,4 @@ class Twig implements View
|
||||||
}
|
}
|
||||||
return $view->render($view_path, $vars);
|
return $view->render($view_path, $vars);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user