import request from '@/utils/request'
import { praseStrEmpty } from "@/utils/ruoyi";

// 查询列表
export function listTools(query) {
  return request({
    url: '/business/tool/list',
    method: 'get',
    params: query
  })
}

export function getTool(toolId) {
  return request({
    url: '/business/tool/' + praseStrEmpty(toolId),
    method: 'get'
  })
}

export function getPrice(toolId) {
  return request({
    url: '/business/tool/price/' + praseStrEmpty(toolId),
    method: 'get'
  })
}

export function getFunction(toolId) {
  return request({
    url: '/business/tool/function/' + praseStrEmpty(toolId),
    method: 'get'
  })
}


// 购买工具支付成功
export function buyTool(tool) {
  return request({
    url: '/pay/one',
    method: 'post',
    data: tool
  })
}

// 购买多个工具支付成功
export function buyTools(tools) {
  return request({
    url: '/pay/more',
    method: 'post',
    data: tools
  })
}
//0元订单支付
export function noPayBuy(tool) {
  return request({
    url: '/business/tool/nopay/one',
    method: 'post',
    data: tool
  })
}
export function noPayMore(tool) {
  return request({
    url: '/business/tool/nopay/more',
    method: 'post',
    data: tool
  })
}

// 购买工具支付成功
export function buyToolByWx(tool) {
  return request({
    url: '/wxpay/one',
    method: 'post',
    data: tool
  })
}
export function  queryOrderState(orderNumber){
  return request({
    url: '/order/status/' + orderNumber,
    method: 'get',
  })
}
