import {  myFetch } from "../utils/fetch";
import { httpApi } from "@/common/js/baseUrl";
const platform = uni.getSystemInfoSync().uniPlatform;
console.log('platform',platform)
export const getOpenId = (data) => {
  let url = "";
  switch (platform) {
    case "mp-weixin":
      url = httpApi + "/system/getOpenId";
      break;
    case "mp-alipay":
      url = httpApi + "/system/getOauthToken";
      break;
    default:
      url=httpApi + "/system/getOpenId";
     break;
  }
  return myFetch(url, "get", data, "form");
};

export const getPhoneNumber = (data) => {
  let url = "";
  switch (platform) {
    case "mp-weixin":
      url = httpApi + "/system/getPhoneNumber";
      break;
    case "mp-alipay":
      url = httpApi + "/system/getPhoneNumberZfb";
      break;
    default:
      url=httpApi + "/system/getPhoneNumber";
     break;
  }
  return myFetch(url, "get", data, "form");
};

export const getQrCode = (data) => {
  const url = httpApi + "/system/getQrCode";
  return myFetch(url, "get", data, "form");
};
