mirror of
https://gitee.com/apiadmin/ApiAdmin.git
synced 2025-04-06 03:58:00 +08:00
added 新增菜单状态修改
This commit is contained in:
parent
ca028dac85
commit
65c5d11c63
@ -9,6 +9,7 @@ namespace app\admin\controller;
|
|||||||
|
|
||||||
|
|
||||||
use app\model\ApiMenu;
|
use app\model\ApiMenu;
|
||||||
|
use app\util\ReturnCode;
|
||||||
|
|
||||||
class Menu extends Base {
|
class Menu extends Base {
|
||||||
|
|
||||||
@ -56,30 +57,20 @@ class Menu extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 显示菜单
|
* 菜单状态编辑
|
||||||
* @author zhaoxiang <zhaoxiang051405@gmail.com>
|
* @author zhaoxiang <zhaoxiang051405@gmail.com>
|
||||||
*/
|
*/
|
||||||
public function open() {
|
public function changeStatus() {
|
||||||
$id = I('post.id');
|
$id = $this->request->get('id');
|
||||||
$res = D('ApiMenu')->where(array('id' => $id))->save(array('hide' => 0));
|
$status = $this->request->get('status');
|
||||||
|
$res = ApiMenu::update([
|
||||||
|
'id' => $id,
|
||||||
|
'hide' => $status
|
||||||
|
]);
|
||||||
if ($res === false) {
|
if ($res === false) {
|
||||||
$this->ajaxError('操作失败');
|
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR, '操作失败');
|
||||||
} else {
|
} else {
|
||||||
$this->ajaxSuccess('添加成功');
|
return $this->buildSuccess([]);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 隐藏菜单
|
|
||||||
* @author zhaoxiang <zhaoxiang051405@gmail.com>
|
|
||||||
*/
|
|
||||||
public function close() {
|
|
||||||
$id = I('post.id');
|
|
||||||
$res = D('ApiMenu')->where(array('id' => $id))->save(array('hide' => 1));
|
|
||||||
if ($res === false) {
|
|
||||||
$this->ajaxError('操作失败');
|
|
||||||
} else {
|
|
||||||
$this->ajaxSuccess('添加成功');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,10 @@ return [
|
|||||||
'admin/Menu/index',
|
'admin/Menu/index',
|
||||||
['method' => 'get', 'after_behavior' => $afterBehavior]
|
['method' => 'get', 'after_behavior' => $afterBehavior]
|
||||||
],
|
],
|
||||||
|
'Menu/changeStatus' => [
|
||||||
|
'admin/Menu/changeStatus',
|
||||||
|
['method' => 'get', 'after_behavior' => $afterBehavior]
|
||||||
|
],
|
||||||
'__miss__' => ['admin/Miss/index'],
|
'__miss__' => ['admin/Miss/index'],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user