import { get, post, put, del } from '../../http'

/**
 * @description: 获取banner列表
 * @param {*} params
 * @return {*}
 */
export const getBannerList = async (params: Record<string, any>) => {
  return await get<any>('/banner/list', { params })
}

/**
 * @description: banner上下线状态
 * @param {*} data
 * @return {*}
 */
export const onlineBanner = async (id: string) => {
  return await post<any>(`/banner/clickBanner/${id}`)
}

/**
 * @description:新建banner
 * @param {*} data
 * @return {*}
 */
export const addBanner = async (data: Record<string, any>) => {
  return await post<any>('/banner', data)
}

/**
 * @description:更新banner
 * @param {*} data
 * @return {*}
 */
export const updateBanner = async (data: Record<string, any>) => {
  return await put('/banner', data)
}

/**
 * @description:根据id删除banner
 * @param {*} data
 * @return {*}
 */
export const delBannerById = async (id: string) => {
  return await del(`/banner/${id}`)
}
