mirror of
https://github.com/lkeme/BiliHelper-personal.git
synced 2025-12-19 01:20:08 +08:00
[fix] AloneTcpClient
This commit is contained in:
parent
61b792232d
commit
ee2a62119f
42
.github/Issue_Template_CN.md
vendored
Normal file
42
.github/Issue_Template_CN.md
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
# Issue: BiliHepler 程序问题
|
||||
<!-- 上面是标题 下面才是正文 -->
|
||||
### 版本、安装方式、系统
|
||||
|
||||
1. 你在使用什么版本的 BiliHelper
|
||||
|
||||
|
||||
2. 你通过什么方式安装 BiliHepler
|
||||
|
||||
|
||||
3. 你所使用的操作系统
|
||||
|
||||
|
||||
---
|
||||
|
||||
### 描述问题
|
||||
<!-- 在下方简要描述问题 -->
|
||||
|
||||
|
||||
---
|
||||
|
||||
### 复现问题的步骤
|
||||
<!-- 在下方描述如何复现问题 -->
|
||||
|
||||
|
||||
---
|
||||
|
||||
### BiliHelper 运行日志:
|
||||
<!-- 如果条件允许请附日志 -->
|
||||
|
||||
```shell
|
||||
# 此处贴入运行日志
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 截图
|
||||
<!-- 如果条件允许请附图 -->
|
||||
|
||||
42
.github/Issue_Template_EN.md
vendored
Normal file
42
.github/Issue_Template_EN.md
vendored
Normal file
@ -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
|
||||
<!-- Describe your problem below -->
|
||||
|
||||
|
||||
---
|
||||
|
||||
### Steps to reproduce
|
||||
<!-- Describe how to reproduce problem below -->
|
||||
|
||||
|
||||
---
|
||||
|
||||
### BiliHelper Logs:
|
||||
<!-- Paste log if possible -->
|
||||
|
||||
```shell
|
||||
# Paste running logs here
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Screenshot
|
||||
<!-- Paste screenshot if possible -->
|
||||
|
||||
15
CHANGELOG.md
15
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
|
||||
|
||||
50
DOC.md
50
DOC.md
@ -2,7 +2,7 @@
|
||||
<p align="center"><img width="300px" src="https://i.loli.net/2018/04/20/5ad97bd395912.jpeg"></p>
|
||||
|
||||
<p align="center">
|
||||
<img src="https://img.shields.io/badge/version-0.3.0.200318 alpha-green.svg?longCache=true&style=for-the-badge">
|
||||
<img src="https://img.shields.io/badge/version-0.3.0.200404 alpha-green.svg?longCache=true&style=for-the-badge">
|
||||
<img src="https://img.shields.io/badge/license-mit-blue.svg?longCache=true&style=for-the-badge">
|
||||
</p>
|
||||
|
||||
@ -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 |数据统计 |
|
||||
|
||||
## 打赏赞助
|
||||
|
||||
|
||||
@ -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**
|
||||
|
||||
## 文档
|
||||
|
||||
|
||||
71
composer.lock
generated
71
composer.lock
generated
@ -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"
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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']}");
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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' => '天选时刻获奖记录',
|
||||
|
||||
@ -11,7 +11,6 @@
|
||||
namespace BiliHelper\Plugin;
|
||||
|
||||
use BiliHelper\Core\Log;
|
||||
use BiliHelper\Core\Curl;
|
||||
use BiliHelper\Util\TimeLock;
|
||||
|
||||
use Amp\Delayed;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user