fix: 静态变量初始化bug

This commit is contained in:
Ying
2022-11-29 13:59:21 +08:00
parent 1c0c886937
commit 9a48186d35

View File

@@ -44,7 +44,7 @@ class Plugin extends AdminController
* 错误信息 * 错误信息
* @var mixed * @var mixed
*/ */
static mixed $errData; static mixed $ServerBody = '';
/** /**
* 获取本地插件列表 * 获取本地插件列表
@@ -93,7 +93,7 @@ class Plugin extends AdminController
self::enabled($name); self::enabled($name);
} catch (\Throwable $th) { } catch (\Throwable $th) {
recursive_delete($pluginPath); recursive_delete($pluginPath);
return $this->error($th->getMessage(), null, self::$errData, $th->getCode()); return $this->error($th->getMessage(), null, self::$ServerBody, $th->getCode());
} }
return $this->success('插件安装成功', null, get_plugin_config($name, true)); return $this->success('插件安装成功', null, get_plugin_config($name, true));
@@ -187,7 +187,7 @@ class Plugin extends AdminController
self::executeSql($name); self::executeSql($name);
self::enabled($name); self::enabled($name);
} catch (\Throwable $th) { } catch (\Throwable $th) {
return $this->error($th->getMessage(), null, self::$errData, $th->getCode()); return $this->error($th->getMessage(), null, self::$ServerBody, $th->getCode());
} }
return $this->success('插件更新成功', null, $data); return $this->success('插件更新成功', null, $data);
@@ -339,7 +339,7 @@ class Plugin extends AdminController
$filePath = plugin_path() . $name . '.zip'; $filePath = plugin_path() . $name . '.zip';
write_file($filePath, $content); write_file($filePath, $content);
} else { } else {
self::$errData = $body['data']; self::$ServerBody = $body['data'];
throw new \Exception($body['msg'], $body['code']); throw new \Exception($body['msg'], $body['code']);
} }