feat: 添加多项功能和修复
功能新增: - OSS 存储使用情况显示(文件页面) - OSS 当日流量统计(阿里云云监控API) - 分享页面路由修复(/s/xxx 格式支持) Bug修复: - 修复分享页面资源路径(相对路径改绝对路径) - 修复分享码获取逻辑(支持路径格式) - 修复OSS配额undefined显示问题 - 修复登录流程OSS配置检查 - 修复文件数为null时的显示问题 依赖更新: - 添加 @alicloud/cms20190101 云监控SDK - 添加 @alicloud/openapi-client Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
93
backend/node_modules/@alicloud/tea-xml/dist/client.js
generated
vendored
Normal file
93
backend/node_modules/@alicloud/tea-xml/dist/client.js
generated
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const xml2js_1 = require("xml2js");
|
||||
class Client {
|
||||
static parseXml(body, response) {
|
||||
let ret = this._parseXML(body);
|
||||
if (response !== null && typeof response !== 'undefined') {
|
||||
ret = this._xmlCast(ret, response);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
static toXML(body) {
|
||||
const builder = new xml2js_1.Builder();
|
||||
return builder.buildObject(body);
|
||||
}
|
||||
static _parseXML(body) {
|
||||
let parser = new xml2js_1.Parser({ explicitArray: false });
|
||||
let result = {};
|
||||
parser.parseString(body, function (err, output) {
|
||||
result.err = err;
|
||||
result.output = output;
|
||||
});
|
||||
if (result.err) {
|
||||
throw result.err;
|
||||
}
|
||||
return result.output;
|
||||
}
|
||||
static _xmlCast(obj, clazz) {
|
||||
obj = obj || {};
|
||||
let ret = {};
|
||||
let clz = clazz;
|
||||
let names = clz.names();
|
||||
let types = clz.types();
|
||||
Object.keys(names).forEach((key) => {
|
||||
let originName = names[key];
|
||||
let value = obj[originName];
|
||||
let type = types[key];
|
||||
switch (type) {
|
||||
case 'boolean':
|
||||
if (!value) {
|
||||
ret[originName] = false;
|
||||
return;
|
||||
}
|
||||
ret[originName] = value === 'false' ? false : true;
|
||||
return;
|
||||
case 'number':
|
||||
if (value != 0 && !value) {
|
||||
ret[originName] = NaN;
|
||||
return;
|
||||
}
|
||||
ret[originName] = +value;
|
||||
return;
|
||||
case 'string':
|
||||
if (!value) {
|
||||
ret[originName] = '';
|
||||
return;
|
||||
}
|
||||
ret[originName] = value.toString();
|
||||
return;
|
||||
default:
|
||||
if (type.type === 'array') {
|
||||
if (!value) {
|
||||
ret[originName] = [];
|
||||
return;
|
||||
}
|
||||
if (!Array.isArray(value)) {
|
||||
value = [value];
|
||||
}
|
||||
if (typeof type.itemType === 'function') {
|
||||
ret[originName] = value.map((d) => {
|
||||
return this._xmlCast(d, type.itemType);
|
||||
});
|
||||
}
|
||||
else {
|
||||
ret[originName] = value;
|
||||
}
|
||||
}
|
||||
else if (typeof type === 'function') {
|
||||
if (!value) {
|
||||
value = {};
|
||||
}
|
||||
ret[originName] = this._xmlCast(value, type);
|
||||
}
|
||||
else {
|
||||
ret[originName] = value;
|
||||
}
|
||||
}
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
exports.default = Client;
|
||||
//# sourceMappingURL=client.js.map
|
||||
Reference in New Issue
Block a user