diff --git a/.github/Issue_Template_CN.md b/.github/Issue_Template_CN.md
new file mode 100644
index 0000000..5b5dec9
--- /dev/null
+++ b/.github/Issue_Template_CN.md
@@ -0,0 +1,42 @@
+# Issue: BiliHepler 程序问题
+
+### 版本、安装方式、系统
+
+1. 你在使用什么版本的 BiliHelper
+
+
+2. 你通过什么方式安装 BiliHepler
+
+
+3. 你所使用的操作系统
+
+
+---
+
+### 描述问题
+
+
+
+---
+
+### 复现问题的步骤
+
+
+
+---
+
+### BiliHelper 运行日志:
+
+
+```shell
+# 此处贴入运行日志
+
+
+
+```
+
+---
+
+### 截图
+
+
diff --git a/.github/Issue_Template_EN.md b/.github/Issue_Template_EN.md
new file mode 100644
index 0000000..10e4f98
--- /dev/null
+++ b/.github/Issue_Template_EN.md
@@ -0,0 +1,42 @@
+# Issue: Bug Report
+
+### Version, approach of installation, operating system
+
+1. What version of BiliHelper are you using?
+
+
+2. What approach of installation do you install BiliHelper?
+
+
+3. What is your operating system?
+
+
+---
+
+### Description
+
+
+
+---
+
+### Steps to reproduce
+
+
+
+---
+
+### BiliHelper Logs:
+
+
+```shell
+# Paste running logs here
+
+
+
+```
+
+---
+
+### Screenshot
+
+
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4c91809..a8a0fc7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,21 @@
# Release Notes
# 本项目Log
+## v0.3.0.200404 alpha (2020-04-04)
+
+### Added
+- 添加ISSUE模板
+- 添加处理监控端命令
+-
+
+### Changed
+-
+
+### Fixed
+- 修复主监控内存溢出
+- 修复活动礼物提醒
+-
+
## v0.3.0.200318 alpha (2020-03-18)
### Added
diff --git a/DOC.md b/DOC.md
index 779b2ff..002b6e0 100644
--- a/DOC.md
+++ b/DOC.md
@@ -2,7 +2,7 @@

