This commit is contained in:
@@ -2,12 +2,13 @@
|
||||
namespace addon\theme_configurator;
|
||||
|
||||
use addon\theme_configurator\model\ThemeConfigModel;
|
||||
use app\common\lib\Plugin;
|
||||
use think\facade\Db;
|
||||
|
||||
/**
|
||||
* 主题可配置项插件主要类
|
||||
*/
|
||||
class ThemeConfigurator
|
||||
class ThemeConfigurator extends Plugin
|
||||
{
|
||||
/** @var array 插件基础信息 */
|
||||
public $info = [
|
||||
@@ -37,18 +38,18 @@ class ThemeConfigurator
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"
|
||||
);
|
||||
} catch (\Throwable $throwable) {
|
||||
return [
|
||||
'status' => 400,
|
||||
'msg' => $throwable->getMessage(),
|
||||
];
|
||||
$this->error = $throwable->getMessage();
|
||||
return false;
|
||||
}
|
||||
|
||||
(new ThemeConfigModel())->initConfig();
|
||||
try {
|
||||
(new ThemeConfigModel())->initConfig();
|
||||
} catch (\Throwable $throwable) {
|
||||
$this->error = $throwable->getMessage();
|
||||
return false;
|
||||
}
|
||||
|
||||
return [
|
||||
'status' => 200,
|
||||
'msg' => lang_plugins('theme_configurator_install_success'),
|
||||
];
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,16 +61,11 @@ class ThemeConfigurator
|
||||
$table = ThemeConfigModel::tableName();
|
||||
Db::execute("DROP TABLE IF EXISTS `{$table}`;");
|
||||
} catch (\Throwable $throwable) {
|
||||
return [
|
||||
'status' => 400,
|
||||
'msg' => $throwable->getMessage(),
|
||||
];
|
||||
$this->error = $throwable->getMessage();
|
||||
return false;
|
||||
}
|
||||
|
||||
return [
|
||||
'status' => 200,
|
||||
'msg' => lang_plugins('theme_configurator_uninstall_success'),
|
||||
];
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user