import { defAxios as request } from '@/utils/http'
/**
 * 获取菜单管理数据接口
 * @returns 菜单数据
 */
export function getMenuList(params) {
  return request({
    url: '/menu/index',
    method: 'GET',
    params
  })
}

/**
 * 获取菜单全部数据接口
 * @returns 菜单全部数据
 */
export function getMenu(params) {
  return request({
    url: '/menu/getMenuAll',
    method: 'GET',
    params
  })
}

/**
 * 添加菜单
 * params
 */
export function menuCreate(data) {
  return request({
    url: '/menu/add',
    method: 'POST',
    data
  })
}

/**
 * 编辑菜单
 * params
 */
export function menuUpdate(data) {
  return request({
    url: '/menu/edit',
    method: 'PUT',
    data
  })
}
/**
 * 删除菜单
 * params
 */
export function deleteMenu(id) {
  return request({
    url: `/menu/delete/${id}`,
    method: 'DELETE'
  })
}
/**
 * 添加按钮
 * params
 */
export function permissionCreate(data) {
  return request({
    url: '/permission/add',
    method: 'POST',
    data
  })
}

/**
 * 编辑按钮
 * params
 */
export function permissionUpdate(data) {
  return request({
    url: '/permission/edit',
    method: 'PUT',
    data
  })
}

/**
 * 删除按钮
 * params
 */
export function deletePermission(ids) {
  return request({
    url: `/permission/delete/${ids}`,
    method: 'DELETE'
  })
}
/**
 * 添加小程序菜单
 * params
 */
export function mpMenuCreate(data) {
  return request({
    url: '/menu/add',
    method: 'POST',
    data
  })
}

/**
 * 编辑小程序菜单
 * params
 */
export function mpMenuUpdate(data) {
  return request({
    url: '/menu/edit',
    method: 'PUT',
    data
  })
}

/**
 * 删除小程序菜单
 * params
 */
export function deleteMpMenu(id) {
  return request({
    url: `/menu/delete/${id}`,
    method: 'DELETE'
  })
}

