import oldRequest from "../../../core/utils/request";
export const request = async ({
  url,
  data,
  ...other
}) => {
  const [err, result] = await oldRequest({
    url,
    data,
    ...other
  });

  if (err && err.code !== 200) {
    my.showToast({
      type: 'fail',
      content: err.msg || '操作失败'
    });
  }

  return [err, result];
}; // 查询商家列表

export function listMerchantStores(data) {
  return request({
    url: '/api/v1/proxy/soldier/listMerchantStores',
    data
  });
} // 查询商家检索条件配置

export function merchantQueryConfig(data) {
  return request({
    url: '/api/v1/proxy/soldier/merchantQueryConfig',
    data
  });
} // 查询商家详情

export function queryMerchantStoreDetail(data) {
  return request({
    url: '/api/v1/proxy/soldier/queryMerchantStoreDetail',
    data
  });
}
/*
* 证件列表查询
* */

export const soldierListCerts = () => {
  return request({
    url: '/api/v1/proxy/soldier/listCerts',
    method: 'POST'
  });
};
/*
* 证件详情
* @para certType string
* */

export const queryCertDetail = certType => {
  return request({
    url: '/api/v1/proxy/soldier/queryCertDetail',
    method: 'POST',
    data: {
      certType
    }
  });
};
/*
* 激活证件
* @para certType string
* @para userCertifyResult boolean
* */

export const activeCert = params => {
  return request({
    url: '/api/v1/proxy/soldier/activeCert',
    method: 'POST',
    data: params
  });
};
/*
* 通过服务码查询服务信息
* @para code string
* */

export const queryServiceByCode = code => {
  return request({
    url: '/api/v1/service/queryByCode',
    method: 'GET',
    data: {
      code
    }
  });
};
/*
*获取证件码
* @para certType string
* */

export const getCertQrCode = certType => {
  return request({
    url: '/api/v1/proxy/soldier/getCertQrCode',
    method: 'post',
    data: {
      certType
    }
  });
};