mirror of
https://gitee.com/ledc/IYUUAutoReseed
synced 2025-06-13 04:08:57 +00:00
移动到helper.php
This commit is contained in:
@ -316,3 +316,41 @@ function getUid($token)
|
||||
//验证是否IYUU开头,strpos($token,'T')<15,token总长度小于60(40+10+5)
|
||||
return (strlen($token)<60)&&(strpos($token, 'IYUU')===0)&&(strpos($token, 'T')<15) ? substr($token, 4, strpos($token, 'T')-4): false;
|
||||
}
|
||||
|
||||
/**
|
||||
* transmission过滤函数,只保留正常做种
|
||||
*/
|
||||
function filterStatus($v)
|
||||
{
|
||||
return isset($v['status']) && $v['status']===6;
|
||||
}
|
||||
|
||||
/**
|
||||
* qBittorrent过滤函数,只保留正常做种
|
||||
*/
|
||||
function qbfilterStatus($v)
|
||||
{
|
||||
if (isset($v['state']) && in_array($v['state'], array('uploading','stalledUP','pausedUP','queuedUP','checkingUP','forcedUP'))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//PHP stdClass Object转array
|
||||
function object_array($array)
|
||||
{
|
||||
if (is_object($array)) {
|
||||
$array = (array)$array;
|
||||
}
|
||||
if (is_array($array)) {
|
||||
foreach ($array as $key=>$value) {
|
||||
$array[$key] = object_array($value);
|
||||
}
|
||||
}
|
||||
return $array;
|
||||
}
|
||||
// 对象转数组
|
||||
function object2array(&$object)
|
||||
{
|
||||
return json_decode(json_encode($object), true);
|
||||
}
|
@ -5,6 +5,6 @@
|
||||
},
|
||||
"autoload": {
|
||||
"classmap":["app/Class"],
|
||||
"files": ["app/Class/Function.php"]
|
||||
"files": ["app/helper.php"]
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user