Skip to content

Commit

Permalink
[fix] AloneTcpClient
Browse files Browse the repository at this point in the history
  • Loading branch information
lkeme committed Apr 4, 2020
1 parent 61b7922 commit ee2a621
Show file tree
Hide file tree
Showing 11 changed files with 210 additions and 54 deletions.
42 changes: 42 additions & 0 deletions .github/Issue_Template_CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Issue: BiliHepler 程序问题
<!-- 上面是标题 下面才是正文 -->
### 版本、安装方式、系统

1. 你在使用什么版本的 BiliHelper


2. 你通过什么方式安装 BiliHepler


3. 你所使用的操作系统


---

### 描述问题
<!-- 在下方简要描述问题 -->


---

### 复现问题的步骤
<!-- 在下方描述如何复现问题 -->


---

### BiliHelper 运行日志:
<!-- 如果条件允许请附日志 -->

```shell
# 此处贴入运行日志



```

---

### 截图
<!-- 如果条件允许请附图 -->

42 changes: 42 additions & 0 deletions .github/Issue_Template_EN.md
Original file line number Diff line number Diff line change
@@ -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 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
50 changes: 25 additions & 25 deletions DOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand All @@ -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 |数据统计 |

## 打赏赞助

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**

## 文档

Expand Down
71 changes: 47 additions & 24 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 16 additions & 2 deletions src/plugin/AloneTcpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
namespace BiliHelper\Plugin;

use BiliHelper\Core\Log;
use BiliHelper\Core\Curl;
use BiliHelper\Util\TimeLock;

use Exception;
Expand Down Expand Up @@ -123,7 +122,7 @@ private static function reader($length)
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);
Expand Down Expand Up @@ -236,6 +235,21 @@ private static function receive()
// 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);
Expand Down
Loading

0 comments on commit ee2a621

Please sign in to comment.