diff --git a/README.md b/README.md index c7ba98b..ab41f60 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@
-
+
diff --git a/composer.json b/composer.json
index 4c26e50..37fe30a 100644
--- a/composer.json
+++ b/composer.json
@@ -42,7 +42,7 @@
}
],
"require": {
- "php": ">=8.0",
+ "php": ">=8.1",
"ext-curl": "*",
"ext-openssl": "*",
"ext-sockets": "*",
diff --git a/plugin/MainSite/MainSite.php b/plugin/MainSite/MainSite.php
index 4383162..63a417b 100644
--- a/plugin/MainSite/MainSite.php
+++ b/plugin/MainSite/MainSite.php
@@ -72,6 +72,7 @@ class MainSite extends BasePlugin
/**
* 投币任务
* @return bool
+ * @throws NoLoginException
*/
protected function coinTask(): bool
{
diff --git a/plugin/VipPrivilege/VipPrivilege.php b/plugin/VipPrivilege/VipPrivilege.php
index fe9915e..d370c9d 100644
--- a/plugin/VipPrivilege/VipPrivilege.php
+++ b/plugin/VipPrivilege/VipPrivilege.php
@@ -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;
}
}
diff --git a/src/Env/Env.php b/src/Env/Env.php
index 47a6e1b..842c1e1 100644
--- a/src/Env/Env.php
+++ b/src/Env/Env.php
@@ -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;
}
diff --git a/src/Helpers.php b/src/Helpers.php
index 2843cd7..8d1a8e8 100644
--- a/src/Helpers.php
+++ b/src/Helpers.php
@@ -138,6 +138,9 @@ function getAppHomePage(): string
if (Env::isDocker()) {
// 暂停两分钟后自动退出
sleep($delay);
+ } else {
+ // 其他环境暂停
+ sleep($delay / 4);
}
die();
}