-
+
@@ -15,30 +15,30 @@ B 站直播实用脚本
|plugin |version |description |
|--------------------|--------------------|--------------------|
-|Login |20.03.18 |账号登录 |
-|Schedule |20.03.18 |休眠控制 |
-|MasterSite |20.03.18 |主站助手 |
-|Daily |20.03.18 |每日礼包 |
-|Heart |20.03.18 |双端心跳 |
-|Task |20.03.18 |每日任务 |
-|Silver |20.03.18 |银瓜子宝箱 |
-|Barrage |20.03.18 |活跃弹幕 |
-|Silver2Coin |20.03.18 |银瓜子换硬币 |
-|GiftSend |20.03.18 |礼物赠送 |
-|Judge |20.03.18 |风纪 |
-|GroupSignIn |20.03.18 |友爱社签到 |
-|ManGa |20.03.18 |漫画签到分享 |
-|GiftHeart |20.03.18 |心跳礼物 |
-|MaterialObject |20.03.18 |实物抽奖 |
-|AloneTcpClient |20.03.18 |独立监控 |
-|ZoneTcpClient |20.03.18 |分区监控 |
-|StormRaffle |20.03.18 |节奏风暴 |
-|GiftRaffle |20.03.18 |活动礼物 |
-|PkRaffle |20.03.18 |大乱斗 |
-|GuardRaffle |20.03.18 |舰长总督 |
-|AnchorRaffle |20.03.18 |天选时刻 |
-|AwardRecord |20.03.18 |获奖通知 |
-|Statistics |20.03.18 |数据统计 |
+|Login |20.04.04 |账号登录 |
+|Schedule |20.04.04 |休眠控制 |
+|MasterSite |20.04.04 |主站助手 |
+|Daily |20.04.04 |每日礼包 |
+|Heart |20.04.04 |双端心跳 |
+|Task |20.04.04 |每日任务 |
+|Silver |20.04.04 |银瓜子宝箱 |
+|Barrage |20.04.04 |活跃弹幕 |
+|Silver2Coin |20.04.04 |银瓜子换硬币 |
+|GiftSend |20.04.04 |礼物赠送 |
+|Judge |20.04.04 |风纪 |
+|GroupSignIn |20.04.04 |友爱社签到 |
+|ManGa |20.04.04 |漫画签到分享 |
+|GiftHeart |20.04.04 |心跳礼物 |
+|MaterialObject |20.04.04 |实物抽奖 |
+|AloneTcpClient |20.04.04 |独立监控 |
+|ZoneTcpClient |20.04.04 |分区监控 |
+|StormRaffle |20.04.04 |节奏风暴 |
+|GiftRaffle |20.04.04 |活动礼物 |
+|PkRaffle |20.04.04 |大乱斗 |
+|GuardRaffle |20.04.04 |舰长总督 |
+|AnchorRaffle |20.04.04 |天选时刻 |
+|AwardRecord |20.04.04 |获奖通知 |
+|Statistics |20.04.04 |数据统计 |
## 打赏赞助
diff --git a/README.md b/README.md
index 08d7d5a..7e5a149 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@ Group: [55308141](https://jq.qq.com/?_wv=1027&k=5AIDaJg) | **仅用于BUG提交
## 公告
-Currently for Personal Edition **0.3.0.200318 alpha**
+Currently for Personal Edition **0.3.0.200404 alpha**
## 文档
diff --git a/composer.lock b/composer.lock
index d80cb04..5694dbe 100644
--- a/composer.lock
+++ b/composer.lock
@@ -537,16 +537,16 @@
},
{
"name": "phpoption/phpoption",
- "version": "1.7.2",
+ "version": "1.7.3",
"source": {
"type": "git",
"url": "https://github.com/schmittjoh/php-option.git",
- "reference": "77f7c4d2e65413aff5b5a8cc8b3caf7a28d81959"
+ "reference": "4acfd6a4b33a509d8c88f50e5222f734b6aeebae"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/77f7c4d2e65413aff5b5a8cc8b3caf7a28d81959",
- "reference": "77f7c4d2e65413aff5b5a8cc8b3caf7a28d81959",
+ "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/4acfd6a4b33a509d8c88f50e5222f734b6aeebae",
+ "reference": "4acfd6a4b33a509d8c88f50e5222f734b6aeebae",
"shasum": "",
"mirrors": [
{
@@ -556,7 +556,7 @@
]
},
"require": {
- "php": "^5.5.9 || ^7.0"
+ "php": "^5.5.9 || ^7.0 || ^8.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.3",
@@ -594,7 +594,7 @@
"php",
"type"
],
- "time": "2019-12-15T19:35:24+00:00"
+ "time": "2020-03-21T18:07:53+00:00"
},
{
"name": "psr/http-message",
@@ -654,16 +654,16 @@
},
{
"name": "psr/log",
- "version": "1.1.2",
+ "version": "1.1.3",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
- "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801"
+ "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/php-fig/log/zipball/446d54b4cb6bf489fc9d75f55843658e6f25d801",
- "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801",
+ "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc",
+ "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc",
"shasum": "",
"mirrors": [
{
@@ -703,7 +703,7 @@
"psr",
"psr-3"
],
- "time": "2019-11-01T11:05:21+00:00"
+ "time": "2020-03-23T09:12:05+00:00"
},
{
"name": "ralouphie/getallheaders",
@@ -753,16 +753,16 @@
},
{
"name": "symfony/polyfill-ctype",
- "version": "v1.14.0",
+ "version": "v1.15.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
- "reference": "fbdeaec0df06cf3d51c93de80c7eb76e271f5a38"
+ "reference": "4719fa9c18b0464d399f1a63bf624b42b6fa8d14"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/fbdeaec0df06cf3d51c93de80c7eb76e271f5a38",
- "reference": "fbdeaec0df06cf3d51c93de80c7eb76e271f5a38",
+ "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/4719fa9c18b0464d399f1a63bf624b42b6fa8d14",
+ "reference": "4719fa9c18b0464d399f1a63bf624b42b6fa8d14",
"shasum": "",
"mirrors": [
{
@@ -780,7 +780,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.14-dev"
+ "dev-master": "1.15-dev"
}
},
"autoload": {
@@ -813,20 +813,34 @@
"polyfill",
"portable"
],
- "time": "2020-01-13T11:15:53+00:00"
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2020-02-27T09:26:54+00:00"
},
{
"name": "vlucas/phpdotenv",
- "version": "v4.1.2",
+ "version": "v4.1.3",
"source": {
"type": "git",
"url": "https://github.com/vlucas/phpdotenv.git",
- "reference": "939dfda2d7267ac8fc53ac3d642b5de357554c39"
+ "reference": "88f7acc95150bca002a498899f8b52f318e444c2"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/939dfda2d7267ac8fc53ac3d642b5de357554c39",
- "reference": "939dfda2d7267ac8fc53ac3d642b5de357554c39",
+ "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/88f7acc95150bca002a498899f8b52f318e444c2",
+ "reference": "88f7acc95150bca002a498899f8b52f318e444c2",
"shasum": "",
"mirrors": [
{
@@ -843,10 +857,12 @@
"require-dev": {
"bamarni/composer-bin-plugin": "^1.3",
"ext-filter": "*",
+ "ext-pcre": "*",
"phpunit/phpunit": "^4.8.35 || ^5.0 || ^6.0 || ^7.0"
},
"suggest": {
- "ext-filter": "Required to use the boolean validator."
+ "ext-filter": "Required to use the boolean validator.",
+ "ext-pcre": "Required to use most of the library."
},
"type": "library",
"extra": {
@@ -881,7 +897,13 @@
"env",
"environment"
],
- "time": "2020-03-12T13:44:15+00:00"
+ "funding": [
+ {
+ "url": "https://tidelift.com/funding/github/packagist/vlucas/phpdotenv",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2020-03-27T23:37:15+00:00"
}
],
"packages-dev": [],
@@ -899,5 +921,6 @@
"ext-zlib": "*",
"ext-mbstring": "*"
},
- "platform-dev": []
+ "platform-dev": [],
+ "plugin-api-version": "1.1.0"
}
diff --git a/src/plugin/AloneTcpClient.php b/src/plugin/AloneTcpClient.php
index 3ee65ff..9197353 100644
--- a/src/plugin/AloneTcpClient.php
+++ b/src/plugin/AloneTcpClient.php
@@ -11,7 +11,6 @@
namespace BiliHelper\Plugin;
use BiliHelper\Core\Log;
-use BiliHelper\Core\Curl;
use BiliHelper\Util\TimeLock;
use Exception;
@@ -123,7 +122,7 @@ class AloneTcpClient
try {
while (self::$client->selectRead(self::$socket_timeout)) {
$data = self::$client->read($length);
- if (!$data) {
+ if (!$data || strlen($data) > 65535 || strlen($data) < 0) {
throw new Exception("Connection failure");
}
if ($length == 4) $data = self::unPackMsg($data);
@@ -236,6 +235,21 @@ class AloneTcpClient
// Log::info("推送服务器心跳推送 {$body}");
Log::debug("(heartbeat={$raw_data['data']['now']})");
break;
+ case 'sleep':
+ // 服务器发布命令
+ Log::warning("服务器发布休眠命令 {$raw_data['data']['msg']}");
+ sleep($raw_data['data']['hour']);
+ break;
+ case 'update':
+ // 服务器发布命令
+ Log::notice("服务器发布更新命令 {$raw_data['data']['msg']}");
+ Notice::push('update', $raw_data['data']['msg']);
+ break;
+ case 'exit':
+ // 服务器发布命令
+ Log::error("服务器发布退出命令 {$raw_data['data']['msg']}");
+ exit();
+ break;
default:
// 未知信息
var_dump($raw_data);
diff --git a/src/plugin/GiftRaffle.php b/src/plugin/GiftRaffle.php
index 6a702a8..d321635 100644
--- a/src/plugin/GiftRaffle.php
+++ b/src/plugin/GiftRaffle.php
@@ -114,7 +114,7 @@ class GiftRaffle extends BaseRaffle
if (isset($de_raw['code']) && !$de_raw['code']) {
// 推送中奖信息
if ($de_raw['data']['award_name'] != '辣条' && $de_raw['data']['award_name'] != '') {
- $info = $de_raw['data']['award_name'] . 'x' . $de_raw['data']['award_name'];
+ $info = $de_raw['data']['award_name'] . 'x' . $de_raw['data']['award_num'];
Notice::push('gift', $info);
}
Log::notice("房间 {$data['room_id']} 编号 {$data['raffle_id']} " . self::ACTIVE_TITLE . ": {$de_raw['data']['award_name']}x{$de_raw['data']['award_num']}");
diff --git a/src/plugin/Live.php b/src/plugin/Live.php
index 4899d02..a44e412 100644
--- a/src/plugin/Live.php
+++ b/src/plugin/Live.php
@@ -143,6 +143,21 @@ class Live
}
+ /**
+ * @use web端获取直播间信息
+ * @param $room_id
+ * @return array
+ */
+ public static function webGetRoomInfo($room_id): array
+ {
+ $url = 'https://api.live.bilibili.com/xlive/web-room/v1/index/getInfoByRoom?=23058';
+ $payload = [
+ 'room_id' => $room_id
+ ];
+ $raw = Curl::get('other', $url, $payload);
+ return json_decode($raw, true);
+ }
+
/**
* @use 钓鱼检测
* @param $room_id
diff --git a/src/plugin/Notice.php b/src/plugin/Notice.php
index 47ef04d..08a031f 100644
--- a/src/plugin/Notice.php
+++ b/src/plugin/Notice.php
@@ -68,6 +68,12 @@ class Notice
{
$now_time = date('Y-m-d H:i:s');
switch (self::$type) {
+ case 'update':
+ $info = [
+ 'title' => '程序更新通知',
+ 'content' => '[' . $now_time . ']' . ' 用户: ' . self::$uname . ' 程序更新通知' . self::$result,
+ ];
+ break;
case 'anchor':
$info = [
'title' => '天选时刻获奖记录',
diff --git a/src/plugin/ZoneTcpClient.php b/src/plugin/ZoneTcpClient.php
index f6ae57a..5b3f5a0 100644
--- a/src/plugin/ZoneTcpClient.php
+++ b/src/plugin/ZoneTcpClient.php
@@ -11,7 +11,6 @@
namespace BiliHelper\Plugin;
use BiliHelper\Core\Log;
-use BiliHelper\Core\Curl;
use BiliHelper\Util\TimeLock;
use Amp\Delayed;