import axios from "../../utils/axios";
import { stringToUrl } from "@/common/js/utils";

// MQTT发送消息
export function sendMqttMessage(params) {
  return axios.post(`/SZWL-SERVER/purse/balance`, params);
}

// 获取余额
export function getBalance(params) {
  return axios.get(`/SZWL-SERVER/purse/balance?${stringToUrl(params)}`);
}

// 提现
export function withdraw(params) {
  return axios.post(`/SZWL-SERVER/purse/withdraw`, params);
}

// 提现记录
export function withdrawRecord(params) {
  return axios.post(`/SZWL-SERVER/purse/withdrawRecordList`, params);
}

// 导出提现记录
export function exportWithdrawRecord(params) {
  return axios.post(`/SZWL-SERVER/purse/exportWithdrawRecord`, params, {
    responseType: "blob",
  });
}

// 查询提现状态
export function withdrawStatus(params) {
  return axios.get(`/SZWL-SERVER/purse/withdrawStatus?${stringToUrl(params)}`);
}

// 证照识别
export function idCardRecognition(params) {
  return axios.post(`/SZWL-SERVER/purse/ocrImage`, params);
}

// 获取商户信息
export function getJoinPayMch(params) {
  return axios.post(
    `/SZWL-SERVER/tJoinpayMch/getOne?${stringToUrl(params)}`,
    params
  );
}

// 汇聚入网
export function createMch(params) {
  return axios.post(`/SZWL-SERVER/tJoinpayMch/createMch`, params);
}

// 上传图片审核
export function uploadPhotos(params) {
  return axios.post(`/SZWL-SERVER/tJoinpayMch/uploadPhotos`, params);
}

// 更新图片审核情况
export function updateApproveStatus(params) {
  return axios.post(`/SZWL-SERVER/tJoinpayMch/updateApproveStatus`, params);
}

// 签约
export function altMchSign(params) {
  return axios.get(
    `/SZWL-SERVER/tJoinpayMch/altMchSign?${stringToUrl(params)}`
  );
}

// 查询证照
export function getPhotos(params) {
  return axios.get(`/SZWL-SERVER/purse/userLicense?${stringToUrl(params)}`);
}