import request from "../utils/request";

// 获取中奖列表
export function getCarouselListApi(page, limit = 10) {
  return request({
    url: `/admin/banner/${page}/${limit}`,
    method: "get",
  });
}

// 保存中奖
export function saveCarouselApi(data) {
  return request({
    url: `/admin/banner/save`,
    method: "post",
    data: { img: data.img,title: data.title,status: data.status }
  });
}

// 删除中奖
export function deleteCarouselApi(id) {
  return request({
    url: `/admin/banner/remove/${id}`,
    method: "delete",
  });
}

// 修改中奖
export function updateCarouselApi(data) {
  return request({
    url: `/admin/banner/update`,
    method: "put",
    data
  });
}

// 上传图片
export function uploadImageApi(file) {
  const formData = new FormData();
  formData.append('file', file);
  return request({
    url: '/admin/cms/upload',
    method: 'post',
    data: formData,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  });
}

