diff --git a/doc/admin/User.js b/doc/admin/User.js index feeefcbc..b8545a97 100644 --- a/doc/admin/User.js +++ b/doc/admin/User.js @@ -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'] ] }, ]; diff --git a/tools/mydoc/app.js b/tools/mydoc/app.js index fb4ea628..51e422fe 100644 --- a/tools/mydoc/app.js +++ b/tools/mydoc/app.js @@ -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); } }