This commit is contained in:
azw 2023-09-03 15:36:55 +08:00
parent 719009b7f2
commit 910dc1ce7c
2 changed files with 13 additions and 7 deletions

View File

@ -27,11 +27,12 @@ module.exports = class {
'desc': '用户登录', 'desc': '用户登录',
'group': 'User', 'group': 'User',
'url': 'api/v1/user/info/:user_id', 'url': 'api/v1/user/info/:user_id',
'is_json_params': true,
'params': [ 'params': [
['!rsp', [new common.RspHead()], 'ok rsp']
], ],
'response': [ 'response': [
new common.RspHead(), new common.RspHead(),
['rsp', new common.RspHead(), 'ok rsp']
] ]
}, },
]; ];

View File

@ -117,11 +117,16 @@ class Doc
this.data += ` * ${curIdent}'${item[0]}': { // struct ${item[2]}\n`; this.data += ` * ${curIdent}'${item[0]}': { // struct ${item[2]}\n`;
} }
} else { } else {
if (util.isArray(item)) {
if (['string', 'number'].indexOf(typeof item[1]) >= 0) { if (['string', 'number'].indexOf(typeof item[1]) >= 0) {
const paramType = this.getFieldType(item[1]); const paramType = this.getFieldType(item[1]);
this.data += ` * ${curIdent}'${item[0]}': ${this.getJsonValue(item[1])}, //${item[2]}\n`; this.data += ` * ${curIdent}'${item[0]}': ${this.getJsonValue(item[1])}, //${item[2]}\n`;
} else { } else {
console.log(11111111111, item, item.__proto__.name); this.data += ` * ${curIdent}'${item[0]}': { // struct ${item[1].constructor.name} ${item[2]}\n`;
this.asJsonOut(item[1].fields, ident + 1);
this.data += ` * ${curIdent}}\n`;
}
} else if (typeof item == 'object'){
this.asJsonOut(item.fields, ident); this.asJsonOut(item.fields, ident);
} }
} }