#!/usr/bin/env node
const express = require('express');
const path = require('path');
const fs = require('fs');
const app = express();
const PORT = 3001;
// 静态文件服务
app.use('/docs', express.static(path.join(__dirname)));
// 主页路由
app.get('/', (req, res) => {
res.send(`
营收系统接口文档
🚀 主要功能
账单管理: 查询、缴费、红冲
代扣管理: 签约、解约、送盘、回盘
多格式支持: XML (GBK) 和 JSON (UTF-8)
安全认证: 3DES、SM2、SM4多种加密算法
错误处理: 统一错误码和详细错误信息
📋 API概览
- POST /api/app/billQuery/query - 账单查询
- POST /api/app/billPay/pay - 账单缴费
- POST /api/app/payInvalid/payInvalid - 账单红冲
- POST /api/app/bankWithholding/signing - 代扣签约
- POST /api/app/bankWithholding/termination - 代扣解约
- POST /api/app/bankWithholding/sendDisc - 代扣送盘
- POST /api/app/bankWithholding/backDisc - 代扣回盘
🔧 快速测试
账单查询示例(JSON格式):
{
"Version": "1.0.1",
"InstId": "00001",
"TranCode": "Query",
"TranDate": "20240101",
"TranSeq": "123456789012",
"BillKey": "123456",
"CompanyId": "654321"
}
🛠️ 开发工具
推荐使用以下工具进行API开发和测试:
`);
});
// 启动服务器
app.listen(PORT, () => {
console.log('🚀 营收系统接口文档服务已启动!');
console.log(`📖 访问地址: http://localhost:${PORT}`);
console.log(`📋 Swagger Editor: https://editor.swagger.io/?url=http://localhost:${PORT}/docs/main/openapi.yaml`);
console.log('');
console.log('📁 文档结构:');
console.log('├── docs/main/openapi.yaml # 主入口文档');
console.log('├── docs/main/components/ # 通用组件');
console.log('└── docs/main/paths/ # API路径定义');
console.log('');
console.log('按 Ctrl+C 停止服务');
});
module.exports = app;