"use strict";
const common_vendor = require("../common/vendor.js");
var Config = Config || {};
Config.API_BASE_URL = "http://192.168.1.7:3000";
Config.FLOWER_SEND_INTERVAL = 60 * 60 * 1e3;
Config.UPLOAD_SERVICE_TYPE = "server";
Config.UPLOAD_CONFIG = {
  // 图片压缩质量（0-100，越高质量越好但文件越大）
  imageQuality: 80,
  // 图片最大大小（字节）
  imageMaxSize: 5 * 1024 * 1024,
  // 5MB
  // 视频最大大小（字节）
  videoMaxSize: 50 * 1024 * 1024,
  // 50MB
  // 服务器上传地址
  serverUploadUrl: "http://192.168.1.7:3000/api/v1/upload/image",
  // COS域名（如果使用COS上传）
  cosDomain: ""
};
Config.UPLOAD_PRESETS = {
  // 普通图片（服务图片、预约附件等）
  normal: {
    imageQuality: 80,
    imageMaxSize: 5 * 1024 * 1024
  },
  // 头像图片（高质量）
  avatar: {
    imageQuality: 90,
    imageMaxSize: 2 * 1024 * 1024
  },
  // 提现收款码
  qrcode: {
    imageQuality: 85,
    imageMaxSize: 3 * 1024 * 1024
  }
};
Config._cachedConfig = null;
Config._cacheTime = 0;
Config._cacheExpiry = 5 * 60 * 1e3;
Config.getPublicConfig = function() {
  const now = Date.now();
  if (Config._cachedConfig && now - Config._cacheTime < Config._cacheExpiry) {
    common_vendor.index.__f__("log", "at modules/Config.js:88", "使用缓存的配置");
    return Promise.resolve(Config._cachedConfig);
  }
  return new Promise((resolve, reject) => {
    common_vendor.index.__f__("log", "at modules/Config.js:93", "发起配置请求:", Config.API_BASE_URL + "/api/v1/config");
    common_vendor.index.request({
      url: Config.API_BASE_URL + "/api/v1/config",
      method: "GET",
      timeout: 1e4,
      success: (res) => {
        common_vendor.index.__f__("log", "at modules/Config.js:99", "请求成功 - 响应状态码:", res.statusCode);
        common_vendor.index.__f__("log", "at modules/Config.js:100", "请求成功 - 响应数据:", res.data);
        if (res.statusCode === 200 && res.data && res.data.code === 0) {
          Config._cachedConfig = res.data.data || {};
          Config._cacheTime = now;
          common_vendor.index.__f__("log", "at modules/Config.js:105", "配置已缓存:", Config._cachedConfig);
          resolve(Config._cachedConfig);
        } else {
          common_vendor.index.__f__("log", "at modules/Config.js:108", "响应状态不符合预期");
          resolve(Config._cachedConfig || {});
        }
      },
      fail: (error) => {
        common_vendor.index.__f__("error", "at modules/Config.js:113", "请求失败:", error);
        resolve(Config._cachedConfig || {});
      }
    });
  });
};
Config.getImageUrl = function(path) {
  if (!path)
    return "";
  if (path.startsWith("http://") || path.startsWith("https://")) {
    return path;
  }
  return Config.API_BASE_URL + path;
};
exports.Config = Config;
//# sourceMappingURL=../../.sourcemap/mp-weixin/modules/Config.js.map
