import request from '@/utils/request'
import requestPay from '@/utils/requestPay'

import qs from 'qs'

// 微信支付接口
export function wechatPayCoin(data) {
  return request({
    url: '/web/wechatPayCoin',
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data: qs.stringify(data)
  })
} 

// 支付宝支付接口
export function aliPayCoin(data, platform) {
  return request({
    url: '/web/aliPayCoin',
    method: 'post',
    headers: {
      'Content-Type': 'application/json',
      'platform': platform
    },
    data
  })
}

// 支付宝H5支付接口
export function aliPayH5(data, platform) {
  return request({
    url: '/pay/alipay/h5',
    method: 'post',
    headers: {
      'Content-Type': 'application/json',
      'platform': platform
    },
    responseType: 'text',  // 指定响应类型为文本
    data
  })
}

export const ahtuCodeApi = (code) =>{
  return requestPay({
    url : `/efps/wechat/officialaccount/auth?code=${code}&state=1`,
     method: 'get',
  })
}



export const wxPay = (data) =>{
  return requestPay({
      url : `/efps/payment/wechat/officialaccount`,
     method: 'post',
     data,
     headers: {
      'Content-Type': 'application/json'
    },
  })
}

