扩展插件完善优化
This commit is contained in:
@@ -205,15 +205,19 @@ class Addons extends Base {
|
||||
*/
|
||||
public function addhook() {
|
||||
if ($this->request->isPost()) {
|
||||
$result = $hooks->change();
|
||||
$data = $this->request->post();
|
||||
$data['addons'] = isset($data['addons'][0]) ? $data['addons'][0] : [];
|
||||
|
||||
$result = Hooks::create($data);
|
||||
if ($result !== false) {
|
||||
return $this->success("修改成功");
|
||||
return $this->success("添加成功");
|
||||
} else {
|
||||
return $this->error($hooks->getError());
|
||||
return $this->error('添加失败!');
|
||||
}
|
||||
} else {
|
||||
$keylist = Hooks::getaddons([]);
|
||||
$this->data = array(
|
||||
'keyList' => Hooks::$keylist,
|
||||
'keyList' => $keylist,
|
||||
);
|
||||
return $this->fetch('admin/public/edit');
|
||||
}
|
||||
@@ -225,12 +229,13 @@ class Addons extends Base {
|
||||
public function edithook($id) {
|
||||
if ($this->request->isPost()) {
|
||||
$data = $this->request->post();
|
||||
$data['addons'] = isset($data['addons'][0]) ? $data['addons'][0] : [];
|
||||
|
||||
$result = Hooks::update($data, ['id' => $data['id']]);
|
||||
if ($result !== false) {
|
||||
return $this->success("修改成功");
|
||||
} else {
|
||||
return $this->error($hooks->getError());
|
||||
return $this->error('修改失败!');
|
||||
}
|
||||
} else {
|
||||
$info = Hooks::find($id);
|
||||
|
||||
@@ -29,6 +29,10 @@ class Base extends BaseC {
|
||||
if ($template == '') {
|
||||
$template = str_replace(".", "@", strtolower($this->request->controller())) . "/" . $this->request->action();
|
||||
}
|
||||
if($this->request->param('addon')){
|
||||
$this->tpl_config['view_depr'] = '/';
|
||||
$this->tpl_config['view_dir_name'] = 'addons' . DIRECTORY_SEPARATOR . $this->request->param('addon') . DIRECTORY_SEPARATOR . 'view';
|
||||
}
|
||||
|
||||
View::config($this->tpl_config);
|
||||
View::assign($this->data);
|
||||
|
||||
Reference in New Issue
Block a user