[update] Version 0.9.1

This commit is contained in:
Lkeme 2021-05-18 16:35:03 +08:00
parent 3c03757d02
commit e6aab0504c
18 changed files with 228 additions and 146 deletions

View File

@ -2,6 +2,31 @@
# 本项目Log # 本项目Log
## v0.9.1.210518 alpha (2021-05-18)
### Added
-
### Changed
- 删除过期活动
- 更新风纪委员
- 更新银瓜子兑换硬币
- 更新点亮勋章
- 更新部分日志打印输出
-
### Fixed
- 修复已知BUG
-
### Remarks
-
-
## v0.9.0.210517 alpha (2021-05-17) ## v0.9.0.210517 alpha (2021-05-17)
### Added ### Added

9
DOC.md
View File

@ -1,5 +1,7 @@
## 环境依赖 ## 环境依赖
通常使用 `composer` 工具会自动检测以下依赖问题。
|Requirement | |Requirement |
|--------------------| |--------------------|
|PHP >=7.3 | |PHP >=7.3 |
@ -10,8 +12,6 @@
|php_zlib | |php_zlib |
|php_mbstring | |php_mbstring |
> 通常使用 `composer` 工具会自动检测上述依赖问题。
## Composer ## Composer
+ [Composer 安装与使用](https://www.runoob.com/w3cnote/composer-install-and-usage.html) + [Composer 安装与使用](https://www.runoob.com/w3cnote/composer-install-and-usage.html)
@ -102,9 +102,12 @@ $ cp user.ini.example user.ini
``` ```
$ composer install $ composer install
$ composer dump-autoload
``` ```
[comment]: <> (composer dump-autoload &#40;-o&#41;)
[comment]: <> (composer dumpautoload &#40;-o&#41;)
3. 按照说明修改配置文件 `user.ini` 3. 按照说明修改配置文件 `user.ini`
``` ```

View File

@ -12,7 +12,7 @@
<p align="center"> <p align="center">
<img src="https://img.shields.io/badge/Version-0.9.0.210517-orange.svg?longCache=true&style=for-the-badge"> <img src="https://img.shields.io/badge/Version-0.9.1.210518-orange.svg?longCache=true&style=for-the-badge">
<img src="https://img.shields.io/badge/PHP-7.3+-green.svg?longCache=true&style=for-the-badge"> <img src="https://img.shields.io/badge/PHP-7.3+-green.svg?longCache=true&style=for-the-badge">
<img src="https://img.shields.io/badge/Composer-latest-blueviolet.svg?longCache=true&style=for-the-badge"> <img src="https://img.shields.io/badge/Composer-latest-blueviolet.svg?longCache=true&style=for-the-badge">
<img src="https://img.shields.io/badge/License-mit-blue.svg?longCache=true&style=for-the-badge"> <img src="https://img.shields.io/badge/License-mit-blue.svg?longCache=true&style=for-the-badge">
@ -28,53 +28,53 @@
## 功能组件 ## 功能组件
> 以下任务都是按设定周期自动执行,`true`为正常使用,`false`为暂停使用或抛弃。 以下任务都是按设定周期自动执行,`true`为正常使用,`false`为暂停使用或抛弃。
| plugin | status | version | description | | plugin | status | version | description |
|-----------------|--------|----------|---------------------------------------------| |-----------------|--------|----------|---------------------------------------------|
| CheckUpdate | true | 21.05.17 | 程序检查更新 | | CheckUpdate | true | 21.05.18 | 程序检查更新 |
| Login | true | 21.05.17 | 账号登录、刷新、维持 | | Login | true | 21.05.18 | 账号登录、刷新、维持 |
| Schedule | true | 21.05.17 | 控制插件运行周期 | | Schedule | true | 21.05.18 | 控制插件运行周期 |
| MainSite | true | 21.05.17 | 投币、观看、分享视频 (速升6级不是梦) | | MainSite | true | 21.05.18 | 投币、观看、分享视频 (速升6级不是梦) |
| DailyBag | true | 21.05.17 | 双端领取日常/周常礼包 | | DailyBag | true | 21.05.18 | 双端领取日常/周常礼包 |
| ManGa | true | 21.05.17 | 漫画签到、分享 | | ManGa | true | 21.05.18 | 漫画签到、分享 |
| ActivityLottery | true | 21.05.17 | 主站活动九宫格抽奖 | | ActivityLottery | true | 21.05.18 | 主站活动九宫格抽奖 |
| Competition | true | 21.05.17 | 游戏赛事竞猜 | | Competition | true | 21.05.18 | 游戏赛事竞猜 |
| DoubleHeart | true | 21.05.17 | 双端心跳 (姥爷直播经验) | | DoubleHeart | true | 21.05.18 | 双端心跳 (姥爷直播经验) |
| DailyTask | true | 21.05.17 | 直播每日任务(签到、观看) | | DailyTask | true | 21.05.18 | 直播每日任务(签到、观看) |
| Barrage | true | 21.05.17 | 保持活跃弹幕 | | Barrage | true | 21.05.18 | 保持活跃弹幕 |
| Silver2Coin | true | 21.05.17 | 银瓜子兑换硬币 | | Silver2Coin | true | 21.05.18 | 银瓜子兑换硬币 |
| Judge | true | 21.05.17 | 风纪委员投票 | | Judge | true | 21.05.18 | 风纪委员投票 |
| GiftSend | true | 21.05.17 | 礼物赠送、维持每日勋章亲密度 | | GiftSend | true | 21.05.18 | 礼物赠送、维持每日勋章亲密度 |
| GroupSignIn | true | 21.05.17 | 友爱社签到 | | GroupSignIn | true | 21.05.18 | 友爱社签到 |
| GiftHeart | true | 21.05.17 | 日常心跳每日礼包礼物 | | GiftHeart | true | 21.05.18 | 日常心跳每日礼包礼物 |
| SmallHeart | true | 21.05.17 | 直播挂机每日24个小心心 | | SmallHeart | true | 21.05.18 | 直播挂机每日24个小心心 |
| MaterialObject | true | 21.05.17 | 直播金色宝箱实物抽奖 | | MaterialObject | true | 21.05.18 | 直播金色宝箱实物抽奖 |
| AloneTcpClient | true | 21.05.17 | 作者的独立直播监控 | | AloneTcpClient | true | 21.05.18 | 作者的独立直播监控 |
| ZoneTcpClient | true | 21.05.17 | 官方的分区直播监控 | | ZoneTcpClient | true | 21.05.18 | 官方的分区直播监控 |
| StormRaffle | true | 21.05.17 | 直播节奏风暴抽奖、亿元 | | StormRaffle | true | 21.05.18 | 直播节奏风暴抽奖、亿元 |
| GiftRaffle | true | 21.05.17 | 直播礼物抽奖 | | GiftRaffle | true | 21.05.18 | 直播礼物抽奖 |
| PkRaffle | true | 21.05.17 | 直播大乱斗抽奖 | | PkRaffle | true | 21.05.18 | 直播大乱斗抽奖 |
| GuardRaffle | true | 21.05.17 | 直播大航海抽奖 | | GuardRaffle | true | 21.05.18 | 直播大航海抽奖 |
| AnchorRaffle | true | 21.05.17 | 直播天选时刻抽奖 | | AnchorRaffle | true | 21.05.18 | 直播天选时刻抽奖 |
| GiftRaffle | true | 21.05.17 | 直播礼物抽奖 | | GiftRaffle | true | 21.05.18 | 直播礼物抽奖 |
| AwardRecord | true | 21.05.17 | 最新的中奖纪录通知 | | AwardRecord | true | 21.05.18 | 最新的中奖纪录通知 |
| Forward | true | 21.05.17 | 主站动态抽奖转发 | | Forward | true | 21.05.18 | 主站动态抽奖转发 |
| CapsuleLottery | true | 21.05.17 | 直播扭蛋活动抽奖 | | CapsuleLottery | true | 21.05.18 | 直播扭蛋活动抽奖 |
| PolishTheMedal | true | 21.05.17 | 每日自动点亮灰色勋章 | | PolishTheMedal | true | 21.05.18 | 每日自动点亮灰色勋章 |
| CapsuleLottery | true | 21.05.17 | 直播扭蛋活动抽奖 | | CapsuleLottery | true | 21.05.18 | 直播扭蛋活动抽奖 |
| VipPrivilege | true | 21.05.17 | 每月领取年度大会员特权(B币券、会员购优惠券) | | VipPrivilege | true | 21.05.18 | 每月领取年度大会员特权(B币券、会员购优惠券) |
| BpConsumption | true | 21.05.17 | 每月消费使用年度大会员特权的B币券 | | BpConsumption | true | 21.05.18 | 每月消费使用年度大会员特权的B币券 |
| Statistics | true | 21.05.17 | 全局抽奖结果统计 | | Statistics | true | 21.05.18 | 全局抽奖结果统计 |
| Silver | false | 21.03.27 | 直播银瓜子自动开启宝箱 | | Silver | false | 21.03.27 | 直播银瓜子自动开启宝箱 |
## 交流反馈 ## 交流反馈
> Group: [55308141](https://jq.qq.com/?_wv=1027&k=5AIDaJg) | **请不要来问如何使用, 文档齐全, 仅用于BUG提交反馈** Group: [55308141](https://jq.qq.com/?_wv=1027&k=5AIDaJg) | **请不要来问如何使用, 文档齐全, 仅用于BUG提交反馈**
## 相关文档 ## 相关文档
> 有疑问一定要先看看文档或Issue里是否存在相同的问题再考虑其他渠道咨询。 有疑问一定要先看看文档或Issue里是否存在相同的问题再考虑其他渠道咨询。
* [使用文档 / DOC.md](./DOC.md) * [使用文档 / DOC.md](./DOC.md)
* [更新日志 / CHANGELOG.md](./CHANGELOG.md) * [更新日志 / CHANGELOG.md](./CHANGELOG.md)
@ -83,15 +83,19 @@
## 打赏支持 ## 打赏支持
> 如果觉得本项目好用,对你有所帮助,欢迎打赏支持。 如果觉得本项目好用,对你有所帮助,欢迎打赏支持本项目哦
![](https://i.loli.net/2019/07/13/5d2963e5cc1eb22973.png) <p align="center"><img width="680px" src="https://i.loli.net/2019/07/13/5d2963e5cc1eb22973.png"></p>
[comment]: <> (![Image]&#40;https://i.loli.net/2019/07/13/5d2963e5cc1eb22973.png&#41;)
## 运行效果 ## 运行效果
> 不代表当前版本,以当前最新版本运行结果为准 效果图不代表当前版本,请以当前最新版本运行结果为准。
![](https://i.loli.net/2019/07/13/5d296961a4bae41364.png) <p align="center"><img width="680px" src="https://i.loli.net/2019/07/13/5d296961a4bae41364.png"></p>
[comment]: <> (![Image]&#40;https://i.loli.net/2019/07/13/5d296961a4bae41364.png&#41;)
## 项目相关 ## 项目相关

View File

@ -95,7 +95,7 @@ enable = false
[live_storm] [live_storm]
enable = false enable = false
drop_rate = 0 drop_rate = 0
attempt = "10,20" attempt = "5,10"
; 直播天选时刻|抽取类型(0: 无限制; 1: 关注主播; 2: 粉丝勋章; 3大航海 4用户等级5主站等级)|自动取关(测试功能)|过滤关键词|逗号分隔 ; 直播天选时刻|抽取类型(0: 无限制; 1: 关注主播; 2: 粉丝勋章; 3大航海 4用户等级5主站等级)|自动取关(测试功能)|过滤关键词|逗号分隔
[live_anchor] [live_anchor]

View File

@ -32,40 +32,6 @@
"draw_times": 1, "draw_times": 1,
"expire_at": "2021-07-15 11:59:59" "expire_at": "2021-07-15 11:59:59"
}, },
{
"url": "https://www.bilibili.com/blackboard/activity-nA2uYrmpfA.html",
"title": "哥斯拉金刚你站谁",
"description": "活动期间每天分享页面,新增一次机会。",
"sid": "f851e27a-858e-11eb-8597-246e966235d8",
"login": "true",
"follow": "false",
"share": "true",
"draw_times": 2,
"expire_at": "2021-05-23 11:59:59"
},
{
"url": "https://www.bilibili.com/blackboard/activity-QEya2bouhQ.html",
"title": "春日嗑糖大作战",
"description": "活动期间每天分享页面,新增一次机会。",
"sid": "20b0dfaf-8bcd-11eb-8597-246e966235d8",
"login": "true",
"follow": "false",
"share": "true",
"draw_times": 2,
"expire_at": "2021-05-05 23:59:59"
},
{
"url": "https://www.bilibili.com/blackboard/gaming_on_bilibili.html",
"title": "上B站看电竞",
"description": "活动期间每天分享页面,新增一次机会。",
"sid": "0b87bd83-8565-11eb-8597-246e966235d8",
"login": "true",
"follow": "false",
"share": "true",
"draw_times": 1,
"expire_at": "2021-05-30 23:59:59",
"remarks": "时间不名,暂定一个月。"
},
{ {
"url": "https://www.bilibili.com/blackboard/activity-aT7zphkwF1.html", "url": "https://www.bilibili.com/blackboard/activity-aT7zphkwF1.html",
"title": "初夏逛吃大会", "title": "初夏逛吃大会",
@ -77,17 +43,6 @@
"draw_times": 1, "draw_times": 1,
"expire_at": "2021-06-10 23:59:59" "expire_at": "2021-06-10 23:59:59"
}, },
{
"url": "https://www.bilibili.com/blackboard/activity-oGiWFe0YTz.html",
"title": "京东超市超有young",
"description": "活动期间每天分享页面,新增一次机会。",
"sid": "4eb728e2-a0d7-11eb-8597-246e966235d8",
"login": "true",
"follow": "false",
"share": "true",
"draw_times": 1,
"expire_at": "2021-04-25 23:59:59"
},
{ {
"url": "https://www.bilibili.com/blackboard/activity-Tpo81ydpiW.html", "url": "https://www.bilibili.com/blackboard/activity-Tpo81ydpiW.html",
"title": "和平精英周年庆嘉年华1次", "title": "和平精英周年庆嘉年华1次",

View File

@ -4,7 +4,7 @@
"branch": "master", "branch": "master",
"source": "https://github.com/lkeme/BiliHelper-personal", "source": "https://github.com/lkeme/BiliHelper-personal",
"raw_url": "https://cdn.jsdelivr.net/gh/lkeme/BiliHelper-personal@master/data/latest_version.json", "raw_url": "https://cdn.jsdelivr.net/gh/lkeme/BiliHelper-personal@master/data/latest_version.json",
"version": "0.9.0.210517", "version": "0.9.1.210518",
"des": "程序有更新,请及时线上查看更新哦~", "des": "程序有更新,请及时线上查看更新哦~",
"time": "2021年5月17日17:44:47" "time": "2021年5月18日16:29:44"
} }

View File

@ -115,7 +115,10 @@ class ActivityLottery
self::addTimes($task['act']->sid, $task['act']->url, 3); self::addTimes($task['act']->sid, $task['act']->url, 3);
break; break;
case 'draw': case 'draw':
self::doLottery($task['act']->sid, $task['act']->url, 0); // 有抽奖机会才抽奖
if (self::initTimes($task['act']->sid, $task['act']->url, false)) {
self::doLottery($task['act']->sid, $task['act']->url, 0);
}
break; break;
default: default:
Log::info("当前 {$task['act']->title} #{$task['operation']} 任务不存在哦"); Log::info("当前 {$task['act']->title} #{$task['operation']} 任务不存在哦");
@ -128,9 +131,10 @@ class ActivityLottery
* @use 获取抽奖机会 * @use 获取抽奖机会
* @param string $sid * @param string $sid
* @param string $referer * @param string $referer
* @param bool $init
* @return bool * @return bool
*/ */
private static function initTimes(string $sid, string $referer): bool private static function initTimes(string $sid, string $referer, bool $init = true): bool
{ {
$url = 'https://api.bilibili.com/x/activity/lottery/mytimes'; $url = 'https://api.bilibili.com/x/activity/lottery/mytimes';
$headers = [ $headers = [
@ -143,12 +147,25 @@ class ActivityLottery
$raw = Curl::get('pc', $url, $payload, $headers); $raw = Curl::get('pc', $url, $payload, $headers);
$de_raw = json_decode($raw, true); $de_raw = json_decode($raw, true);
// {"code":0,"message":"0","ttl":1,"data":{"times":2}} // {"code":0,"message":"0","ttl":1,"data":{"times":2}}
// {"code":0,"message":"0","ttl":1,"data":{"times":3}}
if ($init) {
if ($de_raw['code'] == 0) {
Log::notice("剩余抽奖次数 {$de_raw['data']['times']}");
return true;
}
Log::warning("获取抽奖次数失败 {$raw}");
return false;
}
if ($de_raw['code'] == 0) { if ($de_raw['code'] == 0) {
Log::notice("获取抽奖机会成功 {$raw}"); Log::notice("剩余抽奖次数 {$de_raw['data']['times']}");
if ($de_raw['data']['times'] <= 0) {
return false;
}
return true; return true;
} }
Log::warning("获取抽奖机会失败 {$raw}"); Log::warning("获取抽奖次数失败 {$raw}");
return false; return false;
} }
/** /**
@ -172,9 +189,12 @@ class ActivityLottery
'csrf' => getCsrf() 'csrf' => getCsrf()
]; ];
$raw = Curl::post('pc', $url, $payload, $headers); $raw = Curl::post('pc', $url, $payload, $headers);
// {"code":75405,"message":"抽奖机会用尽啦","ttl":1}
// {"code":75003,"message":"活动已结束","ttl":1}
// {"code":0,"message":"0","ttl":1}
$de_raw = json_decode($raw, true); $de_raw = json_decode($raw, true);
Log::notice("增加抽奖机会#{$action_type} {$raw}"); Log::notice("增加抽奖机会#{$action_type} {$raw}");
// {"code":0,"message":"0","ttl":1}
if ($de_raw['code'] == 0) { if ($de_raw['code'] == 0) {
return true; return true;
} }

View File

@ -86,6 +86,7 @@ class Barrage
$response = Live::sendBarragePC($room_id, $content); $response = Live::sendBarragePC($room_id, $content);
// {"code":0,"data":[],"message":"","msg":""} // {"code":0,"data":[],"message":"","msg":""}
// {"code":0,"message":"你被禁言啦","msg":"你被禁言啦"} // {"code":0,"message":"你被禁言啦","msg":"你被禁言啦"}
// TODO 长度限制
if (isset($response['code']) && $response['code'] == 0 && isset($response['data'])) { if (isset($response['code']) && $response['code'] == 0 && isset($response['data'])) {
Log::notice("在直播间@{$room_id} 发送活跃弹幕成功 CODE -> {$response['code']}"); Log::notice("在直播间@{$room_id} 发送活跃弹幕成功 CODE -> {$response['code']}");
return true; return true;

File diff suppressed because one or more lines are too long

View File

@ -49,9 +49,9 @@ class DoubleHeart
$data = json_decode($data, true); $data = json_decode($data, true);
if (isset($data['code']) && $data['code']) { if (isset($data['code']) && $data['code']) {
Log::warning('[PC] 发送心跳异常', ['msg' => $data['message']]); Log::warning('[PC] 发送在线心跳失败', ['msg' => $data['message']]);
} else { } else {
Log::notice('[PC] 发送心跳正常'); Log::notice('[PC] 发送在线心跳成功');
} }
} }
@ -69,9 +69,9 @@ class DoubleHeart
$data = json_decode($data, true); $data = json_decode($data, true);
if (isset($data['code']) && $data['code']) { if (isset($data['code']) && $data['code']) {
Log::warning('[APP] 发送心跳异常', ['msg' => $data['message']]); Log::warning('[APP] 发送在线心跳失败', ['msg' => $data['message']]);
} else { } else {
Log::notice('[APP] 发送心跳正常'); Log::notice('[APP] 发送在线心跳成功');
} }
} }
} }

View File

@ -36,7 +36,10 @@ class Judge
return; return;
} }
// self::judgementIndex(); // self::judgementIndex();
self::setLock(mt_rand(15, 30) * 60); // 如果没有设置时间 就设置个默认时间
if (self::getLock() < time()) {
self::setLock(mt_rand(15, 30) * 60);
}
} }
/** /**
@ -149,6 +152,7 @@ class Judge
"csrf" => getCsrf(), "csrf" => getCsrf(),
]; ];
$raw = Curl::post('pc', $url, $payload); $raw = Curl::post('pc', $url, $payload);
// {"code":25012,"message":"请勿重复投票","ttl":1}
$de_raw = json_decode($raw, true); $de_raw = json_decode($raw, true);
if (isset($de_raw['code']) && $de_raw['code']) { if (isset($de_raw['code']) && $de_raw['code']) {
Log::warning("案件 {$case_id} 投票失败 {$raw}"); Log::warning("案件 {$case_id} 投票失败 {$raw}");
@ -173,14 +177,23 @@ class Judge
// {"code":25008,"message":"真给力 , 移交众裁的举报案件已经被处理完了","ttl":1} // {"code":25008,"message":"真给力 , 移交众裁的举报案件已经被处理完了","ttl":1}
// {"code":25014,"message":"25014","ttl":1} // {"code":25014,"message":"25014","ttl":1}
// {"code":25005,"message":"请成为风纪委员后再试","ttl":1} // {"code":25005,"message":"请成为风纪委员后再试","ttl":1}
if (isset($de_raw['code']) && $de_raw['code'] == 25005) {
Log::warning($de_raw['message']);
self::setLock(self::timing(10));
return null;
}
if (isset($de_raw['code']) && $de_raw['code']) { if (isset($de_raw['code']) && $de_raw['code']) {
Log::info("没有获取到案件~ {$raw}"); switch ($de_raw['code']) {
return null; case 25005:
Log::warning($de_raw['message']);
self::setLock(self::timing(10));
return null;
case 25008:
Log::info("暂时没有新的案件需要审理~ {$raw}");
return null;
case 25014:
Log::info("今日案件已审满,感谢您对社区的贡献!明天再来看看吧~");
self::setLock(self::timing(7, 0, 0, true));
return null;
default:
Log::info("获取案件失败~ {$raw}");
return null;
}
} else { } else {
$case_id = $de_raw['data']['id']; $case_id = $de_raw['data']['id'];
Log::info("获取到案件 {$case_id} ~"); Log::info("获取到案件 {$case_id} ~");

View File

@ -31,10 +31,10 @@ class PolishTheMedal
} }
// 获取灰色勋章 // 获取灰色勋章
if (self::$metal_lock < time()) { if (self::$metal_lock < time()) {
// 如果勋章过多导致未处理完就1小时一次否则8小时一次。 // 如果勋章过多导致未处理完就1小时一次否则10小时一次。
if (empty(self::$grey_fans_medals)) { if (empty(self::$grey_fans_medals)) {
self::fetchGreyMedalList(); self::fetchGreyMedalList();
self::$metal_lock = time() + 8 * 60 * 60; self::$metal_lock = time() + 10 * 60 * 60;
} else { } else {
self::$metal_lock = time() + 1 * 60 * 60; self::$metal_lock = time() + 1 * 60 * 60;
} }
@ -55,6 +55,9 @@ class PolishTheMedal
$medal = array_pop(self::$grey_fans_medals); $medal = array_pop(self::$grey_fans_medals);
// 为空 // 为空
if (is_null($medal)) return; if (is_null($medal)) return;
// 特殊房间处理|央视未开播|CODE -> 11000 MSG -> ''
if (in_array($medal['roomid'], [21686237])) return;
Log::info("开始点亮直播间@{$medal['roomid']}的勋章"); Log::info("开始点亮直播间@{$medal['roomid']}的勋章");
// 擦亮 // 擦亮
$response = Live::sendBarrageAPP($medal['roomid'], Generator::emoji()); $response = Live::sendBarrageAPP($medal['roomid'], Generator::emoji());

View File

@ -24,7 +24,8 @@ class Silver2Coin
return; return;
} }
if (self::appSilver2coin() && self::pcSilver2coin()) { if (self::appSilver2coin() && self::pcSilver2coin()) {
self::setLock(self::timing(10)); // 定时10点 + 1-60分钟随机
self::setLock(self::timing(10, 0, 0, true));
return; return;
} }
self::setLock(3600); self::setLock(3600);
@ -40,18 +41,10 @@ class Silver2Coin
$url = 'https://api.live.bilibili.com/AppExchange/silver2coin'; $url = 'https://api.live.bilibili.com/AppExchange/silver2coin';
$payload = []; $payload = [];
$raw = Curl::get('app', $url, Sign::common($payload)); $raw = Curl::get('app', $url, Sign::common($payload));
// {"code":403,"msg":"仅主站正式会员以上的用户可以兑换","message":"仅主站正式会员以上的用户可以兑换","data":[]}
$de_raw = json_decode($raw, true); $de_raw = json_decode($raw, true);
if (!$de_raw['code'] && $de_raw['msg'] == '兑换成功') { return self::handle('APP', $de_raw);
Log::notice('[APP] 银瓜子兑换硬币: ' . $de_raw['msg']);
} elseif ($de_raw['code'] == 403) {
Log::warning('[APP] 银瓜子兑换硬币: ' . $de_raw['msg']);
} else {
Log::warning('[APP] 银瓜子兑换硬币: ' . $de_raw['msg']);
return false;
}
return true;
} }
/** /**
@ -64,15 +57,33 @@ class Silver2Coin
$payload = []; $payload = [];
$url = "https://api.live.bilibili.com/exchange/silver2coin"; $url = "https://api.live.bilibili.com/exchange/silver2coin";
$url = "https://api.live.bilibili.com/pay/v1/Exchange/silver2coin"; $url = "https://api.live.bilibili.com/pay/v1/Exchange/silver2coin";
$raw = Curl::get('pc', $url, $payload); $raw = Curl::get('pc', $url, $payload);
// {"code":403,"msg":"仅主站正式会员以上的用户可以兑换","message":"仅主站正式会员以上的用户可以兑换","data":[]}
$de_raw = json_decode($raw, true); $de_raw = json_decode($raw, true);
if (isset($de_raw['code']) && $de_raw['code'] == 0) {
Log::notice('[PC] 银瓜子兑换硬币: ' . $de_raw['msg']); return self::handle('PC', $de_raw);
return true; }
/**
* @use 处理结果
* @param int $type
* @param array $data
* @return bool
*/
private static function handle(int $type, array $data): bool
{
// {"code":403,"msg":"每天最多能兑换 1 个","message":"每天最多能兑换 1 个","data":[]}
// {"code":403,"msg":"仅主站正式会员以上的用户可以兑换","message":"仅主站正式会员以上的用户可以兑换","data":[]}
// {"code":0,"msg":"兑换成功","message":"兑换成功","data":{"gold":"5074","silver":"36734","tid":"727ab65376a15a6b117cf560a20a21122334","coin":1}}
switch ($data['code']) {
case 0:
Log::notice("[{$type}] 银瓜子兑换硬币: {$data['msg']}");
return true;
case 403:
Log::warning("[{$type}] 银瓜子兑换硬币: {$data['msg']}");
return true;
default:
Log::warning("[{$type}] 银瓜子兑换硬币: CODE -> {$data['code']} MSG -> {$data['msg']} ");
return false;
} }
Log::warning('[PC] 银瓜子兑换硬币: ' . $de_raw['msg']);
return false;
} }
} }

View File

@ -76,7 +76,7 @@ class StormRaffle extends BaseRaffle
*/ */
private static function formatInfo($id, $num, $info): string private static function formatInfo($id, $num, $info): string
{ {
return "风暴 {$id} 请求 {$num} 状态 {$info}"; return "节奏风暴 {$id} 请求 {$num} 状态 {$info}";
} }
/** /**
@ -88,7 +88,7 @@ class StormRaffle extends BaseRaffle
{ {
$url = 'https://api.live.bilibili.com/lottery/v1/Storm/join'; $url = 'https://api.live.bilibili.com/lottery/v1/Storm/join';
foreach ($raffles as $raffle) { foreach ($raffles as $raffle) {
self::$attempt = empty($attempt = getConf('attempt', 'live_storm')) ? [10, 20] : explode(',', $attempt); self::$attempt = empty($attempt = getConf('attempt', 'live_storm')) ? [5, 10] : explode(',', $attempt);
$num = mt_rand((int)self::$attempt[0], (int)self::$attempt[1]); $num = mt_rand((int)self::$attempt[0], (int)self::$attempt[1]);
$payload = [ $payload = [
'id' => $raffle['raffle_id'], 'id' => $raffle['raffle_id'],

View File

@ -317,4 +317,24 @@ class User
return false; return false;
} }
/**
* @use 我的钱包
*/
public static function myWallet()
{
$url = 'https://api.live.bilibili.com/pay/v2/Pay/myWallet';
$headers = [
'origin' => 'https://link.bilibili.com',
'referer' => 'https://link.bilibili.com/p/center/index'
];
$payload = [
'need_bp' => 1,
'need_metal' => 1,
'platform' => 'pc',
];
$raw = Curl::get('pc', $url, $payload, $headers);
// {"code":0,"msg":"succ","message":"succ","data":{"gold":5074,"silver":37434,"bp":"0","metal":1904}}
$de_raw = json_decode($raw, true);
}
} }

View File

@ -67,7 +67,7 @@ class Generator
*/ */
public static function emoji(): string public static function emoji(): string
{ {
$emoji_list = [ $emoji_list_all = [
"(⌒▽⌒)", "( ̄▽ ̄)", "(=・ω・=)", "(`・ω・´)", "(〜 ̄△ ̄)〜", "(・∀・)", "(⌒▽⌒)", "( ̄▽ ̄)", "(=・ω・=)", "(`・ω・´)", "(〜 ̄△ ̄)〜", "(・∀・)",
"(°∀°)ノ", "( ̄3 ̄)", "╮( ̄▽ ̄)╭", "_(:3」∠)_", "( ´_ゝ)", "←_←", "→_→", "(°∀°)ノ", "( ̄3 ̄)", "╮( ̄▽ ̄)╭", "_(:3」∠)_", "( ´_ゝ)", "←_←", "→_→",
"(<_<)", "(>_>)", "(;¬_¬)", '("▔□▔)/', "(゚Д゚≡゚д゚)!?", "Σ(゚д゚;)", "Σ(  ̄□ ̄||)", "(<_<)", "(>_>)", "(;¬_¬)", '("▔□▔)/', "(゚Д゚≡゚д゚)!?", "Σ(゚д゚;)", "Σ(  ̄□ ̄||)",
@ -76,6 +76,11 @@ class Generator
"(╯°口°)╯(┴—┴", "←◡←", "( ♥д♥)", "Σ>―(〃°ω°〃)♡→", "( ⁄•⁄ω⁄•⁄ )", "(╯°口°)╯(┴—┴", "←◡←", "( ♥д♥)", "Σ>―(〃°ω°〃)♡→", "( ⁄•⁄ω⁄•⁄ )",
"(╬゚д゚)▄︻┻┳═一", "・*・:≡( ε:)", "(打卡)", "(签到)" "(╬゚д゚)▄︻┻┳═一", "・*・:≡( ε:)", "(打卡)", "(签到)"
]; ];
$emoji_list = [
"(⌒▽⌒)", "( ̄▽ ̄)", "(=・ω・=)", "(`・ω・´)", "(〜 ̄△ ̄)〜",
"╮( ̄▽ ̄)╭", "_(:3」∠)_", "( ´_ゝ)", "(● ̄(エ) ̄●)", "(・∀・)",
"(´・_・`)", "( ̄へ ̄)", "(打卡)", "(签到)"
];
shuffle($emoji_list); shuffle($emoji_list);
return $emoji_list[array_rand($emoji_list)]; return $emoji_list[array_rand($emoji_list)];
} }

View File

@ -49,19 +49,21 @@ trait TimeLock
/** /**
* @use 定时 * @use 定时
* @param int $hour * @param int $hour
* @param int $minute * @param int $minute
* @param int $seconds * @param int $seconds
* @param bool $random 随机一个小时内
* @return int * @return int
*/ */
public static function timing(int $hour, int $minute = 0, int $seconds = 0): int public static function timing(int $hour, int $minute = 0, int $seconds = 0, bool $random = false): int
{ {
$time = strtotime('today') + ($hour * 60 * 60) + ($minute * 60) + ($seconds); $time = strtotime('today') + ($hour * 60 * 60) + ($minute * 60) + ($seconds);
if ($time > time()) { if ($time > time()) {
return strtotime('today') + ($hour * 60 * 60) + ($minute * 60) + ($seconds) - time(); $timing = strtotime('today') + ($hour * 60 * 60) + ($minute * 60) + ($seconds) - time();
} else { } else {
return strtotime('tomorrow') + ($hour * 60 * 60) + ($minute * 60) + ($seconds) - time(); $timing = strtotime('tomorrow') + ($hour * 60 * 60) + ($minute * 60) + ($seconds) - time();
} }
return $random ? $timing + mt_rand(1, 60) * 60 : $timing;
} }

View File

@ -13,7 +13,6 @@ namespace BiliHelper\Util;
use BiliHelper\Core\Curl; use BiliHelper\Core\Curl;
use BiliHelper\Core\Log; use BiliHelper\Core\Log;
use BiliHelper\Plugin\Live; use BiliHelper\Plugin\Live;
use BiliHelper\Plugin\User;
use BiliHelper\Tool\Generator; use BiliHelper\Tool\Generator;
trait XliveHeartBeat trait XliveHeartBeat
@ -41,7 +40,6 @@ trait XliveHeartBeat
'user-agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36' 'user-agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36'
]; ];
/** /**
* @use 任务接口 * @use 任务接口
* @param int $room_id * @param int $room_id
@ -239,7 +237,6 @@ trait XliveHeartBeat
return false; return false;
} }
/** /**
* @use 格式T * @use 格式T
* @param array $t * @param array $t
@ -273,7 +270,7 @@ trait XliveHeartBeat
* @use 重置变量 * @use 重置变量
* @param false $force * @param false $force
*/ */
protected static function resetVar($force = false) protected static function resetVar(bool $force = false)
{ {
if ($force) { if ($force) {
static::$_room_info = []; static::$_room_info = [];