import { ref } from "vue"
import request from "/src/helpers/request"
import { getRequestHostname } from "/src/helpers/utils"

/**
 *  获取免费使用比例
 */
export const useConfigMusicSheetFreeRate = async () => {
  const config = ref(.1)
  const prefix = getRequestHostname()
  try {
    const res = await request.get(
      '/sysParamConfig/queryByParamNameList',
      {
        prefix: prefix,
        params: {
          paramNames: 'music_sheet_free_rate'
        }
      }
    )
    config.value = parseFloat(res.data?.[0].paramValue || '10') / 100
  } catch (error) {}
  return config
}
