后端:公告√
注意数据库新建notice表
This commit is contained in:
29
frontend/unpackage/dist/dev/mp-weixin/common/http.js
vendored
Normal file
29
frontend/unpackage/dist/dev/mp-weixin/common/http.js
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
"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
|
||||
Reference in New Issue
Block a user