mirror of
https://github.com/lkeme/BiliHelper-personal.git
synced 2025-12-19 17:40:07 +08:00
Merge branch 'master' into feature
This commit is contained in:
commit
9b6fa7fb6f
38
README.md
38
README.md
@ -8,15 +8,28 @@
|
|||||||

|

|
||||||

|

|
||||||

|

|
||||||
|

|
||||||

|

|
||||||

|

|
||||||
|

|
||||||
[](https://hub.docker.com/r/lkeme/bilihelper-personal)
|
[](https://hub.docker.com/r/lkeme/bilihelper-personal)
|
||||||
|
|
||||||
|
[//]: # (<br>)
|
||||||
|
|
||||||
|
[//]: # (<img alt="GitHub Workflow Status" src="https://img.shields.io/github/workflow/status/lkeme/BiliHelper-personal/cron%20update?style=flat-square">)
|
||||||
|
|
||||||
|
[//]: # (<img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/lkeme/BiliHelper-personal/main?style=flat-square">)
|
||||||
|
|
||||||
|
[//]: # (<img alt="GitHub commit activity" src="https://img.shields.io/github/commit-activity/w/lkeme/BiliHelper-personal/main?style=flat-square"> )
|
||||||
|
|
||||||
|
[//]: # (<img alt="GitHub commit activity" src="https://data.jsdelivr.com/v1/package/gh/lkeme/BiliHelper-personal/badge?style=rounded&style=flat-square"> )
|
||||||
|
|
||||||
|
[//]: # (<br>)
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
|
|
||||||
<img src="https://img.shields.io/badge/Version-2.0.2.221025-orange.svg?longCache=true&style=for-the-badge">
|
<img src="https://img.shields.io/badge/Version-2.0.3.221031-orange.svg?longCache=true&style=for-the-badge">
|
||||||
<img src="https://img.shields.io/badge/PHP-8.1+-green.svg?longCache=true&style=for-the-badge">
|
<img src="https://img.shields.io/badge/PHP-8.1+-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">
|
||||||
@ -25,8 +38,8 @@
|
|||||||
|
|
||||||
## 🌟 临时通知
|
## 🌟 临时通知
|
||||||
|
|
||||||
- [【master分支 版本2.x.x】](https://github.com/lkeme/BiliHelper-personal/tree/master) 功能缺失但不断开发中(提供基础功能)
|
- [【master分支 版本2.x.x】](https://github.com/lkeme/BiliHelper-personal/tree/master) 功能陆续开发(当前推荐)
|
||||||
- [【1.x.x分支 版本1.x.x】](https://github.com/lkeme/BiliHelper-personal/tree/1.x.x) 功能完整但不后续维护(当前推荐)
|
- [【1.x.x分支 版本1.x.x】](https://github.com/lkeme/BiliHelper-personal/tree/1.x.x) 功能完整(后续不再维护)
|
||||||
|
|
||||||
## 📌 公告通知
|
## 📌 公告通知
|
||||||
|
|
||||||
@ -42,6 +55,10 @@
|
|||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img alingn="center" src="https://profile-counter.glitch.me/BiliHelper-personal/count.svg" />
|
<img alingn="center" src="https://profile-counter.glitch.me/BiliHelper-personal/count.svg" />
|
||||||
|
|
||||||
|
[//]: # ( <br>)
|
||||||
|
|
||||||
|
[//]: # ( <img src="https://count.getloli.com/get/@:BiliHelper-personal" alt=":BiliHelper-personal" />)
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
## 🖨️ 相关文档
|
## 🖨️ 相关文档
|
||||||
@ -73,11 +90,13 @@ Group: [602815575](https://jq.qq.com/?_wv=1027&k=UaalVexM) | **请不要来问
|
|||||||
|
|
||||||
以下任务都是按设定周期自动执行,`true`为正常使用,`false`为暂停使用或抛弃。
|
以下任务都是按设定周期自动执行,`true`为正常使用,`false`为暂停使用或抛弃。
|
||||||
|
|
||||||
<details open>
|
[//]: # (<details open><summary>点击展开</summary>)
|
||||||
<summary>点击展开</summary>
|
<details><summary><strong><code>已经藏起来啦~~ 点击展开 嘻嘻~</code></strong></summary></code>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
| plugin | version | description | author | pid | cycle | status |
|
| plugin | version | description | author | pid | cycle | status |
|
||||||
|-----------------|---------|----------------|--------|------|-----------|--------|
|
|-----------------|---------|----------------|---------|------|-----------|--------|
|
||||||
| CheckUpdate | 0.0.1 | 检查版本更新 | Lkeme | 1000 | 24(小时) | √ |
|
| CheckUpdate | 0.0.1 | 检查版本更新 | Lkeme | 1000 | 24(小时) | √ |
|
||||||
| Login | 0.0.1 | 账号登录、刷新、保活 | Lkeme | 1001 | 2(小时) | √ |
|
| Login | 0.0.1 | 账号登录、刷新、保活 | Lkeme | 1001 | 2(小时) | √ |
|
||||||
| MainSite | 0.0.1 | 主站任务(观看\分享\投币) | Lkeme | 1100 | 24(小时) | √ |
|
| MainSite | 0.0.1 | 主站任务(观看\分享\投币) | Lkeme | 1100 | 24(小时) | √ |
|
||||||
@ -93,15 +112,17 @@ Group: [602815575](https://jq.qq.com/?_wv=1027&k=UaalVexM) | **请不要来问
|
|||||||
| LiveGoldBox | 0.0.1 | 直播金色宝箱(实物抽奖) | Lkeme | 1110 | 6-10(分钟) | √ |
|
| LiveGoldBox | 0.0.1 | 直播金色宝箱(实物抽奖) | Lkeme | 1110 | 6-10(分钟) | √ |
|
||||||
| AwardRecords | 0.0.1 | 获奖记录 | Lkeme | 1111 | 5(分钟) | √ |
|
| AwardRecords | 0.0.1 | 获奖记录 | Lkeme | 1111 | 5(分钟) | √ |
|
||||||
| VipPoint | 0.0.1 | 大会员积分 | Lkeme | 1112 | 5(分钟) | √ |
|
| VipPoint | 0.0.1 | 大会员积分 | Lkeme | 1112 | 5(分钟) | √ |
|
||||||
|
| Lotty | 0.0.1 | 抽奖 | MoeHero | 1113 | 5(分钟) | √ |
|
||||||
|
| DailyGold | 0.0.1 | 每日电池(APP) | Lkeme | 1114 | 24(小时) | √ |
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
## 🖥️星图
|
## 🖥️星图
|
||||||
|
|
||||||
|
[//]: # ([](https://star-history.com/#lkeme/BiliHelper-personal&Timeline))
|
||||||
[](https://starchart.cc/lkeme/BiliHelper-personal)
|
[](https://starchart.cc/lkeme/BiliHelper-personal)
|
||||||
[](https://starchart.cc/lkeme/BiliHelper)
|
[](https://starchart.cc/lkeme/BiliHelper)
|
||||||
|
|
||||||
|
|
||||||
## 🤭 运行效果
|
## 🤭 运行效果
|
||||||
|
|
||||||
效果图不代表当前版本,请以当前最新版本运行结果为准。
|
效果图不代表当前版本,请以当前最新版本运行结果为准。
|
||||||
@ -130,7 +151,8 @@ BiliHelper is under the MIT license.
|
|||||||
|
|
||||||
本项目基于 MIT 协议发布,并增加了 SATA 协议。
|
本项目基于 MIT 协议发布,并增加了 SATA 协议。
|
||||||
|
|
||||||
当你使用了使用 SATA 的开源软件或文档的时候,在遵守基础许可证的前提下,你必须马不停蹄地给你所使用的开源项目 “点赞” ,比如在 GitHub 上
|
当你使用了使用 SATA 的开源软件或文档的时候,在遵守基础许可证的前提下,你必须马不停蹄地给你所使用的开源项目 “点赞” ,比如在
|
||||||
|
GitHub 上
|
||||||
star,然后你必须感谢这个帮助了你的开源项目的作者,作者信息可以在许可证头部的版权声明部分找到。
|
star,然后你必须感谢这个帮助了你的开源项目的作者,作者信息可以在许可证头部的版权声明部分找到。
|
||||||
|
|
||||||
本项目的所有代码文件、配置项,除另有说明外,均基于上述介绍的协议发布,具体请看分支下的 LICENSE。
|
本项目的所有代码文件、配置项,除另有说明外,均基于上述介绍的协议发布,具体请看分支下的 LICENSE。
|
||||||
|
|||||||
@ -8,7 +8,23 @@
|
|||||||
|
|
||||||
[comment]: <> (</details>)
|
[comment]: <> (</details>)
|
||||||
|
|
||||||
|
## v2.0.3.221031 alpha (2022-10-31)
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- 添加每日电池
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
-
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
-
|
||||||
|
|
||||||
|
### Remarks
|
||||||
|
|
||||||
|
-
|
||||||
|
|
||||||
## v2.0.2.221025 alpha (2022-10-25)
|
## v2.0.2.221025 alpha (2022-10-25)
|
||||||
|
|
||||||
@ -23,11 +39,10 @@
|
|||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- 尝试修复主站部分功能`账号异常,操作失败`
|
- 尝试修复主站部分功能`账号异常,操作失败`
|
||||||
-
|
|
||||||
|
|
||||||
### Remarks
|
### Remarks
|
||||||
|
|
||||||
-
|
- 补丁需要触发一次登录或者刷新才会生效,删除`profile/{user}/cache`文件夹可触发
|
||||||
|
|
||||||
## v2.0.1.220911 alpha (2022-09-11)
|
## v2.0.1.220911 alpha (2022-09-11)
|
||||||
|
|
||||||
@ -43,7 +58,6 @@
|
|||||||
|
|
||||||
- 命令行解析錯誤
|
- 命令行解析錯誤
|
||||||
- 掃碼登錄異常
|
- 掃碼登錄異常
|
||||||
-
|
|
||||||
|
|
||||||
### Remarks
|
### Remarks
|
||||||
|
|
||||||
|
|||||||
42
docs/DOC.md
42
docs/DOC.md
@ -141,6 +141,8 @@ $ composer install
|
|||||||
|
|
||||||
```shell script
|
```shell script
|
||||||
$ php app.php
|
$ php app.php
|
||||||
|
# 默认配置user
|
||||||
|
$ php app.php m:a
|
||||||
```
|
```
|
||||||
|
|
||||||
> 以下是`多账户多开方案`,单个账户可以无视
|
> 以下是`多账户多开方案`,单个账户可以无视
|
||||||
@ -148,9 +150,7 @@ $ php app.php
|
|||||||
5. 复制一份profile/example配置文件夹,修改账号密码即可
|
5. 复制一份profile/example配置文件夹,修改账号密码即可
|
||||||
|
|
||||||
```shell script
|
```shell script
|
||||||
# 默认配置user
|
# 默认配置 darling {darling}是配置文件名,可任意
|
||||||
$ php app.php m:a
|
|
||||||
# 默认配置 darling
|
|
||||||
$ php app.php darling m:a
|
$ php app.php darling m:a
|
||||||
# 如果写了用户参数 不带m:a 与上同等效果
|
# 如果写了用户参数 不带m:a 与上同等效果
|
||||||
$ php app.php darling
|
$ php app.php darling
|
||||||
@ -187,6 +187,33 @@ $ php app.php test m:d -p VipPoint
|
|||||||
|
|
||||||
## Docker使用指南
|
## Docker使用指南
|
||||||
|
|
||||||
|
<strong>🌐 镜像加速器</strong>(部分网络原因导致拉取镜像失败)<br/><br/>
|
||||||
|
<details><summary><strong><code>已经藏起来啦~~ 点击展开 嘻嘻~</code></strong></summary></code>
|
||||||
|
|
||||||
|
> 以下是通用系统配置,部分特殊系统修改可能不一样,请自行搜索解决。
|
||||||
|
|
||||||
|
`在文件 /etc/docker/daemon.json 写入以下内容,如果部分不可用节点自行删除`
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"registry-mirrors":[
|
||||||
|
"https://0b27f0a81a00f3560fbdc00ddd2f99e0.mirror.swr.myhuaweicloud.com",
|
||||||
|
"https://dockerproxy.com",
|
||||||
|
"https://hub-mirror.c.163.com",
|
||||||
|
"https://mirror.baidubce.com",
|
||||||
|
"https://oyukeh0j.mirror.aliyuncs.com",
|
||||||
|
"https://ypzju6vq.mirror.aliyuncs.com",
|
||||||
|
"https://registry.docker-cn.com",
|
||||||
|
"http://hub-mirror.c.163.com",
|
||||||
|
"https://docker.mirrors.ustc.edu.cn"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
<br>
|
||||||
|
</details>
|
||||||
|
|
||||||
|
|
||||||
1. 安装好[Docker](https://yeasy.gitbooks.io/docker_practice/content/install/)
|
1. 安装好[Docker](https://yeasy.gitbooks.io/docker_practice/content/install/)
|
||||||
2. 直接命令行拉取镜像后运行
|
2. 直接命令行拉取镜像后运行
|
||||||
|
|
||||||
@ -204,10 +231,7 @@ $ docker run -itd --rm -e USER_NAME=你的B站登录账号 -e USER_PASSWORD=你
|
|||||||
|
|
||||||
[//]: # (2. 修改)
|
[//]: # (2. 修改)
|
||||||
|
|
||||||
1.
|
1. 下载 [配置文件夹](https://github.com/lkeme/BiliHelper-personal/tree/master/profile) `注意是文件夹,可以完整下载后提出来`
|
||||||
|
|
||||||
下载[配置文件夹](https://github.com/lkeme/BiliHelper-personal/tree/master/profile) `注意是文件夹,可以完整下载后提出来`
|
|
||||||
|
|
||||||
2. 重命名 `profile/example -> profile/user` , 修改 `profile/user/config/user.ini`
|
2. 重命名 `profile/example -> profile/user` , 修改 `profile/user/config/user.ini`
|
||||||
3. 通过下面的命令进行挂载并运行
|
3. 通过下面的命令进行挂载并运行
|
||||||
|
|
||||||
@ -302,7 +326,7 @@ Documentation=https://github.com/lkeme/BiliHelper-personal
|
|||||||
After=network.target
|
After=network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=/usr/bin/php /path/to/your/BiliHelper-personal/index.php
|
ExecStart=/usr/bin/php /path/to/your/BiliHelper-personal/app.php m:a
|
||||||
Restart=always
|
Restart=always
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
@ -314,7 +338,7 @@ WantedBy=multi-user.target
|
|||||||
```
|
```
|
||||||
[program:bilibili]
|
[program:bilibili]
|
||||||
process_name=%(program_name)s
|
process_name=%(program_name)s
|
||||||
command=php /path/to/your/BiliHelper-personal/index.php
|
command=php /path/to/your/BiliHelper-personal/app.php m:a
|
||||||
autostart=true
|
autostart=true
|
||||||
autorestart=true
|
autorestart=true
|
||||||
redirect_stderr=true
|
redirect_stderr=true
|
||||||
|
|||||||
151
plugin/DailyGold/DailyGold.php
Normal file
151
plugin/DailyGold/DailyGold.php
Normal file
@ -0,0 +1,151 @@
|
|||||||
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Website: https://mudew.com/
|
||||||
|
* Author: Lkeme
|
||||||
|
* License: The MIT License
|
||||||
|
* Email: Useri@live.cn
|
||||||
|
* Updated: 2022 ~ 2023
|
||||||
|
*
|
||||||
|
* _____ _ _ _ _ _ _____ _ _____ _____ _____
|
||||||
|
* | _ \ | | | | | | | | | | | ____| | | | _ \ | ____| | _ \ & /l、
|
||||||
|
* | |_| | | | | | | | | |_| | | |__ | | | |_| | | |__ | |_| | (゚、 。 7
|
||||||
|
* | _ { | | | | | | | _ | | __| | | | ___/ | __| | _ / \、゙ ~ヽ *
|
||||||
|
* | |_| | | | | |___ | | | | | | | |___ | |___ | | | |___ | | \ \ じしf_, )ノ
|
||||||
|
* |_____/ |_| |_____| |_| |_| |_| |_____| |_____| |_| |_____| |_| \_\
|
||||||
|
*/
|
||||||
|
|
||||||
|
use Bhp\Api\XLive\AppRoom\V1\ApiDM;
|
||||||
|
use Bhp\Api\XLive\AppUcenter\V1\ApiUserTask;
|
||||||
|
use Bhp\Log\Log;
|
||||||
|
use Bhp\Plugin\BasePlugin;
|
||||||
|
use Bhp\Plugin\Plugin;
|
||||||
|
use Bhp\TimeLock\TimeLock;
|
||||||
|
use Bhp\Util\Fake\Fake;
|
||||||
|
|
||||||
|
class DailyGold extends BasePlugin
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 插件信息
|
||||||
|
* @var array|string[]
|
||||||
|
*/
|
||||||
|
protected ?array $info = [
|
||||||
|
'hook' => __CLASS__, // hook
|
||||||
|
'name' => 'DailyGold', // 插件名称
|
||||||
|
'version' => '0.0.1', // 插件版本
|
||||||
|
'desc' => '每日电池(APP)', // 插件描述
|
||||||
|
'author' => 'Lkeme',// 作者
|
||||||
|
'priority' => 1114, // 插件优先级
|
||||||
|
'cycle' => '24(小时)', // 运行周期
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Plugin $plugin
|
||||||
|
*/
|
||||||
|
public function __construct(Plugin &$plugin)
|
||||||
|
{
|
||||||
|
// 时间锁
|
||||||
|
TimeLock::initTimeLock();
|
||||||
|
// $this::class
|
||||||
|
$plugin->register($this, 'execute');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function execute(): void
|
||||||
|
{
|
||||||
|
if (TimeLock::getTimes() > time() || !getEnable('daily_gold')) return;
|
||||||
|
//
|
||||||
|
$up_uid = (int)getConf('daily_gold.target_up_id', '');
|
||||||
|
$up_room_id = (int)getConf('daily_gold.target_room_id', '');
|
||||||
|
if (!$up_room_id || !$up_uid) return;
|
||||||
|
//
|
||||||
|
$process = $this->getUserTaskProgress();
|
||||||
|
switch ($process) {
|
||||||
|
case -3:
|
||||||
|
// 领取完成
|
||||||
|
TimeLock::setTimes(TimeLock::timing(7, 0, 0, true));
|
||||||
|
break;
|
||||||
|
case -1:
|
||||||
|
// 获取失败
|
||||||
|
TimeLock::setTimes(10 * 60);
|
||||||
|
break;
|
||||||
|
case 0:
|
||||||
|
// 领取ing
|
||||||
|
$this->userTaskReceiveRewards($up_uid);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// 默认一次弹幕进度
|
||||||
|
$this->sendDM($up_room_id, Fake::emoji(true));
|
||||||
|
TimeLock::setTimes(mt_rand(30, 60) * 60);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取任务进度
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
protected function getUserTaskProgress(): int
|
||||||
|
{
|
||||||
|
$response = ApiUserTask::getUserTaskProgress();
|
||||||
|
if ($response['code']) {
|
||||||
|
Log::warning("每日电池: 获取任务进度失败 {$response['code']} -> {$response['message']}");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
$target = (int)$response['data']['target'];
|
||||||
|
$progress = (int)$response['data']['progress'];
|
||||||
|
Log::info("每日电池: 当前任务进度 $progress/$target");
|
||||||
|
// 领取完成
|
||||||
|
if ($response['data']['status'] == 3) {
|
||||||
|
return -3;
|
||||||
|
}
|
||||||
|
// 可以领取
|
||||||
|
// if ($response['data']['status'] == 2) {
|
||||||
|
// return 0;
|
||||||
|
// }
|
||||||
|
return (int)($response['data']['target'] - $response['data']['progress']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送弹幕(外部调用APP)
|
||||||
|
* @param int $room_id
|
||||||
|
* @param string $msg
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
protected function sendDM(int $room_id, string $msg): bool
|
||||||
|
{
|
||||||
|
$response = ApiDM::sendMsg($room_id, $msg);
|
||||||
|
if ($response['code']) {
|
||||||
|
Log::warning("每日电池: 发送弹幕失败 {$response['code']} -> {$response['message']}");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
Log::info('每日电池: 发送弹幕成功');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 领取任务奖励
|
||||||
|
* @param int $up_id
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
protected function userTaskReceiveRewards(int $up_id): bool
|
||||||
|
{
|
||||||
|
$response = ApiUserTask::userTaskReceiveRewards($up_id);
|
||||||
|
if ($response['code']) {
|
||||||
|
Log::warning("每日电池: 领取任务奖励失败 {$response['code']} -> {$response['message']}");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
Log::notice("每日电池: 领取任务奖励成功 获得电池*{$response['data']['num']}");
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -231,7 +231,9 @@ class Login extends BasePlugin
|
|||||||
*/
|
*/
|
||||||
public function patchCookie(): string
|
public function patchCookie(): string
|
||||||
{
|
{
|
||||||
$response = ApiMain::home();
|
// $response = ApiMain::home();
|
||||||
|
$bvid_list = ["BV16X4y1g7wT", "BV1cy4y1k7A2", "BV1bz4y1r7Ug", "BV1ti4y1K7uw", "BV1GK411K7Ke", "BV1CC4y1a7ee", "BV1PK411L7h5", "BV1qt411j7fV", "BV1yt4y1Q7SS", "BV1mi4y1b76M", "BV1pi4y147tQ", "BV1FE411A7Xd", "BV19E41197Kc", "BV1tJ411W7hw", "BV1w7411P7jJ", "BV1Jb411W7dH", "BV12J411X7cD", "BV1Nt4y1D7pW", "BV1Wb411v7WN", "BV1Yc411h7uQ", "BV1x54y1e7zf", "BV1UE411y7Wy", "BV1zp4y1U7Z5", "BV1mK411V7wY", "BV1ht411L72V", "BV16Z4y1H7NG", "BV1jE41137eu", "BV1dW411n7La", "BV1Jb411U7u2", "BV1kt411d7Ht", "BV1Sx411T7QQ", "BV1bW411n7fY", "BV1Ys41167aL", "BV1es411D7sW", "BV1f4411M7QC", "BV1XW411F7L6", "BV1xx411c7mu", "BV1Ss411o7vY", "BV1js411f7jY", "BV1gs411B7y4", "BV12s411N7g2", "BV1fs411t7EK", "BV15W411W7NJ", "BV1xx411c7XW", "BV1vx411K7jb", "BV1Ls41127sG", "BV1GW411g7mc", "BV1Hx411V7n9", "BV1hs411Q7zf", "BV1zs411S7sz", "BV1Us411d71V", "BV1EW41167Yv", "BV1px411N7Yd", "BV1Yx411A7wM", "BV1Js411o76u", "BV1Xs411X7wh", "BV1nx411F7Jf", "BV1Dt411r7Tv", "BV1xx411c79H", "BV1Bx411c7hB", "BV1ix411c7Ye", "BV1Vs411y7TM", "BV1rs411S736", "BV11p411o73u", "BV1Js411Z7Nq", "BV1nx411F7fM", "BV1YW411n7aW", "BV1Ds411m7c5", "BV1Fx411w7GK", "BV1cs411S7DX", "BV1cb411V7Lm", "BV1Kt41147o3", "BV1Mt411D73n", "BV1fx411c7v6", "BV1dx411P79c", "BV1es41197ai", "BV1hx411w7MG", "BV1Ys411H7QK", "BV1Kx411y7TJ", "BV1ts411D7mf", "BV1Sx41117dD", "BV1tx411P7N4", "BV1fs411k7Kj", "BV1Sx411T7L3", "BV1es41197hA"];
|
||||||
|
$response = ApiMain::video($bvid_list[array_rand($bvid_list)]);
|
||||||
$headers = $response['Set-Cookie'];
|
$headers = $response['Set-Cookie'];
|
||||||
$cookies = [];
|
$cookies = [];
|
||||||
foreach ($headers as $header) {
|
foreach ($headers as $header) {
|
||||||
@ -569,7 +571,7 @@ class Login extends BasePlugin
|
|||||||
$payload = [
|
$payload = [
|
||||||
'cid' => $cid,
|
'cid' => $cid,
|
||||||
'tel' => $phone,
|
'tel' => $phone,
|
||||||
'statistics' => '{"appId":1,"platform":3,"version":"6.86.0","abtest":""}',
|
'statistics' => getDevice('app.bili_a.statistics'),
|
||||||
];
|
];
|
||||||
|
|
||||||
$raw = ApiLogin::sendSms($payload);
|
$raw = ApiLogin::sendSms($payload);
|
||||||
|
|||||||
@ -104,6 +104,8 @@ class MainSite extends BasePlugin
|
|||||||
// 投币
|
// 投币
|
||||||
foreach ($aids as $aid) {
|
foreach ($aids as $aid) {
|
||||||
$this->reward((string)$aid);
|
$this->reward((string)$aid);
|
||||||
|
//
|
||||||
|
sleep(1);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -132,7 +132,7 @@ class VipPrivilege extends BasePlugin
|
|||||||
case -101:
|
case -101:
|
||||||
throw new NoLoginException($response['message']);
|
throw new NoLoginException($response['message']);
|
||||||
case 0:
|
case 0:
|
||||||
Log::warning("大会员权益: 领取权益 {$this->privilege[$type]} 成功");
|
Log::notice("大会员权益: 领取权益 {$this->privilege[$type]} 成功");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Log::warning("大会员权益: 领取权益 {$this->privilege[$type]} 失败 {$response['code']} -> {$response['message']}");
|
Log::warning("大会员权益: 领取权益 {$this->privilege[$type]} 失败 {$response['code']} -> {$response['message']}");
|
||||||
|
|||||||
@ -111,6 +111,12 @@ lottery_mode = 0
|
|||||||
; 直播预约抽奖
|
; 直播预约抽奖
|
||||||
live_enable = true
|
live_enable = true
|
||||||
|
|
||||||
|
; 每日电池 对应直播间ID和直播间UID
|
||||||
|
[daily_gold]
|
||||||
|
enable = false
|
||||||
|
target_up_id = 11153765
|
||||||
|
target_room_id = 23058
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
# 通知设置 #
|
# 通知设置 #
|
||||||
#######################
|
#######################
|
||||||
|
|||||||
@ -3,8 +3,8 @@ device_version: 0.0.1
|
|||||||
app:
|
app:
|
||||||
bili_a: # Android
|
bili_a: # Android
|
||||||
package: "tv.danmaku.bili"
|
package: "tv.danmaku.bili"
|
||||||
version: "6.86.0"
|
version: "7.3.0"
|
||||||
build: "6860300"
|
build: "7030300"
|
||||||
channel: "bili"
|
channel: "bili"
|
||||||
device: "phone"
|
device: "phone"
|
||||||
mobi_app: "android"
|
mobi_app: "android"
|
||||||
@ -15,6 +15,7 @@ app:
|
|||||||
secret_key: "NTYwYzUyY2NkMjg4ZmVkMDQ1ODU5ZWQxOGJmZmQ5NzM"
|
secret_key: "NTYwYzUyY2NkMjg4ZmVkMDQ1ODU5ZWQxOGJmZmQ5NzM"
|
||||||
app_key_n: "NzgzYmJiNzI2NDQ1MWQ4Mg=="
|
app_key_n: "NzgzYmJiNzI2NDQ1MWQ4Mg=="
|
||||||
secret_key_n: "MjY1MzU4M2M4ODczZGVhMjY4YWI5Mzg2OTE4YjFkNjU="
|
secret_key_n: "MjY1MzU4M2M4ODczZGVhMjY4YWI5Mzg2OTE4YjFkNjU="
|
||||||
|
statistics: '{"appId":1,"platform":3,"version":"7.3.0","abtest":""}'
|
||||||
bili_i: # IOS
|
bili_i: # IOS
|
||||||
app_key: "MjdlYjUzZmM5MDU4ZjhjMw=="
|
app_key: "MjdlYjUzZmM5MDU4ZjhjMw=="
|
||||||
secret_key: "YzJlZDUzYTc0ZWVlZmUzY2Y5OWZiZDAxZDhjOWMzNzU="
|
secret_key: "YzJlZDUzYTc0ZWVlZmUzY2Y5OWZiZDAxZDhjOWMzNzU="
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
"dev_raw_url": "https://gh.notifyplus.cf/https://github.com/lkeme/BiliHelper-personal/blob/dev/resources/version.json",
|
"dev_raw_url": "https://gh.notifyplus.cf/https://github.com/lkeme/BiliHelper-personal/blob/dev/resources/version.json",
|
||||||
"master_purge_url": "https://cdn.staticaly.com/gh/lkeme/BiliHelper-personal/master/resources/version.json",
|
"master_purge_url": "https://cdn.staticaly.com/gh/lkeme/BiliHelper-personal/master/resources/version.json",
|
||||||
"dev_purge_url": "https://cdn.staticaly.com/gh/lkeme/BiliHelper-personal/dev/resources/version.json",
|
"dev_purge_url": "https://cdn.staticaly.com/gh/lkeme/BiliHelper-personal/dev/resources/version.json",
|
||||||
"version": "2.0.2.221025",
|
"version": "2.0.3.221031",
|
||||||
"des": "程序有更新,请及时线上查看更新哦~",
|
"des": "程序有更新,请及时线上查看更新哦~",
|
||||||
"time": "2022年10月25日",
|
"time": "2022年10月25日",
|
||||||
"ini_version": "0.0.1",
|
"ini_version": "0.0.1",
|
||||||
|
|||||||
@ -34,7 +34,7 @@ class ApiTask
|
|||||||
* @var array|string[]
|
* @var array|string[]
|
||||||
*/
|
*/
|
||||||
protected static array $payload = [
|
protected static array $payload = [
|
||||||
'statistics' => '{"appId":1,"platform":3,"version":"6.86.0","abtest":""}',
|
'statistics' => '{"appId":1,"platform":3,"version":"7.3.0","abtest":""}',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -34,7 +34,7 @@ class ApiTask
|
|||||||
* @var array|string[]
|
* @var array|string[]
|
||||||
*/
|
*/
|
||||||
protected static array $payload = [
|
protected static array $payload = [
|
||||||
'statistics' => '{"appId":1,"platform":3,"version":"6.86.0","abtest":""}',
|
'statistics' => '{"appId":1,"platform":3,"version":"7.3.0","abtest":""}',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -175,5 +175,3 @@ class ApiJury
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ class ApiLogin
|
|||||||
// $payload = [
|
// $payload = [
|
||||||
// 'cid' => $cid,
|
// 'cid' => $cid,
|
||||||
// 'tel' => $phone,
|
// 'tel' => $phone,
|
||||||
// 'statistics' => '{"appId":1,"platform":3,"version":"6.86.0","abtest":""}',
|
// 'statistics' => '{"appId":1,"platform":3,"version":"7.3.0","abtest":""}',
|
||||||
// ];
|
// ];
|
||||||
// {"code":0,"message":"0","ttl":1,"data":{"is_new":false,"captcha_key":"4e292933816755442c1568e2043b8e41","recaptcha_url":""}}
|
// {"code":0,"message":"0","ttl":1,"data":{"is_new":false,"captcha_key":"4e292933816755442c1568e2043b8e41","recaptcha_url":""}}
|
||||||
// {"code":0,"message":"0","ttl":1,"data":{"is_new":false,"captcha_key":"","recaptcha_url":"https://www.bilibili.com/h5/project-msg-auth/verify?ct=geetest\u0026recaptcha_token=ad520c3a4a3c46e29b1974d85efd2c4b\u0026gee_gt=1c0ea7c7d47d8126dda19ee3431a5f38\u0026gee_challenge=c772673050dce482b9f63ff45b681ceb\u0026hash=ea2850a43cc6b4f1f7b925d601098e5e"}}
|
// {"code":0,"message":"0","ttl":1,"data":{"is_new":false,"captcha_key":"","recaptcha_url":"https://www.bilibili.com/h5/project-msg-auth/verify?ct=geetest\u0026recaptcha_token=ad520c3a4a3c46e29b1974d85efd2c4b\u0026gee_gt=1c0ea7c7d47d8126dda19ee3431a5f38\u0026gee_challenge=c772673050dce482b9f63ff45b681ceb\u0026hash=ea2850a43cc6b4f1f7b925d601098e5e"}}
|
||||||
|
|||||||
@ -35,7 +35,7 @@ class ApiEvent
|
|||||||
* @var array|string[]
|
* @var array|string[]
|
||||||
*/
|
*/
|
||||||
protected static array $payload = [
|
protected static array $payload = [
|
||||||
'statistics' => '{"appId":1,"platform":3,"version":"6.86.0","abtest":""}',
|
'statistics' => '{"appId":1,"platform":3,"version":"7.3.0","abtest":""}',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -30,4 +30,16 @@ class ApiMain
|
|||||||
$url = 'https://www.bilibili.com/';
|
$url = 'https://www.bilibili.com/';
|
||||||
return Request::headers('pc', $url);
|
return Request::headers('pc', $url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* video主页
|
||||||
|
* @return array|mixed
|
||||||
|
*/
|
||||||
|
public static function video(string $bvid): mixed
|
||||||
|
{
|
||||||
|
$url = "https://www.bilibili.com/video/$bvid/";
|
||||||
|
return Request::headers('pc', $url);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
56
src/Api/XLive/AppRoom/V1/ApiDM.php
Normal file
56
src/Api/XLive/AppRoom/V1/ApiDM.php
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Website: https://mudew.com/
|
||||||
|
* Author: Lkeme
|
||||||
|
* License: The MIT License
|
||||||
|
* Email: Useri@live.cn
|
||||||
|
* Updated: 2022 ~ 2023
|
||||||
|
*
|
||||||
|
* _____ _ _ _ _ _ _____ _ _____ _____ _____
|
||||||
|
* | _ \ | | | | | | | | | | | ____| | | | _ \ | ____| | _ \ & /l、
|
||||||
|
* | |_| | | | | | | | | |_| | | |__ | | | |_| | | |__ | |_| | (゚、 。 7
|
||||||
|
* | _ { | | | | | | | _ | | __| | | | ___/ | __| | _ / \、゙ ~ヽ *
|
||||||
|
* | |_| | | | | |___ | | | | | | | |___ | |___ | | | |___ | | \ \ じしf_, )ノ
|
||||||
|
* |_____/ |_| |_____| |_| |_| |_| |_____| |_____| |_| |_____| |_| \_\
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Bhp\Api\XLive\AppRoom\V1;
|
||||||
|
|
||||||
|
use Bhp\Request\Request;
|
||||||
|
use Bhp\Sign\Sign;
|
||||||
|
|
||||||
|
class ApiDM
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送弹幕(APP)
|
||||||
|
* @param int $room_id
|
||||||
|
* @param string $msg
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function sendMsg(int $room_id, string $msg): array
|
||||||
|
{
|
||||||
|
$params = [
|
||||||
|
'aid' => '',
|
||||||
|
'page' => '1',
|
||||||
|
//'statistics' => getDevice('app.bili_a.statistics'),
|
||||||
|
];
|
||||||
|
$url = 'https://api.live.bilibili.com/xlive/app-room/v1/dM/sendmsg?' . http_build_query(Sign::common($params));
|
||||||
|
$payload = [
|
||||||
|
"cid" => $room_id,
|
||||||
|
"msg" => $msg,
|
||||||
|
"rnd" => time(),
|
||||||
|
"color" => "16777215",
|
||||||
|
"fontsize" => "25",
|
||||||
|
];
|
||||||
|
$headers = [
|
||||||
|
'content-type' => 'application/x-www-form-urlencoded',
|
||||||
|
];
|
||||||
|
|
||||||
|
// {"code":0,"data":{"mode_info":{"extra":"{\"send_from_me\":true,\"mode\":0,\"color\":16777215,\"dm_type\":0,\"font_size\":25,\"player_mode\":1,\"show_player_type\":0,\"content\":\"1\",\"user_hash\":\"111111\",\"emoticon_unique\":\"\",\"bulge_display\":0,\"recommend_score\":8,\"main_state_dm_color\":\"\",\"objective_state_dm_color\":\"\",\"direction\":0,\"pk_direction\":0,\"quartet_direction\":0,\"anniversary_crowd\":0,\"yeah_space_type\":\"\",\"yeah_space_url\":\"\",\"jump_to_url\":\"\",\"space_type\":\"\",\"space_url\":\"\"}","mode":0,"show_player_type":0}},"message":"","msg":""}
|
||||||
|
return Request::postJson(true, 'app', $url, $payload, $headers);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
62
src/Api/XLive/AppUcenter/V1/ApiUserTask.php
Normal file
62
src/Api/XLive/AppUcenter/V1/ApiUserTask.php
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Website: https://mudew.com/
|
||||||
|
* Author: Lkeme
|
||||||
|
* License: The MIT License
|
||||||
|
* Email: Useri@live.cn
|
||||||
|
* Updated: 2022 ~ 2023
|
||||||
|
*
|
||||||
|
* _____ _ _ _ _ _ _____ _ _____ _____ _____
|
||||||
|
* | _ \ | | | | | | | | | | | ____| | | | _ \ | ____| | _ \ & /l、
|
||||||
|
* | |_| | | | | | | | | |_| | | |__ | | | |_| | | |__ | |_| | (゚、 。 7
|
||||||
|
* | _ { | | | | | | | _ | | __| | | | ___/ | __| | _ / \、゙ ~ヽ *
|
||||||
|
* | |_| | | | | |___ | | | | | | | |___ | |___ | | | |___ | | \ \ じしf_, )ノ
|
||||||
|
* |_____/ |_| |_____| |_| |_| |_| |_____| |_____| |_| |_____| |_| \_\
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Bhp\Api\XLive\AppUcenter\V1;
|
||||||
|
|
||||||
|
use Bhp\Request\Request;
|
||||||
|
use Bhp\Sign\Sign;
|
||||||
|
|
||||||
|
class ApiUserTask
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 获取任务进度
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getUserTaskProgress(): array
|
||||||
|
{
|
||||||
|
$url = 'https://api.live.bilibili.com/xlive/app-ucenter/v1/userTask/GetUserTaskProgress';
|
||||||
|
$payload = [
|
||||||
|
'statistics' => getDevice('app.bili_a.statistics'),
|
||||||
|
];
|
||||||
|
|
||||||
|
// 已领取 {"code":0,"message":"0","ttl":1,"data":{"is_surplus":1,"status":3,"progress":5,"target":5,"wallet":{"gold":100,"silver":130},"linked_actions_progress":null}}
|
||||||
|
// 可领取 {"code":0,"message":"0","ttl":1,"data":{"is_surplus":1,"status":2,"progress":5,"target":5,"wallet":{"gold":0,"silver":130},"linked_actions_progress":null}}
|
||||||
|
// 进行中 {"code":0,"message":"0","ttl":1,"data":{"is_surplus":1,"status":1,"progress":4,"target":5,"wallet":{"gold":0,"silver":130},"linked_actions_progress":null}}
|
||||||
|
// 未开始 {"code":0,"message":"0","ttl":1,"data":{"is_surplus":1,"status":0,"progress":0,"target":5,"wallet":{"gold":0,"silver":130},"linked_actions_progress":null}}
|
||||||
|
return Request::getJson(true, 'app', $url, Sign::common($payload));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取任务奖品
|
||||||
|
* @param int $up_id
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function userTaskReceiveRewards(int $up_id): array
|
||||||
|
{
|
||||||
|
$url = 'https://api.live.bilibili.com/xlive/app-ucenter/v1/userTask/UserTaskReceiveRewards';
|
||||||
|
$payload = [
|
||||||
|
'target_id' => $up_id,
|
||||||
|
'statistics' => getDevice('app.bili_a.statistics'),
|
||||||
|
];
|
||||||
|
|
||||||
|
// {"code":0,"message":"0","ttl":1,"data":{"num":1}}
|
||||||
|
return Request::postJson(true, 'app', $url, Sign::common($payload));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ function getEnable(string $key, bool $default = false): bool
|
|||||||
function getU(string $key): mixed
|
function getU(string $key): mixed
|
||||||
{
|
{
|
||||||
$value = '';
|
$value = '';
|
||||||
$fillable = ['username', 'password', 'uid', 'csrf', 'cookie', 'access_token', 'refresh_token', 'sid'];
|
$fillable = ['username', 'password', 'uid', 'csrf', 'cookie', 'access_token', 'refresh_token', 'sid', 'pc_cookie'];
|
||||||
if (in_array($key, $fillable)) {
|
if (in_array($key, $fillable)) {
|
||||||
$value = Cache::get('auth_' . $key, 'Login');
|
$value = Cache::get('auth_' . $key, 'Login');
|
||||||
}
|
}
|
||||||
@ -83,7 +83,7 @@ function getU(string $key): mixed
|
|||||||
*/
|
*/
|
||||||
function setU(string $key, mixed $value): void
|
function setU(string $key, mixed $value): void
|
||||||
{
|
{
|
||||||
$fillable = ['username', 'password', 'uid', 'csrf', 'cookie', 'access_token', 'refresh_token', 'sid'];
|
$fillable = ['username', 'password', 'uid', 'csrf', 'cookie', 'access_token', 'refresh_token', 'sid', 'pc_cookie'];
|
||||||
if (in_array($key, $fillable)) {
|
if (in_array($key, $fillable)) {
|
||||||
Cache::set('auth_' . $key, $value, 'Login');
|
Cache::set('auth_' . $key, $value, 'Login');
|
||||||
}
|
}
|
||||||
@ -126,12 +126,12 @@ function getAppHomePage(): string
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 错误退出
|
* 错误退出
|
||||||
* @param $message
|
* @param mixed $message
|
||||||
* @param array $context
|
* @param array $context
|
||||||
* @param int $delay
|
* @param int $delay
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
#[NoReturn] function failExit($message, array $context = [], int $delay = 60 * 2): void
|
#[NoReturn] function failExit(mixed $message = 'exit', array $context = [], int $delay = 60 * 2): void
|
||||||
{
|
{
|
||||||
Log::error($message, $context);
|
Log::error($message, $context);
|
||||||
// 如果在docker环境中,延迟退出,方便查看错误
|
// 如果在docker环境中,延迟退出,方便查看错误
|
||||||
|
|||||||
@ -49,6 +49,9 @@ class Sign extends SingleTon
|
|||||||
'device' => getDevice('app.bili_a.device'),
|
'device' => getDevice('app.bili_a.device'),
|
||||||
'mobi_app' => getDevice('app.bili_a.mobi_app'),
|
'mobi_app' => getDevice('app.bili_a.mobi_app'),
|
||||||
'platform' => getDevice('app.bili_a.platform'),
|
'platform' => getDevice('app.bili_a.platform'),
|
||||||
|
'c_locale' => 'zh_CN', // zh-Hans_CH
|
||||||
|
's_locale' => 'zh_CN', // zh-Hans_CH
|
||||||
|
'disable_rcmd' => '0', //
|
||||||
'ts' => time(),
|
'ts' => time(),
|
||||||
];
|
];
|
||||||
//
|
//
|
||||||
@ -112,6 +115,9 @@ class Sign extends SingleTon
|
|||||||
'device' => getDevice('app.bili_a.device'),
|
'device' => getDevice('app.bili_a.device'),
|
||||||
'mobi_app' => getDevice('app.bili_a.mobi_app'),
|
'mobi_app' => getDevice('app.bili_a.mobi_app'),
|
||||||
'platform' => getDevice('app.bili_a.platform'),
|
'platform' => getDevice('app.bili_a.platform'),
|
||||||
|
'c_locale' => 'zh_CN', // zh-Hans_CH
|
||||||
|
's_locale' => 'zh_CN', // zh-Hans_CH
|
||||||
|
'disable_rcmd' => '0', //
|
||||||
'ts' => time(),
|
'ts' => time(),
|
||||||
];
|
];
|
||||||
$payload = array_merge($payload, $default);
|
$payload = array_merge($payload, $default);
|
||||||
|
|||||||
@ -94,9 +94,10 @@ class Fake
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取颜文字信息
|
* 获取颜文字信息
|
||||||
|
* @param bool $full
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function emoji(): string
|
public static function emoji(bool $full = false): string
|
||||||
{
|
{
|
||||||
$emoji_list_all = [
|
$emoji_list_all = [
|
||||||
"(⌒▽⌒)", "( ̄▽ ̄)", "(=・ω・=)", "(`・ω・´)", "(〜 ̄△ ̄)〜", "(・∀・)",
|
"(⌒▽⌒)", "( ̄▽ ̄)", "(=・ω・=)", "(`・ω・´)", "(〜 ̄△ ̄)〜", "(・∀・)",
|
||||||
@ -105,13 +106,15 @@ class Fake
|
|||||||
"(´;ω;`)", "(/TДT)/", "(^・ω・^ )", "(。・ω・。)", "(● ̄(エ) ̄●)", "ε=ε=(ノ≧∇≦)ノ",
|
"(´;ω;`)", "(/TДT)/", "(^・ω・^ )", "(。・ω・。)", "(● ̄(エ) ̄●)", "ε=ε=(ノ≧∇≦)ノ",
|
||||||
"(´・_・`)", "(-_-#)", "( ̄へ ̄)", "( ̄ε(# ̄) Σ", "ヽ(`Д´)ノ", "(#-_-)┯━┯",
|
"(´・_・`)", "(-_-#)", "( ̄へ ̄)", "( ̄ε(# ̄) Σ", "ヽ(`Д´)ノ", "(#-_-)┯━┯",
|
||||||
"(╯°口°)╯(┴—┴", "←◡←", "( ♥д♥)", "Σ>―(〃°ω°〃)♡→", "⁄(⁄ ⁄•⁄ω⁄•⁄ ⁄)⁄",
|
"(╯°口°)╯(┴—┴", "←◡←", "( ♥д♥)", "Σ>―(〃°ω°〃)♡→", "⁄(⁄ ⁄•⁄ω⁄•⁄ ⁄)⁄",
|
||||||
"(╬゚д゚)▄︻┻┳═一", "・*・:≡( ε:)", "(打卡)", "(签到)"
|
"(╬゚д゚)▄︻┻┳═一", "・*・:≡( ε:)", "(打卡)", "(签到)", "(⌒▽⌒)", "( ̄▽ ̄)", "(=・ω・=)", "(`・ω・´)", "(〜 ̄△ ̄)〜", "(・∀・)", "(°∀°)ノ", "( ̄3 ̄)", "╮( ̄▽ ̄)╭", "_(:3」∠)_", "( ´_ゝ`)", "←_←", "→_→", "(<_<)", "(>_>)", "(;¬_¬)", '("▔□▔)/', "(゚Д゚≡゚д゚)!?", "Σ(゚д゚;)", "Σ(  ̄□ ̄||)", "(´;ω;`)", "(/TДT)/", "(^・ω・^ )", "(。・ω・。)", "(● ̄(エ) ̄●)", "ε=ε=(ノ≧∇≦)ノ", "(´・_・`)", "(-_-#)", "( ̄へ ̄)", "( ̄ε(# ̄) Σ", "ヽ(`Д´)ノ", "(#-_-)┯━┯", "(╯°口°)╯(┴—┴", "←◡←", "( ♥д♥)", "Σ>―(〃°ω°〃)♡→", "⁄(⁄ ⁄•⁄ω⁄•⁄ ⁄)⁄", "(╬゚д゚)▄︻┻┳═一", "・*・:≡( ε:)", "(汗)", "(苦笑)"
|
||||||
];
|
];
|
||||||
$emoji_list = [
|
$emoji_list_part = [
|
||||||
"(⌒▽⌒)", "( ̄▽ ̄)", "(=・ω・=)", "(`・ω・´)", "(〜 ̄△ ̄)〜",
|
"(⌒▽⌒)", "( ̄▽ ̄)", "(=・ω・=)", "(`・ω・´)", "(〜 ̄△ ̄)〜",
|
||||||
"╮( ̄▽ ̄)╭", "_(:3」∠)_", "( ´_ゝ`)", "(● ̄(エ) ̄●)", "(・∀・)",
|
"╮( ̄▽ ̄)╭", "_(:3」∠)_", "( ´_ゝ`)", "(● ̄(エ) ̄●)", "(・∀・)",
|
||||||
"(´・_・`)", "( ̄へ ̄)", "(打卡)", "(签到)"
|
"(´・_・`)", "( ̄へ ̄)", "(打卡)", "(签到)"
|
||||||
];
|
];
|
||||||
|
$emoji_list = $full ? $emoji_list_all : $emoji_list_part;
|
||||||
|
|
||||||
shuffle($emoji_list);
|
shuffle($emoji_list);
|
||||||
return $emoji_list[array_rand($emoji_list)];
|
return $emoji_list[array_rand($emoji_list)];
|
||||||
}
|
}
|
||||||
|
|||||||
158
src/Util/UUID/UUID.php
Normal file
158
src/Util/UUID/UUID.php
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Website: https://mudew.com/
|
||||||
|
* Author: Lkeme
|
||||||
|
* License: The MIT License
|
||||||
|
* Email: Useri@live.cn
|
||||||
|
* Updated: 2022 ~ 2023
|
||||||
|
* Source: https://raw.githubusercontent.com/abmmhasan/UUID/main/src/Uuid.php
|
||||||
|
*
|
||||||
|
* _____ _ _ _ _ _ _____ _ _____ _____ _____
|
||||||
|
* | _ \ | | | | | | | | | | | ____| | | | _ \ | ____| | _ \ & /l、
|
||||||
|
* | |_| | | | | | | | | |_| | | |__ | | | |_| | | |__ | |_| | (゚、 。 7
|
||||||
|
* | _ { | | | | | | | _ | | __| | | | ___/ | __| | _ / \、゙ ~ヽ *
|
||||||
|
* | |_| | | | | |___ | | | | | | | |___ | |___ | | | |___ | | \ \ じしf_, )ノ
|
||||||
|
* |_____/ |_| |_____| |_| |_| |_| |_____| |_____| |_| |_____| |_| \_\
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Bhp\Util\UUID;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
|
|
||||||
|
class UUID
|
||||||
|
{
|
||||||
|
private static $nsList = [
|
||||||
|
'dns' => 0,
|
||||||
|
'url' => 1,
|
||||||
|
'oid' => 2,
|
||||||
|
'x500' => 3
|
||||||
|
];
|
||||||
|
|
||||||
|
private static $node;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate UUID v1 string
|
||||||
|
*
|
||||||
|
* @param string|null $node
|
||||||
|
* @return string
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static function v1(string $node = null): string
|
||||||
|
{
|
||||||
|
$time = microtime(false);
|
||||||
|
$time = substr($time, 11) . substr($time, 2, 7);
|
||||||
|
$time = str_pad(dechex($time + 0x01b21dd213814000), 16, '0', STR_PAD_LEFT);
|
||||||
|
$clockSeq = random_int(0, 0x3fff);
|
||||||
|
$node = $node ?? self::getNode();
|
||||||
|
return sprintf('%08s-%04s-1%03s-%04x-%012s',
|
||||||
|
substr($time, -8),
|
||||||
|
substr($time, -12, 4),
|
||||||
|
substr($time, -15, 3),
|
||||||
|
$clockSeq | 0x8000,
|
||||||
|
$node
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate UUID v3 string
|
||||||
|
*
|
||||||
|
* @param string $string
|
||||||
|
* @param string $namespace
|
||||||
|
* @return string
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static function v3(string $string, string $namespace = 'x500'): string
|
||||||
|
{
|
||||||
|
$namespace = self::nsResolve($namespace);
|
||||||
|
if (!$namespace) {
|
||||||
|
throw new Exception('Invalid NameSpace!');
|
||||||
|
}
|
||||||
|
$hash = md5(hex2bin($namespace) . $string);
|
||||||
|
return self::output(3, $hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate UUID v4 Random string
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static function v4(): string
|
||||||
|
{
|
||||||
|
$string = bin2hex(random_bytes(16));
|
||||||
|
return self::output(4, $string);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate UUID v5 string
|
||||||
|
*
|
||||||
|
* @param string $string
|
||||||
|
* @param string $namespace
|
||||||
|
* @return string
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static function v5(string $string, string $namespace = 'x500'): string
|
||||||
|
{
|
||||||
|
$namespace = self::nsResolve($namespace);
|
||||||
|
if (!$namespace) {
|
||||||
|
throw new Exception('Invalid NameSpace!');
|
||||||
|
}
|
||||||
|
$hash = sha1(hex2bin($namespace) . $string);
|
||||||
|
return self::output(5, $hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get generated Node (for v1)
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static function getNode(): string
|
||||||
|
{
|
||||||
|
if (self::$node) {
|
||||||
|
return self::$node;
|
||||||
|
}
|
||||||
|
return self::$node = sprintf('%06x%06x',
|
||||||
|
random_int(0, 0xffffff) | 0x010000,
|
||||||
|
random_int(0, 0xffffff)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $version
|
||||||
|
* @param string $string
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private static function output(int $version, string $string): string
|
||||||
|
{
|
||||||
|
$string = str_split($string, 4);
|
||||||
|
return sprintf("%08s-%04s-{$version}%03s-%04x-%012s",
|
||||||
|
$string[0] . $string[1], $string[2],
|
||||||
|
substr($string[3], 1, 3),
|
||||||
|
hexdec($string[4]) & 0x3fff | 0x8000,
|
||||||
|
$string[5] . $string[6] . $string[7]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function nsResolve($namespace)
|
||||||
|
{
|
||||||
|
if (self::isValid($namespace)) {
|
||||||
|
return str_replace('-', '', $namespace);
|
||||||
|
}
|
||||||
|
$namespace = str_replace(['namespace', 'ns', '_'], '', strtolower($namespace));
|
||||||
|
if (isset(self::$nsList[$namespace])) {
|
||||||
|
return "6ba7b81" . self::$nsList[$namespace] . "9dad11d180b400c04fd430c8";
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $uuid
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
private static function isValid($uuid): bool
|
||||||
|
{
|
||||||
|
return (bool)preg_match('{^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$}Di', $uuid);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user