From a8a1787e2414881a1736b62efb0de18899356918 Mon Sep 17 00:00:00 2001 From: Lkeme <19500576+lkeme@users.noreply.github.com> Date: Mon, 15 Nov 2021 15:59:01 +0800 Subject: [PATCH] [update] Version 1.0.2.* closed #137 --- CHANGELOG.md | 39 ++++++++-- DOC.md | 9 ++- NOTIFY.md | 132 ++++++++++++++++++++++++++++++++ README.md | 72 +++++++++--------- conf/bili.yaml | 4 +- conf/device.yaml | 6 +- conf/user.ini.example | 13 +++- data/capsule_infos.json | 130 -------------------------------- data/filter_library.json | 3 +- data/latest_version.json | 4 +- src/core/App.php | 1 + src/plugin/BpConsumption.php | 2 +- src/plugin/CapsuleLottery.php | 4 +- src/plugin/LiveReservation.php | 134 +++++++++++++++++++++++++++++++++ src/plugin/Login.php | 5 +- src/plugin/Notice.php | 93 +++++++++++++++++++++-- src/plugin/User.php | 4 +- src/tool/Common.php | 2 +- 18 files changed, 464 insertions(+), 193 deletions(-) create mode 100644 NOTIFY.md create mode 100644 src/plugin/LiveReservation.php diff --git a/CHANGELOG.md b/CHANGELOG.md index a55ce4a..026a90d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,34 @@ [comment]: <> () +## v1.0.2.211115 alpha (2021-11-15) + +### Added + +- 添加直播预约有奖 +- 添加企业微信群机器人推送 +- 添加企业微信应用消息推送 +- + +### Changed + +- 清理部分无效活动 +- 更新系统环境参数 +- 更新敏感关键字 +- + +### Fixed + +- 修复登录未知错误 +- + +### Remarks + +- 注意文档文件、配置文件有些许改动 +- 注意需要重新进行`composer update`操作 +- 注意只支持PHP8.* 只支持PHP8.* 只支持PHP8.* +- + ## v1.0.1.211014 alpha (2021-10-14) ### Added @@ -18,13 +46,13 @@ - 更新部分活动 - 更新系统环境参数 -- +- ### Fixed - 修复中文用户名运行失败 - 修复风纪(未完善,慎用) -- +- ### Remarks @@ -33,7 +61,6 @@ - 注意只支持PHP8.* 只支持PHP8.* 只支持PHP8.* - - ## v1.0.0.210822 alpha (2021-08-22) ### Added @@ -42,13 +69,13 @@ - 全面支持PHP8.0 - 支持本地缓存 - 对使用体验进行了一轮优化并解决了一些bug~~ -- +- ### Changed - PHP版本提升值8.*, 不向下兼容 - 对使用体验进行了一轮优化并解决了一些bug~~ -- +- ### Fixed @@ -60,7 +87,7 @@ - 注意文档文件有些许改动 - 注意需要重新进行`composer update`操作 - 注意只支持PHP8.* 只支持PHP8.* 只支持PHP8.* -- +- ## v0.9.9.210807 alpha (2021-08-07) diff --git a/DOC.md b/DOC.md index d6f3bcd..e341953 100644 --- a/DOC.md +++ b/DOC.md @@ -201,7 +201,14 @@ $ -e MIRRORS=2 # 使用 github.com.cnpmjs.org -it 前台运行 -itd 后台运行 -v 本地文件:容器内部文件 ==> 挂载本地文件到容器中。本地文件路径随便变,容器内部文件路径不能变。 - ``` +``` + +- -v模式使用短信登录 + +``` +配置文件里设置好,发送完短信 +docker attach 或者docker exec 再进去容器里输入 +``` - 注意: Docker镜像已经包含了所有所需的运行环境,无需在本地环境弄composer。每次启动容器时,都会与项目进行同步以确保版本最新。 diff --git a/NOTIFY.md b/NOTIFY.md new file mode 100644 index 0000000..5a84ed5 --- /dev/null +++ b/NOTIFY.md @@ -0,0 +1,132 @@ +## 关于推送 + +### 开关 + +```ini +[notify] +enable = false +filter_words = +``` + +### 推送单元 + +> 以下数据为示例(e.g.),需要根据实际需求配置 + +**钉钉** + +> 文档: https://developers.dingtalk.com/文档ument/robots/custom-robot-access +> 说明: 钉钉推送的密钥 + +```ini +; Dingtalk机器人|token|依赖USE_NOTIFY +[notify.dingtalk] +token = 566cc69da782ec**** +``` + +**Telegram** + +> 文档: https://core.telegram.org/bots/api#sendmessage +> 说明: 如果开启 TGbot API 反代,填写url,否则为空使用默认api。 +> 说明: TG 推送的Token, xxx/bot{这是token部分}/xxxx +> 说明: TG 推送的用户/群组/频道 ID + +```ini +; Tele机器人|url(可选)|token|chatid|依赖USE_NOTIFY +[notify.telegram] +url = https://*.*.workers.dev/bot +bottoken = 1640****:AAGlV3****_FscZ-**** +chatid = 390**** +``` + +**PUSH PLUS** + +> 文档: http://www.pushplus.plus/doc/ +> 说明: push plus++ 推送的 `token` + +```ini +; Pushplus酱|token|依赖USE_NOTIFY +[notify.pushplus] +token = 566cc69da782ec**** +``` + +**Sever酱(原版)** + +> 文档: https://sc.ftqq.com/ +> 说明: Server 酱老版本 key,SCU 开头的 + +```ini +; Sever酱(原版)|令牌Key|依赖USE_NOTIFY +[notify.sc] +sckey = SCU566cc69da782ec**** +``` + +**Server酱(Turbo版)** + +> 文档: https://sct.ftqq.com/ +> 说明: Server 酱 Turbo 版本 key,SCT 开头的 + +```ini +; Server酱(Turbo版)|令牌Key|依赖USE_NOTIFY +[notify.sct] +sctkey = SCT566cc69da782ec**** +``` + +**GoCqhttp** + +> 文档: https://docs.go-cqhttp.org/api/ +> 说明: 推送的完整api, 包含`/send_private_msg`、`/send_group_msg` 等等完整后缀 +> 说明: 推送的AccessToken +> 说明: 目标QQ号或者QQ群号,根据API调整 + +```ini +; GoCqhttp|url|token|目标qq|依赖USE_NOTIFY +[notify.gocqhttp] +url = "http://127.0.0.1:5700/send_private_msg" +token = 566cc69da782ec**** +target_qq = 10086 +``` + +**Debug(个人用)** + +> 文档: https://localhost:8921/doc + +```ini +; Debug|个人调试推送|url|token| +[notify.debug] +url = "https://localhost:8921/notify" +token = 566cc69da782ec**** +``` + +**企业微信群机器人** + +> 文档: https://open.work.weixin.qq.com/api/doc/90000/90136/91770 | https://weibanzhushou.com/blog/330 +> 说明: 推送的AccessToken + +```ini +; 企业微信群机器人|token +[notify.we_com] +token = ec971f1d-****-4700-****-d9461e76**** +``` + +**企业微信应用** + +> 文档: https://open.work.weixin.qq.com/wwopen/devtool/interface?doc_id=10167 +> 说明: 企业 id +> 说明: 应用的凭证密钥 +> 说明: 企业应用的 id +> 说明: 指定接收消息的成员,成员 ID 列表 默认为@all + +```ini +; 企业微信应用消息|corp_id|corp_secret|agent_id|to_user +[notify.we_com_app] +corp_id = **** +corp_secret = **** +agent_id = **** +to_user = UserId1|UserId2|UserId3 +``` + +### 调试 + +https://github.com/lkeme/BiliHelper-personal/blob/eb06f55fa0fa6cb07bbeffc7e85c6ac0bfaa67b3/data/latest_version.json#L8 + +改成与线上不同的版本即可,检查新版本就会推送一次。 \ No newline at end of file diff --git a/README.md b/README.md index 5873be0..9372a8b 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@
-
+
@@ -47,40 +47,41 @@
| plugin | status | version | cycle | description |
|-----------------|--------|----------|--------|---------------------------------------------|
-| CheckUpdate | true | 21.10.13 | 待整理 | 程序检查更新 |
-| Login | true | 21.10.13 | 待整理 | 账号登录、刷新、维持 |
-| Schedule | true | 21.10.13 | 待整理 | 控制插件运行周期 |
-| MainSite | true | 21.10.13 | 待整理 | 投币、观看、分享视频 (速升6级不是梦) |
-| DailyBag | true | 21.10.13 | 待整理 | 双端领取日常/周常礼包 |
-| ManGa | true | 21.10.13 | 待整理 | 漫画签到、分享 |
-| ActivityLottery | true | 21.10.13 | 待整理 | 主站活动九宫格抽奖 |
-| Competition | true | 21.10.13 | 待整理 | 游戏赛事竞猜 |
-| DoubleHeart | true | 21.10.13 | 待整理 | 双端心跳 (姥爷直播经验) |
-| DailyTask | true | 21.10.13 | 待整理 | 直播每日任务(签到、观看) |
-| Barrage | true | 21.10.13 | 待整理 | 保持活跃弹幕 |
-| Silver2Coin | true | 21.10.13 | 待整理 | 银瓜子兑换硬币 |
-| Judge | true | 21.10.13 | 待整理 | 风纪委员投票 |
-| GiftSend | true | 21.10.13 | 待整理 | 礼物赠送、维持每日勋章亲密度 |
-| GroupSignIn | true | 21.10.13 | 待整理 | 友爱社签到 |
-| GiftHeart | true | 21.10.13 | 待整理 | 日常心跳每日礼包礼物 |
-| SmallHeart | true | 21.10.13 | 待整理 | 直播挂机,每日24个小心心 |
-| MaterialObject | true | 21.10.13 | 待整理 | 直播金色宝箱实物抽奖 |
-| AloneTcpClient | true | 21.10.13 | 待整理 | 作者的独立直播监控(可支持本项目哦) |
-| ZoneTcpClient | true | 21.10.13 | 待整理 | 官方的分区直播监控 |
-| StormRaffle | true | 21.10.13 | 待整理 | 直播节奏风暴抽奖、亿元 |
-| GiftRaffle | true | 21.10.13 | 待整理 | 直播礼物抽奖 |
-| PkRaffle | true | 21.10.13 | 待整理 | 直播大乱斗抽奖 |
-| GuardRaffle | true | 21.10.13 | 待整理 | 直播大航海抽奖 |
-| AnchorRaffle | true | 21.10.13 | 待整理 | 直播天选时刻抽奖 |
-| GiftRaffle | true | 21.10.13 | 待整理 | 直播礼物抽奖 |
-| AwardRecord | true | 21.10.13 | 待整理 | 最新的中奖纪录通知 |
-| Forward | true | 21.10.13 | 待整理 | 主站动态抽奖转发 |
-| CapsuleLottery | true | 21.10.13 | 待整理 | 直播扭蛋活动抽奖 |
-| PolishTheMedal | true | 21.10.13 | 待整理 | 每日自动点亮灰色勋章 |
-| CapsuleLottery | true | 21.10.13 | 待整理 | 直播扭蛋活动抽奖 |
-| VipPrivilege | true | 21.10.13 | 待整理 | 每月领取年度大会员特权(B币券、会员购优惠券) |
-| BpConsumption | true | 21.10.13 | 待整理 | 每月消费使用年度大会员特权的B币券 |
-| Statistics | true | 21.10.13 | 待整理 | 全局抽奖结果统计 |
+| CheckUpdate | true | 21.11.15 | 待整理 | 程序检查更新 |
+| Login | true | 21.11.15 | 待整理 | 账号登录、刷新、维持 |
+| Schedule | true | 21.11.15 | 待整理 | 控制插件运行周期 |
+| MainSite | true | 21.11.15 | 待整理 | 投币、观看、分享视频 (速升6级不是梦) |
+| DailyBag | true | 21.11.15 | 待整理 | 双端领取日常/周常礼包 |
+| ManGa | true | 21.11.15 | 待整理 | 漫画签到、分享 |
+| ActivityLottery | true | 21.11.15 | 待整理 | 主站活动九宫格抽奖 |
+| Competition | true | 21.11.15 | 待整理 | 游戏赛事竞猜 |
+| DoubleHeart | true | 21.11.15 | 待整理 | 双端心跳 (姥爷直播经验) |
+| DailyTask | true | 21.11.15 | 待整理 | 直播每日任务(签到、观看) |
+| Barrage | true | 21.11.15 | 待整理 | 保持活跃弹幕 |
+| Silver2Coin | true | 21.11.15 | 待整理 | 银瓜子兑换硬币 |
+| Judge | true | 21.11.15 | 待整理 | 风纪委员投票 |
+| GiftSend | true | 21.11.15 | 待整理 | 礼物赠送、维持每日勋章亲密度 |
+| GroupSignIn | true | 21.11.15 | 待整理 | 友爱社签到 |
+| GiftHeart | true | 21.11.15 | 待整理 | 日常心跳每日礼包礼物 |
+| SmallHeart | true | 21.11.15 | 待整理 | 直播挂机,每日24个小心心 |
+| MaterialObject | true | 21.11.15 | 待整理 | 直播金色宝箱实物抽奖 |
+| AloneTcpClient | true | 21.11.15 | 待整理 | 作者的独立直播监控(可支持本项目哦) |
+| ZoneTcpClient | true | 21.11.15 | 待整理 | 官方的分区直播监控 |
+| StormRaffle | true | 21.11.15 | 待整理 | 直播节奏风暴抽奖、亿元 |
+| GiftRaffle | true | 21.11.15 | 待整理 | 直播礼物抽奖 |
+| PkRaffle | true | 21.11.15 | 待整理 | 直播大乱斗抽奖 |
+| GuardRaffle | true | 21.11.15 | 待整理 | 直播大航海抽奖 |
+| AnchorRaffle | true | 21.11.15 | 待整理 | 直播天选时刻抽奖 |
+| GiftRaffle | true | 21.11.15 | 待整理 | 直播礼物抽奖 |
+| AwardRecord | true | 21.11.15 | 待整理 | 最新的中奖纪录通知 |
+| Forward | true | 21.11.15 | 待整理 | 主站动态抽奖转发 |
+| CapsuleLottery | true | 21.11.15 | 待整理 | 直播扭蛋活动抽奖 |
+| PolishTheMedal | true | 21.11.15 | 待整理 | 每日自动点亮灰色勋章 |
+| CapsuleLottery | true | 21.11.15 | 待整理 | 直播扭蛋活动抽奖 |
+| VipPrivilege | true | 21.11.15 | 待整理 | 每月领取年度大会员特权(B币券、会员购优惠券) |
+| BpConsumption | true | 21.11.15 | 待整理 | 每月消费使用年度大会员特权的B币券 |
+| Statistics | true | 21.11.15 | 待整理 | 全局抽奖结果统计 |
+| LiveReservation | true | 21.11.15 | 待整理 | 直播预约有奖 |
| Silver | false | 21.03.27 | 待整理 | 直播银瓜子自动开启宝箱 |
## 交流反馈
@@ -94,6 +95,7 @@ Group: [163955623](https://jq.qq.com/?_wv=1027&k=1QMFTUEO) | **请不要来问
[comment]: <> (:cherry_blossom: :gift: :gift_heart: :confetti_ball:)
* [使用文档 / DOC.md](./DOC.md)
+* [推送文档 / DOC.md](./NOTIFY.md)
* [更新日志 / CHANGELOG.md](./CHANGELOG.md)
* [配置文档 / WIKI.md](https://github.com/lkeme/BiliHelper-personal/wiki/%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6%E8%AF%A6%E8%A7%A3)
* [常见问题 / WIKI.md](https://github.com/lkeme/BiliHelper-personal/wiki/%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98)
diff --git a/conf/bili.yaml b/conf/bili.yaml
index 5dc936a..c0e924a 100644
--- a/conf/bili.yaml
+++ b/conf/bili.yaml
@@ -3,8 +3,8 @@ bili_version: 0.0.1
# Android
bili_a:
package: "tv.danmaku.bili"
- version: "6.43.0"
- build: "6430500"
+ version: "6.48.0"
+ build: "6480300"
channel: "bili"
device: "phone"
mobi_app: "android"
diff --git a/conf/device.yaml b/conf/device.yaml
index 798d296..9924851 100644
--- a/conf/device.yaml
+++ b/conf/device.yaml
@@ -7,8 +7,8 @@ device:
network: "2" # 1 流量 2 WIFI
other_headers:
- ua: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4450.0 Safari/537.36"
- pc_headers:
- ua: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.30 Safari/537.36 Edg/90.0.818.8"
+ ua: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36"
+ pc_headers: _增强便携版
+ ua: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36 Edg/95.0.1020.53Chrome/95.0.4638.69 Safari/537.36 Edg/95.0.1020.53"
app_headers:
ua: "Mozilla/5.0 BiliDroid/${bili_a.version} (bbcallen@gmail.com) os/${device.os} model/${device.model} mobi_app/${bili_a.mobi_app} build/${bili_a.build} channel/${bili_a.channel} innerVer/${bili_a.build} osVer/${device.os_ver} network/${device.network}"
diff --git a/conf/user.ini.example b/conf/user.ini.example
index a5e1b9d..7e12f72 100644
--- a/conf/user.ini.example
+++ b/conf/user.ini.example
@@ -204,11 +204,22 @@ url = ""
token =
target_qq =
-; Debug|个人调试推送|url|token|
+; Debug|个人调试推送|url|token
[notify.debug]
url = ""
token =
+; 企业微信群机器人|token
+[notify.we_com]
+token =
+
+; 企业微信应用消息|corp_id|corp_secret|agent_id|to_user
+[notify.we_com_app]
+corp_id =
+corp_secret =
+agent_id =
+to_user =
+
#######################
# 基础设置 #
#######################
diff --git a/data/capsule_infos.json b/data/capsule_infos.json
index bd63471..53133b3 100644
--- a/data/capsule_infos.json
+++ b/data/capsule_infos.json
@@ -38,136 +38,6 @@
"watch_time": 600,
"draw_times": 0,
"expire_at": "2021-11-06 23:59:59"
- },
- {
- "url": "https://www.bilibili.com/blackboard/activity-aCrSakaiX5.html",
- "title": "永劫无间无拘创作挑战赛",
- "description": "视频投稿&主播开播,瓜分40万奖金!",
- "room_id": 0,
- "area_id": 443,
- "parent_area_id": 6,
- "coin_id": 198,
- "pool_id": 208,
- "watch_time": 3700,
- "draw_times": 3,
- "expire_at": "2021-08-08 23:59:59"
- },
- {
- "url": "https://www.bilibili.com/blackboard/activity-jCibw9bk8l.html",
- "title": "我的世界暑期直播大挑战",
- "description": "我的世界暑期直播大挑战",
- "room_id": 0,
- "area_id": 249,
- "parent_area_id": 6,
- "coin_id": 207,
- "pool_id": 216,
- "watch_time": 7320,
- "draw_times": 3,
- "expire_at": "2021-08-15 23:59:59"
- },
- {
- "url": "https://www.bilibili.com/blackboard/activity-TVWStSTDRs.html",
- "title": "游戏直播嘉年华-极限大挑战",
- "description": "每日观看满10/30/60分钟可获得1/2/3枚心愿币",
- "room_id": 0,
- "area_id": 0,
- "parent_area_id": 6,
- "coin_id": 189,
- "pool_id": 205,
- "watch_time": 0,
- "draw_times": 6,
- "expire_at": "2021-08-15 23:59:59"
- },
- {
- "url": "https://www.bilibili.com/blackboard/activity-Bj5ru05xgK.html",
- "title": "第五人格超级预言家",
- "description": "在第五人格分区累计观看直播10分钟/30分钟/60分钟即可获得 应援券1张/2张/3张",
- "room_id": 0,
- "area_id": 163,
- "parent_area_id": 3,
- "coin_id": 172,
- "pool_id": 184,
- "watch_time": 3700,
- "draw_times": 6,
- "expire_at": "2021-09-01 23:59:59"
- },
- {
- "url": "https://www.bilibili.com/blackboard/activity-3F5JplgtKh.html",
- "title": "《怪物猎人物语2:毁灭之翼》",
- "description": "《怪物猎人物语2:毁灭之翼》",
- "room_id": 0,
- "area_id": 481,
- "parent_area_id": 6,
- "coin_id": 200,
- "pool_id": 213,
- "watch_time": 3700,
- "draw_times": 6,
- "expire_at": "2021-07-22 23:59:59"
- },
- {
- "url": "https://live.bilibili.com/76",
- "title": "守望先锋",
- "description": "OWL2021开始了",
- "room_id": 76,
- "area_id": 87,
- "parent_area_id": 2,
- "coin_id": 131,
- "pool_id": 145,
- "watch_time": 1000,
- "draw_times": 3,
- "expire_at": "2021-09-01 23:59:59"
- },
- {
- "url": "https://live.bilibili.com/828",
- "title": "剑网3大师赛",
- "description": "剑网3大师赛",
- "room_id": 828,
- "area_id": 82,
- "parent_area_id": 2,
- "coin_id": 190,
- "pool_id": 203,
- "watch_time": 3700,
- "draw_times": 11,
- "expire_at": "2021-09-01 23:59:59"
- },
- {
- "url": "https://www.bilibili.com/blackboard/activity-HmADkQuRGP.html",
- "title": "《斩妖行》主播招募",
- "description": "《斩妖行》主播招募",
- "room_id": 0,
- "area_id": 358,
- "parent_area_id": 6,
- "coin_id": 202,
- "pool_id": 209,
- "watch_time": 7320,
- "draw_times": 6,
- "expire_at": "2021-07-23 23:59:59"
- },
- {
- "url": "https://www.bilibili.com/blackboard/activity-YJ7JPyI9iJ.html",
- "title": "《战意》国潮新赛季激励计划",
- "description": "20万奖金助力将军凯旋",
- "room_id": 0,
- "area_id": 383,
- "parent_area_id": 2,
- "coin_id": 199,
- "pool_id": 207,
- "watch_time": 1600,
- "draw_times": 6,
- "expire_at": "2021-08-07 23:59:59"
- },
- {
- "url": "https://live.bilibili.com/11218604",
- "title": "PCL夏季赛",
- "description": "每日在PGI直播间观看,5、10",
- "room_id": 11218604,
- "area_id": 0,
- "parent_area_id": 2,
- "coin_id": 211,
- "pool_id": 218,
- "watch_time": 1000,
- "draw_times": 2,
- "expire_at": "2021-08-29 23:59:59"
}
]
}
\ No newline at end of file
diff --git a/data/filter_library.json b/data/filter_library.json
index 3b3b4ef..2306bcd 100644
--- a/data/filter_library.json
+++ b/data/filter_library.json
@@ -513,7 +513,8 @@
"有jqr",
"有bot",
"jqr",
- "bot"
+ "bot",
+ "腹肌"
]
},
"Common": {
diff --git a/data/latest_version.json b/data/latest_version.json
index b6d26fc..1350ba1 100644
--- a/data/latest_version.json
+++ b/data/latest_version.json
@@ -5,7 +5,7 @@
"source": "https://github.com/lkeme/BiliHelper-personal",
"raw_url": "https://cdn.jsdelivr.net/gh/lkeme/BiliHelper-personal@master/data/latest_version.json",
"purge_url": "https://purge.jsdelivr.net/gh/lkeme/BiliHelper-personal@master/data/latest_version.json",
- "version": "1.0.1.211014",
+ "version": "1.0.2.211115",
"des": "程序有更新,请及时线上查看更新哦~",
- "time": "2021年10月14日20:40:35"
+ "time": "2021年11月15日15:40:35"
}
\ No newline at end of file
diff --git a/src/core/App.php b/src/core/App.php
index b09ada5..c4bdf31 100644
--- a/src/core/App.php
+++ b/src/core/App.php
@@ -159,6 +159,7 @@ class App
'PolishTheMedal',
'VipPrivilege',
'BpConsumption',
+ 'LiveReservation',
// 'Silver', // Abandoned
'Statistics',
diff --git a/src/plugin/BpConsumption.php b/src/plugin/BpConsumption.php
index 7f3c367..34d5a37 100644
--- a/src/plugin/BpConsumption.php
+++ b/src/plugin/BpConsumption.php
@@ -60,7 +60,7 @@ class BpConsumption
'origin' => 'https://pay.bilibili.com',
'referer' => 'https://pay.bilibili.com/paywallet-fe/bb_balance.html'
];
- $ts = Common::getMillisecond();
+ $ts = Common::getUnixTimestamp();
$payload = [
'panelType' => 3,
'platformType' => 3,
diff --git a/src/plugin/CapsuleLottery.php b/src/plugin/CapsuleLottery.php
index b5a9510..7b2888e 100644
--- a/src/plugin/CapsuleLottery.php
+++ b/src/plugin/CapsuleLottery.php
@@ -204,7 +204,7 @@ class CapsuleLottery
];
$payload = [
'pool_id' => $pool_id,
- '_' => Common::getMillisecond()
+ '_' => Common::getUnixTimestamp()
];
$raw = Curl::get('pc', $url, $payload);
// {"code":0,"message":"0","ttl":1,"data":{"id":145,"coin":3,"coin_id":131,"title":"OWL2021","open_num_1":1,"open_num_2":10,"open_num_3":100,"status":0,"gift_list":[{"id":1237,"name":"谢谢参与","num":1,"web_url":"https://i0.hdslb.com/bfs/live/b0fccfb3bac2daae35d7e514a8f6d31530b9add2.png","mobile_url":"https://i0.hdslb.com/bfs/live/b0fccfb3bac2daae35d7e514a8f6d31530b9add2.png","usage":{"text":"谢谢参与","url":""},"type":32,"expire":"当天","gift_type":"7290bc172e5ab9e151eb141749adb9dd"},{"id":1238,"name":"杭州闪电队主场队服","num":1,"web_url":"https://i0.hdslb.com/bfs/live/e7cc2043c85c43f8bdd338a693eef3fe3fc18757.png","mobile_url":"https://i0.hdslb.com/bfs/live/e7cc2043c85c43f8bdd338a693eef3fe3fc18757.png","usage":{"text":"新款杭州闪电队队服","url":""},"type":100024,"expire":"当天","gift_type":"895ff9e63081033072a1bc5694d10095"},{"id":1239,"name":"上海龙之队主场队服","num":1,"web_url":"https://i0.hdslb.com/bfs/live/1e53fc5f1f13c1e2e30eaa7504bc0d939e77df42.png","mobile_url":"https://i0.hdslb.com/bfs/live/1e53fc5f1f13c1e2e30eaa7504bc0d939e77df42.png","usage":{"text":"新款上海龙之队队服","url":""},"type":100024,"expire":"当天","gift_type":"a314efd84276f0be571492823b1c0edb"},{"id":1240,"name":"广州冲锋队主场队服","num":1,"web_url":"https://i0.hdslb.com/bfs/live/cdc33523a1b018ee6af447f528c56848f5556eb8.png","mobile_url":"https://i0.hdslb.com/bfs/live/cdc33523a1b018ee6af447f528c56848f5556eb8.png","usage":{"text":"新款广州冲锋队队服","url":""},"type":100024,"expire":"当天","gift_type":"6d46360bc93b8b07b4c64efb9350579a"},{"id":1241,"name":"谢谢参与","num":1,"web_url":"https://i0.hdslb.com/bfs/live/b0fccfb3bac2daae35d7e514a8f6d31530b9add2.png","mobile_url":"https://i0.hdslb.com/bfs/live/b0fccfb3bac2daae35d7e514a8f6d31530b9add2.png","usage":{"text":"谢谢参与","url":""},"type":32,"expire":"当天","gift_type":"7290bc172e5ab9e151eb141749adb9dd"},{"id":1242,"name":"成都猎人队主场队服","num":1,"web_url":"https://i0.hdslb.com/bfs/live/625c55aa7a020040466cc7a842ea0c57ac4f484c.png","mobile_url":"https://i0.hdslb.com/bfs/live/625c55aa7a020040466cc7a842ea0c57ac4f484c.png","usage":{"text":"新款成都猎人队队服","url":""},"type":100024,"expire":"当天","gift_type":"51ecabc603848979410202a93391cd35"},{"id":1243,"name":"随机战队客场队服","num":1,"web_url":"https://i0.hdslb.com/bfs/live/2198f9659645d28a7fc20c15e93f050a30706016.png","mobile_url":"https://i0.hdslb.com/bfs/live/2198f9659645d28a7fc20c15e93f050a30706016.png","usage":{"text":"随机一件OWL战队客场队服","url":""},"type":100024,"expire":"当天","gift_type":"b2ec92156e57708caf923b1c18309fea"},{"id":1244,"name":"哔哩哔哩月度大会员","num":1,"web_url":"https://i0.hdslb.com/bfs/live/49b6d12eadc81acf68d5378b257df78ec38b4355.png","mobile_url":"https://i0.hdslb.com/bfs/live/49b6d12eadc81acf68d5378b257df78ec38b4355.png","usage":{"text":"bilibili月度大会员","url":""},"type":100024,"expire":"当天","gift_type":"78db25f308b8b8db86ba1a172c2deb35"}],"is_login":true,"list":[{"num":1,"gift":"哔哩哔哩月度大会员","date":"2021-05-10","name":"初夏的戏匣子","web_image":"https://i0.hdslb.com/bfs/live/49b6d12eadc81acf68d5378b257df78ec38b4355.png","mobile_image":"https://i0.hdslb.com/bfs/live/49b6d12eadc81acf68d5378b257df78ec38b4355.png","count":1},{"num":1,"gift":"杭州闪电队主场队服","date":"2021-05-10","name":"hentaiDIAO","web_image":"https://i0.hdslb.com/bfs/live/e7cc2043c85c43f8bdd338a693eef3fe3fc18757.png","mobile_image":"https://i0.hdslb.com/bfs/live/e7cc2043c85c43f8bdd338a693eef3fe3fc18757.png","count":1},{"num":1,"gift":"随机战队客场队服","date":"2021-05-10","name":"哗哗はな","web_image":"https://i0.hdslb.com/bfs/live/2198f9659645d28a7fc20c15e93f050a30706016.png","mobile_image":"https://i0.hdslb.com/bfs/live/2198f9659645d28a7fc20c15e93f050a30706016.png","count":10},{"num":1,"gift":"杭州闪电队主场队服","date":"2021-05-10","name":"Promissio小约定","web_image":"https://i0.hdslb.com/bfs/live/e7cc2043c85c43f8bdd338a693eef3fe3fc18757.png","mobile_image":"https://i0.hdslb.com/bfs/live/e7cc2043c85c43f8bdd338a693eef3fe3fc18757.png","count":1},{"num":1,"gift":"上海龙之队主场队服","date":"2021-05-10","name":"小新笔记","web_image":"https://i0.hdslb.com/bfs/live/1e53fc5f1f13c1e2e30eaa7504bc0d939e77df42.png","mobile_image":"https://i0.hdslb.com/bfs/live/1e53fc5f1f13c1e2e30eaa7504bc0d939e77df42.png","count":10},{"num":1,"gift":"广州冲锋队主场队服","date":"2021-05-10","name":"晚来天欲雪yyy","web_image":"https://i0.hdslb.com/bfs/live/cdc33523a1b018ee6af447f528c56848f5556eb8.png","mobile_image":"https://i0.hdslb.com/bfs/live/cdc33523a1b018ee6af447f528c56848f5556eb8.png","count":1},{"num":1,"gift":"成都猎人队主场队服","date":"2021-05-10","name":"Histo2y","web_image":"https://i0.hdslb.com/bfs/live/625c55aa7a020040466cc7a842ea0c57ac4f484c.png","mobile_image":"https://i0.hdslb.com/bfs/live/625c55aa7a020040466cc7a842ea0c57ac4f484c.png","count":1},{"num":1,"gift":"随机战队客场队服","date":"2021-05-10","name":"蜀黍我最怕亏钱啦","web_image":"https://i0.hdslb.com/bfs/live/2198f9659645d28a7fc20c15e93f050a30706016.png","mobile_image":"https://i0.hdslb.com/bfs/live/2198f9659645d28a7fc20c15e93f050a30706016.png","count":1},{"num":1,"gift":"上海龙之队主场队服","date":"2021-05-10","name":"国王大道修车师傅","web_image":"https://i0.hdslb.com/bfs/live/1e53fc5f1f13c1e2e30eaa7504bc0d939e77df42.png","mobile_image":"https://i0.hdslb.com/bfs/live/1e53fc5f1f13c1e2e30eaa7504bc0d939e77df42.png","count":10},{"num":1,"gift":"杭州闪电队主场队服","date":"2021-05-10","name":"丁马的早晨","web_image":"https://i0.hdslb.com/bfs/live/e7cc2043c85c43f8bdd338a693eef3fe3fc18757.png","mobile_image":"https://i0.hdslb.com/bfs/live/e7cc2043c85c43f8bdd338a693eef3fe3fc18757.png","count":10},{"num":1,"gift":"随机战队客场队服","date":"2021-05-10","name":"丁马的早晨","web_image":"https://i0.hdslb.com/bfs/live/2198f9659645d28a7fc20c15e93f050a30706016.png","mobile_image":"https://i0.hdslb.com/bfs/live/2198f9659645d28a7fc20c15e93f050a30706016.png","count":10},{"num":1,"gift":"上海龙之队主场队服","date":"2021-05-10","name":"-St-John","web_image":"https://i0.hdslb.com/bfs/live/1e53fc5f1f13c1e2e30eaa7504bc0d939e77df42.png","mobile_image":"https://i0.hdslb.com/bfs/live/1e53fc5f1f13c1e2e30eaa7504bc0d939e77df42.png","count":10},{"num":1,"gift":"哔哩哔哩月度大会员","date":"2021-05-03","name":"那个臭打游戏的","web_image":"https://i0.hdslb.com/bfs/live/49b6d12eadc81acf68d5378b257df78ec38b4355.png","mobile_image":"https://i0.hdslb.com/bfs/live/49b6d12eadc81acf68d5378b257df78ec38b4355.png","count":1},{"num":1,"gift":"成都猎人队主场队服","date":"2021-05-03","name":"金小伍","web_image":"https://i0.hdslb.com/bfs/live/625c55aa7a020040466cc7a842ea0c57ac4f484c.png","mobile_image":"https://i0.hdslb.com/bfs/live/625c55aa7a020040466cc7a842ea0c57ac4f484c.png","count":1},{"num":1,"gift":"广州冲锋队主场队服","date":"2021-05-03","name":"不灵梦Blame","web_image":"https://i0.hdslb.com/bfs/live/cdc33523a1b018ee6af447f528c56848f5556eb8.png","mobile_image":"https://i0.hdslb.com/bfs/live/cdc33523a1b018ee6af447f528c56848f5556eb8.png","count":1},{"num":1,"gift":"随机战队客场队服","date":"2021-05-03","name":"幻化叶之韵","web_image":"https://i0.hdslb.com/bfs/live/2198f9659645d28a7fc20c15e93f050a30706016.png","mobile_image":"https://i0.hdslb.com/bfs/live/2198f9659645d28a7fc20c15e93f050a30706016.png","count":10},{"num":1,"gift":"上海龙之队主场队服","date":"2021-05-03","name":"-莉娅菠萝-","web_image":"https://i0.hdslb.com/bfs/live/1e53fc5f1f13c1e2e30eaa7504bc0d939e77df42.png","mobile_image":"https://i0.hdslb.com/bfs/live/1e53fc5f1f13c1e2e30eaa7504bc0d939e77df42.png","count":10},{"num":1,"gift":"杭州闪电队主场队服","date":"2021-05-03","name":"康斯坦丁Constantine.","web_image":"https://i0.hdslb.com/bfs/live/e7cc2043c85c43f8bdd338a693eef3fe3fc18757.png","mobile_image":"https://i0.hdslb.com/bfs/live/e7cc2043c85c43f8bdd338a693eef3fe3fc18757.png","count":1},{"num":1,"gift":"随机战队客场队服","date":"2021-05-03","name":"夜魅三清","web_image":"https://i0.hdslb.com/bfs/live/2198f9659645d28a7fc20c15e93f050a30706016.png","mobile_image":"https://i0.hdslb.com/bfs/live/2198f9659645d28a7fc20c15e93f050a30706016.png","count":1},{"num":1,"gift":"上海龙之队主场队服","date":"2021-05-03","name":"夜魅三清","web_image":"https://i0.hdslb.com/bfs/live/1e53fc5f1f13c1e2e30eaa7504bc0d939e77df42.png","mobile_image":"https://i0.hdslb.com/bfs/live/1e53fc5f1f13c1e2e30eaa7504bc0d939e77df42.png","count":1},{"num":1,"gift":"随机战队客场队服","date":"2021-05-03","name":"蓝岚染","web_image":"https://i0.hdslb.com/bfs/live/2198f9659645d28a7fc20c15e93f050a30706016.png","mobile_image":"https://i0.hdslb.com/bfs/live/2198f9659645d28a7fc20c15e93f050a30706016.png","count":10},{"num":1,"gift":"杭州闪电队主场队服","date":"2021-05-03","name":"用了五级经验卡","web_image":"https://i0.hdslb.com/bfs/live/e7cc2043c85c43f8bdd338a693eef3fe3fc18757.png","mobile_image":"https://i0.hdslb.com/bfs/live/e7cc2043c85c43f8bdd338a693eef3fe3fc18757.png","count":1},{"num":1,"gift":"上海龙之队主场队服","date":"2021-05-03","name":"蜀黍我最怕亏钱啦","web_image":"https://i0.hdslb.com/bfs/live/1e53fc5f1f13c1e2e30eaa7504bc0d939e77df42.png","mobile_image":"https://i0.hdslb.com/bfs/live/1e53fc5f1f13c1e2e30eaa7504bc0d939e77df42.png","count":10},{"num":1,"gift":"杭州闪电队主场队服","date":"2021-05-03","name":"aii01992","web_image":"https://i0.hdslb.com/bfs/live/e7cc2043c85c43f8bdd338a693eef3fe3fc18757.png","mobile_image":"https://i0.hdslb.com/bfs/live/e7cc2043c85c43f8bdd338a693eef3fe3fc18757.png","count":10},{"num":1,"gift":"哔哩哔哩月度大会员","date":"2021-04-26","name":"妄想逃离现实的星轨君","web_image":"https://i0.hdslb.com/bfs/live/49b6d12eadc81acf68d5378b257df78ec38b4355.png","mobile_image":"https://i0.hdslb.com/bfs/live/49b6d12eadc81acf68d5378b257df78ec38b4355.png","count":1},{"num":1,"gift":"杭州闪电队主场队服","date":"2021-04-26","name":"乌鲁乌鲁崽","web_image":"https://i0.hdslb.com/bfs/live/e7cc2043c85c43f8bdd338a693eef3fe3fc18757.png","mobile_image":"https://i0.hdslb.com/bfs/live/e7cc2043c85c43f8bdd338a693eef3fe3fc18757.png","count":1},{"num":1,"gift":"上海龙之队主场队服","date":"2021-04-26","name":"思维回廊","web_image":"https://i0.hdslb.com/bfs/live/1e53fc5f1f13c1e2e30eaa7504bc0d939e77df42.png","mobile_image":"https://i0.hdslb.com/bfs/live/1e53fc5f1f13c1e2e30eaa7504bc0d939e77df42.png","count":1},{"num":1,"gift":"随机战队客场队服","date":"2021-04-26","name":"思维回廊","web_image":"https://i0.hdslb.com/bfs/live/2198f9659645d28a7fc20c15e93f050a30706016.png","mobile_image":"https://i0.hdslb.com/bfs/live/2198f9659645d28a7fc20c15e93f050a30706016.png","count":1},{"num":1,"gift":"上海龙之队主场队服","date":"2021-04-26","name":"LilPank","web_image":"https://i0.hdslb.com/bfs/live/1e53fc5f1f13c1e2e30eaa7504bc0d939e77df42.png","mobile_image":"https://i0.hdslb.com/bfs/live/1e53fc5f1f13c1e2e30eaa7504bc0d939e77df42.png","count":10},{"num":1,"gift":"杭州闪电队主场队服","date":"2021-04-26","name":"一日学滴滴","web_image":"https://i0.hdslb.com/bfs/live/e7cc2043c85c43f8bdd338a693eef3fe3fc18757.png","mobile_image":"https://i0.hdslb.com/bfs/live/e7cc2043c85c43f8bdd338a693eef3fe3fc18757.png","count":10}]}}
@@ -227,7 +227,7 @@ class CapsuleLottery
$payload = [
'id' => $coin_id,
'from' => 'web',
- '-' => Common::getMillisecond()
+ '-' => Common::getUnixTimestamp()
];
$raw = Curl::get('pc', $url, $payload, $headers);
// data -> status 0||2
diff --git a/src/plugin/LiveReservation.php b/src/plugin/LiveReservation.php
new file mode 100644
index 0000000..45961fc
--- /dev/null
+++ b/src/plugin/LiveReservation.php
@@ -0,0 +1,134 @@
+ time() || !getEnable('live_reservation')) {
+ return;
+ }
+ if (getConf('vmids', 'live_reservation') == "") {
+ return;
+ }
+ $vmids = explode(',', getConf('vmids', 'live_reservation'));
+ // 获取目标列表->获取预约列表->执行预约列表
+ foreach ($vmids as $vmid) {
+ $reservation_list = self::fetchReservation($vmid);
+ foreach ($reservation_list as $reservation) {
+ self::reserve($reservation);
+ }
+ }
+ // 1-3小时
+ self::setLock(mt_rand(1, 3) * 60 * 60);
+ }
+
+ /**
+ * @use 尝试预约并抽奖
+ * @param array $data
+ */
+ private static function reserve(array $data)
+ {
+ $url = 'https://api.bilibili.com/x/space/reserve';
+ $headers = [
+ 'content-type' => 'application/x-www-form-urlencoded',
+ 'origin' => 'https://space.bilibili.com',
+ 'referer' => "https://space.bilibili.com/{$data['vmid']}"
+ ];
+ $payload = [
+ 'sid' => $data['sid'],
+ 'jsonp' => 'jsonp',
+ 'csrf' => getCsrf()
+ ];
+ $raw = Curl::post('pc', $url, $payload, $headers);
+ $de_raw = json_decode($raw, true);
+ // {"code":0,"message":"0","ttl":1}
+ Log::info($data['name'] . '|' . $data['vmid'] . '|' . $data['sid']);
+ Log::info($data['text']);
+ Log::info($data['jump_url']);
+
+ if (!$de_raw['code']) {
+ Log::notice("尝试预约并抽奖成功: {$de_raw['message']}");
+ } else {
+ Log::warning("尝试预约并抽奖失败: $raw");
+ }
+
+ }
+
+
+ /**
+ * @use 获取预约列表
+ * @param string $vmid
+ * @return array
+ */
+ private static function fetchReservation(string $vmid): array
+ {
+ $reservation_list = [];
+
+ $url = 'https://api.bilibili.com/x/space/reservation';
+ $payload = [
+ 'vmid' => $vmid,
+ ];
+ $headers = [
+ 'origin' => 'https://space.bilibili.com',
+ 'referer' => "https://space.bilibili.com/$vmid/"
+ ];
+ $raw = Curl::get('pc', $url, $payload, $headers);
+ $de_raw = json_decode($raw, true);
+ // {"code":0,"message":"0","ttl":1,"data":[{"sid":253672,"name":"直播预约:创世之音-虚拟偶像演唱会","total":6382,"stime":1636716437,"etime":1637408100,"is_follow":1,"state":100,"oid":"","type":2,"up_mid":9617619,"reserve_record_ctime":1636731801,"live_plan_start_time":1637406000,"lottery_type":1,"lottery_prize_info":{"text":"预约有奖:小电视年糕抱枕、哔哩哔哩小电视樱花毛绒抱枕大号、哔哩哔哩小夜灯","lottery_icon":"https://i0.hdslb.com/bfs/activity-plat/static/ce06d65bc0a8d8aa2a463747ce2a4752/rgHplMQyiX.png","jump_url":"https://www.bilibili.com/h5/lottery/result?business_id=253672\u0026business_type=10\u0026lottery_id=76240"},"show_total":true,"subtitle":""},{"sid":246469,"name":"直播预约:创世之音-YuNi个人演唱会","total":3555,"stime":1636367836,"etime":1637494500,"is_follow":0,"state":100,"oid":"","type":2,"up_mid":9617619,"reserve_record_ctime":0,"live_plan_start_time":1637492400,"show_total":true,"subtitle":""}]}
+ if (!$de_raw['code']) {
+ foreach ($de_raw['data'] as $data) {
+ $result = self::checkLottery($data);
+ if (!$result) continue;
+ array_push($reservation_list, $result);
+ }
+ } else {
+ Log::warning("获取预约列表失败: $raw");
+ }
+ return $reservation_list;
+ }
+
+
+ /**
+ * @use 检测有效抽奖
+ * @param array $data
+ * @return bool|array
+ */
+ private static function checkLottery(array $data): bool|array
+ {
+ // 已经过了有效时间
+ if ($data['etime'] <= time()) {
+ return false;
+ }
+ // 已经预约过了
+ if ($data['is_follow']) {
+ return false;
+ }
+ // 有预约抽奖
+ if (array_key_exists('lottery_prize_info', $data) && array_key_exists('lottery_type', $data)) {
+ return [
+ 'sid' => $data['sid'], // 246469
+ 'name' => $data['name'], // "直播预约:创世之音-虚拟偶像演唱会"
+ 'vmid' => $data['up_mid'], // 9617619
+ 'jump_url' => $data['lottery_prize_info']['jump_url'], // "https://www.bilibili.com/h5/lottery/result?business_id=253672&business_type=10&lottery_id=76240"
+ 'text' => $data['lottery_prize_info']['text'], // "预约有奖:小电视年糕抱枕、哔哩哔哩小电视樱花毛绒抱枕大号、哔哩哔哩小夜灯"
+ ];
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/plugin/Login.php b/src/plugin/Login.php
index 2e2adda..656e8d4 100644
--- a/src/plugin/Login.php
+++ b/src/plugin/Login.php
@@ -363,9 +363,12 @@ class Login
case 2:
// 异常高危
self::loginFail($mode, $data['data']['message']);
+ case 3:
+ // 需要验证手机号
+ self::loginFail($mode, "需要验证手机号: {$data['data']['url']}");
default:
// 未知错误
- self::loginFail($mode, '未知错误: ' . $data['data']['message']);
+ self::loginFail($mode, '未知错误: ' . json_encode($data));
}
} else {
// 正常登录
diff --git a/src/plugin/Notice.php b/src/plugin/Notice.php
index 458366b..691f512 100644
--- a/src/plugin/Notice.php
+++ b/src/plugin/Notice.php
@@ -18,6 +18,13 @@ class Notice
{
use FilterWords;
+ /**
+ * @var array|string[]
+ */
+ private static array $json_headers = [
+ 'Content-Type' => 'application/json'
+ ];
+
/**
* @use 推送消息
* @param string $type
@@ -151,6 +158,12 @@ class Notice
if (getConf('token', 'notify.debug') && getConf('url', 'notify.debug')) {
self::debug($info);
}
+ if (getConf('token', 'notify.we_com')) {
+ self::weCom($info);
+ }
+ if (getConf('corp_id', 'notify.we_com_app') && getConf('corp_secret', 'notify.we_com_app') && getConf('agent_id', 'notify.we_com_app')) {
+ self::weComApp($info);
+ }
}
/**
@@ -266,10 +279,7 @@ class Notice
'title' => $info['title'],
'content' => $info['content']
];
- $headers = [
- 'Content-Type' => 'application/json'
- ];
- $raw = Curl::put('other', $url, $payload, $headers);
+ $raw = Curl::put('other', $url, $payload, self::$json_headers);
// {"code":200,"msg":"请求成功","data":"发送消息成功"}
$de_raw = json_decode($raw, true);
if ($de_raw['code'] == 200) {
@@ -305,7 +315,7 @@ class Notice
/**
* @use 个人调试使用
- * @doc
+ * @doc https://localhost:8921/doc
* @param array $info
*/
private static function debug(array $info)
@@ -326,7 +336,80 @@ class Notice
} else {
Log::warning("推送消息失败: $raw");
}
+ }
+ /**
+ * @use 企业微信群机器人
+ * @doc https://open.work.weixin.qq.com/api/doc/90000/90136/91770
+ * @param array $info
+ */
+ private static function weCom(array $info)
+ {
+ Log::info('使用weCom推送消息');
+ $url = 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=' . getConf('token', 'notify.we_com');
+
+ $payload = [
+ 'msgtype' => 'markdown',
+ 'markdown' => [
+ 'content' => "{$info['title']} \n\n{$info['content']}"
+ ]
+ ];
+ $raw = Curl::put('other', $url, $payload, self::$json_headers);
+ // {"errcode":0,"errmsg":"ok","created_at":"1380000000"}
+ $de_raw = json_decode($raw, true);
+ if ($de_raw['errcode'] == 0) {
+ Log::notice("推送消息成功: {$de_raw['errmsg']}");
+ } else {
+ Log::warning("推送消息失败: $raw");
+ }
+ }
+
+ /**
+ * @use 企业微信应用消息
+ * @doc https://open.work.weixin.qq.com/wwopen/devtool/interface?doc_id=10167
+ * @param array $info
+ */
+ private static function weComApp(array $info)
+ {
+ Log::info('使用weComApp推送消息');
+ $corp_id = getConf('corp_id', 'notify.we_com_app');
+ $corp_secret = getConf('corp_secret', 'notify.we_com_app');
+ $agent_id = getConf('agent_id', 'notify.we_com_app');
+ $to_user = getConf('to_user', 'notify.we_com_app') ?? '@all';
+
+ // 获取token
+ $url = 'https://qyapi.weixin.qq.com/cgi-bin/gettoken';
+ $payload = [
+ 'corpid' => $corp_id,
+ 'corpsecret' => $corp_secret,
+ ];
+ $raw = Curl::get('other', $url, $payload);
+ // {"errcode":0,"errmsg":"ok","created_at":"1380000000"}
+ $de_raw = json_decode($raw, true);
+ if ($de_raw['errcode'] == 0) {
+ Log::info("access_token 获取成功: {$de_raw['access_token']}");
+ } else {
+ Log::warning("access_token 获取失败: $raw");
+ return;
+ }
+ // 推送
+ $url = 'https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=' . $de_raw['access_token'];
+ $payload = [
+ 'touser' => $to_user,
+ 'msgtype' => 'text',
+ 'agentid' => $agent_id,
+ 'text' => [
+ 'content' => "{$info['title']} \n\n{$info['content']}"
+ ]
+ ];
+ $raw = Curl::put('other', $url, $payload, self::$json_headers);
+ // {"errcode":0,"errmsg":"ok","created_at":"1380000000"}
+ $de_raw = json_decode($raw, true);
+ if ($de_raw['errcode'] == 0) {
+ Log::notice("推送消息成功: {$de_raw['errmsg']}");
+ } else {
+ Log::warning("推送消息失败: $raw");
+ }
}
}
\ No newline at end of file
diff --git a/src/plugin/User.php b/src/plugin/User.php
index b9a77bb..e6db29b 100644
--- a/src/plugin/User.php
+++ b/src/plugin/User.php
@@ -57,7 +57,7 @@ class User
{
$url = 'https://api.live.bilibili.com/User/getUserInfo';
$payload = [
- 'ts' => Common::getMillisecond(),
+ 'ts' => Common::getUnixTimestamp(),
];
$raw = Curl::get('app', $url, Sign::common($payload));
return json_decode($raw, true);
@@ -308,7 +308,7 @@ class User
// {"code":0,"message":"0","ttl":1,"data":{"mid":1234,"vip_type":2,"vip_status":1,"vip_due_date":1667750400000,"vip_pay_type":0,"theme_type":0,"label":{"text":"年度大会员","label_theme":"annual_vip","text_color":"#FFFFFF","bg_style":1,"bg_color":"#FB7299","border_color":""},"avatar_subscript":1,"avatar_subscript_url":"http://i0.hdslb.com/bfs/vip/icon_Certification_big_member_22_3x.png","nickname_color":"#FB7299","is_new_user":false}}
$de_raw = json_decode($raw, true);
if ($de_raw['code'] == 0) {
- if ($de_raw['data']['vip_type'] == 2 && $de_raw['data']['vip_due_date'] > Common::getMillisecond()) {
+ if ($de_raw['data']['vip_type'] == 2 && $de_raw['data']['vip_due_date'] > Common::getUnixTimestamp()) {
Log::debug("获取会员成功 有效年度大会员");
return true;
}
diff --git a/src/tool/Common.php b/src/tool/Common.php
index fc8cd5b..3e2c44d 100644
--- a/src/tool/Common.php
+++ b/src/tool/Common.php
@@ -17,7 +17,7 @@ class Common
* @use 获取十三位时间戳
* @return int
*/
- public static function getMillisecond(): int
+ public static function getUnixTimestamp(): int
{
list($t1, $t2) = explode(' ', microtime());
// return (float)sprintf('%.0f', (floatval($t1) + floatval($t2)) * 1000);