mirror of
https://github.com/lkeme/BiliHelper-personal.git
synced 2025-12-19 01:20:08 +08:00
[fix] VipPrivilege
This commit is contained in:
parent
0c32ce0256
commit
5b814434a8
@ -17,7 +17,7 @@
|
||||
<p align="center">
|
||||
|
||||
<img src="https://img.shields.io/badge/Version-2.0.0.220822-orange.svg?longCache=true&style=for-the-badge">
|
||||
<img src="https://img.shields.io/badge/PHP-8.0+-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/License-mit-blue.svg?longCache=true&style=for-the-badge">
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=8.0",
|
||||
"php": ">=8.1",
|
||||
"ext-curl": "*",
|
||||
"ext-openssl": "*",
|
||||
"ext-sockets": "*",
|
||||
|
||||
@ -72,6 +72,7 @@ class MainSite extends BasePlugin
|
||||
/**
|
||||
* 投币任务
|
||||
* @return bool
|
||||
* @throws NoLoginException
|
||||
*/
|
||||
protected function coinTask(): bool
|
||||
{
|
||||
|
||||
@ -21,6 +21,7 @@ use Bhp\Plugin\BasePlugin;
|
||||
use Bhp\Plugin\Plugin;
|
||||
use Bhp\TimeLock\TimeLock;
|
||||
use Bhp\User\User;
|
||||
use Bhp\Util\Exceptions\NoLoginException;
|
||||
|
||||
class VipPrivilege extends BasePlugin
|
||||
{
|
||||
@ -43,8 +44,11 @@ class VipPrivilege extends BasePlugin
|
||||
*/
|
||||
protected array $privilege = [
|
||||
0 => '未知奖励',
|
||||
1 => 'B币劵',
|
||||
2 => '会员购优惠券'
|
||||
1 => '年度专享B币赠送',
|
||||
2 => '年度专享会员购优惠券',
|
||||
3 => '年度专享漫画礼包',
|
||||
4 => '大会员专享会员购包邮券',
|
||||
5 => '年度专享漫画礼包',
|
||||
];
|
||||
|
||||
/**
|
||||
@ -61,6 +65,7 @@ class VipPrivilege extends BasePlugin
|
||||
/**
|
||||
* 执行
|
||||
* @return void
|
||||
* @throws NoLoginException
|
||||
*/
|
||||
public function execute(): void
|
||||
{
|
||||
@ -75,6 +80,7 @@ class VipPrivilege extends BasePlugin
|
||||
/**
|
||||
* 领取
|
||||
* @return void
|
||||
* @throws NoLoginException
|
||||
*/
|
||||
protected function receiveTask(): void
|
||||
{
|
||||
@ -114,16 +120,23 @@ class VipPrivilege extends BasePlugin
|
||||
/**
|
||||
* 领取我的大会员权益
|
||||
* @param int $type
|
||||
* @throws NoLoginException
|
||||
*/
|
||||
protected function myVipPrivilegeReceive(int $type): void
|
||||
{
|
||||
// {"code":0,"message":"0","ttl":1}
|
||||
// {-101: "账号未登录", -111: "csrf 校验失败", -400: "请求错误", 69800: "网络繁忙 请稍后重试", 69801: "你已领取过该权益"}
|
||||
$response = ApiPrivilege::receive($type);
|
||||
//
|
||||
if ($response['code']) {
|
||||
Log::warning("大会员权益: 领取权益 {$this->privilege[$type]} 失败 {$response['code']} -> {$response['message']}");
|
||||
} else {
|
||||
Log::warning("大会员权益: 领取权益 {$this->privilege[$type]} 成功");
|
||||
switch ($response['code']) {
|
||||
case -101:
|
||||
throw new NoLoginException($response['message']);
|
||||
case 0:
|
||||
Log::warning("大会员权益: 领取权益 {$this->privilege[$type]} 成功");
|
||||
break;
|
||||
default:
|
||||
Log::warning("大会员权益: 领取权益 {$this->privilege[$type]} 失败 {$response['code']} -> {$response['message']}");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -95,8 +95,8 @@ class Env extends BaseResource
|
||||
if (PHP_SAPI != 'cli') {
|
||||
failExit('Please run this script from command line .');
|
||||
}
|
||||
if (version_compare(PHP_VERSION, '8.0.0', '<')) {
|
||||
failExit('Please upgrade PHP version < 8.0.0 .');
|
||||
if (version_compare(PHP_VERSION, '8.1.0', '<')) {
|
||||
failExit('Please upgrade PHP version > 8.1.0 .');
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -138,6 +138,9 @@ function getAppHomePage(): string
|
||||
if (Env::isDocker()) {
|
||||
// 暂停两分钟后自动退出
|
||||
sleep($delay);
|
||||
} else {
|
||||
// 其他环境暂停
|
||||
sleep($delay / 4);
|
||||
}
|
||||
die();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user