[update] App

This commit is contained in:
Lkeme 2021-08-19 11:15:13 +08:00
parent 7f37c98d8b
commit 038d5ce7af
4 changed files with 155 additions and 23 deletions

View File

@ -27,6 +27,129 @@
},
"Anchor": {
"default": [
"保温服卡",
"上舰",
"上船",
"初始号",
"大航海",
"封面照",
"手机壁纸",
"舰长",
"宝可梦",
"游戏位",
"未名之花",
"美照",
"游戏好友位",
"游戏道具",
"抽号",
"光谱",
"带飞",
"皮肤",
"上电视",
"星际战甲",
"皂片",
"自画像",
"好友",
"西瓜",
"点券",
"明信片",
"正片",
"水友",
"原神",
"看号",
"双排",
"排位",
"古剑奇谭",
"通宝",
"口令码",
"刷箱子",
"第五人格",
"1.11元",
"1.01元",
"文件夹",
"cdk",
"伊格尼斯亡魂",
"1.2元",
"1元",
"1.1元",
"刀币",
"主播自画像",
"SG5531",
"武器箱",
"极限模式",
"伊洛纳密令",
"星耀王者",
"上车",
"优惠券",
"船长",
"王者",
"开船",
"点播",
"1.88元",
"cos",
"照片",
"照骗",
"正片",
"jk照",
"DNF",
"点券",
"1.68元",
"旗开得胜",
"上电视",
"返现",
"1000金瓜子",
"1.66元",
"1RMB",
"1.5元",
"立牌",
"30内兑换一次",
"私照",
"哼歌",
"船员",
"台历",
"靓照",
"晶核",
"壁纸",
"取关三次作废",
"CDK",
"无脸照",
"游戏礼包",
"公测",
"1.23元",
"头像",
"1块钱",
"完美偶像",
"代金卷",
"海报",
"闪蛋",
"月历",
"风中万花",
"表情包",
"体验票",
"深红之网",
"生活照",
"1.33元",
"提督",
"八折券",
"1.2块",
"1.11元",
"打游戏",
"给主播",
"优惠卷",
"艺术鉴赏虚拟门票",
"金豆",
"点歌",
"1.66元",
"1.22元",
"1.23元",
"身材照",
".照.片",
"取关二次作废",
"取关两次作废",
"项目卡",
"账号规划",
"签名照",
"车车",
"拉黑",
"黑名单",
"脸皮厚",

View File

@ -12,16 +12,6 @@
require 'vendor/autoload.php';
if ($argc >= 3) {
if ($argv[2] == 'script') {
define('__MODE__', 2);
}
}
if (!defined('__MODE__')) {
define('__MODE__', 1);
}
$app = new BiliHelper\Core\App(__DIR__);
$app->load($argv)
->inspect()

View File

@ -15,8 +15,7 @@ use function Amp\asyncCall;
class App
{
private $script_mode = false;
private $loop_mode = true;
private $mode = 0;
/**
* App constructor.
@ -50,19 +49,20 @@ class App
{
$args = (new BCommand($argv))->run();
$filename = $args->args()[0] ?? 'user.ini';
$this->script_mode = $args->script;
$this->selectMode($args);
Config::load($filename);
return $this;
}
/**
* @use 新任务
* @param string $taskName
* @param string $dir
*/
public function newTask(string $taskName, string $dir)
private function newTask(string $taskName, string $dir)
{
asyncCall(function() use ($taskName, $dir) {
asyncCall(function () use ($taskName, $dir) {
while (true) {
try {
call_user_func(array("BiliHelper\\$dir\\" . $taskName, 'run'), []);
@ -141,19 +141,38 @@ class App
Loop::run();
}
/**
* @use 选择模式
* @param object $args
*/
private function selectMode(object $args)
{
// 可能会有其他模式出现 暂定
// 0 默认值 默认模式1 脚本模式 ...
if ($args->script) {
$this->mode = 1;
}
}
/**
* @use 核心运行
*/
public function start()
{
// Todo 模式名称需要优化
if (__MODE__ == 2) {
Log::info('执行Script模式');
$this->script_m();
} else {
Log::info('执行Loop模式');
$this->loop_m();
switch ($this->mode) {
case 0:
// 默认
Log::info('执行Loop模式');
$this->loop_m();
break;
case 1:
// 脚本
Log::info('执行Script模式');
$this->script_m();
break;
default:
Log::error("请检查,没有选定的执行模式");
exit();
}
}
}

View File

@ -181,7 +181,7 @@ class Notice
/**
* @use DingTalkbot推送
* @doc https://developers.dingtalk.com/document/app/document-upgrade-notice#/serverapi2/qf2nxq
* @doc https://developers.dingtalk.com/document/robots/custom-robot-access
* @param array $info
*/
private static function dingTalkSend(array $info)