这一版本优化了很多
This commit is contained in:
17
unpackage/dist/dev/mp-weixin/request/request.js
vendored
17
unpackage/dist/dev/mp-weixin/request/request.js
vendored
@@ -1,7 +1,7 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../common/vendor.js");
|
||||
const request_luchRequest_core_Request = require("./luch-request/core/Request.js");
|
||||
const baseUrl = "https://yingji.hexieapi.com/prod-api";
|
||||
const baseUrl = "http://192.168.1.168:5004";
|
||||
const imageBaseUrl = baseUrl.replace(/\/prod-api\/?$/, "");
|
||||
new request_luchRequest_core_Request.Request({
|
||||
baseURL: baseUrl,
|
||||
@@ -112,8 +112,23 @@ const toImageUrl = (filePath) => {
|
||||
const normalized = p.startsWith("/") ? p : `/${p}`;
|
||||
return imageBaseUrl + normalized;
|
||||
};
|
||||
const toRelativeFilePath = (filePath) => {
|
||||
if (!filePath)
|
||||
return "";
|
||||
let p = String(filePath);
|
||||
if (p.startsWith("http://") || p.startsWith("https://")) {
|
||||
p = p.replace(/^https?:\/\/[^/]+/, "");
|
||||
}
|
||||
p = p.replace(/^\/prod-api(?=\/|$)/, "");
|
||||
if (!p.startsWith("/")) {
|
||||
p = `/${p}`;
|
||||
}
|
||||
return p;
|
||||
};
|
||||
exports.baseUrl = baseUrl;
|
||||
exports.getToken = getToken;
|
||||
exports.imageBaseUrl = imageBaseUrl;
|
||||
exports.requestAPI = requestAPI;
|
||||
exports.toImageUrl = toImageUrl;
|
||||
exports.toRelativeFilePath = toRelativeFilePath;
|
||||
//# sourceMappingURL=../../.sourcemap/mp-weixin/request/request.js.map
|
||||
|
||||
Reference in New Issue
Block a user