This repository has been archived by the owner on Feb 14, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 62
/
index.php
92 lines (77 loc) · 2.09 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
/**
* Website: https://mudew.com/
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
* Updated: 2019
*/
namespace lkeme\BiliHelper;
//autoload
require 'vendor/autoload.php';
use Dotenv\Dotenv;
set_time_limit(0);
header("Content-Type:text/html; charset=utf-8");
date_default_timezone_set('Asia/Shanghai');
class Index
{
public static $conf_file = null;
public static $dotenv = null;
// RUN
public static function run($conf_file)
{
self::$conf_file = $conf_file;
self::loadConfigFile();
while (true) {
if (!Login::check()) {
self::$dotenv->overload();
}
Daily::run();
MasterSite::run();
Danmu::run();
GiftSend::run();
Heart::run();
Silver::run();
Task::run();
Silver2Coin::run();
GroupSignIn::run();
Live::run();
Guard::run();
Pk::run();
GiftHeart::run();
Winning::run();
MaterialObject::run();
DataTreating::run();
Websocket::run();
usleep(0.5 * 1000000);
}
}
protected static function loadConfigFile()
{
$file_path = __DIR__ . '/conf/' . self::$conf_file;
if (is_file($file_path) && self::$conf_file != 'user.conf') {
$load_files = [
self::$conf_file,
];
} else {
$default_file_path = __DIR__ . '/conf/user.conf';
if (!is_file($default_file_path)) {
exit('默认加载配置文件不存在,请按照文档添加配置文件!');
}
$load_files = [
'user.conf',
];
}
foreach ($load_files as $load_file) {
self::$dotenv = new Dotenv(__DIR__ . '/conf', $load_file);
self::$dotenv->load();
}
// load ACCESS_KEY
Login::run();
self::$dotenv->overload();
}
}
// LOAD
$conf_file = isset($argv[1]) ? $argv[1] : 'user.conf';
// RUN
Index::run($conf_file);