- 新增资产状态、订单来源、操作人类型、实名链接类型常量 - 8个模型新增字段(asset_status/generation/source/retail_price等) - 数据库迁移000082:7张表15+字段,含存量retail_price回填 - BUG-1修复:代理零售价渠道隔离,cost_price分配锁定 - BUG-2修复:一次性佣金仅客户端订单触发 - BUG-4修复:充值回调Store操作纳入事务 - 新增资产手动停用接口(PATCH /iot-cards/:id/deactivate、/devices/:id/deactivate) - Carrier管理新增实名链接配置 - 后台订单generation写时快照 - BatchUpdatePricing支持retail_price调价目标 - 清理全部H5旧接口和个人客户旧登录方法
47 lines
1.2 KiB
Go
47 lines
1.2 KiB
Go
package main
|
||
|
||
import (
|
||
"log"
|
||
"path/filepath"
|
||
|
||
"github.com/gofiber/fiber/v2"
|
||
|
||
"github.com/break/junhong_cmp_fiber/internal/bootstrap"
|
||
"github.com/break/junhong_cmp_fiber/internal/handler/admin"
|
||
"github.com/break/junhong_cmp_fiber/internal/routes"
|
||
"github.com/break/junhong_cmp_fiber/pkg/openapi"
|
||
)
|
||
|
||
func main() {
|
||
outputFile := "./docs/admin-openapi.yaml"
|
||
if err := generateAdminDocs(outputFile); err != nil {
|
||
log.Fatalf("生成 OpenAPI 文档失败: %v", err)
|
||
}
|
||
|
||
absPath, _ := filepath.Abs(outputFile)
|
||
log.Printf("成功在以下位置生成 OpenAPI 文档: %s", absPath)
|
||
}
|
||
|
||
// generateAdminDocs 生成 Admin API 的 OpenAPI 文档
|
||
func generateAdminDocs(outputPath string) error {
|
||
// 1. 创建生成器
|
||
adminDoc := openapi.NewGenerator("Admin API", "1.0")
|
||
|
||
// 2. 创建临时 Fiber App 用于路由注册
|
||
app := fiber.New()
|
||
|
||
// 3. 创建 Handler(使用 nil 依赖,因为只需要路由结构)
|
||
handlers := openapi.BuildDocHandlers()
|
||
handlers.AssetLifecycle = admin.NewAssetLifecycleHandler(nil)
|
||
|
||
// 4. 注册所有路由到文档生成器
|
||
routes.RegisterRoutesWithDoc(app, handlers, &bootstrap.Middlewares{}, adminDoc)
|
||
|
||
// 5. 保存规范到指定路径
|
||
if err := adminDoc.Save(outputPath); err != nil {
|
||
return err
|
||
}
|
||
|
||
return nil
|
||
}
|