import {http2} from "@/utils/request.js";
/**获取全局配置 */
export const getSetting = () => {
  return http2.get('/acs/v1/admin/settings/get_settings')
}
/**变更设置 */
export const updateSetting = (data) => {
  return http2.post('/acs/v1/admin/settings/update_settings', data, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}
/**新增设置 */
export const addSetting = (data) => {
  return http2.post('/acs/v1/admin/settings/add_settings', data, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}
/**删除设置 */
export const deleteSetting = (data) => {
  return http2.post('/acs/v1/admin/settings/delete_settings', data,{
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}
/**获取单项配置 */
export const getOneSetting = (data) => {
  return http2.get(`/acs/v1/admin/settings/get_setting?name=${data}`)
}
/**获取多个配置 */
export const getSettings = (data) => {
  // return http2.get(`/acs/v1/admin/settings/get_settings?names=${data}`);
  const namesParam = data.join(',');
  // 将处理后的namesParam放入URL中
  return http2.get(`/acs/v1/admin/settings/get_setting?names=${encodeURIComponent(namesParam)}`);
}