feat: 新增菜单设置排序值接口
This commit is contained in:
@@ -440,10 +440,10 @@ class Menu
|
||||
$param = request()->param(['title' => '']);
|
||||
|
||||
$menus = SysMenuModel::withoutField([
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at'
|
||||
])
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at'
|
||||
])
|
||||
->with(['menu_ability_permission'])
|
||||
->withSearch(['title'], [
|
||||
'title' => $param['title'] ?? null
|
||||
@@ -460,6 +460,25 @@ class Menu
|
||||
return $menus;
|
||||
}
|
||||
|
||||
// 设置排序值
|
||||
public function sort()
|
||||
{
|
||||
$id = request()->param('id');
|
||||
$sort = request()->post('sort');
|
||||
|
||||
$menu = SysMenuModel::bypk($id)->find();
|
||||
if ($menu->isEmpty()) {
|
||||
return error('请确认操作对象是否存在');
|
||||
}
|
||||
|
||||
$menu->sort = $sort;
|
||||
if (!$menu->save()) {
|
||||
return error('操作失败');
|
||||
}
|
||||
|
||||
return success('操作成功');
|
||||
}
|
||||
|
||||
// 删除数据
|
||||
public function delete()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user