Files
PartsInquiry/frontend/unpackage/dist/dev/mp-weixin/common/http.js
Wdp-ab 562ec4abf9 后端:公告√
注意数据库新建notice表
2025-09-16 20:03:17 +08:00

30 lines
894 B
JavaScript

"use strict";
const common_vendor = require("./vendor.js");
const common_config = require("./config.js");
function buildUrl(path) {
if (!path)
return common_config.API_BASE_URL;
if (path.startsWith("http"))
return path;
return common_config.API_BASE_URL + (path.startsWith("/") ? path : "/" + path);
}
function get(path, params = {}) {
return new Promise((resolve, reject) => {
common_vendor.index.request({
url: buildUrl(path),
method: "GET",
data: params,
header: { "X-Shop-Id": common_config.SHOP_ID },
success: (res) => {
const { statusCode, data } = res;
if (statusCode >= 200 && statusCode < 300)
return resolve(data);
reject(new Error("HTTP " + statusCode));
},
fail: (err) => reject(err)
});
});
}
exports.get = get;
//# sourceMappingURL=../../.sourcemap/mp-weixin/common/http.js.map