system.js 1.04 KB
import http from "../request/http";
import { env } from "../env/index";

const serverConfig = {
  mockRequestCount: null,
  mockTimer: {},
  mockCache: null,
};
const configModule = "uplus-fapai-mp";
const configUrl = `https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=${configModule}&env=${env}`;

/**获取mock数据 */
const getFrontConfig = async () => {
  return new Promise((resolve, reject) => {
  wx.showLoading({ title: "加载中..." });
    wx.request({
      // url: `${domain}${path}?method=${method}`,
      url: configUrl,
      // data,
      method: "GET",
      // header,
      dataType: "json",
      responseType: "text",
      success(response) {
        resolve(response.data);
      },
      fail(error) {
        console.log(error, "error");
      },
      complete() {
				wx.hideLoading();
			},
    })
  });
};

// 图片版本号
const getImageVersion = async () => {
  const accountInfo = await getFrontConfig();
  return accountInfo?.version || Date.now();
};

module.exports = {
  getImageVersion,
  getFrontConfig,
};