修改商城逻辑
This commit is contained in:
27
apifox-sync.js
Normal file
27
apifox-sync.js
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* 自动导出Swagger文档到本地文件
|
||||
* 使用方法:
|
||||
* 1. 运行此脚本: node apifox-sync.js
|
||||
* 2. 手动将生成的swagger.json文件导入到Apifox
|
||||
*/
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const swaggerSpecs = require('./swagger');
|
||||
|
||||
// 确保输出目录存在
|
||||
const outputDir = path.join(__dirname, 'api-docs');
|
||||
if (!fs.existsSync(outputDir)) {
|
||||
fs.mkdirSync(outputDir, { recursive: true });
|
||||
}
|
||||
|
||||
// 导出Swagger文档到JSON文件
|
||||
const outputPath = path.join(outputDir, 'swagger.json');
|
||||
fs.writeFileSync(outputPath, JSON.stringify(swaggerSpecs, null, 2));
|
||||
console.log(`Swagger文档已导出到: ${outputPath}`);
|
||||
console.log('请手动将此文件导入到Apifox:');
|
||||
console.log('1. 登录Apifox网页版');
|
||||
console.log('2. 打开您的项目');
|
||||
console.log('3. 点击"导入"按钮');
|
||||
console.log('4. 选择"导入OpenAPI(Swagger)"');
|
||||
console.log('5. 上传刚才生成的swagger.json文件');
|
||||
console.log('6. 选择导入方式(合并或覆盖)并完成导入');
|
||||
Reference in New Issue
Block a user