52 行
1.3 KiB
PHP
52 行
1.3 KiB
PHP
<?php
|
|
|
|
namespace addons\shopro_aliyun_express;
|
|
|
|
use addons\shopro_aliyun_express\library\Installer;
|
|
use app\common\library\Menu;
|
|
use think\Addons;
|
|
|
|
class Shopro_aliyun_express extends Addons
|
|
{
|
|
public function install()
|
|
{
|
|
Installer::run();
|
|
return true;
|
|
}
|
|
|
|
public function uninstall()
|
|
{
|
|
$sql = file_get_contents(__DIR__ . '/uninstall.sql');
|
|
$prefix = config('database.prefix');
|
|
$sql = str_replace('__PREFIX__', $prefix, $sql);
|
|
$statements = array_filter(array_map('trim', explode(';', $sql)));
|
|
foreach ($statements as $statement) {
|
|
if ($statement !== '') {
|
|
try {
|
|
\think\Db::execute($statement);
|
|
} catch (\Exception $e) {
|
|
// ignore
|
|
}
|
|
}
|
|
}
|
|
Menu::delete('shopro_aliyun_express');
|
|
Menu::delete('shopro_aliyun_express/config');
|
|
Menu::delete('shopro_aliyun_express/query');
|
|
return true;
|
|
}
|
|
|
|
public function enable()
|
|
{
|
|
Menu::enable('shopro_aliyun_express/config');
|
|
Menu::enable('shopro_aliyun_express/query');
|
|
return true;
|
|
}
|
|
|
|
public function disable()
|
|
{
|
|
Menu::disable('shopro_aliyun_express/config');
|
|
Menu::disable('shopro_aliyun_express/query');
|
|
return true;
|
|
}
|
|
}
|