1
This commit is contained in:
parent
719009b7f2
commit
910dc1ce7c
@ -27,11 +27,12 @@ module.exports = class {
|
||||
'desc': '用户登录',
|
||||
'group': 'User',
|
||||
'url': 'api/v1/user/info/:user_id',
|
||||
'is_json_params': true,
|
||||
'params': [
|
||||
['!rsp', [new common.RspHead()], 'ok rsp']
|
||||
],
|
||||
'response': [
|
||||
new common.RspHead(),
|
||||
['rsp', new common.RspHead(), 'ok rsp']
|
||||
]
|
||||
},
|
||||
];
|
||||
|
@ -53,7 +53,7 @@ class Doc
|
||||
* @apiDescription ${item.desc}
|
||||
`;
|
||||
if (item.is_json_params) {
|
||||
this.data += ` * @apiParamExample {json} 请求样例:\n`;
|
||||
this.data += ` * @apiParamExample {json} 请求样例:\n`;
|
||||
this.data += ` * {\n`;
|
||||
this.asJsonOut(item.params, 1);
|
||||
this.data += ` * }\n`;
|
||||
@ -117,11 +117,16 @@ class Doc
|
||||
this.data += ` * ${curIdent}'${item[0]}': { // struct ${item[2]}\n`;
|
||||
}
|
||||
} else {
|
||||
if (['string', 'number'].indexOf(typeof item[1]) >= 0) {
|
||||
const paramType = this.getFieldType(item[1]);
|
||||
this.data += ` * ${curIdent}'${item[0]}': ${this.getJsonValue(item[1])}, //${item[2]}\n`;
|
||||
} else {
|
||||
console.log(11111111111, item, item.__proto__.name);
|
||||
if (util.isArray(item)) {
|
||||
if (['string', 'number'].indexOf(typeof item[1]) >= 0) {
|
||||
const paramType = this.getFieldType(item[1]);
|
||||
this.data += ` * ${curIdent}'${item[0]}': ${this.getJsonValue(item[1])}, //${item[2]}\n`;
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user