diff --git a/doc/admin/User.js b/doc/admin/User.js index c59cc04b..c7e37329 100644 --- a/doc/admin/User.js +++ b/doc/admin/User.js @@ -1,34 +1,36 @@ const common = require('./common'); -exports.User = class { +module.exports = class { - const apis = [ - { - 'method': 'GET', - 'name': 'login', - 'desc': '用户登录', - 'group': 'User', - 'url': 'api/v1/user/login', - 'params': [ - ['account', '', '账号'], - ['passwd', '', '密码'] - ], - 'response': [ - new common.RspHead(), - ] - }, - { - 'method': 'GET', - 'name': 'info', - 'desc': '用户登录', - 'group': 'User', - 'url': 'api/v1/user/info/:user_id', - 'params': [ - ], - 'response': [ - new common.RspHead(), - ] - }, - ]; + constructor() { + this.apis = [ + { + 'method': 'GET', + 'name': 'login', + 'desc': '用户登录', + 'group': 'User', + 'url': 'api/v1/user/login', + 'params': [ + ['account', '', '账号'], + ['passwd', '', '密码'] + ], + 'response': [ + new common.RspHead(), + ] + }, + { + 'method': 'GET', + 'name': 'info', + 'desc': '用户登录', + 'group': 'User', + 'url': 'api/v1/user/info/:user_id', + 'params': [ + ], + 'response': [ + new common.RspHead(), + ] + }, + ]; + } }; diff --git a/doc/admin/common.js b/doc/admin/common.js index b509ae82..beff7597 100644 --- a/doc/admin/common.js +++ b/doc/admin/common.js @@ -1,15 +1,19 @@ exports.ReqHead = class { - const fields = [ - ]; + constructor() { + this.fields = [ + ]; + } }; exports.RspHead = class { - const fields = [ - ['errcode', 0, '错误码/0 成功;1 失败'], - ['errmsg', '', '错误描述'], - ]; + constructor() { + this.fields = [ + ['errcode', 0, '错误码/0 成功;1 失败'], + ['errmsg', '', '错误描述'], + ]; + } }; diff --git a/tools/mydoc/app.js b/tools/mydoc/app.js index d38b0390..1a568ce0 100644 --- a/tools/mydoc/app.js +++ b/tools/mydoc/app.js @@ -25,7 +25,11 @@ class Doc } const files = fs.readdirSync('./', {encoding:'utf8', withFileTypes:true}); files.forEach((item) => { - console.log(item); + if (item.name.slice(-3) == '.js' && + item.name != 'common.js') { + //console.log(require('./' + item.name.slice(0, -3))); + console.log(require('/home/azw/pub/game2006go/doc/admin/User')); + } }); }