扩展插件完善优化

This commit is contained in:
2020-04-16 22:16:28 +08:00
parent 5439ccd8fb
commit ce9b63dda1
7 changed files with 48 additions and 29 deletions

View File

@@ -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);