插件机制完善

This commit is contained in:
2020-04-04 14:20:01 +08:00
parent 2f4386f196
commit ba37debc0e
13 changed files with 174 additions and 117 deletions

View File

@@ -23,7 +23,7 @@ class Addons extends Base {
public function index($refresh = 0) {
$map = [];
if ($refresh) {
AddonsM::refreshAddons();
AddonsM::refreshAddons($this->app->getRootPath() . 'addons' . DIRECTORY_SEPARATOR);
}
$list = AddonsM::where($map)->order('id desc')->paginate($this->request->pageConfig);
@@ -36,33 +36,9 @@ class Addons extends Base {
}
/**
* @title 添加插件
* @title 删除插件
*/
public function add() {
if ($this->request->isPost()) {
$data = $this->addons->create();
if ($data) {
if ($result) {
return $this->success("创建成功!", url('admin/addons/index'));
} else {
return $this->error("创建失败!");
}
} else {
return $this->error($this->addons->getError());
}
} else {
// $hooks = db('Hooks')->field('name,description')->select();
// $this->assign('Hooks', $hooks);
// $hook = db('Hooks')->field(true)->select();
// foreach ($hook as $key => $value) {
// $addons_opt[$value['name']] = $value['name'];
// }
// $addons_opt = array(array('type' => 'select', 'opt' => $addons_opt));
// if (!is_writable(SENT_ADDON_PATH)) {
// return $this->error('您没有创建目录写入权限,无法使用此功能');
// }
return $this->fetch();
}
public function del() {
}
/**