1
This commit is contained in:
parent
37a0b58d53
commit
31dc304525
@ -1,6 +1,9 @@
|
||||
const parseArgs = require('minimist');
|
||||
const fs = require('fs');
|
||||
const assert = require('assert');
|
||||
const { resolve } = require('path');
|
||||
|
||||
const IDENT = ' ';
|
||||
|
||||
class MyDoc {
|
||||
|
||||
@ -14,25 +17,49 @@ class MyDoc {
|
||||
|
||||
async convert() {
|
||||
this.env = fs.readFileSync(`${this.workDir}env.json`, 'utf8');
|
||||
let data = `
|
||||
this.data = `
|
||||
<?php5
|
||||
class Doc
|
||||
{
|
||||
|
||||
`;
|
||||
if (fs.existsSync(`${this.workDir}README.php`)) {
|
||||
data += fs.readFileSync(`${this.workDir}README.php`, 'utf8');
|
||||
this.data += fs.readFileSync(`${this.workDir}README.php`, 'utf8');
|
||||
}
|
||||
const files = fs.readdirSync('./', {encoding:'utf8', withFileTypes:true});
|
||||
files.forEach((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'));
|
||||
item.name != 'common.js') {
|
||||
const c = require(resolve('./') + '/' + item.name.slice(0, -3));
|
||||
this.convertClass(new c());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async convertClass(c) {
|
||||
c.apis.forEach(
|
||||
(item) => {
|
||||
const method = item.method ? 'GET' : item.method;
|
||||
this.data += `
|
||||
/**
|
||||
* @api ${method} ${item.url}
|
||||
* @apiPermission
|
||||
* @apiGroup ${item.group}
|
||||
* @apiVersion 1.0
|
||||
* @apiDescription ${item.desc}
|
||||
`;
|
||||
if (item.is_json_params) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
this.data += ` */
|
||||
`;
|
||||
}
|
||||
);
|
||||
console.log(this.data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
(new MyDoc).init();
|
||||
|
Loading…
x
Reference in New Issue
Block a user