import request from '@/utils/request'

/**
 * 查询排行榜数据
 * @param {*} query
 * @returns {Promise}
 */
export function listRanking(query) {
  return request({
    url: '/productranking/list',
    method: 'get',
    params: query
  })
}

/**
 * 查询排行榜分类数据
 * @param {*} query
 * @returns {Promise}
 */
export function listRankingCategory(query) {
  return request({
    url: '/ranking/category/list',
    method: 'get',
    params: query
  })
}

/**
 * 查询排行榜趋势数据
 * @param {*} query
 * @returns {Promise}
 */
export function getRankingTrend(query) {
  return request({
    url: '/productranking/select',
    method: 'get',
    params: query
  })
}

/**
 * 查询排行榜分类详情
 * @param {*} id
 * @returns {Promise}
 */
export function getRankingCategory(id) {
  return request({
    url: `/ranking/category/${id}`,
    method: 'get'
  })
}

/**
 * 新增排行榜分类数据
 * @param {*} data
 * @returns {Promise}
 */
export function addRankingCategory(data) {
  return request({
    url: '/ranking/category',
    method: 'post',
    data
  })
}

/**
 * 修改排行榜分类数据
 * @param {*} data
 * @returns {Promise}
 */
export function updateRankingCategory(data) {
  return request({
    url: '/ranking/category',
    method: 'put',
    data
  })
}

/**
 * 查询库存数据
 * @param {*} query
 * @returns {Promise}
 */
export function listInventory(query) {
  return request({
    url: '/inventory/param',
    method: 'get',
    params: query
  })
}

/**
 * 删除库存数据
 * @param {*} id
 * @returns  {Promise}
 */
export function deleteInventory(id) {
  return request({
    url: `/inventory/${id}`,
    method: 'delete'
  })
}

/**
 * 查询库商品URL数据
 * @param {*} data
 * @returns {Promise}
 */
export function getInventoryUrl(id) {
  return request({
    url: `/inventorybase/${id}`,
    method: 'get'
  })
}

/**
 * 查询库商品URL数据
 * @param {*} data
 * @returns {Promise}
 */
export function listInventoryUrl(query) {
  return request({
    url: `/inventorybase/list`,
    method: 'get',
    params: query
  })
}

/**
 * 新增库商品URL数据
 * @param {*} data
 * @returns {Promise}
 */
export function addInventoryUrl(data) {
  return request({
    url: `/inventorybase`,
    method: 'post',
    data
  })
}

/**
 * 修改库商品URL数据
 * @param {*} data
 * @returns {Promise}
 */
export function updateInventoryUrl(data) {
  return request({
    url: `/inventorybase`,
    method: 'put',
    data
  })
}

/**
 * 删除库商品URL数据
 * @param {*} data
 * @returns {Promise}
 */
export function deleteInventoryUrl(id) {
  return request({
    url: `/inventorybase/${id}`,
    method: 'delete'
  })
}
