[fix] Notice

This commit is contained in:
Lkeme 2020-01-28 18:06:21 +08:00
parent 8bf43d8be9
commit c6606470a3
7 changed files with 46 additions and 12 deletions

View File

@ -1,10 +1,24 @@
# Release Notes
# 本项目Log
## v0.1.0.200128 alpha (2020-01-28)
### Added
- 增加推送消息过滤
-
### Changed
-
### Fixed
- 修复抽奖推送错误
-
## v0.1.0.200111 alpha (2020-01-11)
### Added
- 天选时刻奖品过滤
-
### Changed
-

4
DOC.md
View File

@ -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.1.0.200111 alpha-green.svg?longCache=true&style=for-the-badge">
<img src="https://img.shields.io/badge/version-0.1.0.200128 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>
@ -33,7 +33,7 @@ B 站直播实用脚本
|AloneTcpClient |19.12.27 |独立监控 |
|ZoneTcpClient |19.12.27 |分区监控 |
|StormRaffle |20.01.03 |节奏风暴 |
|GiftRaffle |20.01.03 |活动礼物 |
|GiftRaffle |20.01.28 |活动礼物 |
|PkRaffle |20.01.03 |大乱斗 |
|GuardRaffle |20.01.03 |舰长总督 |
|AnchorRaffle |20.01.11 |天选时刻 |

View File

@ -7,7 +7,7 @@ Group: [55308141](https://jq.qq.com/?_wv=1027&k=5AIDaJg)
## 公告
Currently for Personal Edition **0.1.0.200111 alpha**
Currently for Personal Edition **0.1.0.200128 alpha**
## 文档

View File

@ -70,7 +70,7 @@ ALONE_SERVER_KEY=,*(?PVl]nIbo35sB
USE_ZONE_SERVER=false
ZONE_SERVER_ADDR=tcp://broadcastlv.chat.bilibili.com:2243/sub
# 切换HTTPS,为真则使用https协议
# 切换HTTPS|为真则使用https协议
USE_HTTPS=true
# 是否使用代理(前提保证有效代理)
@ -78,8 +78,10 @@ USE_PROXY=false
PROXY_IP=127.0.0.1
PROXY_PORT=8888
# SERVER酱, 用于推送消息
USE_SCKEY=
# SERVER酱|令牌KEY|过滤关键词|逗号分隔
USE_SC=false
SC_KEY=
SC_FILTER_WORDS=
#######################
# 房间设置 #

View File

@ -44,7 +44,7 @@ class AnchorRaffle extends BaseRaffle
"0.1", "五毛二", "一分", "一毛", "0.52", "0.66", "0.01", "0.77", "0.16", "照片", "", "0.5",
"0.88", "双排"
];
$custom_words = empty(getenv('ANCHOR_TYPE')) ? [] : explode(',', getenv('ANCHOR_TYPE'));
$custom_words = empty(getenv('ANCHOR_FILTER_WORDS')) ? [] : explode(',', getenv('ANCHOR_FILTER_WORDS'));
$total_words = array_merge($default_words, $custom_words);
foreach ($total_words as $word) {
if (strpos($prize_name, $word) !== false) {

View File

@ -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']['gift_name'] . 'x' . $de_raw['data']['gift_num'];
$info = $de_raw['data']['award_name'] . 'x' . $de_raw['data']['award_name'];
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']}");

View File

@ -29,18 +29,36 @@ class Notice
*/
public static function push(string $type, string $result = '')
{
if (getenv('USE_SCKEY') == "") {
if (getenv('USE_SC') == 'false' || getenv('SC_KEY') == "") {
return;
}
self::$type = $type;
self::$result = $result;
self::$sckey = getenv('USE_SCKEY');
self::$sckey = getenv('SC_KEY');
self::$uname = User::userInfo() ? getenv('APP_UNAME') : getenv('APP_USER');
if (self::filterResultWords($result)) {
return;
}
self::sendInfoHandle();
}
/**
* @use 过滤信息
* @param string $result
* @return bool
*/
private static function filterResultWords(string $result): bool
{
$default_words = [];
$custom_words = empty(getenv('SC_FILTER_WORDS')) ? [] : explode(',', getenv('SC_FILTER_WORDS'));
$total_words = array_merge($default_words, $custom_words);
foreach ($total_words as $word) {
if (strpos($result, $word) !== false) {
return true;
}
}
return false;
}
/**
* @use 处理信息