From 0f45c34d63da80c7003a3556a653f93d68d9bcdb Mon Sep 17 00:00:00 2001 From: Lkeme <19500576+lkeme@users.noreply.github.com> Date: Sat, 23 Aug 2025 13:13:26 +0800 Subject: [PATCH] [update] Version 2.5.0 --- README.md | 2 +- docker/entrypoint.sh | 20 ++++---- docs/CHANGELOG.md | 22 ++++++++ docs/DOC.md | 18 +++---- plugin/VipPoint/Traits/PointInfo.php | 4 -- plugin/VipPoint/Traits/SignIn.php | 48 +++++++++-------- plugin/VipPrivilege/VipPrivilege.php | 60 +++++++++++++++++----- profile/example/device/device.yaml | 10 ++-- resources/activity_infos.json | 6 --- resources/version.json | 4 +- src/Api/Api/Pgc/Activity/Score/ApiTask.php | 1 + src/Api/Api/X/VipPoint/ApiTask.php | 16 +++++- 12 files changed, 136 insertions(+), 75 deletions(-) diff --git a/README.md b/README.md index 0af3407..6236201 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@

- + diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index d781c2b..d835022 100644 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -14,9 +14,9 @@ case ${MIRRORS} in git remote set-url origin https://github.com/lkeme/BiliHelper-personal.git ;; "1") - # https://gitdl.cn/ - echo -e "\n ======== \n ${Info} ${GreenBG} 切换源-gitdl.cn(ESP|西班牙) ${Font} \n ======== \n" - git remote set-url origin https://gitdl.cn/https://github.com/lkeme/BiliHelper-personal.git + # https://ghfast.top/ + echo -e "\n ======== \n ${Info} ${GreenBG} 切换源-ghfast.top(US|美国) ${Font} \n ======== \n" + git remote set-url origin https://ghfast.top/https://github.com/lkeme/BiliHelper-personal.git ;; "2") # http://gitclone.com/ @@ -24,19 +24,19 @@ case ${MIRRORS} in git remote set-url origin https://gitclone.com/github.com/lkeme/BiliHelper-personal.git ;; "3") - # https://gh.api.99988866.xyz/ - echo -e "\n ======== \n ${Info} ${GreenBG} 切换源-gh.api.99988866.xyz(US|美国) ${Font} \n ======== \n" - git remote set-url origin https://gh.api.99988866.xyz/https://github.com/lkeme/BiliHelper-personal.git + # https://gh-proxy.com/ + echo -e "\n ======== \n ${Info} ${GreenBG} 切换源-gh-proxy.com(US|美国) ${Font} \n ======== \n" + git remote set-url origin https://gh-proxy.com/https://github.com/lkeme/BiliHelper-personal.git ;; "4") # https://githubfast.com/ - echo -e "\n ======== \n ${Info} ${GreenBG} 切换源-githubfast.com(SG|新加坡) ${Font} \n ======== \n" + echo -e "\n ======== \n ${Info} ${GreenBG} 切换源-githubfast.com(KR|韩国) ${Font} \n ======== \n" git remote set-url origin https://githubfast.com/lkeme/BiliHelper-personal.git ;; "5") - # https://github.moeyy.xyz/ - echo -e "\n ======== \n ${Info} ${GreenBG} 切换源-github.moeyy.xyz(SG|新加坡) ${Font} \n ======== \n" - git remote set-url origin https://github.moeyy.xyz/https://github.com/lkeme/BiliHelper-personal.git + # https://hub.gitmirror.com/ + echo -e "\n ======== \n ${Info} ${GreenBG} 切换源-hub.gitmirror.com(US|美国) ${Font} \n ======== \n" + git remote set-url origin https://hub.gitmirror.com/https://github.com/lkeme/BiliHelper-personal.git ;; *) echo -e "\n ======== \n ${Info} ${GreenBG} 切换源-github.com(RAW|源站) ${Font} \n ======== \n" diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 49d3546..608b6aa 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -8,6 +8,28 @@ [comment]: <> () +## v2.5.0.250823 alpha (2025-08-23) + +### Added + +- + +### Changed + +- 更新设备信息 +- 更新Docker加速镜像 +- 更新Github加速镜像 +- 删除过期活动,保留一个活动模板 + +### Fixed + +- 尝试修复大会员大积分签到信息错误 +- 尝试修复年度大会员领取权益失败 + +### Remarks + +- + ## v2.4.5.250218 alpha (2025-02-18) ### Added diff --git a/docs/DOC.md b/docs/DOC.md index 32727e8..99a1fc3 100644 --- a/docs/DOC.md +++ b/docs/DOC.md @@ -201,15 +201,9 @@ $ php app.php test m:d -P VipPoint,Lottery # 多个插件 ```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" + "https://docker.1ms.run", + "https://docker.1panel.live", + "https://hub.rat.dev" ] } @@ -259,11 +253,11 @@ $ -e VERSION=2 # 使用 版本 V2.x.x(默认选项) ```shell script $ -e MIRRORS=0 # 使用 github.com(RAW|源站|默认) -$ -e MIRRORS=1 # 使用 gitdl.cn(ESP|西班牙) +$ -e MIRRORS=1 # 使用 ghfast.top(US|美国) $ -e MIRRORS=2 # 使用 gitclone.com(CN|中国) -$ -e MIRRORS=3 # 使用 gh.api.99988866.xyz(US|美国) +$ -e MIRRORS=3 # 使用 gh-proxy.com(US|美国) $ -e MIRRORS=4 # 使用 githubfast.com(KR|韩国) -$ -e MIRRORS=5 # 使用 github.moeyy.xyz(HK|香港) +$ -e MIRRORS=5 # 使用 hub.gitmirror.com(US|美国) $ -e MIRRORS=custom -e CUSTOM_CLONE_URL=https://github.com/lkeme/BiliHelper-personal.git # 使用 自定义克隆地址 ``` diff --git a/plugin/VipPoint/Traits/PointInfo.php b/plugin/VipPoint/Traits/PointInfo.php index 07c2349..489d491 100644 --- a/plugin/VipPoint/Traits/PointInfo.php +++ b/plugin/VipPoint/Traits/PointInfo.php @@ -33,10 +33,6 @@ trait PointInfo $score_limit = $data['data']['task_info']['score_limit']; $score_month = $data['data']['task_info']['score_month']; Log::notice("大会员积分@$name: 本月已经获得 $score_month/$score_limit 大积分"); - // - $base_score = $data['data']['task_info']['sing_task_item']['base_score']; - $sign_count = $data['data']['task_info']['sing_task_item']['count']; - Log::notice("大会员积分@$name: 已连续签到 $sign_count 天 获取到 $base_score 个大积分"); return true; } diff --git a/plugin/VipPoint/Traits/SignIn.php b/plugin/VipPoint/Traits/SignIn.php index ebdc1c9..19c22cf 100644 --- a/plugin/VipPoint/Traits/SignIn.php +++ b/plugin/VipPoint/Traits/SignIn.php @@ -17,6 +17,7 @@ use Bhp\Api\Api\Pgc\Activity\Score\ApiTask; +use Bhp\Api\Api\X\VipPoint\ApiTask as VipPointApiTask; use Bhp\Log\Log; trait SignIn @@ -44,13 +45,20 @@ trait SignIn */ protected function _signIn(string $name): bool { + // {"code":xxxx,"message":"xxxxx"} // {"code":0,"message":"success"} + // {"code":6007000,"message":"签到失败,请刷新重试"} 判断为重复签到 $response = ApiTask::sign(); - // if ($response['code']) { - Log::warning("大会员积分@{$name}: 签到失败" . json_encode($response)); + if (isset($response['message']) && $response['message'] == '签到失败,请刷新重试') { + Log::warning("大会员积分@{$name}: 今日已签到,重复签到"); + return true; + } + Log::warning("大会员积分@{$name}: 签到失败,错误码 {$response['code']} " . json_encode($response, JSON_UNESCAPED_UNICODE)); return false; } + // + Log::info("大会员积分@{$name}: 签到成功"); return true; } @@ -58,20 +66,25 @@ trait SignIn /** * 是否已经签到 * @param array $data - * @param string $now - * @return int + * @param string $name + * @return bool */ - protected function _isSignIn(array $data, string $now): int + protected function _isSignIn(array $data, string $name): bool { - $histories = $data['data']['task_info']['sing_task_item']['histories'] ?? []; - // - foreach ($histories as $h) { - // day: "2022-09-10" is_today: true score: 5 signed: true - if ($h['day'] == $now && isset($h['is_today']) && $h['signed'] && $h['is_today']) { - return $h['score']; - } + $response = VipPointApiTask::homepageCombine(); + if ($response['code']) { + Log::warning('大会员积分: 获取签到信息失败'); + return false; } - return 0; + // + $data = $response['data']; + if ($data['task']['signed']) { + Log::info("大会员积分@{$name}: 今日已完成签到,已有积分 {$data['point_info']['point']}分,剩余 {$data['task']['task_count']} 项积分任务待完成"); + return true; + } + // + Log::info("大会员积分@{$name}: 今日未完成签到,已有积分 {$data['point_info']['point']}分,剩余 {$data['task']['task_count']} 项积分任务待完成"); + return false; } @@ -83,14 +96,7 @@ trait SignIn */ protected function isSignIn(array $data, string $name): bool { - $now = date("Y-m-d"); - // - if ($score = $this->_isSignIn($data, $now)) { - Log::info("大会员积分@{$name}: 今日完成签到,获得积分 {$score}分 已累计签到 {$data['data']['task_info']['sing_task_item']['count']}天"); - return true; - } - - return false; + return $this->_isSignIn($data, $name); } } diff --git a/plugin/VipPrivilege/VipPrivilege.php b/plugin/VipPrivilege/VipPrivilege.php index 1922aa3..5053a20 100644 --- a/plugin/VipPrivilege/VipPrivilege.php +++ b/plugin/VipPrivilege/VipPrivilege.php @@ -23,6 +23,7 @@ use Bhp\Plugin\Plugin; use Bhp\TimeLock\TimeLock; use Bhp\User\User; use Bhp\Util\Exceptions\NoLoginException; +use function Amp\delay; class VipPrivilege extends BasePlugin { @@ -81,6 +82,19 @@ class VipPrivilege extends BasePlugin 17 => '大会员专享游戏优惠券(游戏优惠券)', ]; + /** + * @var array|string[] + */ + protected array $privilege_blacklists = [ + 18 => '淘宝账号查询异常,请退出重试', + 20 => '饿了么领取活动已经过期~', + 21 => '超大会员身份状态异常', + 24 => '请求错误', // 未知 + 25 => '请求错误', // 未知 + 26 => '请求错误', // 正式大会员专属票务优惠券-229减18 + 27 => '请求错误', // 正式漫展-大会员专属票务优惠券169减10 + ]; + /** * @param Plugin $plugin */ @@ -117,24 +131,38 @@ class VipPrivilege extends BasePlugin // 如果为年度大会员 if (!User::isYearVip('大会员权益')) return; // - $privilege_list = $this->myVipPrivilege(); + $privilege_list = $this->filterCanReceive($this->myVipPrivilege()); + Log::info('大会员权益: 可领取权益数 ' . count($privilege_list)); // foreach ($privilege_list as $privilege) { - // 是否领取状态 - if ($privilege['state'] != 0) { - continue; - } - // 特殊类型 - if ($privilege['type'] != 9) { - // 领取奖励 - $this->myVipPrivilegeReceive($privilege['type']); - } else { + // 随机延迟 5-10秒 + delay(mt_rand(5, 10)); + // 特殊类型 9 每日10经验 需要观看视频 + if ($privilege['type'] == 9) { // 领取额外经验 $this->myVipExtraExp(); + continue; } + // 领取奖励 + $this->myVipPrivilegeReceive($privilege['type']); } } + /** + * 过滤可领取的权益 + * @param array $privilege_list + * @return array + */ + protected function filterCanReceive(array $privilege_list): array + { + // 是否领取状态 0:未兑换 | 1:已兑换 | 2:未完成(若需要完成) + // 黑名单 + return array_filter($privilege_list, function ($privilege) { + return $privilege['state'] == 0 && !array_key_exists($privilege['type'], $this->privilege_blacklists); + }); + } + + /** * 大会员额外经验 * @return void @@ -144,7 +172,9 @@ class VipPrivilege extends BasePlugin $response = ApiExperience::add(); // if (!$response['code']) { - Log::info("大会员额外经验: 领取额外经验成功"); + Log::notice("大会员额外经验: 领取额外经验成功"); + } else if ($response['code'] == 69198) { + Log::info("大会员额外经验: 用户经验已经领取"); } else { Log::warning("大会员额外经验: 领取额外经验失败 {$response['code']} -> {$response['message']}"); } @@ -177,6 +207,7 @@ class VipPrivilege extends BasePlugin protected function myVipPrivilegeReceive(int $type): void { // {"code":0,"message":"0","ttl":1} + // {"code":73319,"message":"73319","ttl":1} // {-101: "账号未登录", -111: "csrf 校验失败", -400: "请求错误", 69800: "网络繁忙 请稍后重试", 69801: "你已领取过该权益"} $response = ApiPrivilege::receive($type); // 判断type是否在$this->privilege @@ -190,10 +221,13 @@ class VipPrivilege extends BasePlugin case -101: throw new NoLoginException($response['message']); case 0: - Log::notice("大会员权益: 领取权益 {$this->privilege[$type]} 成功"); + Log::notice("大会员权益: 领取权益[$type]成功"); + break; + case 73319: + Log::warning("大会员权益: 领取权益[$type]失败,暂时未到可领取时间"); break; default: - Log::warning("大会员权益: 领取权益 {$this->privilege[$type]} 失败 {$response['code']} -> {$response['message']}"); + Log::warning("大会员权益: 领取权益[$type]失败, {$response['code']} -> {$response['message']}"); break; } } diff --git a/profile/example/device/device.yaml b/profile/example/device/device.yaml index ee03bf2..c87c377 100644 --- a/profile/example/device/device.yaml +++ b/profile/example/device/device.yaml @@ -3,8 +3,8 @@ device_version: 0.0.1 app: bili_a: # Android package: "tv.danmaku.bili" - version: "8.51.0" - build: "8510500" + version: "8.59.0" + build: "8590200" channel: "bili" device: "phone" mobi_app: "android" @@ -15,7 +15,7 @@ app: secret_key: "NTYwYzUyY2NkMjg4ZmVkMDQ1ODU5ZWQxOGJmZmQ5NzM" app_key_n: "NzgzYmJiNzI2NDQ1MWQ4Mg==" secret_key_n: "MjY1MzU4M2M4ODczZGVhMjY4YWI5Mzg2OTE4YjFkNjU=" - statistics: '{"appId":1,"platform":3,"version":"8.51.0","abtest":""}' + statistics: '{"appId":1,"platform":3,"version":"8.59.0","abtest":""}' bili_i: # IOS app_key: "MjdlYjUzZmM5MDU4ZjhjMw==" secret_key: "YzJlZDUzYTc0ZWVlZmUzY2Y5OWZiZDAxZDhjOWMzNzU=" @@ -30,6 +30,6 @@ platform: model: "MuMu" network: "2" # 1 流量 2 WIFI headers: - other_ua: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36" - pc_ua: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0" + other_ua: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36" + pc_ua: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0" app_ua: "Mozilla/5.0 BiliDroid/${app.bili_a.version} (bbcallen@gmail.com) os/${platform.system.os} model/${device.model} mobi_app/${app.bili_a.mobi_app}build/${app.bili_a.build} channel/${app.bili_a.channel} innerVer/${app.bili_a.build}osVer/${platform.system.os_ver} network/${platform.system.network}" diff --git a/resources/activity_infos.json b/resources/activity_infos.json index a3e7fff..4b9726b 100644 --- a/resources/activity_infos.json +++ b/resources/activity_infos.json @@ -2,12 +2,6 @@ "code": 200, "remarks": "有需要可以自己添加,或者提pr", "data": [ - { - "sid": "newLottery_c66923dc-8d33-11ef-ab09-e8b47005dab5", - "title": "1年1度抄级坦白局", - "url": "https://www.bilibili.com/blackboard/activity-938uLTfAXW.html", - "update_time": "2024-10-27 19:22:55" - }, { "sid": "newLottery_b2745c0e-8621-11ef-ab09-e8b47005dab5", "title": "海露 你做个人吧", diff --git a/resources/version.json b/resources/version.json index c480136..7e3bcf1 100644 --- a/resources/version.json +++ b/resources/version.json @@ -8,7 +8,7 @@ "dev_raw_url": "https://raw.githubusercontent.com/lkeme/BiliHelper-personal/dev/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", - "version": "2.4.5.250218", - "update_time": "2025-02-18", + "version": "2.5.0.250823", + "update_time": "2025-08-23", "update_description": "程序有更新,请及时线上查看更新哦~" } diff --git a/src/Api/Api/Pgc/Activity/Score/ApiTask.php b/src/Api/Api/Pgc/Activity/Score/ApiTask.php index 9a4751f..27a63d7 100644 --- a/src/Api/Api/Pgc/Activity/Score/ApiTask.php +++ b/src/Api/Api/Pgc/Activity/Score/ApiTask.php @@ -43,6 +43,7 @@ class ApiTask // $payload = [ 'disable_rcmd' => '0', + 'buvid' => Request::getBuvid(), 'csrf' => $user['csrf'], 'statistics' => getDevice('app.bili_a.statistics'), ]; diff --git a/src/Api/Api/X/VipPoint/ApiTask.php b/src/Api/Api/X/VipPoint/ApiTask.php index ad6328b..ce9818d 100644 --- a/src/Api/Api/X/VipPoint/ApiTask.php +++ b/src/Api/Api/X/VipPoint/ApiTask.php @@ -30,7 +30,8 @@ class ApiTask ]; /** - * 用户信息 + * 任务界面信息 + * https://big.bilibili.com/mobile/bigPoint/task * @return array */ public static function combine(): array @@ -40,4 +41,17 @@ class ApiTask $headers = array_merge([], self::$headers); return Request::getJson(true, 'app', $url, Sign::common($payload), $headers); } + + /** + * 主页界面信息 + * https://big.bilibili.com/mobile/bigPoint + * @return array + */ + public static function homepageCombine(): array + { + $url = 'https://api.bilibili.com/x/vip_point/homepage/combine'; + $payload = []; + $headers = array_merge([], self::$headers); + return Request::getJson(true, 'app', $url, Sign::common($payload), $headers); + } }