fix claim get create at last month

This commit is contained in:
xiaomlove
2023-07-04 01:00:02 +08:00
parent b951fda138
commit f5616f9979
5 changed files with 59 additions and 4 deletions

View File

@@ -5,6 +5,8 @@ class Plugin
{
private static mixed $providers = null;
private static array $plugins = [];
public function __construct()
{
$this->loadProviders();
@@ -16,6 +18,11 @@ class Plugin
return !empty(self::$providers[$name]['providers']);
}
public static function getById($id) :BasePlugin|null
{
return self::$plugins[$id] ?? null;
}
public function getMainClass($name)
{
if (isset(self::$providers[$name]['providers'][0])) {
@@ -39,7 +46,12 @@ class Plugin
if (defined($constantName) && version_compare(VERSION_NUMBER, constant($constantName), '<')) {
continue;
}
call_user_func([new $className, 'boot']);
$plugin = new $className;
call_user_func([$plugin, 'boot']);
$pluginIdName = "$className::ID";
if (defined($pluginIdName)) {
self::$plugins[constant($pluginIdName)] = $plugin;
}
}
}
}
@@ -58,4 +70,6 @@ class Plugin
}
}