mirror of
https://github.com/lkeme/BiliHelper-personal.git
synced 2025-12-19 09:30:10 +08:00
[fix] User
This commit is contained in:
parent
5908419c38
commit
a963ac5617
6
.gitignore
vendored
6
.gitignore
vendored
@ -29,10 +29,14 @@ conf/user1.ini
|
|||||||
/src/backup/
|
/src/backup/
|
||||||
script.php
|
script.php
|
||||||
|
|
||||||
# ignore all files in lib/
|
|
||||||
task/*
|
task/*
|
||||||
cache/*
|
cache/*
|
||||||
log/*
|
log/*
|
||||||
|
|
||||||
|
# ignore all files in lib/
|
||||||
|
#task/*
|
||||||
|
#cache/*
|
||||||
|
#log/*
|
||||||
# except for .gitkeep
|
# except for .gitkeep
|
||||||
!.gitkeep
|
!.gitkeep
|
||||||
# ignore TODO file in root directory,not subdir/TODO
|
# 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]
|
[debug]
|
||||||
enable = false
|
enable = false
|
||||||
|
|
||||||
; 记录日志|日志路径|日志回调地址
|
; 记录日志|日志回调地址
|
||||||
[log]
|
[log]
|
||||||
enable = false
|
enable = false
|
||||||
path = log
|
|
||||||
callback = "http://www.example.com/api.send?text={account}[{level}]: {message}"
|
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)
|
public function __construct(string $app_path)
|
||||||
{
|
{
|
||||||
define('APP_CONF_PATH', $app_path . "/conf/");
|
define('APP_CONF_PATH', $app_path . '/conf/');
|
||||||
define('APP_DATA_PATH', $app_path . "/data/");
|
define('APP_DATA_PATH', $app_path . '/data/');
|
||||||
define('APP_LOG_PATH', $app_path . "/log/");
|
define('APP_LOG_PATH', $app_path . '/log/');
|
||||||
define('APP_TASK_PATH', $app_path . "/task/");
|
define('APP_TASK_PATH', $app_path . '/task/');
|
||||||
define('APP_CACHE_PATH', $app_path . "/cache/");
|
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
|
public function load($argv): App
|
||||||
{
|
{
|
||||||
|
$this->initDataFolder();
|
||||||
$args = (new BCommand($argv))->run();
|
$args = (new BCommand($argv))->run();
|
||||||
$filename = $args->args()[0] ?? 'user.ini';
|
$filename = $args->args()[0] ?? 'user.ini';
|
||||||
// 加载配置
|
// 加载配置
|
||||||
|
|||||||
@ -65,12 +65,8 @@ class Log
|
|||||||
if ($type == 'DEBUG' && !getConf('enable', 'debug')) {
|
if ($type == 'DEBUG' && !getConf('enable', 'debug')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$path = './' . getConf('path', 'log') . '/';
|
|
||||||
if (!file_exists($path)) {
|
$filename = APP_LOG_PATH . getConf('username', 'login.account') . ".log";
|
||||||
mkdir($path);
|
|
||||||
chmod($path, 0777);
|
|
||||||
}
|
|
||||||
$filename = $path . getConf('username', 'login.account') . ".log";
|
|
||||||
$date = date('[Y-m-d H:i:s] ');
|
$date = date('[Y-m-d H:i:s] ');
|
||||||
$data = $date . ' Log.' . $type . ' ' . $message . PHP_EOL;
|
$data = $date . ' Log.' . $type . ' ' . $message . PHP_EOL;
|
||||||
file_put_contents($filename, $data, FILE_APPEND);
|
file_put_contents($filename, $data, FILE_APPEND);
|
||||||
|
|||||||
@ -191,7 +191,7 @@ class User
|
|||||||
* @param bool $un_follow
|
* @param bool $un_follow
|
||||||
* @return bool
|
* @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';
|
$url = 'https://api.live.bilibili.com/relation/v1/Feed/SetUserFollow';
|
||||||
$payload = [
|
$payload = [
|
||||||
|
|||||||
@ -1,3 +0,0 @@
|
|||||||
# Ignore everything in this directory
|
|
||||||
*
|
|
||||||
# Except this file !.gitkeep
|
|
||||||
Loading…
Reference in New Issue
Block a user