内容模型功能完成
This commit is contained in:
@@ -20,11 +20,13 @@ class Addons extends Base {
|
||||
/**
|
||||
* @title 插件列表
|
||||
*/
|
||||
public function index(AddonsM $addons, $refresh = 0) {
|
||||
public function index($refresh = 0) {
|
||||
$map = [];
|
||||
if ($refresh) {
|
||||
$addons->refresh();
|
||||
AddonsM::refreshAddons();
|
||||
}
|
||||
$list = $addons->order('id desc')->paginate($this->request->pageConfig);
|
||||
|
||||
$list = AddonsM::where($map)->order('id desc')->paginate($this->request->pageConfig);
|
||||
|
||||
$this->data = array(
|
||||
'list' => $list,
|
||||
@@ -49,17 +51,16 @@ class Addons extends Base {
|
||||
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('您没有创建目录写入权限,无法使用此功能');
|
||||
}
|
||||
$this->setMeta("添加插件");
|
||||
// $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();
|
||||
}
|
||||
}
|
||||
@@ -220,7 +221,6 @@ class Addons extends Base {
|
||||
* @title 添加钩子
|
||||
*/
|
||||
public function addhook() {
|
||||
$hooks = model('Hooks');
|
||||
if ($this->request->isPost()) {
|
||||
$result = $hooks->change();
|
||||
if ($result !== false) {
|
||||
@@ -229,13 +229,10 @@ class Addons extends Base {
|
||||
return $this->error($hooks->getError());
|
||||
}
|
||||
} else {
|
||||
$keylist = $hooks->getaddons();
|
||||
$data = array(
|
||||
'keyList' => $keylist,
|
||||
$this->data = array(
|
||||
'keyList' => Hooks::$keylist,
|
||||
);
|
||||
$this->assign($data);
|
||||
$this->setMeta('编辑钩子');
|
||||
return $this->fetch('public/edit');
|
||||
return $this->fetch('admin/public/edit');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user