From 59efba0aea00984708a1679accca5df5bf1a1c90 Mon Sep 17 00:00:00 2001 From: lkeme <1462364497@qq.com> Date: Sat, 24 Jul 2021 09:55:55 +0800 Subject: [PATCH 1/8] [update] Resource Data --- .github/FUNDING.yml | 12 ++++ data/activity_infos.json | 10 +-- data/capsule_infos.json | 151 +++++++++++++++++++++++++++++++++------ src/core/Log.php | 3 +- 4 files changed, 147 insertions(+), 29 deletions(-) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..09449d6 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: ['https://i.loli.net/2019/07/13/5d2963e5cc1eb22973.png'] \ No newline at end of file diff --git a/data/activity_infos.json b/data/activity_infos.json index 9b50c37..688bf24 100644 --- a/data/activity_infos.json +++ b/data/activity_infos.json @@ -22,15 +22,15 @@ "expire_at": "2021-03-30 23:59:59" }, { - "url": "https://www.bilibili.com/blackboard/BDF2021.html", - "title": "哔哩哔哩舞蹈嘉年华2021", - "description": "BDF2021等你来玩!活动期间每天分享页面,新增一次机会。", - "sid": "12a6d7e9-7813-11eb-8597-246e966235d8", + "url": "https://www.bilibili.com/blackboard/activity-yellowVSgreen7th.html", + "title": "哔哩哔哩,黄绿合战7th", + "description": "神仙打架、大型选择困难症的噩梦!鬼畜区的巅峰对决,每日两两battle,为你带来最棒的视听盛宴!", + "sid": "13096c11-e89a-11eb-8597-246e966235d8", "login": "true", "follow": "false", "share": "true", "draw_times": 1, - "expire_at": "2021-07-15 11:59:59" + "expire_at": "2021-08-12 11:59:59" } ] } \ No newline at end of file diff --git a/data/capsule_infos.json b/data/capsule_infos.json index 1554e38..8301b77 100644 --- a/data/capsule_infos.json +++ b/data/capsule_infos.json @@ -7,7 +7,7 @@ "_url": "注释: 活动地址", "url": "https://www.bilibili.com/blackboard/activity-kiOl0D1nF8.html", "_title": "注释: 活动标题", - "title": "原神1.6版本UP主激励计划", + "title": "原神2.0版本UP主激励计划", "_description": "注释: 活动描述", "description": "每日在原神分区任意直播间观看,20分钟1张、1小时2张、2小时3张,每日最高6张。", "_room_id": "注释: 活动直播间,如果为0,则取分区随机一个", @@ -17,28 +17,145 @@ "_parent_area_id": "注释: 主分区id", "parent_area_id": 3, "_coin_id": "注释: 抽奖id", - "coin_id": 165, + "coin_id": 209, "_pool_id": "注释: 抽奖id", - "pool_id": 179, + "pool_id": 219, "_watch_time": "注释: 观看时长 单位秒", "watch_time": 7320, "_draw_times": "注释: 抽奖次数", "draw_times": 6, "_expire_at": "注释: 活动有效时间", - "expire_at": "2021-07-20 23:59:59" + "expire_at": "2021-08-31 23:59:59" + }, + { + "url": "https://www.bilibili.com/blackboard/activity-aCrSakaiX5.html", + "title": "永劫无间无拘创作挑战赛", + "description": "视频投稿&主播开播,瓜分40万奖金!", + "room_id": 0, + "area_id": 443, + "parent_area_id": 6, + "coin_id": 198, + "pool_id": 208, + "watch_time": 3700, + "draw_times": 3, + "expire_at": "2021-08-08 23:59:59" + }, + { + "url": "https://www.bilibili.com/blackboard/activity-jCibw9bk8l.html", + "title": "我的世界暑期直播大挑战", + "description": "我的世界暑期直播大挑战", + "room_id": 0, + "area_id": 249, + "parent_area_id": 6, + "coin_id": 207, + "pool_id": 216, + "watch_time": 7320, + "draw_times": 3, + "expire_at": "2021-08-15 23:59:59" + }, + { + "url": "https://www.bilibili.com/blackboard/activity-TVWStSTDRs.html", + "title": "游戏直播嘉年华-极限大挑战", + "description": "每日观看满10/30/60分钟可获得1/2/3枚心愿币", + "room_id": 0, + "area_id": 0, + "parent_area_id": 6, + "coin_id": 189, + "pool_id": 205, + "watch_time": 0, + "draw_times": 6, + "expire_at": "2021-08-15 23:59:59" + }, + { + "url": "https://www.bilibili.com/blackboard/activity-Bj5ru05xgK.html", + "title": "第五人格超级预言家", + "description": "在第五人格分区累计观看直播10分钟/30分钟/60分钟即可获得 应援券1张/2张/3张", + "room_id": 0, + "area_id": 163, + "parent_area_id": 3, + "coin_id": 172, + "pool_id": 184, + "watch_time": 3700, + "draw_times": 6, + "expire_at": "2021-09-01 23:59:59" + }, + { + "url": "https://www.bilibili.com/blackboard/activity-3F5JplgtKh.html", + "title": "《怪物猎人物语2:毁灭之翼》", + "description": "《怪物猎人物语2:毁灭之翼》", + "room_id": 0, + "area_id": 481, + "parent_area_id": 6, + "coin_id": 200, + "pool_id": 213, + "watch_time": 3700, + "draw_times": 6, + "expire_at": "2021-07-22 23:59:59" + }, + { + "url": "https://live.bilibili.com/76", + "title": "守望先锋", + "description": "OWL2021开始了", + "room_id": 76, + "area_id": 87, + "parent_area_id": 2, + "coin_id": 131, + "pool_id": 145, + "watch_time": 1000, + "draw_times": 3, + "expire_at": "2021-09-01 23:59:59" + }, + { + "url": "https://live.bilibili.com/828", + "title": "剑网3大师赛", + "description": "剑网3大师赛", + "room_id": 828, + "area_id": 82, + "parent_area_id": 2, + "coin_id": 190, + "pool_id": 203, + "watch_time": 3700, + "draw_times": 11, + "expire_at": "2021-09-01 23:59:59" + }, + { + "url": "https://www.bilibili.com/blackboard/activity-HmADkQuRGP.html", + "title": "《斩妖行》主播招募", + "description": "《斩妖行》主播招募", + "room_id": 0, + "area_id": 358, + "parent_area_id": 6, + "coin_id": 202, + "pool_id": 209, + "watch_time": 7320, + "draw_times": 6, + "expire_at": "2021-07-23 23:59:59" + }, + { + "url": "https://www.bilibili.com/blackboard/activity-YJ7JPyI9iJ.html", + "title": "《战意》国潮新赛季激励计划", + "description": "20万奖金助力将军凯旋", + "room_id": 0, + "area_id": 383, + "parent_area_id": 2, + "coin_id": 199, + "pool_id": 207, + "watch_time": 1600, + "draw_times": 6, + "expire_at": "2021-08-07 23:59:59" }, { "url": "https://live.bilibili.com/11218604", - "title": "2021PCL春季赛观赛任务", - "description": "每日在PGI直播间观看,10、15、30", + "title": "PCL夏季赛", + "description": "每日在PGI直播间观看,5、10", "room_id": 11218604, "area_id": 0, "parent_area_id": 2, - "coin_id": 170, - "pool_id": 183, - "watch_time": 3720, - "draw_times": 3, - "expire_at": "2021-06-27 23:59:59" + "coin_id": 211, + "pool_id": 218, + "watch_time": 1000, + "draw_times": 2, + "expire_at": "2021-08-29 23:59:59" }, { "url": "https://live.bilibili.com/6", @@ -51,18 +168,6 @@ "watch_time": 3720, "draw_times": 3, "expire_at": "2021-05-31 23:59:59" - }, - { - "url": "https://live.bilibili.com/23", - "title": "PEL和平精英职业联赛", - "description": "每日在PEL直播间观看,5分钟1张", - "room_id": 13242892, - "area_id": 0, - "parent_area_id": 2, - "coin_id": 109, - "watch_time": 3720, - "draw_times": 2, - "expire_at": "2021-06-13 23:59:59" } ] } \ No newline at end of file diff --git a/src/core/Log.php b/src/core/Log.php index 5a7c627..6550ed9 100644 --- a/src/core/Log.php +++ b/src/core/Log.php @@ -48,7 +48,8 @@ class Log private static function prefix(): string { if (getConf('multiple', 'print')) { - return '[' . getConf('user_identity', 'print') ?? getConf('username', 'login.account') . ']'; + // return '[' . (getConf('user_identity', 'print') ?? getConf('username', 'login.account')) . ']'; + return sprintf("[%s]",getConf('user_identity', 'print') ?? getConf('username', 'login.account')); } return ''; } From 15f8dac67a90aef0d463563d398764b0680411f6 Mon Sep 17 00:00:00 2001 From: alfred Date: Sun, 25 Jul 2021 13:20:47 +0800 Subject: [PATCH 2/8] let script mode be one-shot --- src/core/App.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/App.php b/src/core/App.php index 749bf3e..9c96ce8 100644 --- a/src/core/App.php +++ b/src/core/App.php @@ -71,7 +71,10 @@ class App Log::error($error_msg); // Notice::push('error', $error_msg); } - yield call_user_func(array("BiliHelper\\$dir\\" . $taskName, 'Delayed'), []); + if ($dir == 'Plugin') + yield call_user_func(array("BiliHelper\\$dir\\" . $taskName, 'Delayed'), []); + else + break; } }); } From ded642d40ff9dcef1a8d79baf06e0cdf6b105bb7 Mon Sep 17 00:00:00 2001 From: lkeme <1462364497@qq.com> Date: Sat, 7 Aug 2021 10:23:19 +0800 Subject: [PATCH 3/8] [fix] AloneTcpClient & Forward --- composer.lock | 51 ++++++++++++++++++----------------- src/plugin/AloneTcpClient.php | 16 +++++++---- src/plugin/Forward.php | 4 +++ 3 files changed, 41 insertions(+), 30 deletions(-) diff --git a/composer.lock b/composer.lock index 4ea622f..c14ef03 100644 --- a/composer.lock +++ b/composer.lock @@ -80,16 +80,16 @@ }, { "name": "amphp/amp", - "version": "v2.5.2", + "version": "v2.6.0", "source": { "type": "git", "url": "https://github.com/amphp/amp.git", - "reference": "efca2b32a7580087adb8aabbff6be1dc1bb924a9" + "reference": "caa95edeb1ca1bf7532e9118ede4a3c3126408cc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/amp/zipball/efca2b32a7580087adb8aabbff6be1dc1bb924a9", - "reference": "efca2b32a7580087adb8aabbff6be1dc1bb924a9", + "url": "https://api.github.com/repos/amphp/amp/zipball/caa95edeb1ca1bf7532e9118ede4a3c3126408cc", + "reference": "caa95edeb1ca1bf7532e9118ede4a3c3126408cc", "shasum": "", "mirrors": [ { @@ -99,14 +99,14 @@ ] }, "require": { - "php": ">=7" + "php": ">=7.1" }, "require-dev": { "amphp/php-cs-fixer-config": "dev-master", "amphp/phpunit-util": "^1", "ext-json": "*", "jetbrains/phpstorm-stubs": "^2019.3", - "phpunit/phpunit": "^6.0.9 | ^7", + "phpunit/phpunit": "^7 | ^8 | ^9", "psalm/phar": "^3.11@dev", "react/promise": "^2" }, @@ -163,7 +163,7 @@ "support": { "irc": "irc://irc.freenode.org/amphp", "issues": "https://github.com/amphp/amp/issues", - "source": "https://github.com/amphp/amp/tree/v2.5.2" + "source": "https://github.com/amphp/amp/tree/v2.6.0" }, "funding": [ { @@ -171,7 +171,7 @@ "type": "github" } ], - "time": "2021-01-10T17:06:37+00:00" + "time": "2021-07-16T20:06:06+00:00" }, { "name": "bramus/ansi-php", @@ -741,16 +741,16 @@ }, { "name": "laminas/laminas-servicemanager", - "version": "3.6.4", + "version": "3.7.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-servicemanager.git", - "reference": "b1445e1a7077c21b0fad0974a1b7a11b9dbe0828" + "reference": "2b0aee477fdbd3191af7c302b93dbc5fda0626f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-servicemanager/zipball/b1445e1a7077c21b0fad0974a1b7a11b9dbe0828", - "reference": "b1445e1a7077c21b0fad0974a1b7a11b9dbe0828", + "url": "https://api.github.com/repos/laminas/laminas-servicemanager/zipball/2b0aee477fdbd3191af7c302b93dbc5fda0626f4", + "reference": "2b0aee477fdbd3191af7c302b93dbc5fda0626f4", "shasum": "", "mirrors": [ { @@ -779,14 +779,16 @@ }, "require-dev": { "composer/package-versions-deprecated": "^1.0", - "laminas/laminas-coding-standard": "~1.0.0", + "laminas/laminas-coding-standard": "~2.2.0", "laminas/laminas-container-config-test": "^0.3", - "laminas/laminas-dependency-plugin": "^2.1", + "laminas/laminas-dependency-plugin": "^2.1.2", "mikey179/vfsstream": "^1.6.8", "ocramius/proxy-manager": "^2.2.3", - "phpbench/phpbench": "^1.0.0-alpha3", + "phpbench/phpbench": "^1.0.4", "phpspec/prophecy-phpunit": "^2.0", - "phpunit/phpunit": "^9.4" + "phpunit/phpunit": "^9.4", + "psalm/plugin-phpunit": "^0.16.1", + "vimeo/psalm": "^4.8" }, "suggest": { "ocramius/proxy-manager": "ProxyManager ^2.1.1 to handle lazy initialization of services" @@ -830,20 +832,20 @@ "type": "community_bridge" } ], - "time": "2021-02-03T08:44:41+00:00" + "time": "2021-07-24T19:33:07+00:00" }, { "name": "laminas/laminas-stdlib", - "version": "3.4.0", + "version": "3.5.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-stdlib.git", - "reference": "e89c2268c9cad25099f562f7f015c28c5dd383c9" + "reference": "c8ac6a76a133e682acfabc821d4a2ec646934b12" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-stdlib/zipball/e89c2268c9cad25099f562f7f015c28c5dd383c9", - "reference": "e89c2268c9cad25099f562f7f015c28c5dd383c9", + "url": "https://api.github.com/repos/laminas/laminas-stdlib/zipball/c8ac6a76a133e682acfabc821d4a2ec646934b12", + "reference": "c8ac6a76a133e682acfabc821d4a2ec646934b12", "shasum": "", "mirrors": [ { @@ -853,11 +855,10 @@ ] }, "require": { - "laminas/laminas-zendframework-bridge": "^1.0", "php": "^7.3 || ^8.0" }, - "replace": { - "zendframework/zend-stdlib": "^3.2.1" + "conflict": { + "zendframework/zend-stdlib": "*" }, "require-dev": { "laminas/laminas-coding-standard": "~2.3.0", @@ -896,7 +897,7 @@ "type": "community_bridge" } ], - "time": "2021-06-28T21:37:31+00:00" + "time": "2021-08-03T13:40:40+00:00" }, { "name": "laminas/laminas-text", diff --git a/src/plugin/AloneTcpClient.php b/src/plugin/AloneTcpClient.php index da3f3c7..0c921b8 100644 --- a/src/plugin/AloneTcpClient.php +++ b/src/plugin/AloneTcpClient.php @@ -61,10 +61,10 @@ class AloneTcpClient /** * @use 数据封装 * @param $value - * @param $fmt + * @param string $fmt * @return string */ - private static function packMsg($value, $fmt = "N"): string + private static function packMsg($value, string $fmt = "N"): string { $head = pack($fmt, strlen($value)); return $head . $value; @@ -75,11 +75,11 @@ class AloneTcpClient * @param $value * @param string $fmt * @return array|false + * @throws \Exception */ - private static function unPackMsg($value, $fmt = "N") + private static function unPackMsg($value, string $fmt = "N") { - $data = unpack($fmt, $value); - return $data[1]; + return unpack($fmt, $value); } /** @@ -126,6 +126,12 @@ class AloneTcpClient throw new Exception("Connection failure"); } if ($length == 4) $data = self::unPackMsg($data); + // 防止解包异常 + if (!$data) { + throw new Exception("Connection failure"); + } else { + $data = $data[1]; + } break; } } catch (Exception $exception) { diff --git a/src/plugin/Forward.php b/src/plugin/Forward.php index 14e3e41..a89805d 100644 --- a/src/plugin/Forward.php +++ b/src/plugin/Forward.php @@ -211,6 +211,10 @@ class Forward $did = $dynamic['desc']['dynamic_id']; $card = json_decode($dynamic['card'], true); foreach ($msg_list as $msg) { + // 异常情况 跳过 + if (!isset($card['item']['content']) || !$msg) { + continue; + } if (strpos($card['item']['content'], $msg) !== false) { Log::info("[删除所有动态] 删除动态 {$did}"); Dynamic::removeDynamic($did); From 0e993662bb508d42cde18641edbaae31bb773a77 Mon Sep 17 00:00:00 2001 From: lkeme <1462364497@qq.com> Date: Sat, 7 Aug 2021 10:56:18 +0800 Subject: [PATCH 4/8] [fix] AnchorRaffle --- src/plugin/AnchorRaffle.php | 13 +++++++------ src/util/BaseRaffle.php | 7 ++++++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/plugin/AnchorRaffle.php b/src/plugin/AnchorRaffle.php index 85ef140..3071944 100644 --- a/src/plugin/AnchorRaffle.php +++ b/src/plugin/AnchorRaffle.php @@ -16,7 +16,7 @@ use BiliHelper\Util\BaseRaffle; class AnchorRaffle extends BaseRaffle { - const ACTIVE_TITLE = '天选时刻'; + const ACTIVE_TITLE = '天选之子'; const ACTIVE_SWITCH = 'live_anchor'; protected static $wait_list = []; @@ -178,10 +178,11 @@ class AnchorRaffle extends BaseRaffle 'room_id' => $room_id, 'raffle_id' => $de_raw['id'], 'raffle_name' => $de_raw['award_name'], + 'remarks' => self::ACTIVE_TITLE, 'wait' => time() + mt_rand(5, 25) ]; // Statistics::addPushList($data['raffle_name']); - Statistics::addPushList("天选之子"); + Statistics::addPushList(self::ACTIVE_TITLE); array_push(self::$wait_list, $data); return true; } @@ -230,13 +231,13 @@ class AnchorRaffle extends BaseRaffle $de_raw = json_decode($content, true); // {"code":-403,"data":null,"message":"访问被拒绝","msg":"访问被拒绝"} if (isset($de_raw['code']) && $de_raw['code'] == 0) { - Statistics::addSuccessList($data['raffle_name']); - Log::notice("房间 {$data['room_id']} 编号 {$data['raffle_id']} " . self::ACTIVE_TITLE . ": 参与抽奖成功~"); + Statistics::addSuccessList(self::ACTIVE_TITLE); + Log::notice("房间 {$data['room_id']} 编号 {$data['raffle_id']} " . self::ACTIVE_TITLE . "-(" . $data['raffle_name'] . "): 参与抽奖成功~"); } elseif (isset($de_raw['msg']) && $de_raw['code'] == -403 && $de_raw['msg'] == '访问被拒绝') { - Log::debug("房间 {$data['room_id']} 编号 {$data['raffle_id']} " . self::ACTIVE_TITLE . ": {$de_raw['message']}"); + Log::debug("房间 {$data['room_id']} 编号 {$data['raffle_id']} " . self::ACTIVE_TITLE . "-(" . $data['raffle_name'] . "): {$de_raw['message']}"); self::pauseLock(); } else { - Log::notice("房间 {$data['room_id']} 编号 {$data['raffle_id']} " . self::ACTIVE_TITLE . ": {$de_raw['message']}"); + Log::notice("房间 {$data['room_id']} 编号 {$data['raffle_id']} " . self::ACTIVE_TITLE . "-(" . $data['raffle_name'] . "): {$de_raw['message']}"); } } } diff --git a/src/util/BaseRaffle.php b/src/util/BaseRaffle.php index 1c80ddb..2ca5215 100644 --- a/src/util/BaseRaffle.php +++ b/src/util/BaseRaffle.php @@ -70,7 +70,12 @@ abstract class BaseRaffle } array_push($room_list, $raffle['room_id']); array_push($raffle_list, $raffle); - Statistics::addJoinList($raffle['raffle_name']); + // 有备注要单独处理 + if (isset($raffle['remarks'])) { + Statistics::addJoinList($raffle['remarks']); + } else { + Statistics::addJoinList($raffle['raffle_name']); + } } if (count($raffle_list) && count($room_list)) { $room_list = array_unique($room_list); From aadef3def035c0271c8f5f15f20495e08c584e9e Mon Sep 17 00:00:00 2001 From: lkeme <1462364497@qq.com> Date: Sat, 7 Aug 2021 12:18:42 +0800 Subject: [PATCH 5/8] [fix] CapsuleLottery fixed #106 --- src/core/App.php | 1 + src/plugin/CapsuleLottery.php | 7 +++++-- src/util/AllotTasks.php | 14 +++++++++----- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/core/App.php b/src/core/App.php index 9c96ce8..84d66fd 100644 --- a/src/core/App.php +++ b/src/core/App.php @@ -67,6 +67,7 @@ class App try { call_user_func(array("BiliHelper\\$dir\\" . $taskName, 'run'), []); } catch (\Throwable $e) { + // TODO 多次错误删除tasks_***.json文件 $error_msg = "MSG: {$e->getMessage()} CODE: {$e->getCode()} FILE: {$e->getFile()} LINE: {$e->getLine()}"; Log::error($error_msg); // Notice::push('error', $error_msg); diff --git a/src/plugin/CapsuleLottery.php b/src/plugin/CapsuleLottery.php index fe65cb4..0b0d831 100644 --- a/src/plugin/CapsuleLottery.php +++ b/src/plugin/CapsuleLottery.php @@ -110,8 +110,11 @@ class CapsuleLottery switch ($task['operation']) { // Todo 观看 分享 签到任务 case 'watch': - $interval = self::xliveHeartBeatTask($task['act']->room_id, 999, 999); - self::$interval = $interval == 0 ? 60 : $interval; + // 处理值为空 + if (!is_null($task['act']->room_id)) { + $interval = self::xliveHeartBeatTask($task['act']->room_id, 999, 999); + self::$interval = ($interval == 0 ? 60 : $interval); + } break; case 'draw': // 抽奖次数 > 0 开始抽奖 diff --git a/src/util/AllotTasks.php b/src/util/AllotTasks.php index 283d3f3..f38279b 100644 --- a/src/util/AllotTasks.php +++ b/src/util/AllotTasks.php @@ -24,7 +24,6 @@ trait AllotTasks 'work_completed' => null, ]; - /** * @use 加载json数据 * @return Parser @@ -46,11 +45,8 @@ trait AllotTasks $task = [ 'operation' => $operation, 'act' => $act, - 'time' => false + 'time' => $time ]; - if ($time) { - $task['time'] = $time; - } array_push(static::$tasks, $task); return true; } @@ -67,10 +63,18 @@ trait AllotTasks } // 先进先出 弹出一个任务 $task = array_shift(static::$tasks); + // 如果需要时间限制 if ($task['time']) { + // 如果预计时间为空 或 时间未到 推回队列 if (is_null(static::$work_status['estimated_time']) || time() < intval(static::$work_status['estimated_time'])) { array_unshift(static::$tasks, $task); + } else { + // 不再需要推回时 需要制空 不影响下一个任务操作 + static::$work_status['estimated_time'] = null; } + } else { + // 切换任务 制空 + static::$work_status['estimated_time'] = null; } return $task; } From ae8be5f94464c2fe7d032bba9fc5a0415cba8610 Mon Sep 17 00:00:00 2001 From: lkeme <1462364497@qq.com> Date: Sat, 7 Aug 2021 12:58:49 +0800 Subject: [PATCH 6/8] [fix] BCommand --- composer.json | 3 +- composer.lock | 63 +------------------------- src/core/App.php | 7 ++- src/core/{Command.php => BCommand.php} | 24 +++------- 4 files changed, 12 insertions(+), 85 deletions(-) rename src/core/{Command.php => BCommand.php} (58%) diff --git a/composer.json b/composer.json index cb19581..7919a43 100644 --- a/composer.json +++ b/composer.json @@ -20,8 +20,7 @@ "sven/file-config": "^3.1", "hassankhan/config": "^2.2", "lkeme/inifile": "^3.4", - "adhocore/cli": "^0.9.0", - "vanilla/garden-cli": "^3.1" + "adhocore/cli": "^0.9.0" }, "license": "MIT", "authors": [ diff --git a/composer.lock b/composer.lock index c14ef03..e883710 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0678ecd04eed6db66de4668ffffec283", + "content-hash": "ec8eee201c31224952f597aab5be4ea8", "packages": [ { "name": "adhocore/cli", @@ -1790,67 +1790,6 @@ } ], "time": "2021-05-27T09:17:38+00:00" - }, - { - "name": "vanilla/garden-cli", - "version": "v3.1.2", - "source": { - "type": "git", - "url": "https://github.com/vanilla/garden-cli.git", - "reference": "d9844c47f4f2812259ee1b583aa66e7b6b5d85c5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/vanilla/garden-cli/zipball/d9844c47f4f2812259ee1b583aa66e7b6b5d85c5", - "reference": "d9844c47f4f2812259ee1b583aa66e7b6b5d85c5", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "ext-json": "*", - "php": ">=7.2", - "psr/log": "^1.0" - }, - "require-dev": { - "ergebnis/composer-normalize": "^2.8", - "phpdocumentor/reflection-docblock": "^4.3", - "phpunit/phpunit": "^8", - "vanilla/garden-container": "^3.0", - "vanilla/standards": "^1.3", - "vimeo/psalm": "^3.16" - }, - "suggest": { - "ext-pdo": "Required for the DbUtils class.", - "phpdocumentor/reflection-docblock": "Required for the CliApplication functionality.", - "vanilla/garden-container": "Required for the CliApplication functionality." - }, - "type": "library", - "autoload": { - "psr-4": { - "Garden\\Cli\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Todd Burry", - "email": "todd@vanillaforums.com" - } - ], - "description": "A full-featured, yet ridiculously simple commandline parser for your next php cli script. Stop fighting with getopt().", - "support": { - "issues": "https://github.com/vanilla/garden-cli/issues", - "source": "https://github.com/vanilla/garden-cli/tree/v3.1.2" - }, - "time": "2020-10-25T13:36:44+00:00" } ], "packages-dev": [], diff --git a/src/core/App.php b/src/core/App.php index 84d66fd..67f80e1 100644 --- a/src/core/App.php +++ b/src/core/App.php @@ -47,10 +47,9 @@ class App */ public function load($argv): App { - $args = (new Command($argv))->run(); - $filename = $args->getArg(0) ?? 'user.ini'; - $this->script_mode = $args->getOpt('script'); - + $args = (new BCommand($argv))->run(); + $filename = $args->args()[0] ?? 'user.ini'; + $this->script_mode = $args->script; Config::load($filename); return $this; } diff --git a/src/core/Command.php b/src/core/BCommand.php similarity index 58% rename from src/core/Command.php rename to src/core/BCommand.php index be5a97c..28bbe0f 100644 --- a/src/core/Command.php +++ b/src/core/BCommand.php @@ -10,10 +10,9 @@ namespace BiliHelper\Core; -use Garden\Cli\Cli; -use Garden\Cli\Args; +use Ahc\Cli\Input\Command; -class Command +class BCommand { private $argv; @@ -27,18 +26,13 @@ class Command $this->argv = $argv; } - /** - * @return \Garden\Cli\Args - */ - public function run(): Args + public function run() { - $cli = new Cli(); - - $cli->description('BHP命令行工具.') - ->opt('script:s', '执行的Script模式.', false, 'bool'); - + $cli = new Command('BHP-S', 'BHP命令行工具.'); + $cli->version('0.0.1-dev') + ->option('-s --script', '执行的Script模式.',null,false); try { - $args = $cli->parse($this->argv, true); + $args = $cli->parse($this->argv); } catch (\Exception $e) { die('解析命令行参数错误'); } @@ -46,7 +40,3 @@ class Command } } - - - - From 83eab4e467204868be0fee4d519e2e813807867b Mon Sep 17 00:00:00 2001 From: lkeme <1462364497@qq.com> Date: Sat, 7 Aug 2021 13:09:10 +0800 Subject: [PATCH 7/8] [update] Version 0.9.9.* --- CHANGELOG.md | 20 ++++++++++++ README.md | 70 ++++++++++++++++++++-------------------- data/latest_version.json | 4 +-- src/core/Curl.php | 2 +- src/plugin/Sign.php | 4 +-- 5 files changed, 60 insertions(+), 40 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a6ad3a..aa9414f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,26 @@ [comment]: <> () +## v0.9.9.210807 alpha (2021-08-07) + +### Added + +- + +### Changed + +- 更新基础环境参数 +- + +### Fixed + +- 修复独立监控内存溢出 +- 修复天选之人统计数据不正确 +- 修复扭蛋活动只观看第一个任务 +- 修复脚本模式部分设备环境不兼容 +- 修复清理动态错误 +- + ## v0.9.7.210714 alpha (2021-07-14) ### Added diff --git a/README.md b/README.md index 078c81e..63e632f 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@

- + @@ -42,40 +42,40 @@ | plugin | status | version | cycle | description | |-----------------|--------|----------|--------|---------------------------------------------| -| CheckUpdate | true | 21.07.14 | 待整理 | 程序检查更新 | -| Login | true | 21.07.14 | 待整理 | 账号登录、刷新、维持 | -| Schedule | true | 21.07.14 | 待整理 | 控制插件运行周期 | -| MainSite | true | 21.07.14 | 待整理 | 投币、观看、分享视频 (速升6级不是梦) | -| DailyBag | true | 21.07.14 | 待整理 | 双端领取日常/周常礼包 | -| ManGa | true | 21.07.14 | 待整理 | 漫画签到、分享 | -| ActivityLottery | true | 21.07.14 | 待整理 | 主站活动九宫格抽奖 | -| Competition | true | 21.07.14 | 待整理 | 游戏赛事竞猜 | -| DoubleHeart | true | 21.07.14 | 待整理 | 双端心跳 (姥爷直播经验) | -| DailyTask | true | 21.07.14 | 待整理 | 直播每日任务(签到、观看) | -| Barrage | true | 21.07.14 | 待整理 | 保持活跃弹幕 | -| Silver2Coin | true | 21.07.14 | 待整理 | 银瓜子兑换硬币 | -| Judge | true | 21.07.14 | 待整理 | 风纪委员投票 | -| GiftSend | true | 21.07.14 | 待整理 | 礼物赠送、维持每日勋章亲密度 | -| GroupSignIn | true | 21.07.14 | 待整理 | 友爱社签到 | -| GiftHeart | true | 21.07.14 | 待整理 | 日常心跳每日礼包礼物 | -| SmallHeart | true | 21.07.14 | 待整理 | 直播挂机,每日24个小心心 | -| MaterialObject | true | 21.07.14 | 待整理 | 直播金色宝箱实物抽奖 | -| AloneTcpClient | true | 21.07.14 | 待整理 | 作者的独立直播监控(可支持本项目哦) | -| ZoneTcpClient | true | 21.07.14 | 待整理 | 官方的分区直播监控 | -| StormRaffle | true | 21.07.14 | 待整理 | 直播节奏风暴抽奖、亿元 | -| GiftRaffle | true | 21.07.14 | 待整理 | 直播礼物抽奖 | -| PkRaffle | true | 21.07.14 | 待整理 | 直播大乱斗抽奖 | -| GuardRaffle | true | 21.07.14 | 待整理 | 直播大航海抽奖 | -| AnchorRaffle | true | 21.07.14 | 待整理 | 直播天选时刻抽奖 | -| GiftRaffle | true | 21.07.14 | 待整理 | 直播礼物抽奖 | -| AwardRecord | true | 21.07.14 | 待整理 | 最新的中奖纪录通知 | -| Forward | true | 21.07.14 | 待整理 | 主站动态抽奖转发 | -| CapsuleLottery | true | 21.07.14 | 待整理 | 直播扭蛋活动抽奖 | -| PolishTheMedal | true | 21.07.14 | 待整理 | 每日自动点亮灰色勋章 | -| CapsuleLottery | true | 21.07.14 | 待整理 | 直播扭蛋活动抽奖 | -| VipPrivilege | true | 21.07.14 | 待整理 | 每月领取年度大会员特权(B币券、会员购优惠券) | -| BpConsumption | true | 21.07.14 | 待整理 | 每月消费使用年度大会员特权的B币券 | -| Statistics | true | 21.07.14 | 待整理 | 全局抽奖结果统计 | +| CheckUpdate | true | 21.08.07 | 待整理 | 程序检查更新 | +| Login | true | 21.08.07 | 待整理 | 账号登录、刷新、维持 | +| Schedule | true | 21.08.07 | 待整理 | 控制插件运行周期 | +| MainSite | true | 21.08.07 | 待整理 | 投币、观看、分享视频 (速升6级不是梦) | +| DailyBag | true | 21.08.07 | 待整理 | 双端领取日常/周常礼包 | +| ManGa | true | 21.08.07 | 待整理 | 漫画签到、分享 | +| ActivityLottery | true | 21.08.07 | 待整理 | 主站活动九宫格抽奖 | +| Competition | true | 21.08.07 | 待整理 | 游戏赛事竞猜 | +| DoubleHeart | true | 21.08.07 | 待整理 | 双端心跳 (姥爷直播经验) | +| DailyTask | true | 21.08.07 | 待整理 | 直播每日任务(签到、观看) | +| Barrage | true | 21.08.07 | 待整理 | 保持活跃弹幕 | +| Silver2Coin | true | 21.08.07 | 待整理 | 银瓜子兑换硬币 | +| Judge | true | 21.08.07 | 待整理 | 风纪委员投票 | +| GiftSend | true | 21.08.07 | 待整理 | 礼物赠送、维持每日勋章亲密度 | +| GroupSignIn | true | 21.08.07 | 待整理 | 友爱社签到 | +| GiftHeart | true | 21.08.07 | 待整理 | 日常心跳每日礼包礼物 | +| SmallHeart | true | 21.08.07 | 待整理 | 直播挂机,每日24个小心心 | +| MaterialObject | true | 21.08.07 | 待整理 | 直播金色宝箱实物抽奖 | +| AloneTcpClient | true | 21.08.07 | 待整理 | 作者的独立直播监控(可支持本项目哦) | +| ZoneTcpClient | true | 21.08.07 | 待整理 | 官方的分区直播监控 | +| StormRaffle | true | 21.08.07 | 待整理 | 直播节奏风暴抽奖、亿元 | +| GiftRaffle | true | 21.08.07 | 待整理 | 直播礼物抽奖 | +| PkRaffle | true | 21.08.07 | 待整理 | 直播大乱斗抽奖 | +| GuardRaffle | true | 21.08.07 | 待整理 | 直播大航海抽奖 | +| AnchorRaffle | true | 21.08.07 | 待整理 | 直播天选时刻抽奖 | +| GiftRaffle | true | 21.08.07 | 待整理 | 直播礼物抽奖 | +| AwardRecord | true | 21.08.07 | 待整理 | 最新的中奖纪录通知 | +| Forward | true | 21.08.07 | 待整理 | 主站动态抽奖转发 | +| CapsuleLottery | true | 21.08.07 | 待整理 | 直播扭蛋活动抽奖 | +| PolishTheMedal | true | 21.08.07 | 待整理 | 每日自动点亮灰色勋章 | +| CapsuleLottery | true | 21.08.07 | 待整理 | 直播扭蛋活动抽奖 | +| VipPrivilege | true | 21.08.07 | 待整理 | 每月领取年度大会员特权(B币券、会员购优惠券) | +| BpConsumption | true | 21.08.07 | 待整理 | 每月消费使用年度大会员特权的B币券 | +| Statistics | true | 21.08.07 | 待整理 | 全局抽奖结果统计 | | Silver | false | 21.03.27 | 待整理 | 直播银瓜子自动开启宝箱 | diff --git a/data/latest_version.json b/data/latest_version.json index ea47efc..bf4eddf 100644 --- a/data/latest_version.json +++ b/data/latest_version.json @@ -5,7 +5,7 @@ "source": "https://github.com/lkeme/BiliHelper-personal", "raw_url": "https://cdn.jsdelivr.net/gh/lkeme/BiliHelper-personal@master/data/latest_version.json", "purge_url": "https://purge.jsdelivr.net/gh/lkeme/BiliHelper-personal@master/data/latest_version.json", - "version": "0.9.7.210714", + "version": "0.9.9.210807", "des": "程序有更新,请及时线上查看更新哦~", - "time": "2021年7月14日11:40:35" + "time": "2021年8月7日11:40:35" } \ No newline at end of file diff --git a/src/core/Curl.php b/src/core/Curl.php index d5edcb0..31cd14c 100644 --- a/src/core/Curl.php +++ b/src/core/Curl.php @@ -243,7 +243,7 @@ class Curl 'Connection' => 'keep-alive', // 'Content-Type' => 'application/x-www-form-urlencoded', // 'User-Agent' => 'Mozilla/5.0 BiliDroid/5.51.1 (bbcallen@gmail.com)', - 'User-Agent' => 'Mozilla/5.0 BiliDroid/6.32.0 (bbcallen@gmail.com) os/android model/MuMu mobi_app/android build/6320200 channel/bili innerVer/6320200 osVer/7.1.2 network/2', + 'User-Agent' => 'Mozilla/5.0 BiliDroid/6.36.0 (bbcallen@gmail.com) os/android model/MuMu mobi_app/android build/6360400 channel/bili innerVer/6360400 osVer/7.1.2 network/2', // 'Referer' => 'https://live.bilibili.com/', ]; $pc_headers = [ diff --git a/src/plugin/Sign.php b/src/plugin/Sign.php index 5c92e79..c35febd 100644 --- a/src/plugin/Sign.php +++ b/src/plugin/Sign.php @@ -55,7 +55,7 @@ class Sign 'access_key' => getAccessToken(), 'actionKey' => 'appkey', 'appkey' => $appkey, - 'build' => 6320200, + 'build' => 6360400, 'channel' => 'bili', 'device' => 'phone', 'mobi_app' => 'android', @@ -84,7 +84,7 @@ class Sign 'access_key' => getAccessToken(), 'actionKey' => 'appkey', 'appkey' => $appkey, - 'build' => 6320200, + 'build' => 6360400, 'device' => 'phone', 'mobi_app' => 'android', 'platform' => 'android', From 550caf57887d961d7c8dcffb42309f86ec8aab1c Mon Sep 17 00:00:00 2001 From: lkeme <1462364497@qq.com> Date: Sat, 7 Aug 2021 15:47:03 +0800 Subject: [PATCH 8/8] [fix] AloneTcpClient --- src/plugin/AloneTcpClient.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/plugin/AloneTcpClient.php b/src/plugin/AloneTcpClient.php index 0c921b8..33f4d25 100644 --- a/src/plugin/AloneTcpClient.php +++ b/src/plugin/AloneTcpClient.php @@ -79,7 +79,7 @@ class AloneTcpClient */ private static function unPackMsg($value, string $fmt = "N") { - return unpack($fmt, $value); + return unpack($fmt, $value)[1]; } /** @@ -126,12 +126,6 @@ class AloneTcpClient throw new Exception("Connection failure"); } if ($length == 4) $data = self::unPackMsg($data); - // 防止解包异常 - if (!$data) { - throw new Exception("Connection failure"); - } else { - $data = $data[1]; - } break; } } catch (Exception $exception) {