mirror of
https://github.com/lkeme/BiliHelper-personal.git
synced 2025-12-19 01:20:08 +08:00
Merge branch 'master' of github.com:Dishesdog/BiliHelper-personal
This commit is contained in:
commit
71b80e6001
6
.gitignore
vendored
6
.gitignore
vendored
@ -29,10 +29,14 @@ conf/user1.ini
|
||||
/src/backup/
|
||||
script.php
|
||||
|
||||
# ignore all files in lib/
|
||||
task/*
|
||||
cache/*
|
||||
log/*
|
||||
|
||||
# ignore all files in lib/
|
||||
#task/*
|
||||
#cache/*
|
||||
#log/*
|
||||
# except for .gitkeep
|
||||
!.gitkeep
|
||||
# ignore TODO file in root directory,not subdir/TODO
|
||||
|
||||
3
cache/.gitkeep
vendored
3
cache/.gitkeep
vendored
@ -1,3 +0,0 @@
|
||||
# Ignore everything in this directory
|
||||
*
|
||||
# Except this file !.gitkeep
|
||||
@ -1,3 +1,5 @@
|
||||
version = 0.0.1
|
||||
|
||||
#######################
|
||||
# 账户设置 #
|
||||
#######################
|
||||
@ -265,10 +267,9 @@ proxy = "http://127.0.0.1:8888"
|
||||
[debug]
|
||||
enable = false
|
||||
|
||||
; 记录日志|日志路径|日志回调地址
|
||||
; 记录日志|日志回调地址
|
||||
[log]
|
||||
enable = false
|
||||
path = log
|
||||
callback = "http://www.example.com/api.send?text={account}[{level}]: {message}"
|
||||
# 错误回调级别
|
||||
#
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
# Ignore everything in this directory
|
||||
*
|
||||
# Except this file !.gitkeep
|
||||
@ -27,11 +27,29 @@ class App
|
||||
*/
|
||||
public function __construct(string $app_path)
|
||||
{
|
||||
define('APP_CONF_PATH', $app_path . "/conf/");
|
||||
define('APP_DATA_PATH', $app_path . "/data/");
|
||||
define('APP_LOG_PATH', $app_path . "/log/");
|
||||
define('APP_TASK_PATH', $app_path . "/task/");
|
||||
define('APP_CACHE_PATH', $app_path . "/cache/");
|
||||
define('APP_CONF_PATH', $app_path . '/conf/');
|
||||
define('APP_DATA_PATH', $app_path . '/data/');
|
||||
define('APP_LOG_PATH', $app_path . '/log/');
|
||||
define('APP_TASK_PATH', $app_path . '/task/');
|
||||
define('APP_CACHE_PATH', $app_path . '/cache/');
|
||||
}
|
||||
|
||||
/**
|
||||
* @use 初始化数据文件夹
|
||||
* @param int $permissions
|
||||
* @return $this
|
||||
*/
|
||||
private function initDataFolder(int $permissions = 0777): App
|
||||
{
|
||||
// log task cache
|
||||
$data_folder = [APP_LOG_PATH, APP_TASK_PATH, APP_CACHE_PATH];
|
||||
foreach ($data_folder as $path) {
|
||||
if (!file_exists($path)) {
|
||||
mkdir($path);
|
||||
chmod($path, $permissions);
|
||||
}
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -51,6 +69,7 @@ class App
|
||||
*/
|
||||
public function load($argv): App
|
||||
{
|
||||
$this->initDataFolder();
|
||||
$args = (new BCommand($argv))->run();
|
||||
$filename = $args->args()[0] ?? 'user.ini';
|
||||
// 加载配置
|
||||
|
||||
@ -65,12 +65,8 @@ class Log
|
||||
if ($type == 'DEBUG' && !getConf('enable', 'debug')) {
|
||||
return;
|
||||
}
|
||||
$path = './' . getConf('path', 'log') . '/';
|
||||
if (!file_exists($path)) {
|
||||
mkdir($path);
|
||||
chmod($path, 0777);
|
||||
}
|
||||
$filename = $path . getConf('username', 'login.account') . ".log";
|
||||
|
||||
$filename = APP_LOG_PATH . getConf('username', 'login.account') . ".log";
|
||||
$date = date('[Y-m-d H:i:s] ');
|
||||
$data = $date . ' Log.' . $type . ' ' . $message . PHP_EOL;
|
||||
file_put_contents($filename, $data, FILE_APPEND);
|
||||
|
||||
@ -191,7 +191,7 @@ class User
|
||||
* @param bool $un_follow
|
||||
* @return bool
|
||||
*/
|
||||
public static function setUserFollow(int $follow_uid, bool $un_follow): bool
|
||||
public static function setUserFollow(int $follow_uid, bool $un_follow = false): bool
|
||||
{
|
||||
$url = 'https://api.live.bilibili.com/relation/v1/Feed/SetUserFollow';
|
||||
$payload = [
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
# Ignore everything in this directory
|
||||
*
|
||||
# Except this file !.gitkeep
|
||||
Loading…
Reference in New Issue
Block a user