diff --git a/Dockerfile.worker b/Dockerfile.worker new file mode 100644 index 0000000..4e303bd --- /dev/null +++ b/Dockerfile.worker @@ -0,0 +1,42 @@ +# 使用官方 Go 镜像作为构建环境 +FROM golang:1.23-alpine AS builder + +# 设置工作目录 +WORKDIR /app + +# 复制 go mod 文件 +COPY go.mod go.sum ./ + +# 下载依赖 +RUN go mod download + +# 复制源代码 +COPY . . + +# 构建 Worker 可执行文件 +RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o worker cmd/worker/main.go + +# 使用轻量级的 alpine 镜像作为运行环境 +FROM alpine:latest + +# 安装必要的包 +RUN apk --no-cache add ca-certificates tzdata + +# 设置工作目录 +WORKDIR /root/ + +# 复制可执行文件 +COPY --from=builder /app/worker . + +# 复制配置文件 +COPY --from=builder /app/config.yaml . +COPY --from=builder /app/configs ./configs + +# 设置时区 +ENV TZ=Asia/Shanghai + +# 暴露端口(如果需要) +# EXPOSE 8080 + +# 运行 Worker +CMD ["./worker"] diff --git a/cmd/api/main.go b/cmd/api/main.go index 6a41f5e..4867e3a 100644 --- a/cmd/api/main.go +++ b/cmd/api/main.go @@ -7,6 +7,7 @@ import ( "os" "time" + _ "tyapi-server/docs" "tyapi-server/internal/app" ) diff --git a/cmd/worker/main.go b/cmd/worker/main.go new file mode 100644 index 0000000..6b97f3f --- /dev/null +++ b/cmd/worker/main.go @@ -0,0 +1,137 @@ +package main + +import ( + "context" + "encoding/json" + "fmt" + "log" + "os" + "os/signal" + "syscall" + + "tyapi-server/internal/config" + "tyapi-server/internal/domains/article/entities" + + "github.com/hibiken/asynq" + "go.uber.org/zap" + "gorm.io/driver/postgres" + "gorm.io/gorm" +) + +const ( + TaskTypeArticlePublish = "article:publish" +) + +func main() { + // 加载配置 + cfg, err := config.LoadConfig() + if err != nil { + log.Fatal("加载配置失败:", err) + } + + // 创建日志器 + logger, err := zap.NewProduction() + if err != nil { + log.Fatal("创建日志器失败:", err) + } + defer logger.Sync() + + // 连接数据库 + // 在 Docker 环境中使用容器名 + dbHost := os.Getenv("DB_HOST") + if dbHost == "" { + dbHost = cfg.Database.Host + } + + // 使用默认端口 5432 + dbPort := 5432 + + dsn := fmt.Sprintf("host=%s user=%s password=%s dbname=%s port=%d sslmode=disable TimeZone=Asia/Shanghai", + dbHost, cfg.Database.User, cfg.Database.Password, cfg.Database.Name, dbPort) + fmt.Printf("dsn: %s\n", dsn) + db, err := gorm.Open(postgres.Open(dsn), &gorm.Config{}) + if err != nil { + logger.Fatal("连接数据库失败", zap.Error(err)) + } + + // 从环境变量获取 Redis 地址 + redisAddr := os.Getenv("REDIS_ADDR") + if redisAddr == "" { + redisAddr = fmt.Sprintf("%s:%d", cfg.Redis.Host, cfg.Redis.Port) + } + + // 创建 Asynq Server + server := asynq.NewServer( + asynq.RedisClientOpt{Addr: redisAddr}, + asynq.Config{ + Concurrency: 10, + Queues: map[string]int{ + "critical": 6, + "default": 3, + "low": 1, + }, + }, + ) + + // 创建任务处理器 + mux := asynq.NewServeMux() + mux.HandleFunc(TaskTypeArticlePublish, func(ctx context.Context, t *asynq.Task) error { + return handleArticlePublish(ctx, t, db, logger) + }) + + // 启动 Worker + go func() { + logger.Info("启动 Asynq Worker", zap.String("redis_addr", redisAddr)) + if err := server.Run(mux); err != nil { + logger.Fatal("启动 Worker 失败", zap.Error(err)) + } + }() + + // 等待信号 + quit := make(chan os.Signal, 1) + signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM) + <-quit + + // 优雅关闭 + logger.Info("正在关闭 Worker...") + server.Stop() + server.Shutdown() + logger.Info("Worker 已关闭") +} + +// handleArticlePublish 处理文章定时发布任务 +func handleArticlePublish(ctx context.Context, t *asynq.Task, db *gorm.DB, logger *zap.Logger) error { + var payload map[string]interface{} + if err := json.Unmarshal(t.Payload(), &payload); err != nil { + logger.Error("解析任务载荷失败", zap.Error(err)) + return fmt.Errorf("解析任务载荷失败: %w", err) + } + + articleID, ok := payload["article_id"].(string) + if !ok { + logger.Error("任务载荷中缺少文章ID") + return fmt.Errorf("任务载荷中缺少文章ID") + } + + // 获取文章 + var article entities.Article + if err := db.WithContext(ctx).First(&article, "id = ?", articleID).Error; err != nil { + logger.Error("获取文章失败", zap.String("article_id", articleID), zap.Error(err)) + return fmt.Errorf("获取文章失败: %w", err) + } + + // 发布文章 + if err := article.Publish(); err != nil { + logger.Error("发布文章失败", zap.String("article_id", articleID), zap.Error(err)) + return fmt.Errorf("发布文章失败: %w", err) + } + + // 保存更新 + if err := db.WithContext(ctx).Save(&article).Error; err != nil { + logger.Error("保存文章失败", zap.String("article_id", articleID), zap.Error(err)) + return fmt.Errorf("保存文章失败: %w", err) + } + + logger.Info("定时发布文章成功", zap.String("article_id", articleID)) + return nil +} diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index fa9b2ac..5bfb49a 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -44,6 +44,45 @@ services: timeout: 3s retries: 5 + # Asynq 任务监控 + asynq-monitor: + image: hibiken/asynqmon:latest + container_name: tyapi-asynq-monitor + environment: + TZ: Asia/Shanghai + ports: + - "8081:8080" + command: --redis-addr=tyapi-redis:6379 + networks: + - tyapi-network + depends_on: + redis: + condition: service_healthy + restart: unless-stopped + + # TYAPI Worker (定时任务处理) - 开发环境 + tyapi-worker: + build: + context: . + dockerfile: Dockerfile.worker + container_name: tyapi-worker-dev + environment: + TZ: Asia/Shanghai + ENV: development + REDIS_ADDR: tyapi-redis:6379 + DB_HOST: tyapi-postgres + volumes: + - ./logs:/app/logs + - .:/app # 开发环境挂载代码目录 + networks: + - tyapi-network + depends_on: + redis: + condition: service_healthy + postgres: + condition: service_healthy + restart: unless-stopped + # Jaeger 链路追踪 jaeger: image: jaegertracing/all-in-one:1.70.0 diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index bf0d661..73ed697 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -68,7 +68,6 @@ services: # 生产环境不暴露端口到主机 # ports: # - "6379:6379" - # TYAPI 应用程序 tyapi-app: build: diff --git a/docs/docs.go b/docs/docs.go index f85bda7..5bbd2aa 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1,8 +1,9257 @@ -// Package docs 生成的API文档包 -// 这个包导入了自动生成的Swagger文档 +// Package docs Code generated by swaggo/swag. DO NOT EDIT package docs -import ( - // 导入生成的swagger文档 - _ "tyapi-server/docs/swagger" -) +import "github.com/swaggo/swag" + +const docTemplate = `{ + "schemes": {{ marshal .Schemes }}, + "swagger": "2.0", + "info": { + "description": "{{escape .Description}}", + "title": "{{.Title}}", + "contact": { + "name": "API Support", + "url": "https://github.com/your-org/tyapi-server-gin", + "email": "support@example.com" + }, + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.html" + }, + "version": "{{.Version}}" + }, + "host": "{{.Host}}", + "basePath": "{{.BasePath}}", + "paths": { + "/api/v1/:api_name": { + "post": { + "description": "统一API调用入口,参数加密传输", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "API调用" + ], + "summary": "API调用", + "parameters": [ + { + "description": "API调用请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.ApiCallCommand" + } + } + ], + "responses": { + "200": { + "description": "调用成功", + "schema": { + "$ref": "#/definitions/dto.ApiCallResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "$ref": "#/definitions/dto.ApiCallResponse" + } + }, + "401": { + "description": "未授权", + "schema": { + "$ref": "#/definitions/dto.ApiCallResponse" + } + }, + "429": { + "description": "请求过于频繁", + "schema": { + "$ref": "#/definitions/dto.ApiCallResponse" + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "$ref": "#/definitions/dto.ApiCallResponse" + } + } + } + } + }, + "/api/v1/admin/api-calls": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取API调用记录,支持筛选和分页", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "API管理" + ], + "summary": "获取管理端API调用记录", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "用户ID", + "name": "user_id", + "in": "query" + }, + { + "type": "string", + "description": "交易ID", + "name": "transaction_id", + "in": "query" + }, + { + "type": "string", + "description": "产品名称", + "name": "product_name", + "in": "query" + }, + { + "type": "string", + "description": "状态", + "name": "status", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "开始时间", + "name": "start_time", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "结束时间", + "name": "end_time", + "in": "query" + }, + { + "type": "string", + "description": "排序字段", + "name": "sort_by", + "in": "query" + }, + { + "enum": [ + "asc", + "desc" + ], + "type": "string", + "description": "排序方向", + "name": "sort_order", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取API调用记录成功", + "schema": { + "$ref": "#/definitions/dto.ApiCallListResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/invoices/pending": { + "get": { + "description": "管理员获取发票申请列表,支持状态和时间范围筛选", + "produces": [ + "application/json" + ], + "tags": [ + "管理员-发票管理" + ], + "summary": "获取发票申请列表", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "状态筛选:pending/completed/rejected", + "name": "status", + "in": "query" + }, + { + "type": "string", + "description": "开始时间 (格式: 2006-01-02 15:04:05)", + "name": "start_time", + "in": "query" + }, + { + "type": "string", + "description": "结束时间 (格式: 2006-01-02 15:04:05)", + "name": "end_time", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/interfaces.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.PendingApplicationsResponse" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, + "/api/v1/admin/invoices/{application_id}/approve": { + "post": { + "description": "管理员通过发票申请并上传发票文件", + "consumes": [ + "multipart/form-data" + ], + "produces": [ + "application/json" + ], + "tags": [ + "管理员-发票管理" + ], + "summary": "通过发票申请", + "parameters": [ + { + "type": "string", + "description": "申请ID", + "name": "application_id", + "in": "path", + "required": true + }, + { + "type": "file", + "description": "发票文件", + "name": "file", + "in": "formData", + "required": true + }, + { + "type": "string", + "description": "管理员备注", + "name": "admin_notes", + "in": "formData" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, + "/api/v1/admin/invoices/{application_id}/download": { + "get": { + "description": "管理员下载指定发票的文件", + "produces": [ + "application/octet-stream" + ], + "tags": [ + "管理员-发票管理" + ], + "summary": "管理员下载发票文件", + "parameters": [ + { + "type": "string", + "description": "申请ID", + "name": "application_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "file" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, + "/api/v1/admin/invoices/{application_id}/reject": { + "post": { + "description": "管理员拒绝发票申请", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "管理员-发票管理" + ], + "summary": "拒绝发票申请", + "parameters": [ + { + "type": "string", + "description": "申请ID", + "name": "application_id", + "in": "path", + "required": true + }, + { + "description": "拒绝申请请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/finance.RejectInvoiceRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, + "/api/v1/admin/product-categories": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取产品分类列表", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "分类管理" + ], + "summary": "获取分类列表", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取分类列表成功", + "schema": { + "$ref": "#/definitions/responses.CategoryListResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员创建新产品分类", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "分类管理" + ], + "summary": "创建分类", + "parameters": [ + { + "description": "创建分类请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.CreateCategoryCommand" + } + } + ], + "responses": { + "201": { + "description": "分类创建成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/product-categories/{id}": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取分类详细信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "分类管理" + ], + "summary": "获取分类详情", + "parameters": [ + { + "type": "string", + "description": "分类ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "获取分类详情成功", + "schema": { + "$ref": "#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "分类不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员更新产品分类信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "分类管理" + ], + "summary": "更新分类", + "parameters": [ + { + "type": "string", + "description": "分类ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "更新分类请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.UpdateCategoryCommand" + } + } + ], + "responses": { + "200": { + "description": "分类更新成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "分类不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "delete": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员删除产品分类", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "分类管理" + ], + "summary": "删除分类", + "parameters": [ + { + "type": "string", + "description": "分类ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "分类删除成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "分类不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/products": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取产品列表,支持筛选和分页,包含所有产品(包括隐藏的)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "获取产品列表", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "搜索关键词", + "name": "keyword", + "in": "query" + }, + { + "type": "string", + "description": "分类ID", + "name": "category_id", + "in": "query" + }, + { + "type": "boolean", + "description": "是否启用", + "name": "is_enabled", + "in": "query" + }, + { + "type": "boolean", + "description": "是否可见", + "name": "is_visible", + "in": "query" + }, + { + "type": "boolean", + "description": "是否组合包", + "name": "is_package", + "in": "query" + }, + { + "type": "string", + "description": "排序字段", + "name": "sort_by", + "in": "query" + }, + { + "enum": [ + "asc", + "desc" + ], + "type": "string", + "description": "排序方向", + "name": "sort_order", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取产品列表成功", + "schema": { + "$ref": "#/definitions/responses.ProductAdminListResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员创建新产品", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "创建产品", + "parameters": [ + { + "description": "创建产品请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.CreateProductCommand" + } + } + ], + "responses": { + "201": { + "description": "产品创建成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/products/available": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取可选作组合包子产品的产品列表", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "获取可选子产品列表", + "parameters": [ + { + "type": "string", + "description": "排除的组合包ID", + "name": "exclude_package_id", + "in": "query" + }, + { + "type": "string", + "description": "搜索关键词", + "name": "keyword", + "in": "query" + }, + { + "type": "string", + "description": "分类ID", + "name": "category_id", + "in": "query" + }, + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 20, + "description": "每页数量", + "name": "page_size", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取可选产品列表成功", + "schema": { + "$ref": "#/definitions/responses.ProductListResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/products/{id}": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取产品详细信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "获取产品详情", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "boolean", + "description": "是否包含文档信息", + "name": "with_document", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取产品详情成功", + "schema": { + "$ref": "#/definitions/responses.ProductAdminInfoResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员更新产品信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "更新产品", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "更新产品请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.UpdateProductCommand" + } + } + ], + "responses": { + "200": { + "description": "产品更新成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "delete": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员删除产品", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "删除产品", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "产品删除成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/products/{id}/api-config": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取产品的API配置信息,如果不存在则返回空配置", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "获取产品API配置", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "获取API配置成功", + "schema": { + "$ref": "#/definitions/responses.ProductApiConfigResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员更新产品的API配置", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "更新产品API配置", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "API配置信息", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/responses.ProductApiConfigResponse" + } + } + ], + "responses": { + "200": { + "description": "API配置更新成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品或配置不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员为产品创建API配置", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "创建产品API配置", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "API配置信息", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/responses.ProductApiConfigResponse" + } + } + ], + "responses": { + "201": { + "description": "API配置创建成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "409": { + "description": "API配置已存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "delete": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员删除产品的API配置", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "删除产品API配置", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "API配置删除成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品或API配置不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/products/{id}/documentation": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取产品的文档信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "获取产品文档", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "获取文档成功", + "schema": { + "$ref": "#/definitions/responses.DocumentationResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品或文档不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员创建或更新产品的文档信息,如果文档不存在则创建,存在则更新", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "创建或更新产品文档", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "文档信息", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.CreateDocumentationCommand" + } + } + ], + "responses": { + "200": { + "description": "文档操作成功", + "schema": { + "$ref": "#/definitions/responses.DocumentationResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "delete": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员删除产品的文档", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "删除产品文档", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "文档删除成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品或文档不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/products/{id}/package-items": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员向组合包添加子产品", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "添加组合包子产品", + "parameters": [ + { + "type": "string", + "description": "组合包ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "添加子产品命令", + "name": "command", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.AddPackageItemCommand" + } + } + ], + "responses": { + "200": { + "description": "添加成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/products/{id}/package-items/batch": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员批量更新组合包子产品配置", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "批量更新组合包子产品", + "parameters": [ + { + "type": "string", + "description": "组合包ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "批量更新命令", + "name": "command", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.UpdatePackageItemsCommand" + } + } + ], + "responses": { + "200": { + "description": "更新成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/products/{id}/package-items/reorder": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员重新排序组合包子产品", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "重新排序组合包子产品", + "parameters": [ + { + "type": "string", + "description": "组合包ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "重新排序命令", + "name": "command", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.ReorderPackageItemsCommand" + } + } + ], + "responses": { + "200": { + "description": "排序成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/products/{id}/package-items/{item_id}": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员更新组合包子产品信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "更新组合包子产品", + "parameters": [ + { + "type": "string", + "description": "组合包ID", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "子产品项目ID", + "name": "item_id", + "in": "path", + "required": true + }, + { + "description": "更新子产品命令", + "name": "command", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.UpdatePackageItemCommand" + } + } + ], + "responses": { + "200": { + "description": "更新成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "delete": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员从组合包移除子产品", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "移除组合包子产品", + "parameters": [ + { + "type": "string", + "description": "组合包ID", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "子产品项目ID", + "name": "item_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "移除成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/recharge-records": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取充值记录,支持筛选和分页", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "财务管理" + ], + "summary": "获取管理端充值记录", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "用户ID", + "name": "user_id", + "in": "query" + }, + { + "enum": [ + "alipay", + "transfer", + "gift" + ], + "type": "string", + "description": "充值类型", + "name": "recharge_type", + "in": "query" + }, + { + "enum": [ + "pending", + "success", + "failed" + ], + "type": "string", + "description": "状态", + "name": "status", + "in": "query" + }, + { + "type": "string", + "description": "最小金额", + "name": "min_amount", + "in": "query" + }, + { + "type": "string", + "description": "最大金额", + "name": "max_amount", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "开始时间", + "name": "start_time", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "结束时间", + "name": "end_time", + "in": "query" + }, + { + "type": "string", + "description": "排序字段", + "name": "sort_by", + "in": "query" + }, + { + "enum": [ + "asc", + "desc" + ], + "type": "string", + "description": "排序方向", + "name": "sort_order", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取充值记录成功", + "schema": { + "$ref": "#/definitions/responses.RechargeRecordListResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/subscriptions": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取订阅列表", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "订阅管理" + ], + "summary": "获取订阅列表", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "搜索关键词", + "name": "keyword", + "in": "query" + }, + { + "type": "string", + "description": "企业名称", + "name": "company_name", + "in": "query" + }, + { + "type": "string", + "description": "产品名称", + "name": "product_name", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "订阅开始时间", + "name": "start_time", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "订阅结束时间", + "name": "end_time", + "in": "query" + }, + { + "type": "string", + "description": "排序字段", + "name": "sort_by", + "in": "query" + }, + { + "enum": [ + "asc", + "desc" + ], + "type": "string", + "description": "排序方向", + "name": "sort_order", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取订阅列表成功", + "schema": { + "$ref": "#/definitions/responses.SubscriptionListResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/subscriptions/batch-update-prices": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员一键调整用户所有订阅的价格", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "订阅管理" + ], + "summary": "一键改价", + "parameters": [ + { + "description": "批量改价请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.BatchUpdateSubscriptionPricesCommand" + } + } + ], + "responses": { + "200": { + "description": "一键改价成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/subscriptions/stats": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取订阅统计信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "订阅管理" + ], + "summary": "获取订阅统计", + "responses": { + "200": { + "description": "获取订阅统计成功", + "schema": { + "$ref": "#/definitions/responses.SubscriptionStatsResponse" + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/subscriptions/{id}/price": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员修改用户订阅价格", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "订阅管理" + ], + "summary": "更新订阅价格", + "parameters": [ + { + "type": "string", + "description": "订阅ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "更新订阅价格请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.UpdateSubscriptionPriceCommand" + } + } + ], + "responses": { + "200": { + "description": "订阅价格更新成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "订阅不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/wallet-transactions": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取消费记录,支持筛选和分页", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "财务管理" + ], + "summary": "获取管理端消费记录", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "用户ID", + "name": "user_id", + "in": "query" + }, + { + "type": "string", + "description": "交易ID", + "name": "transaction_id", + "in": "query" + }, + { + "type": "string", + "description": "产品名称", + "name": "product_name", + "in": "query" + }, + { + "type": "string", + "description": "最小金额", + "name": "min_amount", + "in": "query" + }, + { + "type": "string", + "description": "最大金额", + "name": "max_amount", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "开始时间", + "name": "start_time", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "结束时间", + "name": "end_time", + "in": "query" + }, + { + "type": "string", + "description": "排序字段", + "name": "sort_by", + "in": "query" + }, + { + "enum": [ + "asc", + "desc" + ], + "type": "string", + "description": "排序方向", + "name": "sort_order", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取消费记录成功", + "schema": { + "$ref": "#/definitions/responses.WalletTransactionListResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/articles": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "分页获取文章列表", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章管理" + ], + "summary": "获取文章列表", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "文章状态", + "name": "status", + "in": "query" + }, + { + "type": "string", + "description": "分类ID", + "name": "category_id", + "in": "query" + }, + { + "type": "string", + "description": "作者ID", + "name": "author_id", + "in": "query" + }, + { + "type": "boolean", + "description": "是否推荐", + "name": "is_featured", + "in": "query" + }, + { + "type": "string", + "description": "排序字段", + "name": "order_by", + "in": "query" + }, + { + "type": "string", + "description": "排序方向", + "name": "order_dir", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取文章列表成功", + "schema": { + "$ref": "#/definitions/responses.ArticleListResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "创建新的文章", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章管理" + ], + "summary": "创建文章", + "parameters": [ + { + "description": "创建文章请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.CreateArticleCommand" + } + } + ], + "responses": { + "201": { + "description": "文章创建成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/articles/search": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "根据关键词搜索文章", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章管理" + ], + "summary": "搜索文章", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "搜索关键词", + "name": "keyword", + "in": "query", + "required": true + }, + { + "type": "string", + "description": "分类ID", + "name": "category_id", + "in": "query" + }, + { + "type": "string", + "description": "作者ID", + "name": "author_id", + "in": "query" + }, + { + "type": "string", + "description": "文章状态", + "name": "status", + "in": "query" + }, + { + "type": "string", + "description": "排序字段", + "name": "order_by", + "in": "query" + }, + { + "type": "string", + "description": "排序方向", + "name": "order_dir", + "in": "query" + } + ], + "responses": { + "200": { + "description": "搜索文章成功", + "schema": { + "$ref": "#/definitions/responses.ArticleListResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/articles/stats": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取文章相关统计数据", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章管理" + ], + "summary": "获取文章统计", + "responses": { + "200": { + "description": "获取统计成功", + "schema": { + "$ref": "#/definitions/responses.ArticleStatsResponse" + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/articles/{id}": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "根据ID获取文章详情", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章管理" + ], + "summary": "获取文章详情", + "parameters": [ + { + "type": "string", + "description": "文章ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "获取文章详情成功", + "schema": { + "$ref": "#/definitions/responses.ArticleInfoResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "文章不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "更新文章信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章管理" + ], + "summary": "更新文章", + "parameters": [ + { + "type": "string", + "description": "文章ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "更新文章请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.UpdateArticleCommand" + } + } + ], + "responses": { + "200": { + "description": "文章更新成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "文章不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "delete": { + "security": [ + { + "Bearer": [] + } + ], + "description": "删除指定文章", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章管理" + ], + "summary": "删除文章", + "parameters": [ + { + "type": "string", + "description": "文章ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "文章删除成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "文章不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/articles/{id}/archive": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "将已发布文章归档", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章管理" + ], + "summary": "归档文章", + "parameters": [ + { + "type": "string", + "description": "文章ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "文章归档成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "文章不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/articles/{id}/featured": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "设置文章的推荐状态", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章管理" + ], + "summary": "设置推荐状态", + "parameters": [ + { + "type": "string", + "description": "文章ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "设置推荐状态请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.SetFeaturedCommand" + } + } + ], + "responses": { + "200": { + "description": "设置推荐状态成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "文章不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/articles/{id}/publish": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "将草稿文章发布", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章管理" + ], + "summary": "发布文章", + "parameters": [ + { + "type": "string", + "description": "文章ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "文章发布成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "文章不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/categories": { + "get": { + "description": "获取产品分类列表,支持筛选", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "数据大厅" + ], + "summary": "获取分类列表", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "boolean", + "description": "是否启用", + "name": "is_enabled", + "in": "query" + }, + { + "type": "boolean", + "description": "是否可见", + "name": "is_visible", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取分类列表成功", + "schema": { + "$ref": "#/definitions/responses.CategoryListResponse" + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/categories/{id}": { + "get": { + "description": "根据分类ID获取分类详细信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "数据大厅" + ], + "summary": "获取分类详情", + "parameters": [ + { + "type": "string", + "description": "分类ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "获取分类详情成功", + "schema": { + "$ref": "#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "分类不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/certifications": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取认证申请列表", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "认证管理" + ], + "summary": "获取认证列表", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "排序字段", + "name": "sort_by", + "in": "query" + }, + { + "enum": [ + "asc", + "desc" + ], + "type": "string", + "description": "排序方向", + "name": "sort_order", + "in": "query" + }, + { + "type": "string", + "description": "认证状态", + "name": "status", + "in": "query" + }, + { + "type": "string", + "description": "用户ID", + "name": "user_id", + "in": "query" + }, + { + "type": "string", + "description": "公司名称", + "name": "company_name", + "in": "query" + }, + { + "type": "string", + "description": "法人姓名", + "name": "legal_person_name", + "in": "query" + }, + { + "type": "string", + "description": "搜索关键词", + "name": "search_keyword", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取认证列表成功", + "schema": { + "$ref": "#/definitions/responses.CertificationListResponse" + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "403": { + "description": "权限不足", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/certifications/apply-contract": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "申请企业认证合同签署", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "认证管理" + ], + "summary": "申请合同签署", + "parameters": [ + { + "description": "申请合同请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.ApplyContractCommand" + } + } + ], + "responses": { + "200": { + "description": "合同申请成功", + "schema": { + "$ref": "#/definitions/responses.ContractSignUrlResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "认证记录不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/certifications/confirm-auth": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "前端轮询确认企业认证是否完成", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "认证管理" + ], + "summary": "前端确认认证状态", + "parameters": [ + { + "description": "确认状态请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/queries.ConfirmAuthCommand" + } + } + ], + "responses": { + "200": { + "description": "状态确认成功", + "schema": { + "$ref": "#/definitions/responses.ConfirmAuthResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "认证记录不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/certifications/confirm-sign": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "前端轮询确认合同签署是否完成", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "认证管理" + ], + "summary": "前端确认签署状态", + "parameters": [ + { + "description": "确认状态请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/queries.ConfirmSignCommand" + } + } + ], + "responses": { + "200": { + "description": "状态确认成功", + "schema": { + "$ref": "#/definitions/responses.ConfirmSignResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "认证记录不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/certifications/details": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "根据认证ID获取认证详情", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "认证管理" + ], + "summary": "获取认证详情", + "responses": { + "200": { + "description": "获取认证详情成功", + "schema": { + "$ref": "#/definitions/responses.CertificationResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "认证记录不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/certifications/enterprise-info": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "提交企业认证所需的企业信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "认证管理" + ], + "summary": "提交企业信息", + "parameters": [ + { + "description": "提交企业信息请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.SubmitEnterpriseInfoCommand" + } + } + ], + "responses": { + "200": { + "description": "企业信息提交成功", + "schema": { + "$ref": "#/definitions/responses.CertificationResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "认证记录不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/certifications/esign/callback": { + "post": { + "description": "处理e签宝的异步回调通知", + "consumes": [ + "application/json" + ], + "produces": [ + "text/plain" + ], + "tags": [ + "认证管理" + ], + "summary": "处理e签宝回调", + "responses": { + "200": { + "description": "success", + "schema": { + "type": "string" + } + }, + "400": { + "description": "fail", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/debug/event-system": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "调试事件系统,用于测试事件触发和处理", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "系统调试" + ], + "summary": "调试事件系统", + "responses": { + "200": { + "description": "调试成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/decrypt": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "使用密钥解密加密的数据", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "API调试" + ], + "summary": "解密参数", + "parameters": [ + { + "description": "解密请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.DecryptCommand" + } + } + ], + "responses": { + "200": { + "description": "解密成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未授权", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "解密失败", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/encrypt": { + "post": { + "description": "用于前端调试时加密API调用参数", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "API调试" + ], + "summary": "加密参数", + "parameters": [ + { + "description": "加密请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.EncryptCommand" + } + } + ], + "responses": { + "200": { + "description": "加密成功", + "schema": { + "$ref": "#/definitions/dto.EncryptResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "$ref": "#/definitions/dto.EncryptResponse" + } + }, + "401": { + "description": "未授权", + "schema": { + "$ref": "#/definitions/dto.EncryptResponse" + } + } + } + } + }, + "/api/v1/finance/alipay/callback": { + "post": { + "description": "处理支付宝异步支付通知", + "consumes": [ + "application/x-www-form-urlencoded" + ], + "produces": [ + "text/plain" + ], + "tags": [ + "支付管理" + ], + "summary": "支付宝支付回调", + "responses": { + "200": { + "description": "success", + "schema": { + "type": "string" + } + }, + "400": { + "description": "fail", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/finance/alipay/return": { + "get": { + "description": "处理支付宝同步支付通知,跳转到前端成功页面", + "consumes": [ + "application/x-www-form-urlencoded" + ], + "produces": [ + "text/html" + ], + "tags": [ + "支付管理" + ], + "summary": "支付宝同步回调", + "responses": { + "200": { + "description": "支付成功页面", + "schema": { + "type": "string" + } + }, + "400": { + "description": "支付失败页面", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/finance/wallet": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取当前用户的钱包详细信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "钱包管理" + ], + "summary": "获取钱包信息", + "responses": { + "200": { + "description": "获取钱包信息成功", + "schema": { + "$ref": "#/definitions/responses.WalletResponse" + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "钱包不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/finance/wallet/alipay-order-status": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取支付宝订单的当前状态,用于轮询查询", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "钱包管理" + ], + "summary": "获取支付宝订单状态", + "parameters": [ + { + "type": "string", + "description": "商户订单号", + "name": "out_trade_no", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "获取订单状态成功", + "schema": { + "$ref": "#/definitions/responses.AlipayOrderStatusResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "订单不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/finance/wallet/alipay-recharge": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "创建支付宝充值订单并返回支付链接", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "钱包管理" + ], + "summary": "创建支付宝充值订单", + "parameters": [ + { + "description": "充值请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.CreateAlipayRechargeCommand" + } + } + ], + "responses": { + "200": { + "description": "创建充值订单成功", + "schema": { + "$ref": "#/definitions/responses.AlipayRechargeOrderResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/finance/wallet/recharge-config": { + "get": { + "description": "获取当前环境的充值配置信息(最低充值金额、最高充值金额等)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "钱包管理" + ], + "summary": "获取充值配置", + "responses": { + "200": { + "description": "获取充值配置成功", + "schema": { + "$ref": "#/definitions/responses.RechargeConfigResponse" + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/finance/wallet/transactions": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取当前用户的钱包交易记录列表,支持分页和筛选", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "钱包管理" + ], + "summary": "获取用户钱包交易记录", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "开始时间 (格式: 2006-01-02 15:04:05)", + "name": "start_time", + "in": "query" + }, + { + "type": "string", + "description": "结束时间 (格式: 2006-01-02 15:04:05)", + "name": "end_time", + "in": "query" + }, + { + "type": "string", + "description": "交易ID", + "name": "transaction_id", + "in": "query" + }, + { + "type": "string", + "description": "产品名称", + "name": "product_name", + "in": "query" + }, + { + "type": "string", + "description": "最小金额", + "name": "min_amount", + "in": "query" + }, + { + "type": "string", + "description": "最大金额", + "name": "max_amount", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取成功", + "schema": { + "$ref": "#/definitions/responses.WalletTransactionListResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/form-config/{api_code}": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取指定API的表单配置,用于前端动态生成表单", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "API调试" + ], + "summary": "获取表单配置", + "parameters": [ + { + "type": "string", + "description": "API代码", + "name": "api_code", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "获取成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未授权", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "API接口不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/invoices/apply": { + "post": { + "description": "用户申请开票", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "发票管理" + ], + "summary": "申请开票", + "parameters": [ + { + "description": "申请开票请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/finance.ApplyInvoiceRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/interfaces.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.InvoiceApplicationResponse" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, + "/api/v1/invoices/available-amount": { + "get": { + "description": "获取用户当前可开票的金额", + "produces": [ + "application/json" + ], + "tags": [ + "发票管理" + ], + "summary": "获取可开票金额", + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/interfaces.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.AvailableAmountResponse" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, + "/api/v1/invoices/info": { + "get": { + "description": "获取用户的发票信息", + "produces": [ + "application/json" + ], + "tags": [ + "发票管理" + ], + "summary": "获取用户发票信息", + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/interfaces.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.InvoiceInfoResponse" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + }, + "put": { + "description": "更新用户的发票信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "发票管理" + ], + "summary": "更新用户发票信息", + "parameters": [ + { + "description": "更新发票信息请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/finance.UpdateInvoiceInfoRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, + "/api/v1/invoices/records": { + "get": { + "description": "获取用户的开票记录列表", + "produces": [ + "application/json" + ], + "tags": [ + "发票管理" + ], + "summary": "获取用户开票记录", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "状态筛选", + "name": "status", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/interfaces.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.InvoiceRecordsResponse" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, + "/api/v1/invoices/{application_id}/download": { + "get": { + "description": "下载指定发票的文件", + "produces": [ + "application/octet-stream" + ], + "tags": [ + "发票管理" + ], + "summary": "下载发票文件", + "parameters": [ + { + "type": "string", + "description": "申请ID", + "name": "application_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "file" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, + "/api/v1/my/api-calls": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取当前用户的API调用记录列表,支持分页和筛选", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "API管理" + ], + "summary": "获取用户API调用记录", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "开始时间 (格式: 2006-01-02 15:04:05)", + "name": "start_time", + "in": "query" + }, + { + "type": "string", + "description": "结束时间 (格式: 2006-01-02 15:04:05)", + "name": "end_time", + "in": "query" + }, + { + "type": "string", + "description": "交易ID", + "name": "transaction_id", + "in": "query" + }, + { + "type": "string", + "description": "产品名称", + "name": "product_name", + "in": "query" + }, + { + "type": "string", + "description": "状态 (pending/success/failed)", + "name": "status", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取成功", + "schema": { + "$ref": "#/definitions/dto.ApiCallListResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/my/subscriptions": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取当前用户的订阅列表", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "我的订阅" + ], + "summary": "获取我的订阅列表", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "搜索关键词", + "name": "keyword", + "in": "query" + }, + { + "type": "string", + "description": "产品名称", + "name": "product_name", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "订阅开始时间", + "name": "start_time", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "订阅结束时间", + "name": "end_time", + "in": "query" + }, + { + "type": "string", + "description": "排序字段", + "name": "sort_by", + "in": "query" + }, + { + "enum": [ + "asc", + "desc" + ], + "type": "string", + "description": "排序方向", + "name": "sort_order", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取订阅列表成功", + "schema": { + "$ref": "#/definitions/responses.SubscriptionListResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/my/subscriptions/stats": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取当前用户的订阅统计信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "我的订阅" + ], + "summary": "获取我的订阅统计", + "responses": { + "200": { + "description": "获取订阅统计成功", + "schema": { + "$ref": "#/definitions/responses.SubscriptionStatsResponse" + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/my/subscriptions/{id}": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取指定订阅的详细信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "我的订阅" + ], + "summary": "获取我的订阅详情", + "parameters": [ + { + "type": "string", + "description": "订阅ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "获取订阅详情成功", + "schema": { + "$ref": "#/definitions/responses.SubscriptionInfoResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "订阅不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/my/subscriptions/{id}/usage": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取指定订阅的使用情况统计", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "我的订阅" + ], + "summary": "获取我的订阅使用情况", + "parameters": [ + { + "type": "string", + "description": "订阅ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "获取使用情况成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "订阅不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/my/whitelist/{ip}": { + "delete": { + "security": [ + { + "Bearer": [] + } + ], + "description": "从当前用户的白名单中删除指定IP地址", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "API管理" + ], + "summary": "删除白名单IP", + "parameters": [ + { + "type": "string", + "description": "IP地址", + "name": "ip", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "删除白名单IP成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/products": { + "get": { + "description": "分页获取可用的产品列表,支持筛选,默认只返回可见的产品", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "数据大厅" + ], + "summary": "获取产品列表", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "搜索关键词", + "name": "keyword", + "in": "query" + }, + { + "type": "string", + "description": "分类ID", + "name": "category_id", + "in": "query" + }, + { + "type": "boolean", + "description": "是否启用", + "name": "is_enabled", + "in": "query" + }, + { + "type": "boolean", + "description": "是否可见", + "name": "is_visible", + "in": "query" + }, + { + "type": "boolean", + "description": "是否组合包", + "name": "is_package", + "in": "query" + }, + { + "type": "boolean", + "description": "是否已订阅(需要认证)", + "name": "is_subscribed", + "in": "query" + }, + { + "type": "string", + "description": "排序字段", + "name": "sort_by", + "in": "query" + }, + { + "enum": [ + "asc", + "desc" + ], + "type": "string", + "description": "排序方向", + "name": "sort_order", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取产品列表成功", + "schema": { + "$ref": "#/definitions/responses.ProductListResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/products/code/{product_code}/api-config": { + "get": { + "description": "根据产品代码获取API配置信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品API配置" + ], + "summary": "根据产品代码获取API配置", + "parameters": [ + { + "type": "string", + "description": "产品代码", + "name": "product_code", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "获取成功", + "schema": { + "$ref": "#/definitions/responses.ProductApiConfigResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "404": { + "description": "配置不存在", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, + "/api/v1/products/stats": { + "get": { + "description": "获取产品相关的统计信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "数据大厅" + ], + "summary": "获取产品统计", + "responses": { + "200": { + "description": "获取统计信息成功", + "schema": { + "$ref": "#/definitions/responses.ProductStatsResponse" + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/products/{id}": { + "get": { + "description": "获取产品详细信息,用户端只能查看可见的产品", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "数据大厅" + ], + "summary": "获取产品详情", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "boolean", + "description": "是否包含文档信息", + "name": "with_document", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取产品详情成功", + "schema": { + "$ref": "#/definitions/responses.ProductInfoWithDocumentResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在或不可见", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/products/{id}/api-config": { + "get": { + "description": "根据产品ID获取API配置信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品API配置" + ], + "summary": "获取产品API配置", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "获取成功", + "schema": { + "$ref": "#/definitions/responses.ProductApiConfigResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "404": { + "description": "配置不存在", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, + "/api/v1/products/{id}/documentation": { + "get": { + "description": "获取指定产品的文档信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "数据大厅" + ], + "summary": "获取产品文档", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "获取产品文档成功", + "schema": { + "$ref": "#/definitions/responses.DocumentationResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/products/{id}/subscribe": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "用户订阅指定产品", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "数据大厅" + ], + "summary": "订阅产品", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "订阅成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/users/admin/list": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员查看用户列表,支持分页和筛选", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "用户管理" + ], + "summary": "管理员查看用户列表", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "手机号筛选", + "name": "phone", + "in": "query" + }, + { + "enum": [ + "user", + "admin" + ], + "type": "string", + "description": "用户类型筛选", + "name": "user_type", + "in": "query" + }, + { + "type": "boolean", + "description": "是否激活筛选", + "name": "is_active", + "in": "query" + }, + { + "type": "boolean", + "description": "是否已认证筛选", + "name": "is_certified", + "in": "query" + }, + { + "type": "string", + "description": "企业名称筛选", + "name": "company_name", + "in": "query" + }, + { + "type": "string", + "format": "date", + "description": "开始日期", + "name": "start_date", + "in": "query" + }, + { + "type": "string", + "format": "date", + "description": "结束日期", + "name": "end_date", + "in": "query" + } + ], + "responses": { + "200": { + "description": "用户列表", + "schema": { + "$ref": "#/definitions/responses.UserListResponse" + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "403": { + "description": "权限不足", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/users/admin/stats": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取用户相关的统计信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "用户管理" + ], + "summary": "获取用户统计信息", + "responses": { + "200": { + "description": "用户统计信息", + "schema": { + "$ref": "#/definitions/responses.UserStatsResponse" + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "403": { + "description": "权限不足", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/users/admin/{user_id}": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取指定用户的详细信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "用户管理" + ], + "summary": "管理员获取用户详情", + "parameters": [ + { + "type": "string", + "description": "用户ID", + "name": "user_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "用户详情", + "schema": { + "$ref": "#/definitions/responses.UserDetailResponse" + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "403": { + "description": "权限不足", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "用户不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/users/login-password": { + "post": { + "description": "使用手机号和密码进行用户登录,返回JWT令牌", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "用户认证" + ], + "summary": "用户密码登录", + "parameters": [ + { + "description": "密码登录请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.LoginWithPasswordCommand" + } + } + ], + "responses": { + "200": { + "description": "登录成功", + "schema": { + "$ref": "#/definitions/responses.LoginUserResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "用户名或密码错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/users/login-sms": { + "post": { + "description": "使用手机号和短信验证码进行用户登录,返回JWT令牌", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "用户认证" + ], + "summary": "用户短信验证码登录", + "parameters": [ + { + "description": "短信登录请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.LoginWithSMSCommand" + } + } + ], + "responses": { + "200": { + "description": "登录成功", + "schema": { + "$ref": "#/definitions/responses.LoginUserResponse" + } + }, + "400": { + "description": "请求参数错误或验证码无效", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "认证失败", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/users/me": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "根据JWT令牌获取当前登录用户的详细信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "用户管理" + ], + "summary": "获取当前用户信息", + "responses": { + "200": { + "description": "用户信息", + "schema": { + "$ref": "#/definitions/responses.UserProfileResponse" + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "用户不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/users/me/password": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "使用旧密码、新密码确认和验证码修改当前用户的密码", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "用户管理" + ], + "summary": "修改密码", + "parameters": [ + { + "description": "修改密码请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.ChangePasswordCommand" + } + } + ], + "responses": { + "200": { + "description": "密码修改成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误或验证码无效", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/users/register": { + "post": { + "description": "使用手机号、密码和验证码进行用户注册,需要确认密码", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "用户认证" + ], + "summary": "用户注册", + "parameters": [ + { + "description": "用户注册请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.RegisterUserCommand" + } + } + ], + "responses": { + "201": { + "description": "注册成功", + "schema": { + "$ref": "#/definitions/responses.RegisterUserResponse" + } + }, + "400": { + "description": "请求参数错误或验证码无效", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "409": { + "description": "手机号已存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/users/reset-password": { + "post": { + "description": "使用手机号、验证码和新密码重置用户密码(忘记密码时使用)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "用户认证" + ], + "summary": "重置密码", + "parameters": [ + { + "description": "重置密码请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.ResetPasswordCommand" + } + } + ], + "responses": { + "200": { + "description": "密码重置成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误或验证码无效", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "用户不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/users/send-code": { + "post": { + "description": "向指定手机号发送验证码,支持注册、登录、修改密码等场景", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "用户认证" + ], + "summary": "发送短信验证码", + "parameters": [ + { + "description": "发送验证码请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.SendCodeCommand" + } + } + ], + "responses": { + "200": { + "description": "验证码发送成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "429": { + "description": "请求频率限制", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + } + }, + "definitions": { + "commands.AddPackageItemCommand": { + "type": "object", + "required": [ + "product_id" + ], + "properties": { + "product_id": { + "type": "string" + } + } + }, + "commands.ApiCallCommand": { + "type": "object", + "required": [ + "data" + ], + "properties": { + "data": { + "type": "string" + }, + "options": { + "$ref": "#/definitions/commands.ApiCallOptions" + } + } + }, + "commands.ApiCallOptions": { + "type": "object", + "properties": { + "is_debug": { + "description": "是否为调试调用", + "type": "boolean" + }, + "json": { + "description": "是否返回JSON格式", + "type": "boolean" + } + } + }, + "commands.ApplyContractCommand": { + "type": "object", + "required": [ + "user_id" + ], + "properties": { + "user_id": { + "type": "string" + } + } + }, + "commands.BatchUpdateSubscriptionPricesCommand": { + "type": "object", + "required": [ + "discount", + "scope", + "user_id" + ], + "properties": { + "discount": { + "type": "number", + "maximum": 10, + "minimum": 0.1 + }, + "scope": { + "type": "string", + "enum": [ + "undiscounted", + "all" + ] + }, + "user_id": { + "type": "string" + } + } + }, + "commands.ChangePasswordCommand": { + "description": "修改用户密码请求参数", + "type": "object", + "required": [ + "code", + "confirm_new_password", + "new_password", + "old_password" + ], + "properties": { + "code": { + "type": "string", + "example": "123456" + }, + "confirm_new_password": { + "type": "string", + "example": "NewPassword123" + }, + "new_password": { + "type": "string", + "example": "NewPassword123" + }, + "old_password": { + "type": "string", + "maxLength": 128, + "minLength": 6, + "example": "OldPassword123" + } + } + }, + "commands.CreateAlipayRechargeCommand": { + "type": "object", + "required": [ + "amount", + "platform" + ], + "properties": { + "amount": { + "description": "充值金额", + "type": "string" + }, + "platform": { + "description": "支付平台:app/h5/pc", + "type": "string", + "enum": [ + "app", + "h5", + "pc" + ] + } + } + }, + "commands.CreateArticleCommand": { + "type": "object", + "required": [ + "content", + "title" + ], + "properties": { + "category_id": { + "type": "string" + }, + "content": { + "type": "string" + }, + "cover_image": { + "type": "string" + }, + "is_featured": { + "type": "boolean" + }, + "summary": { + "type": "string" + }, + "tag_ids": { + "type": "array", + "items": { + "type": "string" + } + }, + "title": { + "type": "string" + } + } + }, + "commands.CreateCategoryCommand": { + "type": "object", + "required": [ + "code", + "name" + ], + "properties": { + "code": { + "type": "string" + }, + "description": { + "type": "string", + "maxLength": 200 + }, + "is_enabled": { + "type": "boolean" + }, + "is_visible": { + "type": "boolean" + }, + "name": { + "type": "string", + "maxLength": 50, + "minLength": 2 + }, + "sort": { + "type": "integer", + "maximum": 9999, + "minimum": 0 + } + } + }, + "commands.CreateDocumentationCommand": { + "type": "object", + "required": [ + "basic_info", + "product_id", + "request_method", + "request_params", + "request_url" + ], + "properties": { + "basic_info": { + "type": "string" + }, + "error_codes": { + "type": "string" + }, + "product_id": { + "type": "string" + }, + "request_method": { + "type": "string" + }, + "request_params": { + "type": "string" + }, + "request_url": { + "type": "string" + }, + "response_example": { + "type": "string" + }, + "response_fields": { + "type": "string" + } + } + }, + "commands.CreateProductCommand": { + "type": "object", + "required": [ + "category_id", + "code", + "name" + ], + "properties": { + "category_id": { + "type": "string" + }, + "code": { + "type": "string" + }, + "content": { + "type": "string", + "maxLength": 5000 + }, + "description": { + "type": "string", + "maxLength": 500 + }, + "is_enabled": { + "type": "boolean" + }, + "is_package": { + "type": "boolean" + }, + "is_visible": { + "type": "boolean" + }, + "name": { + "type": "string", + "maxLength": 100, + "minLength": 2 + }, + "price": { + "type": "number", + "minimum": 0 + }, + "seo_description": { + "type": "string", + "maxLength": 200 + }, + "seo_keywords": { + "type": "string", + "maxLength": 200 + }, + "seo_title": { + "description": "SEO信息", + "type": "string", + "maxLength": 100 + } + } + }, + "commands.DecryptCommand": { + "type": "object", + "required": [ + "encrypted_data", + "secret_key" + ], + "properties": { + "encrypted_data": { + "type": "string" + }, + "secret_key": { + "type": "string" + } + } + }, + "commands.EncryptCommand": { + "type": "object", + "required": [ + "data", + "secret_key" + ], + "properties": { + "data": { + "type": "object", + "additionalProperties": true + }, + "secret_key": { + "type": "string" + } + } + }, + "commands.LoginWithPasswordCommand": { + "description": "使用密码进行用户登录请求参数", + "type": "object", + "required": [ + "password", + "phone" + ], + "properties": { + "password": { + "type": "string", + "maxLength": 128, + "minLength": 6, + "example": "Password123" + }, + "phone": { + "type": "string", + "example": "13800138000" + } + } + }, + "commands.LoginWithSMSCommand": { + "description": "使用短信验证码进行用户登录请求参数", + "type": "object", + "required": [ + "code", + "phone" + ], + "properties": { + "code": { + "type": "string", + "example": "123456" + }, + "phone": { + "type": "string", + "example": "13800138000" + } + } + }, + "commands.PackageItemData": { + "type": "object", + "required": [ + "product_id", + "sort_order" + ], + "properties": { + "product_id": { + "type": "string" + }, + "sort_order": { + "type": "integer", + "minimum": 0 + } + } + }, + "commands.RegisterUserCommand": { + "description": "用户注册请求参数", + "type": "object", + "required": [ + "code", + "confirm_password", + "password", + "phone" + ], + "properties": { + "code": { + "type": "string", + "example": "123456" + }, + "confirm_password": { + "type": "string", + "example": "Password123" + }, + "password": { + "type": "string", + "example": "Password123" + }, + "phone": { + "type": "string", + "example": "13800138000" + } + } + }, + "commands.ReorderPackageItemsCommand": { + "type": "object", + "required": [ + "item_ids" + ], + "properties": { + "item_ids": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "commands.ResetPasswordCommand": { + "description": "重置用户密码请求参数(忘记密码时使用)", + "type": "object", + "required": [ + "code", + "confirm_new_password", + "new_password", + "phone" + ], + "properties": { + "code": { + "type": "string", + "example": "123456" + }, + "confirm_new_password": { + "type": "string", + "example": "NewPassword123" + }, + "new_password": { + "type": "string", + "example": "NewPassword123" + }, + "phone": { + "type": "string", + "example": "13800138000" + } + } + }, + "commands.SendCodeCommand": { + "description": "发送短信验证码请求参数", + "type": "object", + "required": [ + "phone", + "scene" + ], + "properties": { + "phone": { + "type": "string", + "example": "13800138000" + }, + "scene": { + "type": "string", + "enum": [ + "register", + "login", + "change_password", + "reset_password", + "bind", + "unbind", + "certification" + ], + "example": "register" + } + } + }, + "commands.SetFeaturedCommand": { + "type": "object", + "required": [ + "is_featured" + ], + "properties": { + "is_featured": { + "type": "boolean" + } + } + }, + "commands.SubmitEnterpriseInfoCommand": { + "type": "object", + "required": [ + "company_name", + "enterprise_address", + "legal_person_id", + "legal_person_name", + "legal_person_phone", + "unified_social_code", + "verification_code" + ], + "properties": { + "company_name": { + "type": "string", + "maxLength": 100, + "minLength": 2 + }, + "enterprise_address": { + "type": "string" + }, + "legal_person_id": { + "type": "string" + }, + "legal_person_name": { + "type": "string", + "maxLength": 20, + "minLength": 2 + }, + "legal_person_phone": { + "type": "string" + }, + "unified_social_code": { + "type": "string" + }, + "verification_code": { + "type": "string" + } + } + }, + "commands.UpdateArticleCommand": { + "type": "object", + "properties": { + "category_id": { + "type": "string" + }, + "content": { + "type": "string" + }, + "cover_image": { + "type": "string" + }, + "is_featured": { + "type": "boolean" + }, + "summary": { + "type": "string" + }, + "tag_ids": { + "type": "array", + "items": { + "type": "string" + } + }, + "title": { + "type": "string" + } + } + }, + "commands.UpdateCategoryCommand": { + "type": "object", + "required": [ + "code", + "name" + ], + "properties": { + "code": { + "type": "string" + }, + "description": { + "type": "string", + "maxLength": 200 + }, + "is_enabled": { + "type": "boolean" + }, + "is_visible": { + "type": "boolean" + }, + "name": { + "type": "string", + "maxLength": 50, + "minLength": 2 + }, + "sort": { + "type": "integer", + "maximum": 9999, + "minimum": 0 + } + } + }, + "commands.UpdatePackageItemCommand": { + "type": "object", + "required": [ + "sort_order" + ], + "properties": { + "sort_order": { + "type": "integer", + "minimum": 0 + } + } + }, + "commands.UpdatePackageItemsCommand": { + "type": "object", + "required": [ + "items" + ], + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/commands.PackageItemData" + } + } + } + }, + "commands.UpdateProductCommand": { + "type": "object", + "required": [ + "category_id", + "code", + "name" + ], + "properties": { + "category_id": { + "type": "string" + }, + "code": { + "type": "string" + }, + "content": { + "type": "string", + "maxLength": 5000 + }, + "description": { + "type": "string", + "maxLength": 500 + }, + "is_enabled": { + "type": "boolean" + }, + "is_package": { + "type": "boolean" + }, + "is_visible": { + "type": "boolean" + }, + "name": { + "type": "string", + "maxLength": 100, + "minLength": 2 + }, + "price": { + "type": "number", + "minimum": 0 + }, + "seo_description": { + "type": "string", + "maxLength": 200 + }, + "seo_keywords": { + "type": "string", + "maxLength": 200 + }, + "seo_title": { + "description": "SEO信息", + "type": "string", + "maxLength": 100 + } + } + }, + "commands.UpdateSubscriptionPriceCommand": { + "type": "object", + "properties": { + "price": { + "type": "number", + "minimum": 0 + } + } + }, + "dto.ApiCallListResponse": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.ApiCallRecordResponse" + } + }, + "page": { + "type": "integer" + }, + "size": { + "type": "integer" + }, + "total": { + "type": "integer" + } + } + }, + "dto.ApiCallRecordResponse": { + "type": "object", + "properties": { + "access_id": { + "type": "string" + }, + "client_ip": { + "type": "string" + }, + "company_name": { + "type": "string" + }, + "cost": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "end_at": { + "type": "string" + }, + "error_msg": { + "type": "string" + }, + "error_type": { + "type": "string" + }, + "id": { + "type": "string" + }, + "product_id": { + "type": "string" + }, + "product_name": { + "type": "string" + }, + "start_at": { + "type": "string" + }, + "status": { + "type": "string" + }, + "transaction_id": { + "type": "string" + }, + "translated_error_msg": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "user": { + "$ref": "#/definitions/dto.UserSimpleResponse" + }, + "user_id": { + "type": "string" + } + } + }, + "dto.ApiCallResponse": { + "type": "object", + "properties": { + "code": { + "type": "integer" + }, + "data": { + "type": "string" + }, + "message": { + "type": "string" + }, + "transaction_id": { + "type": "string" + } + } + }, + "dto.AvailableAmountResponse": { + "type": "object", + "properties": { + "available_amount": { + "description": "可开票金额", + "type": "number" + }, + "pending_applications": { + "description": "待处理申请金额", + "type": "number" + }, + "total_gifted": { + "description": "总赠送金额", + "type": "number" + }, + "total_invoiced": { + "description": "已开票金额", + "type": "number" + }, + "total_recharged": { + "description": "总充值金额", + "type": "number" + } + } + }, + "dto.EncryptResponse": { + "type": "object", + "properties": { + "encrypted_data": { + "type": "string" + } + } + }, + "dto.InvoiceApplicationResponse": { + "type": "object", + "properties": { + "amount": { + "type": "number" + }, + "created_at": { + "type": "string" + }, + "id": { + "type": "string" + }, + "invoice_info": { + "$ref": "#/definitions/value_objects.InvoiceInfo" + }, + "invoice_type": { + "$ref": "#/definitions/value_objects.InvoiceType" + }, + "status": { + "$ref": "#/definitions/entities.ApplicationStatus" + }, + "user_id": { + "type": "string" + } + } + }, + "dto.InvoiceInfoResponse": { + "type": "object", + "properties": { + "bank_account": { + "description": "用户可编辑", + "type": "string" + }, + "bank_name": { + "description": "用户可编辑", + "type": "string" + }, + "company_address": { + "description": "用户可编辑", + "type": "string" + }, + "company_name": { + "description": "从企业认证信息获取,只读", + "type": "string" + }, + "company_name_read_only": { + "description": "字段权限标识", + "type": "boolean" + }, + "company_phone": { + "description": "用户可编辑", + "type": "string" + }, + "is_complete": { + "type": "boolean" + }, + "missing_fields": { + "type": "array", + "items": { + "type": "string" + } + }, + "receiving_email": { + "description": "用户可编辑", + "type": "string" + }, + "taxpayer_id": { + "description": "从企业认证信息获取,只读", + "type": "string" + }, + "taxpayer_id_read_only": { + "description": "纳税人识别号是否只读", + "type": "boolean" + } + } + }, + "dto.InvoiceRecordResponse": { + "type": "object", + "properties": { + "amount": { + "type": "number" + }, + "bank_account": { + "description": "银行账号", + "type": "string" + }, + "bank_name": { + "description": "开户银行", + "type": "string" + }, + "company_address": { + "description": "企业地址", + "type": "string" + }, + "company_name": { + "description": "开票信息(快照数据)", + "type": "string" + }, + "company_phone": { + "description": "企业电话", + "type": "string" + }, + "created_at": { + "type": "string" + }, + "file_name": { + "description": "文件信息", + "type": "string" + }, + "file_size": { + "type": "integer" + }, + "file_url": { + "type": "string" + }, + "id": { + "type": "string" + }, + "invoice_type": { + "$ref": "#/definitions/value_objects.InvoiceType" + }, + "processed_at": { + "description": "时间信息", + "type": "string" + }, + "receiving_email": { + "description": "接收邮箱", + "type": "string" + }, + "reject_reason": { + "description": "拒绝原因", + "type": "string" + }, + "status": { + "$ref": "#/definitions/entities.ApplicationStatus" + }, + "taxpayer_id": { + "description": "纳税人识别号", + "type": "string" + }, + "user_id": { + "type": "string" + } + } + }, + "dto.InvoiceRecordsResponse": { + "type": "object", + "properties": { + "page": { + "type": "integer" + }, + "page_size": { + "type": "integer" + }, + "records": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.InvoiceRecordResponse" + } + }, + "total": { + "type": "integer" + }, + "total_pages": { + "type": "integer" + } + } + }, + "dto.PendingApplicationResponse": { + "type": "object", + "properties": { + "amount": { + "type": "number" + }, + "bank_account": { + "type": "string" + }, + "bank_name": { + "type": "string" + }, + "company_address": { + "type": "string" + }, + "company_name": { + "type": "string" + }, + "company_phone": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "file_name": { + "type": "string" + }, + "file_size": { + "type": "integer" + }, + "file_url": { + "type": "string" + }, + "id": { + "type": "string" + }, + "invoice_type": { + "$ref": "#/definitions/value_objects.InvoiceType" + }, + "processed_at": { + "type": "string" + }, + "receiving_email": { + "type": "string" + }, + "reject_reason": { + "type": "string" + }, + "status": { + "$ref": "#/definitions/entities.ApplicationStatus" + }, + "taxpayer_id": { + "type": "string" + }, + "user_id": { + "type": "string" + } + } + }, + "dto.PendingApplicationsResponse": { + "type": "object", + "properties": { + "applications": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.PendingApplicationResponse" + } + }, + "page": { + "type": "integer" + }, + "page_size": { + "type": "integer" + }, + "total": { + "type": "integer" + }, + "total_pages": { + "type": "integer" + } + } + }, + "dto.UserSimpleResponse": { + "type": "object", + "properties": { + "company_name": { + "type": "string" + }, + "id": { + "type": "string" + }, + "phone": { + "type": "string" + } + } + }, + "entities.ApplicationStatus": { + "type": "string", + "enum": [ + "pending", + "completed", + "rejected" + ], + "x-enum-comments": { + "ApplicationStatusCompleted": "已完成(已上传发票)", + "ApplicationStatusPending": "待处理", + "ApplicationStatusRejected": "已拒绝" + }, + "x-enum-descriptions": [ + "待处理", + "已完成(已上传发票)", + "已拒绝" + ], + "x-enum-varnames": [ + "ApplicationStatusPending", + "ApplicationStatusCompleted", + "ApplicationStatusRejected" + ] + }, + "enums.CertificationStatus": { + "type": "string", + "enum": [ + "pending", + "info_submitted", + "enterprise_verified", + "contract_applied", + "contract_signed", + "completed", + "info_rejected", + "contract_rejected", + "contract_expired" + ], + "x-enum-comments": { + "StatusCompleted": "认证完成", + "StatusContractApplied": "已申请签署合同", + "StatusContractExpired": "合同签署超时", + "StatusContractRejected": "合同被拒签", + "StatusContractSigned": "已签署合同", + "StatusEnterpriseVerified": "已企业认证", + "StatusInfoRejected": "企业信息被拒绝", + "StatusInfoSubmitted": "已提交企业信息", + "StatusPending": "待认证" + }, + "x-enum-descriptions": [ + "待认证", + "已提交企业信息", + "已企业认证", + "已申请签署合同", + "已签署合同", + "认证完成", + "企业信息被拒绝", + "合同被拒签", + "合同签署超时" + ], + "x-enum-varnames": [ + "StatusPending", + "StatusInfoSubmitted", + "StatusEnterpriseVerified", + "StatusContractApplied", + "StatusContractSigned", + "StatusCompleted", + "StatusInfoRejected", + "StatusContractRejected", + "StatusContractExpired" + ] + }, + "enums.FailureReason": { + "type": "string", + "enum": [ + "enterprise_not_exists", + "enterprise_info_mismatch", + "enterprise_status_abnormal", + "legal_person_mismatch", + "esign_verification_failed", + "invalid_document", + "contract_rejected_by_user", + "contract_expired", + "sign_process_failed", + "contract_gen_failed", + "esign_flow_error", + "system_error", + "network_error", + "timeout", + "unknown_error" + ], + "x-enum-comments": { + "FailureReasonContractExpired": "合同签署超时", + "FailureReasonContractGenFailed": "合同生成失败", + "FailureReasonContractRejectedByUser": "用户拒绝签署", + "FailureReasonEnterpriseInfoMismatch": "企业信息不匹配", + "FailureReasonEnterpriseNotExists": "企业不存在", + "FailureReasonEnterpriseStatusAbnormal": "企业状态异常", + "FailureReasonEsignFlowError": "e签宝流程错误", + "FailureReasonEsignVerificationFailed": "e签宝验证失败", + "FailureReasonInvalidDocument": "证件信息无效", + "FailureReasonLegalPersonMismatch": "法定代表人信息不匹配", + "FailureReasonNetworkError": "网络错误", + "FailureReasonSignProcessFailed": "签署流程失败", + "FailureReasonSystemError": "系统错误", + "FailureReasonTimeout": "操作超时", + "FailureReasonUnknownError": "未知错误" + }, + "x-enum-descriptions": [ + "企业不存在", + "企业信息不匹配", + "企业状态异常", + "法定代表人信息不匹配", + "e签宝验证失败", + "证件信息无效", + "用户拒绝签署", + "合同签署超时", + "签署流程失败", + "合同生成失败", + "e签宝流程错误", + "系统错误", + "网络错误", + "操作超时", + "未知错误" + ], + "x-enum-varnames": [ + "FailureReasonEnterpriseNotExists", + "FailureReasonEnterpriseInfoMismatch", + "FailureReasonEnterpriseStatusAbnormal", + "FailureReasonLegalPersonMismatch", + "FailureReasonEsignVerificationFailed", + "FailureReasonInvalidDocument", + "FailureReasonContractRejectedByUser", + "FailureReasonContractExpired", + "FailureReasonSignProcessFailed", + "FailureReasonContractGenFailed", + "FailureReasonEsignFlowError", + "FailureReasonSystemError", + "FailureReasonNetworkError", + "FailureReasonTimeout", + "FailureReasonUnknownError" + ] + }, + "finance.ApplyInvoiceRequest": { + "type": "object", + "required": [ + "amount", + "invoice_type" + ], + "properties": { + "amount": { + "description": "开票金额", + "type": "string" + }, + "invoice_type": { + "description": "发票类型:general/special", + "type": "string" + } + } + }, + "finance.RejectInvoiceRequest": { + "type": "object", + "required": [ + "reason" + ], + "properties": { + "reason": { + "description": "拒绝原因", + "type": "string" + } + } + }, + "finance.UpdateInvoiceInfoRequest": { + "type": "object", + "required": [ + "receiving_email" + ], + "properties": { + "bank_account": { + "description": "银行账户", + "type": "string" + }, + "bank_name": { + "description": "银行名称", + "type": "string" + }, + "company_address": { + "description": "公司地址", + "type": "string" + }, + "company_name": { + "description": "公司名称(从企业认证信息获取,用户不可修改)", + "type": "string" + }, + "company_phone": { + "description": "企业注册电话", + "type": "string" + }, + "receiving_email": { + "description": "发票接收邮箱", + "type": "string" + }, + "taxpayer_id": { + "description": "纳税人识别号(从企业认证信息获取,用户不可修改)", + "type": "string" + } + } + }, + "interfaces.APIResponse": { + "type": "object", + "properties": { + "data": {}, + "errors": {}, + "message": { + "type": "string" + }, + "meta": { + "type": "object", + "additionalProperties": true + }, + "pagination": { + "$ref": "#/definitions/interfaces.PaginationMeta" + }, + "request_id": { + "type": "string" + }, + "success": { + "type": "boolean" + }, + "timestamp": { + "type": "integer" + } + } + }, + "interfaces.PaginationMeta": { + "type": "object", + "properties": { + "has_next": { + "type": "boolean" + }, + "has_prev": { + "type": "boolean" + }, + "page": { + "type": "integer" + }, + "page_size": { + "type": "integer" + }, + "total": { + "type": "integer" + }, + "total_pages": { + "type": "integer" + } + } + }, + "queries.ConfirmAuthCommand": { + "type": "object" + }, + "queries.ConfirmSignCommand": { + "type": "object" + }, + "responses.AlipayOrderStatusResponse": { + "type": "object", + "properties": { + "amount": { + "description": "订单金额", + "type": "number" + }, + "can_retry": { + "description": "是否可以重试", + "type": "boolean" + }, + "created_at": { + "description": "创建时间", + "type": "string" + }, + "error_code": { + "description": "错误码", + "type": "string" + }, + "error_message": { + "description": "错误信息", + "type": "string" + }, + "is_processing": { + "description": "是否处理中", + "type": "boolean" + }, + "notify_time": { + "description": "异步通知时间", + "type": "string" + }, + "out_trade_no": { + "description": "商户订单号", + "type": "string" + }, + "platform": { + "description": "支付平台", + "type": "string" + }, + "return_time": { + "description": "同步返回时间", + "type": "string" + }, + "status": { + "description": "订单状态", + "type": "string" + }, + "subject": { + "description": "订单标题", + "type": "string" + }, + "trade_no": { + "description": "支付宝交易号", + "type": "string" + }, + "updated_at": { + "description": "更新时间", + "type": "string" + } + } + }, + "responses.AlipayRechargeBonusRuleResponse": { + "type": "object", + "properties": { + "bonus_amount": { + "type": "number" + }, + "recharge_amount": { + "type": "number" + } + } + }, + "responses.AlipayRechargeOrderResponse": { + "type": "object", + "properties": { + "amount": { + "description": "充值金额", + "type": "number" + }, + "out_trade_no": { + "description": "商户订单号", + "type": "string" + }, + "pay_url": { + "description": "支付链接", + "type": "string" + }, + "platform": { + "description": "支付平台", + "type": "string" + }, + "subject": { + "description": "订单标题", + "type": "string" + } + } + }, + "responses.ArticleInfoResponse": { + "type": "object", + "properties": { + "category": { + "$ref": "#/definitions/tyapi-server_internal_application_article_dto_responses.CategoryInfoResponse" + }, + "category_id": { + "type": "string" + }, + "content": { + "type": "string" + }, + "cover_image": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "id": { + "type": "string" + }, + "is_featured": { + "type": "boolean" + }, + "published_at": { + "type": "string" + }, + "status": { + "type": "string" + }, + "summary": { + "type": "string" + }, + "tags": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.TagInfoResponse" + } + }, + "title": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "view_count": { + "type": "integer" + } + } + }, + "responses.ArticleListResponse": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.ArticleInfoResponse" + } + }, + "page": { + "type": "integer" + }, + "size": { + "type": "integer" + }, + "total": { + "type": "integer" + } + } + }, + "responses.ArticleStatsResponse": { + "type": "object", + "properties": { + "archived_articles": { + "type": "integer" + }, + "draft_articles": { + "type": "integer" + }, + "published_articles": { + "type": "integer" + }, + "total_articles": { + "type": "integer" + }, + "total_views": { + "type": "integer" + } + } + }, + "responses.CategoryListResponse": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse" + } + }, + "page": { + "type": "integer" + }, + "size": { + "type": "integer" + }, + "total": { + "type": "integer" + } + } + }, + "responses.CategorySimpleResponse": { + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "id": { + "type": "string" + }, + "name": { + "type": "string" + } + } + }, + "responses.CertificationListResponse": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.CertificationResponse" + } + }, + "page": { + "type": "integer" + }, + "page_size": { + "type": "integer" + }, + "total": { + "type": "integer" + }, + "total_pages": { + "type": "integer" + } + } + }, + "responses.CertificationResponse": { + "type": "object", + "properties": { + "available_actions": { + "type": "array", + "items": { + "type": "string" + } + }, + "can_retry": { + "type": "boolean" + }, + "completed_at": { + "type": "string" + }, + "contract_applied_at": { + "type": "string" + }, + "contract_info": { + "description": "合同信息", + "allOf": [ + { + "$ref": "#/definitions/value_objects.ContractInfo" + } + ] + }, + "contract_signed_at": { + "type": "string" + }, + "created_at": { + "description": "时间戳", + "type": "string" + }, + "enterprise_info": { + "description": "企业信息", + "allOf": [ + { + "$ref": "#/definitions/value_objects.EnterpriseInfo" + } + ] + }, + "enterprise_verified_at": { + "type": "string" + }, + "failure_message": { + "type": "string" + }, + "failure_reason": { + "description": "失败信息", + "allOf": [ + { + "$ref": "#/definitions/enums.FailureReason" + } + ] + }, + "failure_reason_name": { + "type": "string" + }, + "id": { + "type": "string" + }, + "info_submitted_at": { + "type": "string" + }, + "is_completed": { + "description": "业务状态", + "type": "boolean" + }, + "is_failed": { + "type": "boolean" + }, + "is_user_action_required": { + "type": "boolean" + }, + "metadata": { + "description": "元数据", + "type": "object", + "additionalProperties": true + }, + "next_action": { + "description": "用户操作提示", + "type": "string" + }, + "progress": { + "type": "integer" + }, + "retry_count": { + "type": "integer" + }, + "status": { + "$ref": "#/definitions/enums.CertificationStatus" + }, + "status_name": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "user_id": { + "type": "string" + } + } + }, + "responses.ConfirmAuthResponse": { + "type": "object", + "properties": { + "reason": { + "type": "string" + }, + "status": { + "$ref": "#/definitions/enums.CertificationStatus" + } + } + }, + "responses.ConfirmSignResponse": { + "type": "object", + "properties": { + "reason": { + "type": "string" + }, + "status": { + "$ref": "#/definitions/enums.CertificationStatus" + } + } + }, + "responses.ContractInfoItem": { + "type": "object", + "properties": { + "contract_file_url": { + "type": "string" + }, + "contract_name": { + "type": "string" + }, + "contract_type": { + "description": "合同类型代码", + "type": "string" + }, + "contract_type_name": { + "description": "合同类型中文名称", + "type": "string" + }, + "created_at": { + "type": "string" + }, + "id": { + "type": "string" + } + } + }, + "responses.ContractSignUrlResponse": { + "type": "object", + "properties": { + "certification_id": { + "type": "string" + }, + "contract_sign_url": { + "type": "string" + }, + "contract_url": { + "type": "string" + }, + "expire_at": { + "type": "string" + }, + "message": { + "type": "string" + }, + "next_action": { + "type": "string" + } + } + }, + "responses.DocumentationResponse": { + "type": "object", + "properties": { + "basic_info": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "error_codes": { + "type": "string" + }, + "id": { + "type": "string" + }, + "product_id": { + "type": "string" + }, + "request_method": { + "type": "string" + }, + "request_params": { + "type": "string" + }, + "request_url": { + "type": "string" + }, + "response_example": { + "type": "string" + }, + "response_fields": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "version": { + "type": "string" + } + } + }, + "responses.EnterpriseInfoItem": { + "type": "object", + "properties": { + "company_name": { + "type": "string" + }, + "contracts": { + "description": "合同信息", + "type": "array", + "items": { + "$ref": "#/definitions/responses.ContractInfoItem" + } + }, + "created_at": { + "type": "string" + }, + "enterprise_address": { + "type": "string" + }, + "id": { + "type": "string" + }, + "legal_person_name": { + "type": "string" + }, + "legal_person_phone": { + "type": "string" + }, + "unified_social_code": { + "type": "string" + } + } + }, + "responses.EnterpriseInfoResponse": { + "description": "企业信息响应", + "type": "object", + "properties": { + "certified_at": { + "type": "string", + "example": "2024-01-01T00:00:00Z" + }, + "company_name": { + "type": "string", + "example": "示例企业有限公司" + }, + "created_at": { + "type": "string", + "example": "2024-01-01T00:00:00Z" + }, + "enterprise_address": { + "type": "string", + "example": "北京市朝阳区xxx街道xxx号" + }, + "id": { + "type": "string", + "example": "123e4567-e89b-12d3-a456-426614174000" + }, + "legal_person_id": { + "type": "string", + "example": "110101199001011234" + }, + "legal_person_name": { + "type": "string", + "example": "张三" + }, + "legal_person_phone": { + "type": "string", + "example": "13800138000" + }, + "unified_social_code": { + "type": "string", + "example": "91110000123456789X" + }, + "updated_at": { + "type": "string", + "example": "2024-01-01T00:00:00Z" + } + } + }, + "responses.LoginUserResponse": { + "description": "用户登录成功响应", + "type": "object", + "properties": { + "access_token": { + "type": "string", + "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." + }, + "expires_in": { + "type": "integer", + "example": 86400 + }, + "login_method": { + "type": "string", + "example": "password" + }, + "token_type": { + "type": "string", + "example": "Bearer" + }, + "user": { + "$ref": "#/definitions/responses.UserProfileResponse" + } + } + }, + "responses.PackageItemResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "price": { + "type": "number" + }, + "product_code": { + "type": "string" + }, + "product_id": { + "type": "string" + }, + "product_name": { + "type": "string" + }, + "sort_order": { + "type": "integer" + } + } + }, + "responses.ProductAdminInfoResponse": { + "type": "object", + "properties": { + "category": { + "description": "关联信息", + "allOf": [ + { + "$ref": "#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse" + } + ] + }, + "category_id": { + "type": "string" + }, + "code": { + "type": "string" + }, + "content": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "description": { + "type": "string" + }, + "documentation": { + "description": "文档信息", + "allOf": [ + { + "$ref": "#/definitions/responses.DocumentationResponse" + } + ] + }, + "id": { + "type": "string" + }, + "is_enabled": { + "type": "boolean" + }, + "is_package": { + "type": "boolean" + }, + "is_visible": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "old_id": { + "type": "string" + }, + "package_items": { + "description": "组合包信息", + "type": "array", + "items": { + "$ref": "#/definitions/responses.PackageItemResponse" + } + }, + "price": { + "type": "number" + }, + "seo_description": { + "type": "string" + }, + "seo_keywords": { + "type": "string" + }, + "seo_title": { + "description": "SEO信息", + "type": "string" + }, + "updated_at": { + "type": "string" + } + } + }, + "responses.ProductAdminListResponse": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.ProductAdminInfoResponse" + } + }, + "page": { + "type": "integer" + }, + "size": { + "type": "integer" + }, + "total": { + "type": "integer" + } + } + }, + "responses.ProductApiConfigResponse": { + "type": "object", + "properties": { + "created_at": { + "type": "string" + }, + "id": { + "type": "string" + }, + "product_id": { + "type": "string" + }, + "request_params": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.RequestParamResponse" + } + }, + "response_example": { + "type": "object", + "additionalProperties": true + }, + "response_fields": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.ResponseFieldResponse" + } + }, + "updated_at": { + "type": "string" + } + } + }, + "responses.ProductInfoResponse": { + "type": "object", + "properties": { + "category": { + "description": "关联信息", + "allOf": [ + { + "$ref": "#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse" + } + ] + }, + "category_id": { + "type": "string" + }, + "code": { + "type": "string" + }, + "content": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "description": { + "type": "string" + }, + "id": { + "type": "string" + }, + "is_enabled": { + "type": "boolean" + }, + "is_package": { + "type": "boolean" + }, + "is_subscribed": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "old_id": { + "type": "string" + }, + "package_items": { + "description": "组合包信息", + "type": "array", + "items": { + "$ref": "#/definitions/responses.PackageItemResponse" + } + }, + "price": { + "type": "number" + }, + "seo_description": { + "type": "string" + }, + "seo_keywords": { + "type": "string" + }, + "seo_title": { + "description": "SEO信息", + "type": "string" + }, + "updated_at": { + "type": "string" + } + } + }, + "responses.ProductInfoWithDocumentResponse": { + "type": "object", + "properties": { + "category": { + "description": "关联信息", + "allOf": [ + { + "$ref": "#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse" + } + ] + }, + "category_id": { + "type": "string" + }, + "code": { + "type": "string" + }, + "content": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "description": { + "type": "string" + }, + "documentation": { + "$ref": "#/definitions/responses.DocumentationResponse" + }, + "id": { + "type": "string" + }, + "is_enabled": { + "type": "boolean" + }, + "is_package": { + "type": "boolean" + }, + "is_subscribed": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "old_id": { + "type": "string" + }, + "package_items": { + "description": "组合包信息", + "type": "array", + "items": { + "$ref": "#/definitions/responses.PackageItemResponse" + } + }, + "price": { + "type": "number" + }, + "seo_description": { + "type": "string" + }, + "seo_keywords": { + "type": "string" + }, + "seo_title": { + "description": "SEO信息", + "type": "string" + }, + "updated_at": { + "type": "string" + } + } + }, + "responses.ProductListResponse": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.ProductInfoResponse" + } + }, + "page": { + "type": "integer" + }, + "size": { + "type": "integer" + }, + "total": { + "type": "integer" + } + } + }, + "responses.ProductSimpleResponse": { + "type": "object", + "properties": { + "category": { + "$ref": "#/definitions/responses.CategorySimpleResponse" + }, + "code": { + "type": "string" + }, + "description": { + "type": "string" + }, + "id": { + "type": "string" + }, + "is_package": { + "type": "boolean" + }, + "is_subscribed": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "old_id": { + "type": "string" + }, + "price": { + "type": "number" + } + } + }, + "responses.ProductStatsResponse": { + "type": "object", + "properties": { + "enabled_products": { + "type": "integer" + }, + "package_products": { + "type": "integer" + }, + "total_products": { + "type": "integer" + }, + "visible_products": { + "type": "integer" + } + } + }, + "responses.RechargeConfigResponse": { + "type": "object", + "properties": { + "alipay_recharge_bonus": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.AlipayRechargeBonusRuleResponse" + } + }, + "max_amount": { + "description": "最高充值金额", + "type": "string" + }, + "min_amount": { + "description": "最低充值金额", + "type": "string" + } + } + }, + "responses.RechargeRecordListResponse": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.RechargeRecordResponse" + } + }, + "page": { + "type": "integer" + }, + "size": { + "type": "integer" + }, + "total": { + "type": "integer" + } + } + }, + "responses.RechargeRecordResponse": { + "type": "object", + "properties": { + "alipay_order_id": { + "type": "string" + }, + "amount": { + "type": "number" + }, + "company_name": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "id": { + "type": "string" + }, + "notes": { + "type": "string" + }, + "operator_id": { + "type": "string" + }, + "recharge_type": { + "type": "string" + }, + "status": { + "type": "string" + }, + "transfer_order_id": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "user": { + "$ref": "#/definitions/tyapi-server_internal_application_finance_dto_responses.UserSimpleResponse" + }, + "user_id": { + "type": "string" + } + } + }, + "responses.RegisterUserResponse": { + "description": "用户注册成功响应", + "type": "object", + "properties": { + "id": { + "type": "string", + "example": "123e4567-e89b-12d3-a456-426614174000" + }, + "phone": { + "type": "string", + "example": "13800138000" + } + } + }, + "responses.RequestParamResponse": { + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "example": { + "type": "string" + }, + "field": { + "type": "string" + }, + "name": { + "type": "string" + }, + "required": { + "type": "boolean" + }, + "type": { + "type": "string" + }, + "validation": { + "type": "string" + } + } + }, + "responses.ResponseFieldResponse": { + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "example": { + "type": "string" + }, + "name": { + "type": "string" + }, + "path": { + "type": "string" + }, + "required": { + "type": "boolean" + }, + "type": { + "type": "string" + } + } + }, + "responses.SubscriptionInfoResponse": { + "type": "object", + "properties": { + "api_used": { + "type": "integer" + }, + "created_at": { + "type": "string" + }, + "id": { + "type": "string" + }, + "price": { + "type": "number" + }, + "product": { + "$ref": "#/definitions/responses.ProductSimpleResponse" + }, + "product_id": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "user": { + "description": "关联信息", + "allOf": [ + { + "$ref": "#/definitions/tyapi-server_internal_application_product_dto_responses.UserSimpleResponse" + } + ] + }, + "user_id": { + "type": "string" + } + } + }, + "responses.SubscriptionListResponse": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.SubscriptionInfoResponse" + } + }, + "page": { + "type": "integer" + }, + "size": { + "type": "integer" + }, + "total": { + "type": "integer" + } + } + }, + "responses.SubscriptionStatsResponse": { + "type": "object", + "properties": { + "total_revenue": { + "type": "number" + }, + "total_subscriptions": { + "type": "integer" + } + } + }, + "responses.TagInfoResponse": { + "type": "object", + "properties": { + "color": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "id": { + "type": "string" + }, + "name": { + "type": "string" + } + } + }, + "responses.UserDetailResponse": { + "type": "object", + "properties": { + "created_at": { + "type": "string" + }, + "enterprise_info": { + "description": "企业信息", + "allOf": [ + { + "$ref": "#/definitions/responses.EnterpriseInfoItem" + } + ] + }, + "id": { + "type": "string" + }, + "is_active": { + "type": "boolean" + }, + "is_certified": { + "type": "boolean" + }, + "last_login_at": { + "type": "string" + }, + "login_count": { + "type": "integer" + }, + "phone": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "user_type": { + "type": "string" + }, + "username": { + "type": "string" + }, + "wallet_balance": { + "description": "钱包信息", + "type": "string" + } + } + }, + "responses.UserListItem": { + "type": "object", + "properties": { + "created_at": { + "type": "string" + }, + "enterprise_info": { + "description": "企业信息", + "allOf": [ + { + "$ref": "#/definitions/responses.EnterpriseInfoItem" + } + ] + }, + "id": { + "type": "string" + }, + "is_active": { + "type": "boolean" + }, + "is_certified": { + "type": "boolean" + }, + "last_login_at": { + "type": "string" + }, + "login_count": { + "type": "integer" + }, + "phone": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "user_type": { + "type": "string" + }, + "username": { + "type": "string" + }, + "wallet_balance": { + "description": "钱包信息", + "type": "string" + } + } + }, + "responses.UserListResponse": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.UserListItem" + } + }, + "page": { + "type": "integer" + }, + "size": { + "type": "integer" + }, + "total": { + "type": "integer" + } + } + }, + "responses.UserProfileResponse": { + "description": "用户基本信息", + "type": "object", + "properties": { + "created_at": { + "type": "string", + "example": "2024-01-01T00:00:00Z" + }, + "enterprise_info": { + "$ref": "#/definitions/responses.EnterpriseInfoResponse" + }, + "id": { + "type": "string", + "example": "123e4567-e89b-12d3-a456-426614174000" + }, + "is_active": { + "type": "boolean", + "example": true + }, + "is_certified": { + "type": "boolean", + "example": false + }, + "last_login_at": { + "type": "string", + "example": "2024-01-01T00:00:00Z" + }, + "login_count": { + "type": "integer", + "example": 10 + }, + "permissions": { + "type": "array", + "items": { + "type": "string" + }, + "example": [ + "['user:read'", + "'user:write']" + ] + }, + "phone": { + "type": "string", + "example": "13800138000" + }, + "updated_at": { + "type": "string", + "example": "2024-01-01T00:00:00Z" + }, + "user_type": { + "type": "string", + "example": "user" + }, + "username": { + "type": "string", + "example": "admin" + } + } + }, + "responses.UserStatsResponse": { + "type": "object", + "properties": { + "active_users": { + "type": "integer" + }, + "certified_users": { + "type": "integer" + }, + "total_users": { + "type": "integer" + } + } + }, + "responses.WalletResponse": { + "type": "object", + "properties": { + "balance": { + "type": "number" + }, + "balance_status": { + "description": "normal, low, arrears", + "type": "string" + }, + "created_at": { + "type": "string" + }, + "id": { + "type": "string" + }, + "is_active": { + "type": "boolean" + }, + "is_arrears": { + "description": "是否欠费", + "type": "boolean" + }, + "is_low_balance": { + "description": "是否余额较低", + "type": "boolean" + }, + "updated_at": { + "type": "string" + }, + "user_id": { + "type": "string" + } + } + }, + "responses.WalletTransactionListResponse": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.WalletTransactionResponse" + } + }, + "page": { + "type": "integer" + }, + "size": { + "type": "integer" + }, + "total": { + "type": "integer" + } + } + }, + "responses.WalletTransactionResponse": { + "type": "object", + "properties": { + "amount": { + "type": "number" + }, + "api_call_id": { + "type": "string" + }, + "company_name": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "id": { + "type": "string" + }, + "product_id": { + "type": "string" + }, + "product_name": { + "type": "string" + }, + "transaction_id": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "user": { + "$ref": "#/definitions/tyapi-server_internal_application_finance_dto_responses.UserSimpleResponse" + }, + "user_id": { + "type": "string" + } + } + }, + "tyapi-server_internal_application_article_dto_responses.CategoryInfoResponse": { + "type": "object", + "properties": { + "created_at": { + "type": "string" + }, + "description": { + "type": "string" + }, + "id": { + "type": "string" + }, + "is_active": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "sort_order": { + "type": "integer" + } + } + }, + "tyapi-server_internal_application_finance_dto_responses.UserSimpleResponse": { + "type": "object", + "properties": { + "company_name": { + "type": "string" + }, + "id": { + "type": "string" + }, + "phone": { + "type": "string" + } + } + }, + "tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse": { + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "description": { + "type": "string" + }, + "id": { + "type": "string" + }, + "is_enabled": { + "type": "boolean" + }, + "is_visible": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "sort": { + "type": "integer" + }, + "updated_at": { + "type": "string" + } + } + }, + "tyapi-server_internal_application_product_dto_responses.UserSimpleResponse": { + "type": "object", + "properties": { + "company_name": { + "type": "string" + }, + "id": { + "type": "string" + }, + "phone": { + "type": "string" + } + } + }, + "value_objects.ContractInfo": { + "type": "object", + "properties": { + "contract_file_id": { + "description": "合同基本信息", + "type": "string" + }, + "contract_sign_url": { + "description": "合同签署链接", + "type": "string" + }, + "contract_title": { + "description": "合同元数据", + "type": "string" + }, + "contract_url": { + "description": "合同文件访问链接", + "type": "string" + }, + "contract_version": { + "description": "合同版本", + "type": "string" + }, + "esign_flow_id": { + "description": "e签宝签署流程ID", + "type": "string" + }, + "expires_at": { + "description": "签署链接过期时间", + "type": "string" + }, + "generated_at": { + "description": "时间信息", + "type": "string" + }, + "metadata": { + "description": "附加信息", + "type": "object", + "additionalProperties": true + }, + "sign_flow_created_at": { + "description": "签署流程创建时间", + "type": "string" + }, + "sign_progress": { + "description": "签署进度", + "type": "integer" + }, + "signed_at": { + "description": "签署完成时间", + "type": "string" + }, + "signer_account": { + "description": "签署相关信息", + "type": "string" + }, + "signer_name": { + "description": "签署人姓名", + "type": "string" + }, + "status": { + "description": "状态信息", + "type": "string" + }, + "template_id": { + "description": "模板ID", + "type": "string" + }, + "transactor_id_card_num": { + "description": "经办人身份证号", + "type": "string" + }, + "transactor_name": { + "description": "经办人姓名", + "type": "string" + }, + "transactor_phone": { + "description": "经办人手机号", + "type": "string" + } + } + }, + "value_objects.EnterpriseInfo": { + "type": "object", + "properties": { + "company_name": { + "description": "企业基本信息", + "type": "string" + }, + "enterprise_address": { + "description": "企业地址(新增)", + "type": "string" + }, + "legal_person_id": { + "description": "法定代表人身份证号", + "type": "string" + }, + "legal_person_name": { + "description": "法定代表人信息", + "type": "string" + }, + "legal_person_phone": { + "description": "法定代表人手机号", + "type": "string" + }, + "registered_address": { + "description": "企业详细信息", + "type": "string" + }, + "unified_social_code": { + "description": "统一社会信用代码", + "type": "string" + } + } + }, + "value_objects.InvoiceInfo": { + "type": "object", + "properties": { + "bank_account": { + "description": "基本开户账号", + "type": "string" + }, + "bank_name": { + "description": "基本开户银行", + "type": "string" + }, + "company_address": { + "description": "企业注册地址", + "type": "string" + }, + "company_name": { + "description": "公司名称", + "type": "string" + }, + "company_phone": { + "description": "企业注册电话", + "type": "string" + }, + "receiving_email": { + "description": "发票接收邮箱", + "type": "string" + }, + "taxpayer_id": { + "description": "纳税人识别号", + "type": "string" + } + } + }, + "value_objects.InvoiceType": { + "type": "string", + "enum": [ + "general", + "special" + ], + "x-enum-comments": { + "InvoiceTypeGeneral": "增值税普通发票 (普票)", + "InvoiceTypeSpecial": "增值税专用发票 (专票)" + }, + "x-enum-descriptions": [ + "增值税普通发票 (普票)", + "增值税专用发票 (专票)" + ], + "x-enum-varnames": [ + "InvoiceTypeGeneral", + "InvoiceTypeSpecial" + ] + } + }, + "securityDefinitions": { + "Bearer": { + "description": "Type \"Bearer\" followed by a space and JWT token.", + "type": "apiKey", + "name": "Authorization", + "in": "header" + } + } +}` + +// SwaggerInfo holds exported Swagger Info so clients can modify it +var SwaggerInfo = &swag.Spec{ + Version: "1.0", + Host: "localhost:8080", + BasePath: "/", + Schemes: []string{}, + Title: "TYAPI Server API", + Description: "基于DDD和Clean Architecture的企业级后端API服务\n采用Gin框架构建,支持用户管理、JWT认证、事件驱动等功能", + InfoInstanceName: "swagger", + SwaggerTemplate: docTemplate, + LeftDelim: "{{", + RightDelim: "}}", +} + +func init() { + swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo) +} diff --git a/docs/swagger.json b/docs/swagger.json new file mode 100644 index 0000000..3855adb --- /dev/null +++ b/docs/swagger.json @@ -0,0 +1,9233 @@ +{ + "swagger": "2.0", + "info": { + "description": "基于DDD和Clean Architecture的企业级后端API服务\n采用Gin框架构建,支持用户管理、JWT认证、事件驱动等功能", + "title": "TYAPI Server API", + "contact": { + "name": "API Support", + "url": "https://github.com/your-org/tyapi-server-gin", + "email": "support@example.com" + }, + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.html" + }, + "version": "1.0" + }, + "host": "localhost:8080", + "basePath": "/", + "paths": { + "/api/v1/:api_name": { + "post": { + "description": "统一API调用入口,参数加密传输", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "API调用" + ], + "summary": "API调用", + "parameters": [ + { + "description": "API调用请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.ApiCallCommand" + } + } + ], + "responses": { + "200": { + "description": "调用成功", + "schema": { + "$ref": "#/definitions/dto.ApiCallResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "$ref": "#/definitions/dto.ApiCallResponse" + } + }, + "401": { + "description": "未授权", + "schema": { + "$ref": "#/definitions/dto.ApiCallResponse" + } + }, + "429": { + "description": "请求过于频繁", + "schema": { + "$ref": "#/definitions/dto.ApiCallResponse" + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "$ref": "#/definitions/dto.ApiCallResponse" + } + } + } + } + }, + "/api/v1/admin/api-calls": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取API调用记录,支持筛选和分页", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "API管理" + ], + "summary": "获取管理端API调用记录", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "用户ID", + "name": "user_id", + "in": "query" + }, + { + "type": "string", + "description": "交易ID", + "name": "transaction_id", + "in": "query" + }, + { + "type": "string", + "description": "产品名称", + "name": "product_name", + "in": "query" + }, + { + "type": "string", + "description": "状态", + "name": "status", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "开始时间", + "name": "start_time", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "结束时间", + "name": "end_time", + "in": "query" + }, + { + "type": "string", + "description": "排序字段", + "name": "sort_by", + "in": "query" + }, + { + "enum": [ + "asc", + "desc" + ], + "type": "string", + "description": "排序方向", + "name": "sort_order", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取API调用记录成功", + "schema": { + "$ref": "#/definitions/dto.ApiCallListResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/invoices/pending": { + "get": { + "description": "管理员获取发票申请列表,支持状态和时间范围筛选", + "produces": [ + "application/json" + ], + "tags": [ + "管理员-发票管理" + ], + "summary": "获取发票申请列表", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "状态筛选:pending/completed/rejected", + "name": "status", + "in": "query" + }, + { + "type": "string", + "description": "开始时间 (格式: 2006-01-02 15:04:05)", + "name": "start_time", + "in": "query" + }, + { + "type": "string", + "description": "结束时间 (格式: 2006-01-02 15:04:05)", + "name": "end_time", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/interfaces.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.PendingApplicationsResponse" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, + "/api/v1/admin/invoices/{application_id}/approve": { + "post": { + "description": "管理员通过发票申请并上传发票文件", + "consumes": [ + "multipart/form-data" + ], + "produces": [ + "application/json" + ], + "tags": [ + "管理员-发票管理" + ], + "summary": "通过发票申请", + "parameters": [ + { + "type": "string", + "description": "申请ID", + "name": "application_id", + "in": "path", + "required": true + }, + { + "type": "file", + "description": "发票文件", + "name": "file", + "in": "formData", + "required": true + }, + { + "type": "string", + "description": "管理员备注", + "name": "admin_notes", + "in": "formData" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, + "/api/v1/admin/invoices/{application_id}/download": { + "get": { + "description": "管理员下载指定发票的文件", + "produces": [ + "application/octet-stream" + ], + "tags": [ + "管理员-发票管理" + ], + "summary": "管理员下载发票文件", + "parameters": [ + { + "type": "string", + "description": "申请ID", + "name": "application_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "file" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, + "/api/v1/admin/invoices/{application_id}/reject": { + "post": { + "description": "管理员拒绝发票申请", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "管理员-发票管理" + ], + "summary": "拒绝发票申请", + "parameters": [ + { + "type": "string", + "description": "申请ID", + "name": "application_id", + "in": "path", + "required": true + }, + { + "description": "拒绝申请请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/finance.RejectInvoiceRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, + "/api/v1/admin/product-categories": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取产品分类列表", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "分类管理" + ], + "summary": "获取分类列表", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取分类列表成功", + "schema": { + "$ref": "#/definitions/responses.CategoryListResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员创建新产品分类", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "分类管理" + ], + "summary": "创建分类", + "parameters": [ + { + "description": "创建分类请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.CreateCategoryCommand" + } + } + ], + "responses": { + "201": { + "description": "分类创建成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/product-categories/{id}": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取分类详细信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "分类管理" + ], + "summary": "获取分类详情", + "parameters": [ + { + "type": "string", + "description": "分类ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "获取分类详情成功", + "schema": { + "$ref": "#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "分类不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员更新产品分类信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "分类管理" + ], + "summary": "更新分类", + "parameters": [ + { + "type": "string", + "description": "分类ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "更新分类请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.UpdateCategoryCommand" + } + } + ], + "responses": { + "200": { + "description": "分类更新成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "分类不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "delete": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员删除产品分类", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "分类管理" + ], + "summary": "删除分类", + "parameters": [ + { + "type": "string", + "description": "分类ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "分类删除成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "分类不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/products": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取产品列表,支持筛选和分页,包含所有产品(包括隐藏的)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "获取产品列表", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "搜索关键词", + "name": "keyword", + "in": "query" + }, + { + "type": "string", + "description": "分类ID", + "name": "category_id", + "in": "query" + }, + { + "type": "boolean", + "description": "是否启用", + "name": "is_enabled", + "in": "query" + }, + { + "type": "boolean", + "description": "是否可见", + "name": "is_visible", + "in": "query" + }, + { + "type": "boolean", + "description": "是否组合包", + "name": "is_package", + "in": "query" + }, + { + "type": "string", + "description": "排序字段", + "name": "sort_by", + "in": "query" + }, + { + "enum": [ + "asc", + "desc" + ], + "type": "string", + "description": "排序方向", + "name": "sort_order", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取产品列表成功", + "schema": { + "$ref": "#/definitions/responses.ProductAdminListResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员创建新产品", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "创建产品", + "parameters": [ + { + "description": "创建产品请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.CreateProductCommand" + } + } + ], + "responses": { + "201": { + "description": "产品创建成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/products/available": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取可选作组合包子产品的产品列表", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "获取可选子产品列表", + "parameters": [ + { + "type": "string", + "description": "排除的组合包ID", + "name": "exclude_package_id", + "in": "query" + }, + { + "type": "string", + "description": "搜索关键词", + "name": "keyword", + "in": "query" + }, + { + "type": "string", + "description": "分类ID", + "name": "category_id", + "in": "query" + }, + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 20, + "description": "每页数量", + "name": "page_size", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取可选产品列表成功", + "schema": { + "$ref": "#/definitions/responses.ProductListResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/products/{id}": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取产品详细信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "获取产品详情", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "boolean", + "description": "是否包含文档信息", + "name": "with_document", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取产品详情成功", + "schema": { + "$ref": "#/definitions/responses.ProductAdminInfoResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员更新产品信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "更新产品", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "更新产品请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.UpdateProductCommand" + } + } + ], + "responses": { + "200": { + "description": "产品更新成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "delete": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员删除产品", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "删除产品", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "产品删除成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/products/{id}/api-config": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取产品的API配置信息,如果不存在则返回空配置", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "获取产品API配置", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "获取API配置成功", + "schema": { + "$ref": "#/definitions/responses.ProductApiConfigResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员更新产品的API配置", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "更新产品API配置", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "API配置信息", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/responses.ProductApiConfigResponse" + } + } + ], + "responses": { + "200": { + "description": "API配置更新成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品或配置不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员为产品创建API配置", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "创建产品API配置", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "API配置信息", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/responses.ProductApiConfigResponse" + } + } + ], + "responses": { + "201": { + "description": "API配置创建成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "409": { + "description": "API配置已存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "delete": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员删除产品的API配置", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "删除产品API配置", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "API配置删除成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品或API配置不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/products/{id}/documentation": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取产品的文档信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "获取产品文档", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "获取文档成功", + "schema": { + "$ref": "#/definitions/responses.DocumentationResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品或文档不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员创建或更新产品的文档信息,如果文档不存在则创建,存在则更新", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "创建或更新产品文档", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "文档信息", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.CreateDocumentationCommand" + } + } + ], + "responses": { + "200": { + "description": "文档操作成功", + "schema": { + "$ref": "#/definitions/responses.DocumentationResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "delete": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员删除产品的文档", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "删除产品文档", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "文档删除成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品或文档不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/products/{id}/package-items": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员向组合包添加子产品", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "添加组合包子产品", + "parameters": [ + { + "type": "string", + "description": "组合包ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "添加子产品命令", + "name": "command", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.AddPackageItemCommand" + } + } + ], + "responses": { + "200": { + "description": "添加成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/products/{id}/package-items/batch": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员批量更新组合包子产品配置", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "批量更新组合包子产品", + "parameters": [ + { + "type": "string", + "description": "组合包ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "批量更新命令", + "name": "command", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.UpdatePackageItemsCommand" + } + } + ], + "responses": { + "200": { + "description": "更新成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/products/{id}/package-items/reorder": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员重新排序组合包子产品", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "重新排序组合包子产品", + "parameters": [ + { + "type": "string", + "description": "组合包ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "重新排序命令", + "name": "command", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.ReorderPackageItemsCommand" + } + } + ], + "responses": { + "200": { + "description": "排序成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/products/{id}/package-items/{item_id}": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员更新组合包子产品信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "更新组合包子产品", + "parameters": [ + { + "type": "string", + "description": "组合包ID", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "子产品项目ID", + "name": "item_id", + "in": "path", + "required": true + }, + { + "description": "更新子产品命令", + "name": "command", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.UpdatePackageItemCommand" + } + } + ], + "responses": { + "200": { + "description": "更新成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "delete": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员从组合包移除子产品", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "移除组合包子产品", + "parameters": [ + { + "type": "string", + "description": "组合包ID", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "子产品项目ID", + "name": "item_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "移除成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/recharge-records": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取充值记录,支持筛选和分页", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "财务管理" + ], + "summary": "获取管理端充值记录", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "用户ID", + "name": "user_id", + "in": "query" + }, + { + "enum": [ + "alipay", + "transfer", + "gift" + ], + "type": "string", + "description": "充值类型", + "name": "recharge_type", + "in": "query" + }, + { + "enum": [ + "pending", + "success", + "failed" + ], + "type": "string", + "description": "状态", + "name": "status", + "in": "query" + }, + { + "type": "string", + "description": "最小金额", + "name": "min_amount", + "in": "query" + }, + { + "type": "string", + "description": "最大金额", + "name": "max_amount", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "开始时间", + "name": "start_time", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "结束时间", + "name": "end_time", + "in": "query" + }, + { + "type": "string", + "description": "排序字段", + "name": "sort_by", + "in": "query" + }, + { + "enum": [ + "asc", + "desc" + ], + "type": "string", + "description": "排序方向", + "name": "sort_order", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取充值记录成功", + "schema": { + "$ref": "#/definitions/responses.RechargeRecordListResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/subscriptions": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取订阅列表", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "订阅管理" + ], + "summary": "获取订阅列表", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "搜索关键词", + "name": "keyword", + "in": "query" + }, + { + "type": "string", + "description": "企业名称", + "name": "company_name", + "in": "query" + }, + { + "type": "string", + "description": "产品名称", + "name": "product_name", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "订阅开始时间", + "name": "start_time", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "订阅结束时间", + "name": "end_time", + "in": "query" + }, + { + "type": "string", + "description": "排序字段", + "name": "sort_by", + "in": "query" + }, + { + "enum": [ + "asc", + "desc" + ], + "type": "string", + "description": "排序方向", + "name": "sort_order", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取订阅列表成功", + "schema": { + "$ref": "#/definitions/responses.SubscriptionListResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/subscriptions/batch-update-prices": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员一键调整用户所有订阅的价格", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "订阅管理" + ], + "summary": "一键改价", + "parameters": [ + { + "description": "批量改价请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.BatchUpdateSubscriptionPricesCommand" + } + } + ], + "responses": { + "200": { + "description": "一键改价成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/subscriptions/stats": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取订阅统计信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "订阅管理" + ], + "summary": "获取订阅统计", + "responses": { + "200": { + "description": "获取订阅统计成功", + "schema": { + "$ref": "#/definitions/responses.SubscriptionStatsResponse" + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/subscriptions/{id}/price": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员修改用户订阅价格", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "订阅管理" + ], + "summary": "更新订阅价格", + "parameters": [ + { + "type": "string", + "description": "订阅ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "更新订阅价格请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.UpdateSubscriptionPriceCommand" + } + } + ], + "responses": { + "200": { + "description": "订阅价格更新成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "订阅不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/wallet-transactions": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取消费记录,支持筛选和分页", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "财务管理" + ], + "summary": "获取管理端消费记录", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "用户ID", + "name": "user_id", + "in": "query" + }, + { + "type": "string", + "description": "交易ID", + "name": "transaction_id", + "in": "query" + }, + { + "type": "string", + "description": "产品名称", + "name": "product_name", + "in": "query" + }, + { + "type": "string", + "description": "最小金额", + "name": "min_amount", + "in": "query" + }, + { + "type": "string", + "description": "最大金额", + "name": "max_amount", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "开始时间", + "name": "start_time", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "结束时间", + "name": "end_time", + "in": "query" + }, + { + "type": "string", + "description": "排序字段", + "name": "sort_by", + "in": "query" + }, + { + "enum": [ + "asc", + "desc" + ], + "type": "string", + "description": "排序方向", + "name": "sort_order", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取消费记录成功", + "schema": { + "$ref": "#/definitions/responses.WalletTransactionListResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/articles": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "分页获取文章列表", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章管理" + ], + "summary": "获取文章列表", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "文章状态", + "name": "status", + "in": "query" + }, + { + "type": "string", + "description": "分类ID", + "name": "category_id", + "in": "query" + }, + { + "type": "string", + "description": "作者ID", + "name": "author_id", + "in": "query" + }, + { + "type": "boolean", + "description": "是否推荐", + "name": "is_featured", + "in": "query" + }, + { + "type": "string", + "description": "排序字段", + "name": "order_by", + "in": "query" + }, + { + "type": "string", + "description": "排序方向", + "name": "order_dir", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取文章列表成功", + "schema": { + "$ref": "#/definitions/responses.ArticleListResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "创建新的文章", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章管理" + ], + "summary": "创建文章", + "parameters": [ + { + "description": "创建文章请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.CreateArticleCommand" + } + } + ], + "responses": { + "201": { + "description": "文章创建成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/articles/search": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "根据关键词搜索文章", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章管理" + ], + "summary": "搜索文章", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "搜索关键词", + "name": "keyword", + "in": "query", + "required": true + }, + { + "type": "string", + "description": "分类ID", + "name": "category_id", + "in": "query" + }, + { + "type": "string", + "description": "作者ID", + "name": "author_id", + "in": "query" + }, + { + "type": "string", + "description": "文章状态", + "name": "status", + "in": "query" + }, + { + "type": "string", + "description": "排序字段", + "name": "order_by", + "in": "query" + }, + { + "type": "string", + "description": "排序方向", + "name": "order_dir", + "in": "query" + } + ], + "responses": { + "200": { + "description": "搜索文章成功", + "schema": { + "$ref": "#/definitions/responses.ArticleListResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/articles/stats": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取文章相关统计数据", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章管理" + ], + "summary": "获取文章统计", + "responses": { + "200": { + "description": "获取统计成功", + "schema": { + "$ref": "#/definitions/responses.ArticleStatsResponse" + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/articles/{id}": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "根据ID获取文章详情", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章管理" + ], + "summary": "获取文章详情", + "parameters": [ + { + "type": "string", + "description": "文章ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "获取文章详情成功", + "schema": { + "$ref": "#/definitions/responses.ArticleInfoResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "文章不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "更新文章信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章管理" + ], + "summary": "更新文章", + "parameters": [ + { + "type": "string", + "description": "文章ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "更新文章请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.UpdateArticleCommand" + } + } + ], + "responses": { + "200": { + "description": "文章更新成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "文章不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "delete": { + "security": [ + { + "Bearer": [] + } + ], + "description": "删除指定文章", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章管理" + ], + "summary": "删除文章", + "parameters": [ + { + "type": "string", + "description": "文章ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "文章删除成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "文章不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/articles/{id}/archive": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "将已发布文章归档", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章管理" + ], + "summary": "归档文章", + "parameters": [ + { + "type": "string", + "description": "文章ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "文章归档成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "文章不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/articles/{id}/featured": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "设置文章的推荐状态", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章管理" + ], + "summary": "设置推荐状态", + "parameters": [ + { + "type": "string", + "description": "文章ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "设置推荐状态请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.SetFeaturedCommand" + } + } + ], + "responses": { + "200": { + "description": "设置推荐状态成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "文章不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/articles/{id}/publish": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "将草稿文章发布", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章管理" + ], + "summary": "发布文章", + "parameters": [ + { + "type": "string", + "description": "文章ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "文章发布成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "文章不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/categories": { + "get": { + "description": "获取产品分类列表,支持筛选", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "数据大厅" + ], + "summary": "获取分类列表", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "boolean", + "description": "是否启用", + "name": "is_enabled", + "in": "query" + }, + { + "type": "boolean", + "description": "是否可见", + "name": "is_visible", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取分类列表成功", + "schema": { + "$ref": "#/definitions/responses.CategoryListResponse" + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/categories/{id}": { + "get": { + "description": "根据分类ID获取分类详细信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "数据大厅" + ], + "summary": "获取分类详情", + "parameters": [ + { + "type": "string", + "description": "分类ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "获取分类详情成功", + "schema": { + "$ref": "#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "分类不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/certifications": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取认证申请列表", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "认证管理" + ], + "summary": "获取认证列表", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "排序字段", + "name": "sort_by", + "in": "query" + }, + { + "enum": [ + "asc", + "desc" + ], + "type": "string", + "description": "排序方向", + "name": "sort_order", + "in": "query" + }, + { + "type": "string", + "description": "认证状态", + "name": "status", + "in": "query" + }, + { + "type": "string", + "description": "用户ID", + "name": "user_id", + "in": "query" + }, + { + "type": "string", + "description": "公司名称", + "name": "company_name", + "in": "query" + }, + { + "type": "string", + "description": "法人姓名", + "name": "legal_person_name", + "in": "query" + }, + { + "type": "string", + "description": "搜索关键词", + "name": "search_keyword", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取认证列表成功", + "schema": { + "$ref": "#/definitions/responses.CertificationListResponse" + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "403": { + "description": "权限不足", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/certifications/apply-contract": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "申请企业认证合同签署", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "认证管理" + ], + "summary": "申请合同签署", + "parameters": [ + { + "description": "申请合同请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.ApplyContractCommand" + } + } + ], + "responses": { + "200": { + "description": "合同申请成功", + "schema": { + "$ref": "#/definitions/responses.ContractSignUrlResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "认证记录不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/certifications/confirm-auth": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "前端轮询确认企业认证是否完成", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "认证管理" + ], + "summary": "前端确认认证状态", + "parameters": [ + { + "description": "确认状态请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/queries.ConfirmAuthCommand" + } + } + ], + "responses": { + "200": { + "description": "状态确认成功", + "schema": { + "$ref": "#/definitions/responses.ConfirmAuthResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "认证记录不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/certifications/confirm-sign": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "前端轮询确认合同签署是否完成", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "认证管理" + ], + "summary": "前端确认签署状态", + "parameters": [ + { + "description": "确认状态请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/queries.ConfirmSignCommand" + } + } + ], + "responses": { + "200": { + "description": "状态确认成功", + "schema": { + "$ref": "#/definitions/responses.ConfirmSignResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "认证记录不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/certifications/details": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "根据认证ID获取认证详情", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "认证管理" + ], + "summary": "获取认证详情", + "responses": { + "200": { + "description": "获取认证详情成功", + "schema": { + "$ref": "#/definitions/responses.CertificationResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "认证记录不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/certifications/enterprise-info": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "提交企业认证所需的企业信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "认证管理" + ], + "summary": "提交企业信息", + "parameters": [ + { + "description": "提交企业信息请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.SubmitEnterpriseInfoCommand" + } + } + ], + "responses": { + "200": { + "description": "企业信息提交成功", + "schema": { + "$ref": "#/definitions/responses.CertificationResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "认证记录不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/certifications/esign/callback": { + "post": { + "description": "处理e签宝的异步回调通知", + "consumes": [ + "application/json" + ], + "produces": [ + "text/plain" + ], + "tags": [ + "认证管理" + ], + "summary": "处理e签宝回调", + "responses": { + "200": { + "description": "success", + "schema": { + "type": "string" + } + }, + "400": { + "description": "fail", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/debug/event-system": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "调试事件系统,用于测试事件触发和处理", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "系统调试" + ], + "summary": "调试事件系统", + "responses": { + "200": { + "description": "调试成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/decrypt": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "使用密钥解密加密的数据", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "API调试" + ], + "summary": "解密参数", + "parameters": [ + { + "description": "解密请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.DecryptCommand" + } + } + ], + "responses": { + "200": { + "description": "解密成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未授权", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "解密失败", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/encrypt": { + "post": { + "description": "用于前端调试时加密API调用参数", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "API调试" + ], + "summary": "加密参数", + "parameters": [ + { + "description": "加密请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.EncryptCommand" + } + } + ], + "responses": { + "200": { + "description": "加密成功", + "schema": { + "$ref": "#/definitions/dto.EncryptResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "$ref": "#/definitions/dto.EncryptResponse" + } + }, + "401": { + "description": "未授权", + "schema": { + "$ref": "#/definitions/dto.EncryptResponse" + } + } + } + } + }, + "/api/v1/finance/alipay/callback": { + "post": { + "description": "处理支付宝异步支付通知", + "consumes": [ + "application/x-www-form-urlencoded" + ], + "produces": [ + "text/plain" + ], + "tags": [ + "支付管理" + ], + "summary": "支付宝支付回调", + "responses": { + "200": { + "description": "success", + "schema": { + "type": "string" + } + }, + "400": { + "description": "fail", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/finance/alipay/return": { + "get": { + "description": "处理支付宝同步支付通知,跳转到前端成功页面", + "consumes": [ + "application/x-www-form-urlencoded" + ], + "produces": [ + "text/html" + ], + "tags": [ + "支付管理" + ], + "summary": "支付宝同步回调", + "responses": { + "200": { + "description": "支付成功页面", + "schema": { + "type": "string" + } + }, + "400": { + "description": "支付失败页面", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/finance/wallet": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取当前用户的钱包详细信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "钱包管理" + ], + "summary": "获取钱包信息", + "responses": { + "200": { + "description": "获取钱包信息成功", + "schema": { + "$ref": "#/definitions/responses.WalletResponse" + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "钱包不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/finance/wallet/alipay-order-status": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取支付宝订单的当前状态,用于轮询查询", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "钱包管理" + ], + "summary": "获取支付宝订单状态", + "parameters": [ + { + "type": "string", + "description": "商户订单号", + "name": "out_trade_no", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "获取订单状态成功", + "schema": { + "$ref": "#/definitions/responses.AlipayOrderStatusResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "订单不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/finance/wallet/alipay-recharge": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "创建支付宝充值订单并返回支付链接", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "钱包管理" + ], + "summary": "创建支付宝充值订单", + "parameters": [ + { + "description": "充值请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.CreateAlipayRechargeCommand" + } + } + ], + "responses": { + "200": { + "description": "创建充值订单成功", + "schema": { + "$ref": "#/definitions/responses.AlipayRechargeOrderResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/finance/wallet/recharge-config": { + "get": { + "description": "获取当前环境的充值配置信息(最低充值金额、最高充值金额等)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "钱包管理" + ], + "summary": "获取充值配置", + "responses": { + "200": { + "description": "获取充值配置成功", + "schema": { + "$ref": "#/definitions/responses.RechargeConfigResponse" + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/finance/wallet/transactions": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取当前用户的钱包交易记录列表,支持分页和筛选", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "钱包管理" + ], + "summary": "获取用户钱包交易记录", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "开始时间 (格式: 2006-01-02 15:04:05)", + "name": "start_time", + "in": "query" + }, + { + "type": "string", + "description": "结束时间 (格式: 2006-01-02 15:04:05)", + "name": "end_time", + "in": "query" + }, + { + "type": "string", + "description": "交易ID", + "name": "transaction_id", + "in": "query" + }, + { + "type": "string", + "description": "产品名称", + "name": "product_name", + "in": "query" + }, + { + "type": "string", + "description": "最小金额", + "name": "min_amount", + "in": "query" + }, + { + "type": "string", + "description": "最大金额", + "name": "max_amount", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取成功", + "schema": { + "$ref": "#/definitions/responses.WalletTransactionListResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/form-config/{api_code}": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取指定API的表单配置,用于前端动态生成表单", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "API调试" + ], + "summary": "获取表单配置", + "parameters": [ + { + "type": "string", + "description": "API代码", + "name": "api_code", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "获取成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未授权", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "API接口不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/invoices/apply": { + "post": { + "description": "用户申请开票", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "发票管理" + ], + "summary": "申请开票", + "parameters": [ + { + "description": "申请开票请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/finance.ApplyInvoiceRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/interfaces.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.InvoiceApplicationResponse" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, + "/api/v1/invoices/available-amount": { + "get": { + "description": "获取用户当前可开票的金额", + "produces": [ + "application/json" + ], + "tags": [ + "发票管理" + ], + "summary": "获取可开票金额", + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/interfaces.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.AvailableAmountResponse" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, + "/api/v1/invoices/info": { + "get": { + "description": "获取用户的发票信息", + "produces": [ + "application/json" + ], + "tags": [ + "发票管理" + ], + "summary": "获取用户发票信息", + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/interfaces.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.InvoiceInfoResponse" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + }, + "put": { + "description": "更新用户的发票信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "发票管理" + ], + "summary": "更新用户发票信息", + "parameters": [ + { + "description": "更新发票信息请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/finance.UpdateInvoiceInfoRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, + "/api/v1/invoices/records": { + "get": { + "description": "获取用户的开票记录列表", + "produces": [ + "application/json" + ], + "tags": [ + "发票管理" + ], + "summary": "获取用户开票记录", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "状态筛选", + "name": "status", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/interfaces.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.InvoiceRecordsResponse" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, + "/api/v1/invoices/{application_id}/download": { + "get": { + "description": "下载指定发票的文件", + "produces": [ + "application/octet-stream" + ], + "tags": [ + "发票管理" + ], + "summary": "下载发票文件", + "parameters": [ + { + "type": "string", + "description": "申请ID", + "name": "application_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "file" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, + "/api/v1/my/api-calls": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取当前用户的API调用记录列表,支持分页和筛选", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "API管理" + ], + "summary": "获取用户API调用记录", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "开始时间 (格式: 2006-01-02 15:04:05)", + "name": "start_time", + "in": "query" + }, + { + "type": "string", + "description": "结束时间 (格式: 2006-01-02 15:04:05)", + "name": "end_time", + "in": "query" + }, + { + "type": "string", + "description": "交易ID", + "name": "transaction_id", + "in": "query" + }, + { + "type": "string", + "description": "产品名称", + "name": "product_name", + "in": "query" + }, + { + "type": "string", + "description": "状态 (pending/success/failed)", + "name": "status", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取成功", + "schema": { + "$ref": "#/definitions/dto.ApiCallListResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/my/subscriptions": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取当前用户的订阅列表", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "我的订阅" + ], + "summary": "获取我的订阅列表", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "搜索关键词", + "name": "keyword", + "in": "query" + }, + { + "type": "string", + "description": "产品名称", + "name": "product_name", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "订阅开始时间", + "name": "start_time", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "订阅结束时间", + "name": "end_time", + "in": "query" + }, + { + "type": "string", + "description": "排序字段", + "name": "sort_by", + "in": "query" + }, + { + "enum": [ + "asc", + "desc" + ], + "type": "string", + "description": "排序方向", + "name": "sort_order", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取订阅列表成功", + "schema": { + "$ref": "#/definitions/responses.SubscriptionListResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/my/subscriptions/stats": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取当前用户的订阅统计信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "我的订阅" + ], + "summary": "获取我的订阅统计", + "responses": { + "200": { + "description": "获取订阅统计成功", + "schema": { + "$ref": "#/definitions/responses.SubscriptionStatsResponse" + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/my/subscriptions/{id}": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取指定订阅的详细信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "我的订阅" + ], + "summary": "获取我的订阅详情", + "parameters": [ + { + "type": "string", + "description": "订阅ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "获取订阅详情成功", + "schema": { + "$ref": "#/definitions/responses.SubscriptionInfoResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "订阅不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/my/subscriptions/{id}/usage": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取指定订阅的使用情况统计", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "我的订阅" + ], + "summary": "获取我的订阅使用情况", + "parameters": [ + { + "type": "string", + "description": "订阅ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "获取使用情况成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "订阅不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/my/whitelist/{ip}": { + "delete": { + "security": [ + { + "Bearer": [] + } + ], + "description": "从当前用户的白名单中删除指定IP地址", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "API管理" + ], + "summary": "删除白名单IP", + "parameters": [ + { + "type": "string", + "description": "IP地址", + "name": "ip", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "删除白名单IP成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/products": { + "get": { + "description": "分页获取可用的产品列表,支持筛选,默认只返回可见的产品", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "数据大厅" + ], + "summary": "获取产品列表", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "搜索关键词", + "name": "keyword", + "in": "query" + }, + { + "type": "string", + "description": "分类ID", + "name": "category_id", + "in": "query" + }, + { + "type": "boolean", + "description": "是否启用", + "name": "is_enabled", + "in": "query" + }, + { + "type": "boolean", + "description": "是否可见", + "name": "is_visible", + "in": "query" + }, + { + "type": "boolean", + "description": "是否组合包", + "name": "is_package", + "in": "query" + }, + { + "type": "boolean", + "description": "是否已订阅(需要认证)", + "name": "is_subscribed", + "in": "query" + }, + { + "type": "string", + "description": "排序字段", + "name": "sort_by", + "in": "query" + }, + { + "enum": [ + "asc", + "desc" + ], + "type": "string", + "description": "排序方向", + "name": "sort_order", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取产品列表成功", + "schema": { + "$ref": "#/definitions/responses.ProductListResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/products/code/{product_code}/api-config": { + "get": { + "description": "根据产品代码获取API配置信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品API配置" + ], + "summary": "根据产品代码获取API配置", + "parameters": [ + { + "type": "string", + "description": "产品代码", + "name": "product_code", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "获取成功", + "schema": { + "$ref": "#/definitions/responses.ProductApiConfigResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "404": { + "description": "配置不存在", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, + "/api/v1/products/stats": { + "get": { + "description": "获取产品相关的统计信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "数据大厅" + ], + "summary": "获取产品统计", + "responses": { + "200": { + "description": "获取统计信息成功", + "schema": { + "$ref": "#/definitions/responses.ProductStatsResponse" + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/products/{id}": { + "get": { + "description": "获取产品详细信息,用户端只能查看可见的产品", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "数据大厅" + ], + "summary": "获取产品详情", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "boolean", + "description": "是否包含文档信息", + "name": "with_document", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取产品详情成功", + "schema": { + "$ref": "#/definitions/responses.ProductInfoWithDocumentResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在或不可见", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/products/{id}/api-config": { + "get": { + "description": "根据产品ID获取API配置信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品API配置" + ], + "summary": "获取产品API配置", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "获取成功", + "schema": { + "$ref": "#/definitions/responses.ProductApiConfigResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "404": { + "description": "配置不存在", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, + "/api/v1/products/{id}/documentation": { + "get": { + "description": "获取指定产品的文档信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "数据大厅" + ], + "summary": "获取产品文档", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "获取产品文档成功", + "schema": { + "$ref": "#/definitions/responses.DocumentationResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/products/{id}/subscribe": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "用户订阅指定产品", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "数据大厅" + ], + "summary": "订阅产品", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "订阅成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/users/admin/list": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员查看用户列表,支持分页和筛选", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "用户管理" + ], + "summary": "管理员查看用户列表", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "手机号筛选", + "name": "phone", + "in": "query" + }, + { + "enum": [ + "user", + "admin" + ], + "type": "string", + "description": "用户类型筛选", + "name": "user_type", + "in": "query" + }, + { + "type": "boolean", + "description": "是否激活筛选", + "name": "is_active", + "in": "query" + }, + { + "type": "boolean", + "description": "是否已认证筛选", + "name": "is_certified", + "in": "query" + }, + { + "type": "string", + "description": "企业名称筛选", + "name": "company_name", + "in": "query" + }, + { + "type": "string", + "format": "date", + "description": "开始日期", + "name": "start_date", + "in": "query" + }, + { + "type": "string", + "format": "date", + "description": "结束日期", + "name": "end_date", + "in": "query" + } + ], + "responses": { + "200": { + "description": "用户列表", + "schema": { + "$ref": "#/definitions/responses.UserListResponse" + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "403": { + "description": "权限不足", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/users/admin/stats": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取用户相关的统计信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "用户管理" + ], + "summary": "获取用户统计信息", + "responses": { + "200": { + "description": "用户统计信息", + "schema": { + "$ref": "#/definitions/responses.UserStatsResponse" + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "403": { + "description": "权限不足", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/users/admin/{user_id}": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取指定用户的详细信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "用户管理" + ], + "summary": "管理员获取用户详情", + "parameters": [ + { + "type": "string", + "description": "用户ID", + "name": "user_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "用户详情", + "schema": { + "$ref": "#/definitions/responses.UserDetailResponse" + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "403": { + "description": "权限不足", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "用户不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/users/login-password": { + "post": { + "description": "使用手机号和密码进行用户登录,返回JWT令牌", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "用户认证" + ], + "summary": "用户密码登录", + "parameters": [ + { + "description": "密码登录请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.LoginWithPasswordCommand" + } + } + ], + "responses": { + "200": { + "description": "登录成功", + "schema": { + "$ref": "#/definitions/responses.LoginUserResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "用户名或密码错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/users/login-sms": { + "post": { + "description": "使用手机号和短信验证码进行用户登录,返回JWT令牌", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "用户认证" + ], + "summary": "用户短信验证码登录", + "parameters": [ + { + "description": "短信登录请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.LoginWithSMSCommand" + } + } + ], + "responses": { + "200": { + "description": "登录成功", + "schema": { + "$ref": "#/definitions/responses.LoginUserResponse" + } + }, + "400": { + "description": "请求参数错误或验证码无效", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "认证失败", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/users/me": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "根据JWT令牌获取当前登录用户的详细信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "用户管理" + ], + "summary": "获取当前用户信息", + "responses": { + "200": { + "description": "用户信息", + "schema": { + "$ref": "#/definitions/responses.UserProfileResponse" + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "用户不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/users/me/password": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "使用旧密码、新密码确认和验证码修改当前用户的密码", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "用户管理" + ], + "summary": "修改密码", + "parameters": [ + { + "description": "修改密码请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.ChangePasswordCommand" + } + } + ], + "responses": { + "200": { + "description": "密码修改成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误或验证码无效", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/users/register": { + "post": { + "description": "使用手机号、密码和验证码进行用户注册,需要确认密码", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "用户认证" + ], + "summary": "用户注册", + "parameters": [ + { + "description": "用户注册请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.RegisterUserCommand" + } + } + ], + "responses": { + "201": { + "description": "注册成功", + "schema": { + "$ref": "#/definitions/responses.RegisterUserResponse" + } + }, + "400": { + "description": "请求参数错误或验证码无效", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "409": { + "description": "手机号已存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/users/reset-password": { + "post": { + "description": "使用手机号、验证码和新密码重置用户密码(忘记密码时使用)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "用户认证" + ], + "summary": "重置密码", + "parameters": [ + { + "description": "重置密码请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.ResetPasswordCommand" + } + } + ], + "responses": { + "200": { + "description": "密码重置成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误或验证码无效", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "用户不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/users/send-code": { + "post": { + "description": "向指定手机号发送验证码,支持注册、登录、修改密码等场景", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "用户认证" + ], + "summary": "发送短信验证码", + "parameters": [ + { + "description": "发送验证码请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.SendCodeCommand" + } + } + ], + "responses": { + "200": { + "description": "验证码发送成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "429": { + "description": "请求频率限制", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + } + }, + "definitions": { + "commands.AddPackageItemCommand": { + "type": "object", + "required": [ + "product_id" + ], + "properties": { + "product_id": { + "type": "string" + } + } + }, + "commands.ApiCallCommand": { + "type": "object", + "required": [ + "data" + ], + "properties": { + "data": { + "type": "string" + }, + "options": { + "$ref": "#/definitions/commands.ApiCallOptions" + } + } + }, + "commands.ApiCallOptions": { + "type": "object", + "properties": { + "is_debug": { + "description": "是否为调试调用", + "type": "boolean" + }, + "json": { + "description": "是否返回JSON格式", + "type": "boolean" + } + } + }, + "commands.ApplyContractCommand": { + "type": "object", + "required": [ + "user_id" + ], + "properties": { + "user_id": { + "type": "string" + } + } + }, + "commands.BatchUpdateSubscriptionPricesCommand": { + "type": "object", + "required": [ + "discount", + "scope", + "user_id" + ], + "properties": { + "discount": { + "type": "number", + "maximum": 10, + "minimum": 0.1 + }, + "scope": { + "type": "string", + "enum": [ + "undiscounted", + "all" + ] + }, + "user_id": { + "type": "string" + } + } + }, + "commands.ChangePasswordCommand": { + "description": "修改用户密码请求参数", + "type": "object", + "required": [ + "code", + "confirm_new_password", + "new_password", + "old_password" + ], + "properties": { + "code": { + "type": "string", + "example": "123456" + }, + "confirm_new_password": { + "type": "string", + "example": "NewPassword123" + }, + "new_password": { + "type": "string", + "example": "NewPassword123" + }, + "old_password": { + "type": "string", + "maxLength": 128, + "minLength": 6, + "example": "OldPassword123" + } + } + }, + "commands.CreateAlipayRechargeCommand": { + "type": "object", + "required": [ + "amount", + "platform" + ], + "properties": { + "amount": { + "description": "充值金额", + "type": "string" + }, + "platform": { + "description": "支付平台:app/h5/pc", + "type": "string", + "enum": [ + "app", + "h5", + "pc" + ] + } + } + }, + "commands.CreateArticleCommand": { + "type": "object", + "required": [ + "content", + "title" + ], + "properties": { + "category_id": { + "type": "string" + }, + "content": { + "type": "string" + }, + "cover_image": { + "type": "string" + }, + "is_featured": { + "type": "boolean" + }, + "summary": { + "type": "string" + }, + "tag_ids": { + "type": "array", + "items": { + "type": "string" + } + }, + "title": { + "type": "string" + } + } + }, + "commands.CreateCategoryCommand": { + "type": "object", + "required": [ + "code", + "name" + ], + "properties": { + "code": { + "type": "string" + }, + "description": { + "type": "string", + "maxLength": 200 + }, + "is_enabled": { + "type": "boolean" + }, + "is_visible": { + "type": "boolean" + }, + "name": { + "type": "string", + "maxLength": 50, + "minLength": 2 + }, + "sort": { + "type": "integer", + "maximum": 9999, + "minimum": 0 + } + } + }, + "commands.CreateDocumentationCommand": { + "type": "object", + "required": [ + "basic_info", + "product_id", + "request_method", + "request_params", + "request_url" + ], + "properties": { + "basic_info": { + "type": "string" + }, + "error_codes": { + "type": "string" + }, + "product_id": { + "type": "string" + }, + "request_method": { + "type": "string" + }, + "request_params": { + "type": "string" + }, + "request_url": { + "type": "string" + }, + "response_example": { + "type": "string" + }, + "response_fields": { + "type": "string" + } + } + }, + "commands.CreateProductCommand": { + "type": "object", + "required": [ + "category_id", + "code", + "name" + ], + "properties": { + "category_id": { + "type": "string" + }, + "code": { + "type": "string" + }, + "content": { + "type": "string", + "maxLength": 5000 + }, + "description": { + "type": "string", + "maxLength": 500 + }, + "is_enabled": { + "type": "boolean" + }, + "is_package": { + "type": "boolean" + }, + "is_visible": { + "type": "boolean" + }, + "name": { + "type": "string", + "maxLength": 100, + "minLength": 2 + }, + "price": { + "type": "number", + "minimum": 0 + }, + "seo_description": { + "type": "string", + "maxLength": 200 + }, + "seo_keywords": { + "type": "string", + "maxLength": 200 + }, + "seo_title": { + "description": "SEO信息", + "type": "string", + "maxLength": 100 + } + } + }, + "commands.DecryptCommand": { + "type": "object", + "required": [ + "encrypted_data", + "secret_key" + ], + "properties": { + "encrypted_data": { + "type": "string" + }, + "secret_key": { + "type": "string" + } + } + }, + "commands.EncryptCommand": { + "type": "object", + "required": [ + "data", + "secret_key" + ], + "properties": { + "data": { + "type": "object", + "additionalProperties": true + }, + "secret_key": { + "type": "string" + } + } + }, + "commands.LoginWithPasswordCommand": { + "description": "使用密码进行用户登录请求参数", + "type": "object", + "required": [ + "password", + "phone" + ], + "properties": { + "password": { + "type": "string", + "maxLength": 128, + "minLength": 6, + "example": "Password123" + }, + "phone": { + "type": "string", + "example": "13800138000" + } + } + }, + "commands.LoginWithSMSCommand": { + "description": "使用短信验证码进行用户登录请求参数", + "type": "object", + "required": [ + "code", + "phone" + ], + "properties": { + "code": { + "type": "string", + "example": "123456" + }, + "phone": { + "type": "string", + "example": "13800138000" + } + } + }, + "commands.PackageItemData": { + "type": "object", + "required": [ + "product_id", + "sort_order" + ], + "properties": { + "product_id": { + "type": "string" + }, + "sort_order": { + "type": "integer", + "minimum": 0 + } + } + }, + "commands.RegisterUserCommand": { + "description": "用户注册请求参数", + "type": "object", + "required": [ + "code", + "confirm_password", + "password", + "phone" + ], + "properties": { + "code": { + "type": "string", + "example": "123456" + }, + "confirm_password": { + "type": "string", + "example": "Password123" + }, + "password": { + "type": "string", + "example": "Password123" + }, + "phone": { + "type": "string", + "example": "13800138000" + } + } + }, + "commands.ReorderPackageItemsCommand": { + "type": "object", + "required": [ + "item_ids" + ], + "properties": { + "item_ids": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "commands.ResetPasswordCommand": { + "description": "重置用户密码请求参数(忘记密码时使用)", + "type": "object", + "required": [ + "code", + "confirm_new_password", + "new_password", + "phone" + ], + "properties": { + "code": { + "type": "string", + "example": "123456" + }, + "confirm_new_password": { + "type": "string", + "example": "NewPassword123" + }, + "new_password": { + "type": "string", + "example": "NewPassword123" + }, + "phone": { + "type": "string", + "example": "13800138000" + } + } + }, + "commands.SendCodeCommand": { + "description": "发送短信验证码请求参数", + "type": "object", + "required": [ + "phone", + "scene" + ], + "properties": { + "phone": { + "type": "string", + "example": "13800138000" + }, + "scene": { + "type": "string", + "enum": [ + "register", + "login", + "change_password", + "reset_password", + "bind", + "unbind", + "certification" + ], + "example": "register" + } + } + }, + "commands.SetFeaturedCommand": { + "type": "object", + "required": [ + "is_featured" + ], + "properties": { + "is_featured": { + "type": "boolean" + } + } + }, + "commands.SubmitEnterpriseInfoCommand": { + "type": "object", + "required": [ + "company_name", + "enterprise_address", + "legal_person_id", + "legal_person_name", + "legal_person_phone", + "unified_social_code", + "verification_code" + ], + "properties": { + "company_name": { + "type": "string", + "maxLength": 100, + "minLength": 2 + }, + "enterprise_address": { + "type": "string" + }, + "legal_person_id": { + "type": "string" + }, + "legal_person_name": { + "type": "string", + "maxLength": 20, + "minLength": 2 + }, + "legal_person_phone": { + "type": "string" + }, + "unified_social_code": { + "type": "string" + }, + "verification_code": { + "type": "string" + } + } + }, + "commands.UpdateArticleCommand": { + "type": "object", + "properties": { + "category_id": { + "type": "string" + }, + "content": { + "type": "string" + }, + "cover_image": { + "type": "string" + }, + "is_featured": { + "type": "boolean" + }, + "summary": { + "type": "string" + }, + "tag_ids": { + "type": "array", + "items": { + "type": "string" + } + }, + "title": { + "type": "string" + } + } + }, + "commands.UpdateCategoryCommand": { + "type": "object", + "required": [ + "code", + "name" + ], + "properties": { + "code": { + "type": "string" + }, + "description": { + "type": "string", + "maxLength": 200 + }, + "is_enabled": { + "type": "boolean" + }, + "is_visible": { + "type": "boolean" + }, + "name": { + "type": "string", + "maxLength": 50, + "minLength": 2 + }, + "sort": { + "type": "integer", + "maximum": 9999, + "minimum": 0 + } + } + }, + "commands.UpdatePackageItemCommand": { + "type": "object", + "required": [ + "sort_order" + ], + "properties": { + "sort_order": { + "type": "integer", + "minimum": 0 + } + } + }, + "commands.UpdatePackageItemsCommand": { + "type": "object", + "required": [ + "items" + ], + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/commands.PackageItemData" + } + } + } + }, + "commands.UpdateProductCommand": { + "type": "object", + "required": [ + "category_id", + "code", + "name" + ], + "properties": { + "category_id": { + "type": "string" + }, + "code": { + "type": "string" + }, + "content": { + "type": "string", + "maxLength": 5000 + }, + "description": { + "type": "string", + "maxLength": 500 + }, + "is_enabled": { + "type": "boolean" + }, + "is_package": { + "type": "boolean" + }, + "is_visible": { + "type": "boolean" + }, + "name": { + "type": "string", + "maxLength": 100, + "minLength": 2 + }, + "price": { + "type": "number", + "minimum": 0 + }, + "seo_description": { + "type": "string", + "maxLength": 200 + }, + "seo_keywords": { + "type": "string", + "maxLength": 200 + }, + "seo_title": { + "description": "SEO信息", + "type": "string", + "maxLength": 100 + } + } + }, + "commands.UpdateSubscriptionPriceCommand": { + "type": "object", + "properties": { + "price": { + "type": "number", + "minimum": 0 + } + } + }, + "dto.ApiCallListResponse": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.ApiCallRecordResponse" + } + }, + "page": { + "type": "integer" + }, + "size": { + "type": "integer" + }, + "total": { + "type": "integer" + } + } + }, + "dto.ApiCallRecordResponse": { + "type": "object", + "properties": { + "access_id": { + "type": "string" + }, + "client_ip": { + "type": "string" + }, + "company_name": { + "type": "string" + }, + "cost": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "end_at": { + "type": "string" + }, + "error_msg": { + "type": "string" + }, + "error_type": { + "type": "string" + }, + "id": { + "type": "string" + }, + "product_id": { + "type": "string" + }, + "product_name": { + "type": "string" + }, + "start_at": { + "type": "string" + }, + "status": { + "type": "string" + }, + "transaction_id": { + "type": "string" + }, + "translated_error_msg": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "user": { + "$ref": "#/definitions/dto.UserSimpleResponse" + }, + "user_id": { + "type": "string" + } + } + }, + "dto.ApiCallResponse": { + "type": "object", + "properties": { + "code": { + "type": "integer" + }, + "data": { + "type": "string" + }, + "message": { + "type": "string" + }, + "transaction_id": { + "type": "string" + } + } + }, + "dto.AvailableAmountResponse": { + "type": "object", + "properties": { + "available_amount": { + "description": "可开票金额", + "type": "number" + }, + "pending_applications": { + "description": "待处理申请金额", + "type": "number" + }, + "total_gifted": { + "description": "总赠送金额", + "type": "number" + }, + "total_invoiced": { + "description": "已开票金额", + "type": "number" + }, + "total_recharged": { + "description": "总充值金额", + "type": "number" + } + } + }, + "dto.EncryptResponse": { + "type": "object", + "properties": { + "encrypted_data": { + "type": "string" + } + } + }, + "dto.InvoiceApplicationResponse": { + "type": "object", + "properties": { + "amount": { + "type": "number" + }, + "created_at": { + "type": "string" + }, + "id": { + "type": "string" + }, + "invoice_info": { + "$ref": "#/definitions/value_objects.InvoiceInfo" + }, + "invoice_type": { + "$ref": "#/definitions/value_objects.InvoiceType" + }, + "status": { + "$ref": "#/definitions/entities.ApplicationStatus" + }, + "user_id": { + "type": "string" + } + } + }, + "dto.InvoiceInfoResponse": { + "type": "object", + "properties": { + "bank_account": { + "description": "用户可编辑", + "type": "string" + }, + "bank_name": { + "description": "用户可编辑", + "type": "string" + }, + "company_address": { + "description": "用户可编辑", + "type": "string" + }, + "company_name": { + "description": "从企业认证信息获取,只读", + "type": "string" + }, + "company_name_read_only": { + "description": "字段权限标识", + "type": "boolean" + }, + "company_phone": { + "description": "用户可编辑", + "type": "string" + }, + "is_complete": { + "type": "boolean" + }, + "missing_fields": { + "type": "array", + "items": { + "type": "string" + } + }, + "receiving_email": { + "description": "用户可编辑", + "type": "string" + }, + "taxpayer_id": { + "description": "从企业认证信息获取,只读", + "type": "string" + }, + "taxpayer_id_read_only": { + "description": "纳税人识别号是否只读", + "type": "boolean" + } + } + }, + "dto.InvoiceRecordResponse": { + "type": "object", + "properties": { + "amount": { + "type": "number" + }, + "bank_account": { + "description": "银行账号", + "type": "string" + }, + "bank_name": { + "description": "开户银行", + "type": "string" + }, + "company_address": { + "description": "企业地址", + "type": "string" + }, + "company_name": { + "description": "开票信息(快照数据)", + "type": "string" + }, + "company_phone": { + "description": "企业电话", + "type": "string" + }, + "created_at": { + "type": "string" + }, + "file_name": { + "description": "文件信息", + "type": "string" + }, + "file_size": { + "type": "integer" + }, + "file_url": { + "type": "string" + }, + "id": { + "type": "string" + }, + "invoice_type": { + "$ref": "#/definitions/value_objects.InvoiceType" + }, + "processed_at": { + "description": "时间信息", + "type": "string" + }, + "receiving_email": { + "description": "接收邮箱", + "type": "string" + }, + "reject_reason": { + "description": "拒绝原因", + "type": "string" + }, + "status": { + "$ref": "#/definitions/entities.ApplicationStatus" + }, + "taxpayer_id": { + "description": "纳税人识别号", + "type": "string" + }, + "user_id": { + "type": "string" + } + } + }, + "dto.InvoiceRecordsResponse": { + "type": "object", + "properties": { + "page": { + "type": "integer" + }, + "page_size": { + "type": "integer" + }, + "records": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.InvoiceRecordResponse" + } + }, + "total": { + "type": "integer" + }, + "total_pages": { + "type": "integer" + } + } + }, + "dto.PendingApplicationResponse": { + "type": "object", + "properties": { + "amount": { + "type": "number" + }, + "bank_account": { + "type": "string" + }, + "bank_name": { + "type": "string" + }, + "company_address": { + "type": "string" + }, + "company_name": { + "type": "string" + }, + "company_phone": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "file_name": { + "type": "string" + }, + "file_size": { + "type": "integer" + }, + "file_url": { + "type": "string" + }, + "id": { + "type": "string" + }, + "invoice_type": { + "$ref": "#/definitions/value_objects.InvoiceType" + }, + "processed_at": { + "type": "string" + }, + "receiving_email": { + "type": "string" + }, + "reject_reason": { + "type": "string" + }, + "status": { + "$ref": "#/definitions/entities.ApplicationStatus" + }, + "taxpayer_id": { + "type": "string" + }, + "user_id": { + "type": "string" + } + } + }, + "dto.PendingApplicationsResponse": { + "type": "object", + "properties": { + "applications": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.PendingApplicationResponse" + } + }, + "page": { + "type": "integer" + }, + "page_size": { + "type": "integer" + }, + "total": { + "type": "integer" + }, + "total_pages": { + "type": "integer" + } + } + }, + "dto.UserSimpleResponse": { + "type": "object", + "properties": { + "company_name": { + "type": "string" + }, + "id": { + "type": "string" + }, + "phone": { + "type": "string" + } + } + }, + "entities.ApplicationStatus": { + "type": "string", + "enum": [ + "pending", + "completed", + "rejected" + ], + "x-enum-comments": { + "ApplicationStatusCompleted": "已完成(已上传发票)", + "ApplicationStatusPending": "待处理", + "ApplicationStatusRejected": "已拒绝" + }, + "x-enum-descriptions": [ + "待处理", + "已完成(已上传发票)", + "已拒绝" + ], + "x-enum-varnames": [ + "ApplicationStatusPending", + "ApplicationStatusCompleted", + "ApplicationStatusRejected" + ] + }, + "enums.CertificationStatus": { + "type": "string", + "enum": [ + "pending", + "info_submitted", + "enterprise_verified", + "contract_applied", + "contract_signed", + "completed", + "info_rejected", + "contract_rejected", + "contract_expired" + ], + "x-enum-comments": { + "StatusCompleted": "认证完成", + "StatusContractApplied": "已申请签署合同", + "StatusContractExpired": "合同签署超时", + "StatusContractRejected": "合同被拒签", + "StatusContractSigned": "已签署合同", + "StatusEnterpriseVerified": "已企业认证", + "StatusInfoRejected": "企业信息被拒绝", + "StatusInfoSubmitted": "已提交企业信息", + "StatusPending": "待认证" + }, + "x-enum-descriptions": [ + "待认证", + "已提交企业信息", + "已企业认证", + "已申请签署合同", + "已签署合同", + "认证完成", + "企业信息被拒绝", + "合同被拒签", + "合同签署超时" + ], + "x-enum-varnames": [ + "StatusPending", + "StatusInfoSubmitted", + "StatusEnterpriseVerified", + "StatusContractApplied", + "StatusContractSigned", + "StatusCompleted", + "StatusInfoRejected", + "StatusContractRejected", + "StatusContractExpired" + ] + }, + "enums.FailureReason": { + "type": "string", + "enum": [ + "enterprise_not_exists", + "enterprise_info_mismatch", + "enterprise_status_abnormal", + "legal_person_mismatch", + "esign_verification_failed", + "invalid_document", + "contract_rejected_by_user", + "contract_expired", + "sign_process_failed", + "contract_gen_failed", + "esign_flow_error", + "system_error", + "network_error", + "timeout", + "unknown_error" + ], + "x-enum-comments": { + "FailureReasonContractExpired": "合同签署超时", + "FailureReasonContractGenFailed": "合同生成失败", + "FailureReasonContractRejectedByUser": "用户拒绝签署", + "FailureReasonEnterpriseInfoMismatch": "企业信息不匹配", + "FailureReasonEnterpriseNotExists": "企业不存在", + "FailureReasonEnterpriseStatusAbnormal": "企业状态异常", + "FailureReasonEsignFlowError": "e签宝流程错误", + "FailureReasonEsignVerificationFailed": "e签宝验证失败", + "FailureReasonInvalidDocument": "证件信息无效", + "FailureReasonLegalPersonMismatch": "法定代表人信息不匹配", + "FailureReasonNetworkError": "网络错误", + "FailureReasonSignProcessFailed": "签署流程失败", + "FailureReasonSystemError": "系统错误", + "FailureReasonTimeout": "操作超时", + "FailureReasonUnknownError": "未知错误" + }, + "x-enum-descriptions": [ + "企业不存在", + "企业信息不匹配", + "企业状态异常", + "法定代表人信息不匹配", + "e签宝验证失败", + "证件信息无效", + "用户拒绝签署", + "合同签署超时", + "签署流程失败", + "合同生成失败", + "e签宝流程错误", + "系统错误", + "网络错误", + "操作超时", + "未知错误" + ], + "x-enum-varnames": [ + "FailureReasonEnterpriseNotExists", + "FailureReasonEnterpriseInfoMismatch", + "FailureReasonEnterpriseStatusAbnormal", + "FailureReasonLegalPersonMismatch", + "FailureReasonEsignVerificationFailed", + "FailureReasonInvalidDocument", + "FailureReasonContractRejectedByUser", + "FailureReasonContractExpired", + "FailureReasonSignProcessFailed", + "FailureReasonContractGenFailed", + "FailureReasonEsignFlowError", + "FailureReasonSystemError", + "FailureReasonNetworkError", + "FailureReasonTimeout", + "FailureReasonUnknownError" + ] + }, + "finance.ApplyInvoiceRequest": { + "type": "object", + "required": [ + "amount", + "invoice_type" + ], + "properties": { + "amount": { + "description": "开票金额", + "type": "string" + }, + "invoice_type": { + "description": "发票类型:general/special", + "type": "string" + } + } + }, + "finance.RejectInvoiceRequest": { + "type": "object", + "required": [ + "reason" + ], + "properties": { + "reason": { + "description": "拒绝原因", + "type": "string" + } + } + }, + "finance.UpdateInvoiceInfoRequest": { + "type": "object", + "required": [ + "receiving_email" + ], + "properties": { + "bank_account": { + "description": "银行账户", + "type": "string" + }, + "bank_name": { + "description": "银行名称", + "type": "string" + }, + "company_address": { + "description": "公司地址", + "type": "string" + }, + "company_name": { + "description": "公司名称(从企业认证信息获取,用户不可修改)", + "type": "string" + }, + "company_phone": { + "description": "企业注册电话", + "type": "string" + }, + "receiving_email": { + "description": "发票接收邮箱", + "type": "string" + }, + "taxpayer_id": { + "description": "纳税人识别号(从企业认证信息获取,用户不可修改)", + "type": "string" + } + } + }, + "interfaces.APIResponse": { + "type": "object", + "properties": { + "data": {}, + "errors": {}, + "message": { + "type": "string" + }, + "meta": { + "type": "object", + "additionalProperties": true + }, + "pagination": { + "$ref": "#/definitions/interfaces.PaginationMeta" + }, + "request_id": { + "type": "string" + }, + "success": { + "type": "boolean" + }, + "timestamp": { + "type": "integer" + } + } + }, + "interfaces.PaginationMeta": { + "type": "object", + "properties": { + "has_next": { + "type": "boolean" + }, + "has_prev": { + "type": "boolean" + }, + "page": { + "type": "integer" + }, + "page_size": { + "type": "integer" + }, + "total": { + "type": "integer" + }, + "total_pages": { + "type": "integer" + } + } + }, + "queries.ConfirmAuthCommand": { + "type": "object" + }, + "queries.ConfirmSignCommand": { + "type": "object" + }, + "responses.AlipayOrderStatusResponse": { + "type": "object", + "properties": { + "amount": { + "description": "订单金额", + "type": "number" + }, + "can_retry": { + "description": "是否可以重试", + "type": "boolean" + }, + "created_at": { + "description": "创建时间", + "type": "string" + }, + "error_code": { + "description": "错误码", + "type": "string" + }, + "error_message": { + "description": "错误信息", + "type": "string" + }, + "is_processing": { + "description": "是否处理中", + "type": "boolean" + }, + "notify_time": { + "description": "异步通知时间", + "type": "string" + }, + "out_trade_no": { + "description": "商户订单号", + "type": "string" + }, + "platform": { + "description": "支付平台", + "type": "string" + }, + "return_time": { + "description": "同步返回时间", + "type": "string" + }, + "status": { + "description": "订单状态", + "type": "string" + }, + "subject": { + "description": "订单标题", + "type": "string" + }, + "trade_no": { + "description": "支付宝交易号", + "type": "string" + }, + "updated_at": { + "description": "更新时间", + "type": "string" + } + } + }, + "responses.AlipayRechargeBonusRuleResponse": { + "type": "object", + "properties": { + "bonus_amount": { + "type": "number" + }, + "recharge_amount": { + "type": "number" + } + } + }, + "responses.AlipayRechargeOrderResponse": { + "type": "object", + "properties": { + "amount": { + "description": "充值金额", + "type": "number" + }, + "out_trade_no": { + "description": "商户订单号", + "type": "string" + }, + "pay_url": { + "description": "支付链接", + "type": "string" + }, + "platform": { + "description": "支付平台", + "type": "string" + }, + "subject": { + "description": "订单标题", + "type": "string" + } + } + }, + "responses.ArticleInfoResponse": { + "type": "object", + "properties": { + "category": { + "$ref": "#/definitions/tyapi-server_internal_application_article_dto_responses.CategoryInfoResponse" + }, + "category_id": { + "type": "string" + }, + "content": { + "type": "string" + }, + "cover_image": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "id": { + "type": "string" + }, + "is_featured": { + "type": "boolean" + }, + "published_at": { + "type": "string" + }, + "status": { + "type": "string" + }, + "summary": { + "type": "string" + }, + "tags": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.TagInfoResponse" + } + }, + "title": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "view_count": { + "type": "integer" + } + } + }, + "responses.ArticleListResponse": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.ArticleInfoResponse" + } + }, + "page": { + "type": "integer" + }, + "size": { + "type": "integer" + }, + "total": { + "type": "integer" + } + } + }, + "responses.ArticleStatsResponse": { + "type": "object", + "properties": { + "archived_articles": { + "type": "integer" + }, + "draft_articles": { + "type": "integer" + }, + "published_articles": { + "type": "integer" + }, + "total_articles": { + "type": "integer" + }, + "total_views": { + "type": "integer" + } + } + }, + "responses.CategoryListResponse": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse" + } + }, + "page": { + "type": "integer" + }, + "size": { + "type": "integer" + }, + "total": { + "type": "integer" + } + } + }, + "responses.CategorySimpleResponse": { + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "id": { + "type": "string" + }, + "name": { + "type": "string" + } + } + }, + "responses.CertificationListResponse": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.CertificationResponse" + } + }, + "page": { + "type": "integer" + }, + "page_size": { + "type": "integer" + }, + "total": { + "type": "integer" + }, + "total_pages": { + "type": "integer" + } + } + }, + "responses.CertificationResponse": { + "type": "object", + "properties": { + "available_actions": { + "type": "array", + "items": { + "type": "string" + } + }, + "can_retry": { + "type": "boolean" + }, + "completed_at": { + "type": "string" + }, + "contract_applied_at": { + "type": "string" + }, + "contract_info": { + "description": "合同信息", + "allOf": [ + { + "$ref": "#/definitions/value_objects.ContractInfo" + } + ] + }, + "contract_signed_at": { + "type": "string" + }, + "created_at": { + "description": "时间戳", + "type": "string" + }, + "enterprise_info": { + "description": "企业信息", + "allOf": [ + { + "$ref": "#/definitions/value_objects.EnterpriseInfo" + } + ] + }, + "enterprise_verified_at": { + "type": "string" + }, + "failure_message": { + "type": "string" + }, + "failure_reason": { + "description": "失败信息", + "allOf": [ + { + "$ref": "#/definitions/enums.FailureReason" + } + ] + }, + "failure_reason_name": { + "type": "string" + }, + "id": { + "type": "string" + }, + "info_submitted_at": { + "type": "string" + }, + "is_completed": { + "description": "业务状态", + "type": "boolean" + }, + "is_failed": { + "type": "boolean" + }, + "is_user_action_required": { + "type": "boolean" + }, + "metadata": { + "description": "元数据", + "type": "object", + "additionalProperties": true + }, + "next_action": { + "description": "用户操作提示", + "type": "string" + }, + "progress": { + "type": "integer" + }, + "retry_count": { + "type": "integer" + }, + "status": { + "$ref": "#/definitions/enums.CertificationStatus" + }, + "status_name": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "user_id": { + "type": "string" + } + } + }, + "responses.ConfirmAuthResponse": { + "type": "object", + "properties": { + "reason": { + "type": "string" + }, + "status": { + "$ref": "#/definitions/enums.CertificationStatus" + } + } + }, + "responses.ConfirmSignResponse": { + "type": "object", + "properties": { + "reason": { + "type": "string" + }, + "status": { + "$ref": "#/definitions/enums.CertificationStatus" + } + } + }, + "responses.ContractInfoItem": { + "type": "object", + "properties": { + "contract_file_url": { + "type": "string" + }, + "contract_name": { + "type": "string" + }, + "contract_type": { + "description": "合同类型代码", + "type": "string" + }, + "contract_type_name": { + "description": "合同类型中文名称", + "type": "string" + }, + "created_at": { + "type": "string" + }, + "id": { + "type": "string" + } + } + }, + "responses.ContractSignUrlResponse": { + "type": "object", + "properties": { + "certification_id": { + "type": "string" + }, + "contract_sign_url": { + "type": "string" + }, + "contract_url": { + "type": "string" + }, + "expire_at": { + "type": "string" + }, + "message": { + "type": "string" + }, + "next_action": { + "type": "string" + } + } + }, + "responses.DocumentationResponse": { + "type": "object", + "properties": { + "basic_info": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "error_codes": { + "type": "string" + }, + "id": { + "type": "string" + }, + "product_id": { + "type": "string" + }, + "request_method": { + "type": "string" + }, + "request_params": { + "type": "string" + }, + "request_url": { + "type": "string" + }, + "response_example": { + "type": "string" + }, + "response_fields": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "version": { + "type": "string" + } + } + }, + "responses.EnterpriseInfoItem": { + "type": "object", + "properties": { + "company_name": { + "type": "string" + }, + "contracts": { + "description": "合同信息", + "type": "array", + "items": { + "$ref": "#/definitions/responses.ContractInfoItem" + } + }, + "created_at": { + "type": "string" + }, + "enterprise_address": { + "type": "string" + }, + "id": { + "type": "string" + }, + "legal_person_name": { + "type": "string" + }, + "legal_person_phone": { + "type": "string" + }, + "unified_social_code": { + "type": "string" + } + } + }, + "responses.EnterpriseInfoResponse": { + "description": "企业信息响应", + "type": "object", + "properties": { + "certified_at": { + "type": "string", + "example": "2024-01-01T00:00:00Z" + }, + "company_name": { + "type": "string", + "example": "示例企业有限公司" + }, + "created_at": { + "type": "string", + "example": "2024-01-01T00:00:00Z" + }, + "enterprise_address": { + "type": "string", + "example": "北京市朝阳区xxx街道xxx号" + }, + "id": { + "type": "string", + "example": "123e4567-e89b-12d3-a456-426614174000" + }, + "legal_person_id": { + "type": "string", + "example": "110101199001011234" + }, + "legal_person_name": { + "type": "string", + "example": "张三" + }, + "legal_person_phone": { + "type": "string", + "example": "13800138000" + }, + "unified_social_code": { + "type": "string", + "example": "91110000123456789X" + }, + "updated_at": { + "type": "string", + "example": "2024-01-01T00:00:00Z" + } + } + }, + "responses.LoginUserResponse": { + "description": "用户登录成功响应", + "type": "object", + "properties": { + "access_token": { + "type": "string", + "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." + }, + "expires_in": { + "type": "integer", + "example": 86400 + }, + "login_method": { + "type": "string", + "example": "password" + }, + "token_type": { + "type": "string", + "example": "Bearer" + }, + "user": { + "$ref": "#/definitions/responses.UserProfileResponse" + } + } + }, + "responses.PackageItemResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "price": { + "type": "number" + }, + "product_code": { + "type": "string" + }, + "product_id": { + "type": "string" + }, + "product_name": { + "type": "string" + }, + "sort_order": { + "type": "integer" + } + } + }, + "responses.ProductAdminInfoResponse": { + "type": "object", + "properties": { + "category": { + "description": "关联信息", + "allOf": [ + { + "$ref": "#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse" + } + ] + }, + "category_id": { + "type": "string" + }, + "code": { + "type": "string" + }, + "content": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "description": { + "type": "string" + }, + "documentation": { + "description": "文档信息", + "allOf": [ + { + "$ref": "#/definitions/responses.DocumentationResponse" + } + ] + }, + "id": { + "type": "string" + }, + "is_enabled": { + "type": "boolean" + }, + "is_package": { + "type": "boolean" + }, + "is_visible": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "old_id": { + "type": "string" + }, + "package_items": { + "description": "组合包信息", + "type": "array", + "items": { + "$ref": "#/definitions/responses.PackageItemResponse" + } + }, + "price": { + "type": "number" + }, + "seo_description": { + "type": "string" + }, + "seo_keywords": { + "type": "string" + }, + "seo_title": { + "description": "SEO信息", + "type": "string" + }, + "updated_at": { + "type": "string" + } + } + }, + "responses.ProductAdminListResponse": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.ProductAdminInfoResponse" + } + }, + "page": { + "type": "integer" + }, + "size": { + "type": "integer" + }, + "total": { + "type": "integer" + } + } + }, + "responses.ProductApiConfigResponse": { + "type": "object", + "properties": { + "created_at": { + "type": "string" + }, + "id": { + "type": "string" + }, + "product_id": { + "type": "string" + }, + "request_params": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.RequestParamResponse" + } + }, + "response_example": { + "type": "object", + "additionalProperties": true + }, + "response_fields": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.ResponseFieldResponse" + } + }, + "updated_at": { + "type": "string" + } + } + }, + "responses.ProductInfoResponse": { + "type": "object", + "properties": { + "category": { + "description": "关联信息", + "allOf": [ + { + "$ref": "#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse" + } + ] + }, + "category_id": { + "type": "string" + }, + "code": { + "type": "string" + }, + "content": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "description": { + "type": "string" + }, + "id": { + "type": "string" + }, + "is_enabled": { + "type": "boolean" + }, + "is_package": { + "type": "boolean" + }, + "is_subscribed": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "old_id": { + "type": "string" + }, + "package_items": { + "description": "组合包信息", + "type": "array", + "items": { + "$ref": "#/definitions/responses.PackageItemResponse" + } + }, + "price": { + "type": "number" + }, + "seo_description": { + "type": "string" + }, + "seo_keywords": { + "type": "string" + }, + "seo_title": { + "description": "SEO信息", + "type": "string" + }, + "updated_at": { + "type": "string" + } + } + }, + "responses.ProductInfoWithDocumentResponse": { + "type": "object", + "properties": { + "category": { + "description": "关联信息", + "allOf": [ + { + "$ref": "#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse" + } + ] + }, + "category_id": { + "type": "string" + }, + "code": { + "type": "string" + }, + "content": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "description": { + "type": "string" + }, + "documentation": { + "$ref": "#/definitions/responses.DocumentationResponse" + }, + "id": { + "type": "string" + }, + "is_enabled": { + "type": "boolean" + }, + "is_package": { + "type": "boolean" + }, + "is_subscribed": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "old_id": { + "type": "string" + }, + "package_items": { + "description": "组合包信息", + "type": "array", + "items": { + "$ref": "#/definitions/responses.PackageItemResponse" + } + }, + "price": { + "type": "number" + }, + "seo_description": { + "type": "string" + }, + "seo_keywords": { + "type": "string" + }, + "seo_title": { + "description": "SEO信息", + "type": "string" + }, + "updated_at": { + "type": "string" + } + } + }, + "responses.ProductListResponse": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.ProductInfoResponse" + } + }, + "page": { + "type": "integer" + }, + "size": { + "type": "integer" + }, + "total": { + "type": "integer" + } + } + }, + "responses.ProductSimpleResponse": { + "type": "object", + "properties": { + "category": { + "$ref": "#/definitions/responses.CategorySimpleResponse" + }, + "code": { + "type": "string" + }, + "description": { + "type": "string" + }, + "id": { + "type": "string" + }, + "is_package": { + "type": "boolean" + }, + "is_subscribed": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "old_id": { + "type": "string" + }, + "price": { + "type": "number" + } + } + }, + "responses.ProductStatsResponse": { + "type": "object", + "properties": { + "enabled_products": { + "type": "integer" + }, + "package_products": { + "type": "integer" + }, + "total_products": { + "type": "integer" + }, + "visible_products": { + "type": "integer" + } + } + }, + "responses.RechargeConfigResponse": { + "type": "object", + "properties": { + "alipay_recharge_bonus": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.AlipayRechargeBonusRuleResponse" + } + }, + "max_amount": { + "description": "最高充值金额", + "type": "string" + }, + "min_amount": { + "description": "最低充值金额", + "type": "string" + } + } + }, + "responses.RechargeRecordListResponse": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.RechargeRecordResponse" + } + }, + "page": { + "type": "integer" + }, + "size": { + "type": "integer" + }, + "total": { + "type": "integer" + } + } + }, + "responses.RechargeRecordResponse": { + "type": "object", + "properties": { + "alipay_order_id": { + "type": "string" + }, + "amount": { + "type": "number" + }, + "company_name": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "id": { + "type": "string" + }, + "notes": { + "type": "string" + }, + "operator_id": { + "type": "string" + }, + "recharge_type": { + "type": "string" + }, + "status": { + "type": "string" + }, + "transfer_order_id": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "user": { + "$ref": "#/definitions/tyapi-server_internal_application_finance_dto_responses.UserSimpleResponse" + }, + "user_id": { + "type": "string" + } + } + }, + "responses.RegisterUserResponse": { + "description": "用户注册成功响应", + "type": "object", + "properties": { + "id": { + "type": "string", + "example": "123e4567-e89b-12d3-a456-426614174000" + }, + "phone": { + "type": "string", + "example": "13800138000" + } + } + }, + "responses.RequestParamResponse": { + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "example": { + "type": "string" + }, + "field": { + "type": "string" + }, + "name": { + "type": "string" + }, + "required": { + "type": "boolean" + }, + "type": { + "type": "string" + }, + "validation": { + "type": "string" + } + } + }, + "responses.ResponseFieldResponse": { + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "example": { + "type": "string" + }, + "name": { + "type": "string" + }, + "path": { + "type": "string" + }, + "required": { + "type": "boolean" + }, + "type": { + "type": "string" + } + } + }, + "responses.SubscriptionInfoResponse": { + "type": "object", + "properties": { + "api_used": { + "type": "integer" + }, + "created_at": { + "type": "string" + }, + "id": { + "type": "string" + }, + "price": { + "type": "number" + }, + "product": { + "$ref": "#/definitions/responses.ProductSimpleResponse" + }, + "product_id": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "user": { + "description": "关联信息", + "allOf": [ + { + "$ref": "#/definitions/tyapi-server_internal_application_product_dto_responses.UserSimpleResponse" + } + ] + }, + "user_id": { + "type": "string" + } + } + }, + "responses.SubscriptionListResponse": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.SubscriptionInfoResponse" + } + }, + "page": { + "type": "integer" + }, + "size": { + "type": "integer" + }, + "total": { + "type": "integer" + } + } + }, + "responses.SubscriptionStatsResponse": { + "type": "object", + "properties": { + "total_revenue": { + "type": "number" + }, + "total_subscriptions": { + "type": "integer" + } + } + }, + "responses.TagInfoResponse": { + "type": "object", + "properties": { + "color": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "id": { + "type": "string" + }, + "name": { + "type": "string" + } + } + }, + "responses.UserDetailResponse": { + "type": "object", + "properties": { + "created_at": { + "type": "string" + }, + "enterprise_info": { + "description": "企业信息", + "allOf": [ + { + "$ref": "#/definitions/responses.EnterpriseInfoItem" + } + ] + }, + "id": { + "type": "string" + }, + "is_active": { + "type": "boolean" + }, + "is_certified": { + "type": "boolean" + }, + "last_login_at": { + "type": "string" + }, + "login_count": { + "type": "integer" + }, + "phone": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "user_type": { + "type": "string" + }, + "username": { + "type": "string" + }, + "wallet_balance": { + "description": "钱包信息", + "type": "string" + } + } + }, + "responses.UserListItem": { + "type": "object", + "properties": { + "created_at": { + "type": "string" + }, + "enterprise_info": { + "description": "企业信息", + "allOf": [ + { + "$ref": "#/definitions/responses.EnterpriseInfoItem" + } + ] + }, + "id": { + "type": "string" + }, + "is_active": { + "type": "boolean" + }, + "is_certified": { + "type": "boolean" + }, + "last_login_at": { + "type": "string" + }, + "login_count": { + "type": "integer" + }, + "phone": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "user_type": { + "type": "string" + }, + "username": { + "type": "string" + }, + "wallet_balance": { + "description": "钱包信息", + "type": "string" + } + } + }, + "responses.UserListResponse": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.UserListItem" + } + }, + "page": { + "type": "integer" + }, + "size": { + "type": "integer" + }, + "total": { + "type": "integer" + } + } + }, + "responses.UserProfileResponse": { + "description": "用户基本信息", + "type": "object", + "properties": { + "created_at": { + "type": "string", + "example": "2024-01-01T00:00:00Z" + }, + "enterprise_info": { + "$ref": "#/definitions/responses.EnterpriseInfoResponse" + }, + "id": { + "type": "string", + "example": "123e4567-e89b-12d3-a456-426614174000" + }, + "is_active": { + "type": "boolean", + "example": true + }, + "is_certified": { + "type": "boolean", + "example": false + }, + "last_login_at": { + "type": "string", + "example": "2024-01-01T00:00:00Z" + }, + "login_count": { + "type": "integer", + "example": 10 + }, + "permissions": { + "type": "array", + "items": { + "type": "string" + }, + "example": [ + "['user:read'", + "'user:write']" + ] + }, + "phone": { + "type": "string", + "example": "13800138000" + }, + "updated_at": { + "type": "string", + "example": "2024-01-01T00:00:00Z" + }, + "user_type": { + "type": "string", + "example": "user" + }, + "username": { + "type": "string", + "example": "admin" + } + } + }, + "responses.UserStatsResponse": { + "type": "object", + "properties": { + "active_users": { + "type": "integer" + }, + "certified_users": { + "type": "integer" + }, + "total_users": { + "type": "integer" + } + } + }, + "responses.WalletResponse": { + "type": "object", + "properties": { + "balance": { + "type": "number" + }, + "balance_status": { + "description": "normal, low, arrears", + "type": "string" + }, + "created_at": { + "type": "string" + }, + "id": { + "type": "string" + }, + "is_active": { + "type": "boolean" + }, + "is_arrears": { + "description": "是否欠费", + "type": "boolean" + }, + "is_low_balance": { + "description": "是否余额较低", + "type": "boolean" + }, + "updated_at": { + "type": "string" + }, + "user_id": { + "type": "string" + } + } + }, + "responses.WalletTransactionListResponse": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.WalletTransactionResponse" + } + }, + "page": { + "type": "integer" + }, + "size": { + "type": "integer" + }, + "total": { + "type": "integer" + } + } + }, + "responses.WalletTransactionResponse": { + "type": "object", + "properties": { + "amount": { + "type": "number" + }, + "api_call_id": { + "type": "string" + }, + "company_name": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "id": { + "type": "string" + }, + "product_id": { + "type": "string" + }, + "product_name": { + "type": "string" + }, + "transaction_id": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "user": { + "$ref": "#/definitions/tyapi-server_internal_application_finance_dto_responses.UserSimpleResponse" + }, + "user_id": { + "type": "string" + } + } + }, + "tyapi-server_internal_application_article_dto_responses.CategoryInfoResponse": { + "type": "object", + "properties": { + "created_at": { + "type": "string" + }, + "description": { + "type": "string" + }, + "id": { + "type": "string" + }, + "is_active": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "sort_order": { + "type": "integer" + } + } + }, + "tyapi-server_internal_application_finance_dto_responses.UserSimpleResponse": { + "type": "object", + "properties": { + "company_name": { + "type": "string" + }, + "id": { + "type": "string" + }, + "phone": { + "type": "string" + } + } + }, + "tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse": { + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "description": { + "type": "string" + }, + "id": { + "type": "string" + }, + "is_enabled": { + "type": "boolean" + }, + "is_visible": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "sort": { + "type": "integer" + }, + "updated_at": { + "type": "string" + } + } + }, + "tyapi-server_internal_application_product_dto_responses.UserSimpleResponse": { + "type": "object", + "properties": { + "company_name": { + "type": "string" + }, + "id": { + "type": "string" + }, + "phone": { + "type": "string" + } + } + }, + "value_objects.ContractInfo": { + "type": "object", + "properties": { + "contract_file_id": { + "description": "合同基本信息", + "type": "string" + }, + "contract_sign_url": { + "description": "合同签署链接", + "type": "string" + }, + "contract_title": { + "description": "合同元数据", + "type": "string" + }, + "contract_url": { + "description": "合同文件访问链接", + "type": "string" + }, + "contract_version": { + "description": "合同版本", + "type": "string" + }, + "esign_flow_id": { + "description": "e签宝签署流程ID", + "type": "string" + }, + "expires_at": { + "description": "签署链接过期时间", + "type": "string" + }, + "generated_at": { + "description": "时间信息", + "type": "string" + }, + "metadata": { + "description": "附加信息", + "type": "object", + "additionalProperties": true + }, + "sign_flow_created_at": { + "description": "签署流程创建时间", + "type": "string" + }, + "sign_progress": { + "description": "签署进度", + "type": "integer" + }, + "signed_at": { + "description": "签署完成时间", + "type": "string" + }, + "signer_account": { + "description": "签署相关信息", + "type": "string" + }, + "signer_name": { + "description": "签署人姓名", + "type": "string" + }, + "status": { + "description": "状态信息", + "type": "string" + }, + "template_id": { + "description": "模板ID", + "type": "string" + }, + "transactor_id_card_num": { + "description": "经办人身份证号", + "type": "string" + }, + "transactor_name": { + "description": "经办人姓名", + "type": "string" + }, + "transactor_phone": { + "description": "经办人手机号", + "type": "string" + } + } + }, + "value_objects.EnterpriseInfo": { + "type": "object", + "properties": { + "company_name": { + "description": "企业基本信息", + "type": "string" + }, + "enterprise_address": { + "description": "企业地址(新增)", + "type": "string" + }, + "legal_person_id": { + "description": "法定代表人身份证号", + "type": "string" + }, + "legal_person_name": { + "description": "法定代表人信息", + "type": "string" + }, + "legal_person_phone": { + "description": "法定代表人手机号", + "type": "string" + }, + "registered_address": { + "description": "企业详细信息", + "type": "string" + }, + "unified_social_code": { + "description": "统一社会信用代码", + "type": "string" + } + } + }, + "value_objects.InvoiceInfo": { + "type": "object", + "properties": { + "bank_account": { + "description": "基本开户账号", + "type": "string" + }, + "bank_name": { + "description": "基本开户银行", + "type": "string" + }, + "company_address": { + "description": "企业注册地址", + "type": "string" + }, + "company_name": { + "description": "公司名称", + "type": "string" + }, + "company_phone": { + "description": "企业注册电话", + "type": "string" + }, + "receiving_email": { + "description": "发票接收邮箱", + "type": "string" + }, + "taxpayer_id": { + "description": "纳税人识别号", + "type": "string" + } + } + }, + "value_objects.InvoiceType": { + "type": "string", + "enum": [ + "general", + "special" + ], + "x-enum-comments": { + "InvoiceTypeGeneral": "增值税普通发票 (普票)", + "InvoiceTypeSpecial": "增值税专用发票 (专票)" + }, + "x-enum-descriptions": [ + "增值税普通发票 (普票)", + "增值税专用发票 (专票)" + ], + "x-enum-varnames": [ + "InvoiceTypeGeneral", + "InvoiceTypeSpecial" + ] + } + }, + "securityDefinitions": { + "Bearer": { + "description": "Type \"Bearer\" followed by a space and JWT token.", + "type": "apiKey", + "name": "Authorization", + "in": "header" + } + } +} \ No newline at end of file diff --git a/docs/swagger.yaml b/docs/swagger.yaml new file mode 100644 index 0000000..8a03737 --- /dev/null +++ b/docs/swagger.yaml @@ -0,0 +1,6209 @@ +basePath: / +definitions: + commands.AddPackageItemCommand: + properties: + product_id: + type: string + required: + - product_id + type: object + commands.ApiCallCommand: + properties: + data: + type: string + options: + $ref: '#/definitions/commands.ApiCallOptions' + required: + - data + type: object + commands.ApiCallOptions: + properties: + is_debug: + description: 是否为调试调用 + type: boolean + json: + description: 是否返回JSON格式 + type: boolean + type: object + commands.ApplyContractCommand: + properties: + user_id: + type: string + required: + - user_id + type: object + commands.BatchUpdateSubscriptionPricesCommand: + properties: + discount: + maximum: 10 + minimum: 0.1 + type: number + scope: + enum: + - undiscounted + - all + type: string + user_id: + type: string + required: + - discount + - scope + - user_id + type: object + commands.ChangePasswordCommand: + description: 修改用户密码请求参数 + properties: + code: + example: "123456" + type: string + confirm_new_password: + example: NewPassword123 + type: string + new_password: + example: NewPassword123 + type: string + old_password: + example: OldPassword123 + maxLength: 128 + minLength: 6 + type: string + required: + - code + - confirm_new_password + - new_password + - old_password + type: object + commands.CreateAlipayRechargeCommand: + properties: + amount: + description: 充值金额 + type: string + platform: + description: 支付平台:app/h5/pc + enum: + - app + - h5 + - pc + type: string + required: + - amount + - platform + type: object + commands.CreateArticleCommand: + properties: + category_id: + type: string + content: + type: string + cover_image: + type: string + is_featured: + type: boolean + summary: + type: string + tag_ids: + items: + type: string + type: array + title: + type: string + required: + - content + - title + type: object + commands.CreateCategoryCommand: + properties: + code: + type: string + description: + maxLength: 200 + type: string + is_enabled: + type: boolean + is_visible: + type: boolean + name: + maxLength: 50 + minLength: 2 + type: string + sort: + maximum: 9999 + minimum: 0 + type: integer + required: + - code + - name + type: object + commands.CreateDocumentationCommand: + properties: + basic_info: + type: string + error_codes: + type: string + product_id: + type: string + request_method: + type: string + request_params: + type: string + request_url: + type: string + response_example: + type: string + response_fields: + type: string + required: + - basic_info + - product_id + - request_method + - request_params + - request_url + type: object + commands.CreateProductCommand: + properties: + category_id: + type: string + code: + type: string + content: + maxLength: 5000 + type: string + description: + maxLength: 500 + type: string + is_enabled: + type: boolean + is_package: + type: boolean + is_visible: + type: boolean + name: + maxLength: 100 + minLength: 2 + type: string + price: + minimum: 0 + type: number + seo_description: + maxLength: 200 + type: string + seo_keywords: + maxLength: 200 + type: string + seo_title: + description: SEO信息 + maxLength: 100 + type: string + required: + - category_id + - code + - name + type: object + commands.DecryptCommand: + properties: + encrypted_data: + type: string + secret_key: + type: string + required: + - encrypted_data + - secret_key + type: object + commands.EncryptCommand: + properties: + data: + additionalProperties: true + type: object + secret_key: + type: string + required: + - data + - secret_key + type: object + commands.LoginWithPasswordCommand: + description: 使用密码进行用户登录请求参数 + properties: + password: + example: Password123 + maxLength: 128 + minLength: 6 + type: string + phone: + example: "13800138000" + type: string + required: + - password + - phone + type: object + commands.LoginWithSMSCommand: + description: 使用短信验证码进行用户登录请求参数 + properties: + code: + example: "123456" + type: string + phone: + example: "13800138000" + type: string + required: + - code + - phone + type: object + commands.PackageItemData: + properties: + product_id: + type: string + sort_order: + minimum: 0 + type: integer + required: + - product_id + - sort_order + type: object + commands.RegisterUserCommand: + description: 用户注册请求参数 + properties: + code: + example: "123456" + type: string + confirm_password: + example: Password123 + type: string + password: + example: Password123 + type: string + phone: + example: "13800138000" + type: string + required: + - code + - confirm_password + - password + - phone + type: object + commands.ReorderPackageItemsCommand: + properties: + item_ids: + items: + type: string + type: array + required: + - item_ids + type: object + commands.ResetPasswordCommand: + description: 重置用户密码请求参数(忘记密码时使用) + properties: + code: + example: "123456" + type: string + confirm_new_password: + example: NewPassword123 + type: string + new_password: + example: NewPassword123 + type: string + phone: + example: "13800138000" + type: string + required: + - code + - confirm_new_password + - new_password + - phone + type: object + commands.SendCodeCommand: + description: 发送短信验证码请求参数 + properties: + phone: + example: "13800138000" + type: string + scene: + enum: + - register + - login + - change_password + - reset_password + - bind + - unbind + - certification + example: register + type: string + required: + - phone + - scene + type: object + commands.SetFeaturedCommand: + properties: + is_featured: + type: boolean + required: + - is_featured + type: object + commands.SubmitEnterpriseInfoCommand: + properties: + company_name: + maxLength: 100 + minLength: 2 + type: string + enterprise_address: + type: string + legal_person_id: + type: string + legal_person_name: + maxLength: 20 + minLength: 2 + type: string + legal_person_phone: + type: string + unified_social_code: + type: string + verification_code: + type: string + required: + - company_name + - enterprise_address + - legal_person_id + - legal_person_name + - legal_person_phone + - unified_social_code + - verification_code + type: object + commands.UpdateArticleCommand: + properties: + category_id: + type: string + content: + type: string + cover_image: + type: string + is_featured: + type: boolean + summary: + type: string + tag_ids: + items: + type: string + type: array + title: + type: string + type: object + commands.UpdateCategoryCommand: + properties: + code: + type: string + description: + maxLength: 200 + type: string + is_enabled: + type: boolean + is_visible: + type: boolean + name: + maxLength: 50 + minLength: 2 + type: string + sort: + maximum: 9999 + minimum: 0 + type: integer + required: + - code + - name + type: object + commands.UpdatePackageItemCommand: + properties: + sort_order: + minimum: 0 + type: integer + required: + - sort_order + type: object + commands.UpdatePackageItemsCommand: + properties: + items: + items: + $ref: '#/definitions/commands.PackageItemData' + type: array + required: + - items + type: object + commands.UpdateProductCommand: + properties: + category_id: + type: string + code: + type: string + content: + maxLength: 5000 + type: string + description: + maxLength: 500 + type: string + is_enabled: + type: boolean + is_package: + type: boolean + is_visible: + type: boolean + name: + maxLength: 100 + minLength: 2 + type: string + price: + minimum: 0 + type: number + seo_description: + maxLength: 200 + type: string + seo_keywords: + maxLength: 200 + type: string + seo_title: + description: SEO信息 + maxLength: 100 + type: string + required: + - category_id + - code + - name + type: object + commands.UpdateSubscriptionPriceCommand: + properties: + price: + minimum: 0 + type: number + type: object + dto.ApiCallListResponse: + properties: + items: + items: + $ref: '#/definitions/dto.ApiCallRecordResponse' + type: array + page: + type: integer + size: + type: integer + total: + type: integer + type: object + dto.ApiCallRecordResponse: + properties: + access_id: + type: string + client_ip: + type: string + company_name: + type: string + cost: + type: string + created_at: + type: string + end_at: + type: string + error_msg: + type: string + error_type: + type: string + id: + type: string + product_id: + type: string + product_name: + type: string + start_at: + type: string + status: + type: string + transaction_id: + type: string + translated_error_msg: + type: string + updated_at: + type: string + user: + $ref: '#/definitions/dto.UserSimpleResponse' + user_id: + type: string + type: object + dto.ApiCallResponse: + properties: + code: + type: integer + data: + type: string + message: + type: string + transaction_id: + type: string + type: object + dto.AvailableAmountResponse: + properties: + available_amount: + description: 可开票金额 + type: number + pending_applications: + description: 待处理申请金额 + type: number + total_gifted: + description: 总赠送金额 + type: number + total_invoiced: + description: 已开票金额 + type: number + total_recharged: + description: 总充值金额 + type: number + type: object + dto.EncryptResponse: + properties: + encrypted_data: + type: string + type: object + dto.InvoiceApplicationResponse: + properties: + amount: + type: number + created_at: + type: string + id: + type: string + invoice_info: + $ref: '#/definitions/value_objects.InvoiceInfo' + invoice_type: + $ref: '#/definitions/value_objects.InvoiceType' + status: + $ref: '#/definitions/entities.ApplicationStatus' + user_id: + type: string + type: object + dto.InvoiceInfoResponse: + properties: + bank_account: + description: 用户可编辑 + type: string + bank_name: + description: 用户可编辑 + type: string + company_address: + description: 用户可编辑 + type: string + company_name: + description: 从企业认证信息获取,只读 + type: string + company_name_read_only: + description: 字段权限标识 + type: boolean + company_phone: + description: 用户可编辑 + type: string + is_complete: + type: boolean + missing_fields: + items: + type: string + type: array + receiving_email: + description: 用户可编辑 + type: string + taxpayer_id: + description: 从企业认证信息获取,只读 + type: string + taxpayer_id_read_only: + description: 纳税人识别号是否只读 + type: boolean + type: object + dto.InvoiceRecordResponse: + properties: + amount: + type: number + bank_account: + description: 银行账号 + type: string + bank_name: + description: 开户银行 + type: string + company_address: + description: 企业地址 + type: string + company_name: + description: 开票信息(快照数据) + type: string + company_phone: + description: 企业电话 + type: string + created_at: + type: string + file_name: + description: 文件信息 + type: string + file_size: + type: integer + file_url: + type: string + id: + type: string + invoice_type: + $ref: '#/definitions/value_objects.InvoiceType' + processed_at: + description: 时间信息 + type: string + receiving_email: + description: 接收邮箱 + type: string + reject_reason: + description: 拒绝原因 + type: string + status: + $ref: '#/definitions/entities.ApplicationStatus' + taxpayer_id: + description: 纳税人识别号 + type: string + user_id: + type: string + type: object + dto.InvoiceRecordsResponse: + properties: + page: + type: integer + page_size: + type: integer + records: + items: + $ref: '#/definitions/dto.InvoiceRecordResponse' + type: array + total: + type: integer + total_pages: + type: integer + type: object + dto.PendingApplicationResponse: + properties: + amount: + type: number + bank_account: + type: string + bank_name: + type: string + company_address: + type: string + company_name: + type: string + company_phone: + type: string + created_at: + type: string + file_name: + type: string + file_size: + type: integer + file_url: + type: string + id: + type: string + invoice_type: + $ref: '#/definitions/value_objects.InvoiceType' + processed_at: + type: string + receiving_email: + type: string + reject_reason: + type: string + status: + $ref: '#/definitions/entities.ApplicationStatus' + taxpayer_id: + type: string + user_id: + type: string + type: object + dto.PendingApplicationsResponse: + properties: + applications: + items: + $ref: '#/definitions/dto.PendingApplicationResponse' + type: array + page: + type: integer + page_size: + type: integer + total: + type: integer + total_pages: + type: integer + type: object + dto.UserSimpleResponse: + properties: + company_name: + type: string + id: + type: string + phone: + type: string + type: object + entities.ApplicationStatus: + enum: + - pending + - completed + - rejected + type: string + x-enum-comments: + ApplicationStatusCompleted: 已完成(已上传发票) + ApplicationStatusPending: 待处理 + ApplicationStatusRejected: 已拒绝 + x-enum-descriptions: + - 待处理 + - 已完成(已上传发票) + - 已拒绝 + x-enum-varnames: + - ApplicationStatusPending + - ApplicationStatusCompleted + - ApplicationStatusRejected + enums.CertificationStatus: + enum: + - pending + - info_submitted + - enterprise_verified + - contract_applied + - contract_signed + - completed + - info_rejected + - contract_rejected + - contract_expired + type: string + x-enum-comments: + StatusCompleted: 认证完成 + StatusContractApplied: 已申请签署合同 + StatusContractExpired: 合同签署超时 + StatusContractRejected: 合同被拒签 + StatusContractSigned: 已签署合同 + StatusEnterpriseVerified: 已企业认证 + StatusInfoRejected: 企业信息被拒绝 + StatusInfoSubmitted: 已提交企业信息 + StatusPending: 待认证 + x-enum-descriptions: + - 待认证 + - 已提交企业信息 + - 已企业认证 + - 已申请签署合同 + - 已签署合同 + - 认证完成 + - 企业信息被拒绝 + - 合同被拒签 + - 合同签署超时 + x-enum-varnames: + - StatusPending + - StatusInfoSubmitted + - StatusEnterpriseVerified + - StatusContractApplied + - StatusContractSigned + - StatusCompleted + - StatusInfoRejected + - StatusContractRejected + - StatusContractExpired + enums.FailureReason: + enum: + - enterprise_not_exists + - enterprise_info_mismatch + - enterprise_status_abnormal + - legal_person_mismatch + - esign_verification_failed + - invalid_document + - contract_rejected_by_user + - contract_expired + - sign_process_failed + - contract_gen_failed + - esign_flow_error + - system_error + - network_error + - timeout + - unknown_error + type: string + x-enum-comments: + FailureReasonContractExpired: 合同签署超时 + FailureReasonContractGenFailed: 合同生成失败 + FailureReasonContractRejectedByUser: 用户拒绝签署 + FailureReasonEnterpriseInfoMismatch: 企业信息不匹配 + FailureReasonEnterpriseNotExists: 企业不存在 + FailureReasonEnterpriseStatusAbnormal: 企业状态异常 + FailureReasonEsignFlowError: e签宝流程错误 + FailureReasonEsignVerificationFailed: e签宝验证失败 + FailureReasonInvalidDocument: 证件信息无效 + FailureReasonLegalPersonMismatch: 法定代表人信息不匹配 + FailureReasonNetworkError: 网络错误 + FailureReasonSignProcessFailed: 签署流程失败 + FailureReasonSystemError: 系统错误 + FailureReasonTimeout: 操作超时 + FailureReasonUnknownError: 未知错误 + x-enum-descriptions: + - 企业不存在 + - 企业信息不匹配 + - 企业状态异常 + - 法定代表人信息不匹配 + - e签宝验证失败 + - 证件信息无效 + - 用户拒绝签署 + - 合同签署超时 + - 签署流程失败 + - 合同生成失败 + - e签宝流程错误 + - 系统错误 + - 网络错误 + - 操作超时 + - 未知错误 + x-enum-varnames: + - FailureReasonEnterpriseNotExists + - FailureReasonEnterpriseInfoMismatch + - FailureReasonEnterpriseStatusAbnormal + - FailureReasonLegalPersonMismatch + - FailureReasonEsignVerificationFailed + - FailureReasonInvalidDocument + - FailureReasonContractRejectedByUser + - FailureReasonContractExpired + - FailureReasonSignProcessFailed + - FailureReasonContractGenFailed + - FailureReasonEsignFlowError + - FailureReasonSystemError + - FailureReasonNetworkError + - FailureReasonTimeout + - FailureReasonUnknownError + finance.ApplyInvoiceRequest: + properties: + amount: + description: 开票金额 + type: string + invoice_type: + description: 发票类型:general/special + type: string + required: + - amount + - invoice_type + type: object + finance.RejectInvoiceRequest: + properties: + reason: + description: 拒绝原因 + type: string + required: + - reason + type: object + finance.UpdateInvoiceInfoRequest: + properties: + bank_account: + description: 银行账户 + type: string + bank_name: + description: 银行名称 + type: string + company_address: + description: 公司地址 + type: string + company_name: + description: 公司名称(从企业认证信息获取,用户不可修改) + type: string + company_phone: + description: 企业注册电话 + type: string + receiving_email: + description: 发票接收邮箱 + type: string + taxpayer_id: + description: 纳税人识别号(从企业认证信息获取,用户不可修改) + type: string + required: + - receiving_email + type: object + interfaces.APIResponse: + properties: + data: {} + errors: {} + message: + type: string + meta: + additionalProperties: true + type: object + pagination: + $ref: '#/definitions/interfaces.PaginationMeta' + request_id: + type: string + success: + type: boolean + timestamp: + type: integer + type: object + interfaces.PaginationMeta: + properties: + has_next: + type: boolean + has_prev: + type: boolean + page: + type: integer + page_size: + type: integer + total: + type: integer + total_pages: + type: integer + type: object + queries.ConfirmAuthCommand: + type: object + queries.ConfirmSignCommand: + type: object + responses.AlipayOrderStatusResponse: + properties: + amount: + description: 订单金额 + type: number + can_retry: + description: 是否可以重试 + type: boolean + created_at: + description: 创建时间 + type: string + error_code: + description: 错误码 + type: string + error_message: + description: 错误信息 + type: string + is_processing: + description: 是否处理中 + type: boolean + notify_time: + description: 异步通知时间 + type: string + out_trade_no: + description: 商户订单号 + type: string + platform: + description: 支付平台 + type: string + return_time: + description: 同步返回时间 + type: string + status: + description: 订单状态 + type: string + subject: + description: 订单标题 + type: string + trade_no: + description: 支付宝交易号 + type: string + updated_at: + description: 更新时间 + type: string + type: object + responses.AlipayRechargeBonusRuleResponse: + properties: + bonus_amount: + type: number + recharge_amount: + type: number + type: object + responses.AlipayRechargeOrderResponse: + properties: + amount: + description: 充值金额 + type: number + out_trade_no: + description: 商户订单号 + type: string + pay_url: + description: 支付链接 + type: string + platform: + description: 支付平台 + type: string + subject: + description: 订单标题 + type: string + type: object + responses.ArticleInfoResponse: + properties: + category: + $ref: '#/definitions/tyapi-server_internal_application_article_dto_responses.CategoryInfoResponse' + category_id: + type: string + content: + type: string + cover_image: + type: string + created_at: + type: string + id: + type: string + is_featured: + type: boolean + published_at: + type: string + status: + type: string + summary: + type: string + tags: + items: + $ref: '#/definitions/responses.TagInfoResponse' + type: array + title: + type: string + updated_at: + type: string + view_count: + type: integer + type: object + responses.ArticleListResponse: + properties: + items: + items: + $ref: '#/definitions/responses.ArticleInfoResponse' + type: array + page: + type: integer + size: + type: integer + total: + type: integer + type: object + responses.ArticleStatsResponse: + properties: + archived_articles: + type: integer + draft_articles: + type: integer + published_articles: + type: integer + total_articles: + type: integer + total_views: + type: integer + type: object + responses.CategoryListResponse: + properties: + items: + items: + $ref: '#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse' + type: array + page: + type: integer + size: + type: integer + total: + type: integer + type: object + responses.CategorySimpleResponse: + properties: + code: + type: string + id: + type: string + name: + type: string + type: object + responses.CertificationListResponse: + properties: + items: + items: + $ref: '#/definitions/responses.CertificationResponse' + type: array + page: + type: integer + page_size: + type: integer + total: + type: integer + total_pages: + type: integer + type: object + responses.CertificationResponse: + properties: + available_actions: + items: + type: string + type: array + can_retry: + type: boolean + completed_at: + type: string + contract_applied_at: + type: string + contract_info: + allOf: + - $ref: '#/definitions/value_objects.ContractInfo' + description: 合同信息 + contract_signed_at: + type: string + created_at: + description: 时间戳 + type: string + enterprise_info: + allOf: + - $ref: '#/definitions/value_objects.EnterpriseInfo' + description: 企业信息 + enterprise_verified_at: + type: string + failure_message: + type: string + failure_reason: + allOf: + - $ref: '#/definitions/enums.FailureReason' + description: 失败信息 + failure_reason_name: + type: string + id: + type: string + info_submitted_at: + type: string + is_completed: + description: 业务状态 + type: boolean + is_failed: + type: boolean + is_user_action_required: + type: boolean + metadata: + additionalProperties: true + description: 元数据 + type: object + next_action: + description: 用户操作提示 + type: string + progress: + type: integer + retry_count: + type: integer + status: + $ref: '#/definitions/enums.CertificationStatus' + status_name: + type: string + updated_at: + type: string + user_id: + type: string + type: object + responses.ConfirmAuthResponse: + properties: + reason: + type: string + status: + $ref: '#/definitions/enums.CertificationStatus' + type: object + responses.ConfirmSignResponse: + properties: + reason: + type: string + status: + $ref: '#/definitions/enums.CertificationStatus' + type: object + responses.ContractInfoItem: + properties: + contract_file_url: + type: string + contract_name: + type: string + contract_type: + description: 合同类型代码 + type: string + contract_type_name: + description: 合同类型中文名称 + type: string + created_at: + type: string + id: + type: string + type: object + responses.ContractSignUrlResponse: + properties: + certification_id: + type: string + contract_sign_url: + type: string + contract_url: + type: string + expire_at: + type: string + message: + type: string + next_action: + type: string + type: object + responses.DocumentationResponse: + properties: + basic_info: + type: string + created_at: + type: string + error_codes: + type: string + id: + type: string + product_id: + type: string + request_method: + type: string + request_params: + type: string + request_url: + type: string + response_example: + type: string + response_fields: + type: string + updated_at: + type: string + version: + type: string + type: object + responses.EnterpriseInfoItem: + properties: + company_name: + type: string + contracts: + description: 合同信息 + items: + $ref: '#/definitions/responses.ContractInfoItem' + type: array + created_at: + type: string + enterprise_address: + type: string + id: + type: string + legal_person_name: + type: string + legal_person_phone: + type: string + unified_social_code: + type: string + type: object + responses.EnterpriseInfoResponse: + description: 企业信息响应 + properties: + certified_at: + example: "2024-01-01T00:00:00Z" + type: string + company_name: + example: 示例企业有限公司 + type: string + created_at: + example: "2024-01-01T00:00:00Z" + type: string + enterprise_address: + example: 北京市朝阳区xxx街道xxx号 + type: string + id: + example: 123e4567-e89b-12d3-a456-426614174000 + type: string + legal_person_id: + example: "110101199001011234" + type: string + legal_person_name: + example: 张三 + type: string + legal_person_phone: + example: "13800138000" + type: string + unified_social_code: + example: 91110000123456789X + type: string + updated_at: + example: "2024-01-01T00:00:00Z" + type: string + type: object + responses.LoginUserResponse: + description: 用户登录成功响应 + properties: + access_token: + example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... + type: string + expires_in: + example: 86400 + type: integer + login_method: + example: password + type: string + token_type: + example: Bearer + type: string + user: + $ref: '#/definitions/responses.UserProfileResponse' + type: object + responses.PackageItemResponse: + properties: + id: + type: string + price: + type: number + product_code: + type: string + product_id: + type: string + product_name: + type: string + sort_order: + type: integer + type: object + responses.ProductAdminInfoResponse: + properties: + category: + allOf: + - $ref: '#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse' + description: 关联信息 + category_id: + type: string + code: + type: string + content: + type: string + created_at: + type: string + description: + type: string + documentation: + allOf: + - $ref: '#/definitions/responses.DocumentationResponse' + description: 文档信息 + id: + type: string + is_enabled: + type: boolean + is_package: + type: boolean + is_visible: + type: boolean + name: + type: string + old_id: + type: string + package_items: + description: 组合包信息 + items: + $ref: '#/definitions/responses.PackageItemResponse' + type: array + price: + type: number + seo_description: + type: string + seo_keywords: + type: string + seo_title: + description: SEO信息 + type: string + updated_at: + type: string + type: object + responses.ProductAdminListResponse: + properties: + items: + items: + $ref: '#/definitions/responses.ProductAdminInfoResponse' + type: array + page: + type: integer + size: + type: integer + total: + type: integer + type: object + responses.ProductApiConfigResponse: + properties: + created_at: + type: string + id: + type: string + product_id: + type: string + request_params: + items: + $ref: '#/definitions/responses.RequestParamResponse' + type: array + response_example: + additionalProperties: true + type: object + response_fields: + items: + $ref: '#/definitions/responses.ResponseFieldResponse' + type: array + updated_at: + type: string + type: object + responses.ProductInfoResponse: + properties: + category: + allOf: + - $ref: '#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse' + description: 关联信息 + category_id: + type: string + code: + type: string + content: + type: string + created_at: + type: string + description: + type: string + id: + type: string + is_enabled: + type: boolean + is_package: + type: boolean + is_subscribed: + type: boolean + name: + type: string + old_id: + type: string + package_items: + description: 组合包信息 + items: + $ref: '#/definitions/responses.PackageItemResponse' + type: array + price: + type: number + seo_description: + type: string + seo_keywords: + type: string + seo_title: + description: SEO信息 + type: string + updated_at: + type: string + type: object + responses.ProductInfoWithDocumentResponse: + properties: + category: + allOf: + - $ref: '#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse' + description: 关联信息 + category_id: + type: string + code: + type: string + content: + type: string + created_at: + type: string + description: + type: string + documentation: + $ref: '#/definitions/responses.DocumentationResponse' + id: + type: string + is_enabled: + type: boolean + is_package: + type: boolean + is_subscribed: + type: boolean + name: + type: string + old_id: + type: string + package_items: + description: 组合包信息 + items: + $ref: '#/definitions/responses.PackageItemResponse' + type: array + price: + type: number + seo_description: + type: string + seo_keywords: + type: string + seo_title: + description: SEO信息 + type: string + updated_at: + type: string + type: object + responses.ProductListResponse: + properties: + items: + items: + $ref: '#/definitions/responses.ProductInfoResponse' + type: array + page: + type: integer + size: + type: integer + total: + type: integer + type: object + responses.ProductSimpleResponse: + properties: + category: + $ref: '#/definitions/responses.CategorySimpleResponse' + code: + type: string + description: + type: string + id: + type: string + is_package: + type: boolean + is_subscribed: + type: boolean + name: + type: string + old_id: + type: string + price: + type: number + type: object + responses.ProductStatsResponse: + properties: + enabled_products: + type: integer + package_products: + type: integer + total_products: + type: integer + visible_products: + type: integer + type: object + responses.RechargeConfigResponse: + properties: + alipay_recharge_bonus: + items: + $ref: '#/definitions/responses.AlipayRechargeBonusRuleResponse' + type: array + max_amount: + description: 最高充值金额 + type: string + min_amount: + description: 最低充值金额 + type: string + type: object + responses.RechargeRecordListResponse: + properties: + items: + items: + $ref: '#/definitions/responses.RechargeRecordResponse' + type: array + page: + type: integer + size: + type: integer + total: + type: integer + type: object + responses.RechargeRecordResponse: + properties: + alipay_order_id: + type: string + amount: + type: number + company_name: + type: string + created_at: + type: string + id: + type: string + notes: + type: string + operator_id: + type: string + recharge_type: + type: string + status: + type: string + transfer_order_id: + type: string + updated_at: + type: string + user: + $ref: '#/definitions/tyapi-server_internal_application_finance_dto_responses.UserSimpleResponse' + user_id: + type: string + type: object + responses.RegisterUserResponse: + description: 用户注册成功响应 + properties: + id: + example: 123e4567-e89b-12d3-a456-426614174000 + type: string + phone: + example: "13800138000" + type: string + type: object + responses.RequestParamResponse: + properties: + description: + type: string + example: + type: string + field: + type: string + name: + type: string + required: + type: boolean + type: + type: string + validation: + type: string + type: object + responses.ResponseFieldResponse: + properties: + description: + type: string + example: + type: string + name: + type: string + path: + type: string + required: + type: boolean + type: + type: string + type: object + responses.SubscriptionInfoResponse: + properties: + api_used: + type: integer + created_at: + type: string + id: + type: string + price: + type: number + product: + $ref: '#/definitions/responses.ProductSimpleResponse' + product_id: + type: string + updated_at: + type: string + user: + allOf: + - $ref: '#/definitions/tyapi-server_internal_application_product_dto_responses.UserSimpleResponse' + description: 关联信息 + user_id: + type: string + type: object + responses.SubscriptionListResponse: + properties: + items: + items: + $ref: '#/definitions/responses.SubscriptionInfoResponse' + type: array + page: + type: integer + size: + type: integer + total: + type: integer + type: object + responses.SubscriptionStatsResponse: + properties: + total_revenue: + type: number + total_subscriptions: + type: integer + type: object + responses.TagInfoResponse: + properties: + color: + type: string + created_at: + type: string + id: + type: string + name: + type: string + type: object + responses.UserDetailResponse: + properties: + created_at: + type: string + enterprise_info: + allOf: + - $ref: '#/definitions/responses.EnterpriseInfoItem' + description: 企业信息 + id: + type: string + is_active: + type: boolean + is_certified: + type: boolean + last_login_at: + type: string + login_count: + type: integer + phone: + type: string + updated_at: + type: string + user_type: + type: string + username: + type: string + wallet_balance: + description: 钱包信息 + type: string + type: object + responses.UserListItem: + properties: + created_at: + type: string + enterprise_info: + allOf: + - $ref: '#/definitions/responses.EnterpriseInfoItem' + description: 企业信息 + id: + type: string + is_active: + type: boolean + is_certified: + type: boolean + last_login_at: + type: string + login_count: + type: integer + phone: + type: string + updated_at: + type: string + user_type: + type: string + username: + type: string + wallet_balance: + description: 钱包信息 + type: string + type: object + responses.UserListResponse: + properties: + items: + items: + $ref: '#/definitions/responses.UserListItem' + type: array + page: + type: integer + size: + type: integer + total: + type: integer + type: object + responses.UserProfileResponse: + description: 用户基本信息 + properties: + created_at: + example: "2024-01-01T00:00:00Z" + type: string + enterprise_info: + $ref: '#/definitions/responses.EnterpriseInfoResponse' + id: + example: 123e4567-e89b-12d3-a456-426614174000 + type: string + is_active: + example: true + type: boolean + is_certified: + example: false + type: boolean + last_login_at: + example: "2024-01-01T00:00:00Z" + type: string + login_count: + example: 10 + type: integer + permissions: + example: + - '[''user:read''' + - '''user:write'']' + items: + type: string + type: array + phone: + example: "13800138000" + type: string + updated_at: + example: "2024-01-01T00:00:00Z" + type: string + user_type: + example: user + type: string + username: + example: admin + type: string + type: object + responses.UserStatsResponse: + properties: + active_users: + type: integer + certified_users: + type: integer + total_users: + type: integer + type: object + responses.WalletResponse: + properties: + balance: + type: number + balance_status: + description: normal, low, arrears + type: string + created_at: + type: string + id: + type: string + is_active: + type: boolean + is_arrears: + description: 是否欠费 + type: boolean + is_low_balance: + description: 是否余额较低 + type: boolean + updated_at: + type: string + user_id: + type: string + type: object + responses.WalletTransactionListResponse: + properties: + items: + items: + $ref: '#/definitions/responses.WalletTransactionResponse' + type: array + page: + type: integer + size: + type: integer + total: + type: integer + type: object + responses.WalletTransactionResponse: + properties: + amount: + type: number + api_call_id: + type: string + company_name: + type: string + created_at: + type: string + id: + type: string + product_id: + type: string + product_name: + type: string + transaction_id: + type: string + updated_at: + type: string + user: + $ref: '#/definitions/tyapi-server_internal_application_finance_dto_responses.UserSimpleResponse' + user_id: + type: string + type: object + tyapi-server_internal_application_article_dto_responses.CategoryInfoResponse: + properties: + created_at: + type: string + description: + type: string + id: + type: string + is_active: + type: boolean + name: + type: string + sort_order: + type: integer + type: object + tyapi-server_internal_application_finance_dto_responses.UserSimpleResponse: + properties: + company_name: + type: string + id: + type: string + phone: + type: string + type: object + tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse: + properties: + code: + type: string + created_at: + type: string + description: + type: string + id: + type: string + is_enabled: + type: boolean + is_visible: + type: boolean + name: + type: string + sort: + type: integer + updated_at: + type: string + type: object + tyapi-server_internal_application_product_dto_responses.UserSimpleResponse: + properties: + company_name: + type: string + id: + type: string + phone: + type: string + type: object + value_objects.ContractInfo: + properties: + contract_file_id: + description: 合同基本信息 + type: string + contract_sign_url: + description: 合同签署链接 + type: string + contract_title: + description: 合同元数据 + type: string + contract_url: + description: 合同文件访问链接 + type: string + contract_version: + description: 合同版本 + type: string + esign_flow_id: + description: e签宝签署流程ID + type: string + expires_at: + description: 签署链接过期时间 + type: string + generated_at: + description: 时间信息 + type: string + metadata: + additionalProperties: true + description: 附加信息 + type: object + sign_flow_created_at: + description: 签署流程创建时间 + type: string + sign_progress: + description: 签署进度 + type: integer + signed_at: + description: 签署完成时间 + type: string + signer_account: + description: 签署相关信息 + type: string + signer_name: + description: 签署人姓名 + type: string + status: + description: 状态信息 + type: string + template_id: + description: 模板ID + type: string + transactor_id_card_num: + description: 经办人身份证号 + type: string + transactor_name: + description: 经办人姓名 + type: string + transactor_phone: + description: 经办人手机号 + type: string + type: object + value_objects.EnterpriseInfo: + properties: + company_name: + description: 企业基本信息 + type: string + enterprise_address: + description: 企业地址(新增) + type: string + legal_person_id: + description: 法定代表人身份证号 + type: string + legal_person_name: + description: 法定代表人信息 + type: string + legal_person_phone: + description: 法定代表人手机号 + type: string + registered_address: + description: 企业详细信息 + type: string + unified_social_code: + description: 统一社会信用代码 + type: string + type: object + value_objects.InvoiceInfo: + properties: + bank_account: + description: 基本开户账号 + type: string + bank_name: + description: 基本开户银行 + type: string + company_address: + description: 企业注册地址 + type: string + company_name: + description: 公司名称 + type: string + company_phone: + description: 企业注册电话 + type: string + receiving_email: + description: 发票接收邮箱 + type: string + taxpayer_id: + description: 纳税人识别号 + type: string + type: object + value_objects.InvoiceType: + enum: + - general + - special + type: string + x-enum-comments: + InvoiceTypeGeneral: 增值税普通发票 (普票) + InvoiceTypeSpecial: 增值税专用发票 (专票) + x-enum-descriptions: + - 增值税普通发票 (普票) + - 增值税专用发票 (专票) + x-enum-varnames: + - InvoiceTypeGeneral + - InvoiceTypeSpecial +host: localhost:8080 +info: + contact: + email: support@example.com + name: API Support + url: https://github.com/your-org/tyapi-server-gin + description: |- + 基于DDD和Clean Architecture的企业级后端API服务 + 采用Gin框架构建,支持用户管理、JWT认证、事件驱动等功能 + license: + name: Apache 2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html + title: TYAPI Server API + version: "1.0" +paths: + /api/v1/:api_name: + post: + consumes: + - application/json + description: 统一API调用入口,参数加密传输 + parameters: + - description: API调用请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/commands.ApiCallCommand' + produces: + - application/json + responses: + "200": + description: 调用成功 + schema: + $ref: '#/definitions/dto.ApiCallResponse' + "400": + description: 请求参数错误 + schema: + $ref: '#/definitions/dto.ApiCallResponse' + "401": + description: 未授权 + schema: + $ref: '#/definitions/dto.ApiCallResponse' + "429": + description: 请求过于频繁 + schema: + $ref: '#/definitions/dto.ApiCallResponse' + "500": + description: 服务器内部错误 + schema: + $ref: '#/definitions/dto.ApiCallResponse' + summary: API调用 + tags: + - API调用 + /api/v1/admin/api-calls: + get: + consumes: + - application/json + description: 管理员获取API调用记录,支持筛选和分页 + parameters: + - default: 1 + description: 页码 + in: query + name: page + type: integer + - default: 10 + description: 每页数量 + in: query + name: page_size + type: integer + - description: 用户ID + in: query + name: user_id + type: string + - description: 交易ID + in: query + name: transaction_id + type: string + - description: 产品名称 + in: query + name: product_name + type: string + - description: 状态 + in: query + name: status + type: string + - description: 开始时间 + format: date-time + in: query + name: start_time + type: string + - description: 结束时间 + format: date-time + in: query + name: end_time + type: string + - description: 排序字段 + in: query + name: sort_by + type: string + - description: 排序方向 + enum: + - asc + - desc + in: query + name: sort_order + type: string + produces: + - application/json + responses: + "200": + description: 获取API调用记录成功 + schema: + $ref: '#/definitions/dto.ApiCallListResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 获取管理端API调用记录 + tags: + - API管理 + /api/v1/admin/invoices/{application_id}/approve: + post: + consumes: + - multipart/form-data + description: 管理员通过发票申请并上传发票文件 + parameters: + - description: 申请ID + in: path + name: application_id + required: true + type: string + - description: 发票文件 + in: formData + name: file + required: true + type: file + - description: 管理员备注 + in: formData + name: admin_notes + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/interfaces.APIResponse' + "400": + description: Bad Request + schema: + $ref: '#/definitions/interfaces.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/interfaces.APIResponse' + summary: 通过发票申请 + tags: + - 管理员-发票管理 + /api/v1/admin/invoices/{application_id}/download: + get: + description: 管理员下载指定发票的文件 + parameters: + - description: 申请ID + in: path + name: application_id + required: true + type: string + produces: + - application/octet-stream + responses: + "200": + description: OK + schema: + type: file + "400": + description: Bad Request + schema: + $ref: '#/definitions/interfaces.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/interfaces.APIResponse' + summary: 管理员下载发票文件 + tags: + - 管理员-发票管理 + /api/v1/admin/invoices/{application_id}/reject: + post: + consumes: + - application/json + description: 管理员拒绝发票申请 + parameters: + - description: 申请ID + in: path + name: application_id + required: true + type: string + - description: 拒绝申请请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/finance.RejectInvoiceRequest' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/interfaces.APIResponse' + "400": + description: Bad Request + schema: + $ref: '#/definitions/interfaces.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/interfaces.APIResponse' + summary: 拒绝发票申请 + tags: + - 管理员-发票管理 + /api/v1/admin/invoices/pending: + get: + description: 管理员获取发票申请列表,支持状态和时间范围筛选 + parameters: + - default: 1 + description: 页码 + in: query + name: page + type: integer + - default: 10 + description: 每页数量 + in: query + name: page_size + type: integer + - description: 状态筛选:pending/completed/rejected + in: query + name: status + type: string + - description: '开始时间 (格式: 2006-01-02 15:04:05)' + in: query + name: start_time + type: string + - description: '结束时间 (格式: 2006-01-02 15:04:05)' + in: query + name: end_time + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/interfaces.APIResponse' + - properties: + data: + $ref: '#/definitions/dto.PendingApplicationsResponse' + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/interfaces.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/interfaces.APIResponse' + summary: 获取发票申请列表 + tags: + - 管理员-发票管理 + /api/v1/admin/product-categories: + get: + consumes: + - application/json + description: 管理员获取产品分类列表 + parameters: + - default: 1 + description: 页码 + in: query + name: page + type: integer + - default: 10 + description: 每页数量 + in: query + name: page_size + type: integer + produces: + - application/json + responses: + "200": + description: 获取分类列表成功 + schema: + $ref: '#/definitions/responses.CategoryListResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 获取分类列表 + tags: + - 分类管理 + post: + consumes: + - application/json + description: 管理员创建新产品分类 + parameters: + - description: 创建分类请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/commands.CreateCategoryCommand' + produces: + - application/json + responses: + "201": + description: 分类创建成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 创建分类 + tags: + - 分类管理 + /api/v1/admin/product-categories/{id}: + delete: + consumes: + - application/json + description: 管理员删除产品分类 + parameters: + - description: 分类ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 分类删除成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 分类不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 删除分类 + tags: + - 分类管理 + get: + consumes: + - application/json + description: 管理员获取分类详细信息 + parameters: + - description: 分类ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 获取分类详情成功 + schema: + $ref: '#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 分类不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 获取分类详情 + tags: + - 分类管理 + put: + consumes: + - application/json + description: 管理员更新产品分类信息 + parameters: + - description: 分类ID + in: path + name: id + required: true + type: string + - description: 更新分类请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/commands.UpdateCategoryCommand' + produces: + - application/json + responses: + "200": + description: 分类更新成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 分类不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 更新分类 + tags: + - 分类管理 + /api/v1/admin/products: + get: + consumes: + - application/json + description: 管理员获取产品列表,支持筛选和分页,包含所有产品(包括隐藏的) + parameters: + - default: 1 + description: 页码 + in: query + name: page + type: integer + - default: 10 + description: 每页数量 + in: query + name: page_size + type: integer + - description: 搜索关键词 + in: query + name: keyword + type: string + - description: 分类ID + in: query + name: category_id + type: string + - description: 是否启用 + in: query + name: is_enabled + type: boolean + - description: 是否可见 + in: query + name: is_visible + type: boolean + - description: 是否组合包 + in: query + name: is_package + type: boolean + - description: 排序字段 + in: query + name: sort_by + type: string + - description: 排序方向 + enum: + - asc + - desc + in: query + name: sort_order + type: string + produces: + - application/json + responses: + "200": + description: 获取产品列表成功 + schema: + $ref: '#/definitions/responses.ProductAdminListResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 获取产品列表 + tags: + - 产品管理 + post: + consumes: + - application/json + description: 管理员创建新产品 + parameters: + - description: 创建产品请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/commands.CreateProductCommand' + produces: + - application/json + responses: + "201": + description: 产品创建成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 创建产品 + tags: + - 产品管理 + /api/v1/admin/products/{id}: + delete: + consumes: + - application/json + description: 管理员删除产品 + parameters: + - description: 产品ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 产品删除成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 产品不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 删除产品 + tags: + - 产品管理 + get: + consumes: + - application/json + description: 管理员获取产品详细信息 + parameters: + - description: 产品ID + in: path + name: id + required: true + type: string + - description: 是否包含文档信息 + in: query + name: with_document + type: boolean + produces: + - application/json + responses: + "200": + description: 获取产品详情成功 + schema: + $ref: '#/definitions/responses.ProductAdminInfoResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 产品不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 获取产品详情 + tags: + - 产品管理 + put: + consumes: + - application/json + description: 管理员更新产品信息 + parameters: + - description: 产品ID + in: path + name: id + required: true + type: string + - description: 更新产品请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/commands.UpdateProductCommand' + produces: + - application/json + responses: + "200": + description: 产品更新成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 产品不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 更新产品 + tags: + - 产品管理 + /api/v1/admin/products/{id}/api-config: + delete: + consumes: + - application/json + description: 管理员删除产品的API配置 + parameters: + - description: 产品ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: API配置删除成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 产品或API配置不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 删除产品API配置 + tags: + - 产品管理 + get: + consumes: + - application/json + description: 管理员获取产品的API配置信息,如果不存在则返回空配置 + parameters: + - description: 产品ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 获取API配置成功 + schema: + $ref: '#/definitions/responses.ProductApiConfigResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 产品不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 获取产品API配置 + tags: + - 产品管理 + post: + consumes: + - application/json + description: 管理员为产品创建API配置 + parameters: + - description: 产品ID + in: path + name: id + required: true + type: string + - description: API配置信息 + in: body + name: request + required: true + schema: + $ref: '#/definitions/responses.ProductApiConfigResponse' + produces: + - application/json + responses: + "201": + description: API配置创建成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "409": + description: API配置已存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 创建产品API配置 + tags: + - 产品管理 + put: + consumes: + - application/json + description: 管理员更新产品的API配置 + parameters: + - description: 产品ID + in: path + name: id + required: true + type: string + - description: API配置信息 + in: body + name: request + required: true + schema: + $ref: '#/definitions/responses.ProductApiConfigResponse' + produces: + - application/json + responses: + "200": + description: API配置更新成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 产品或配置不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 更新产品API配置 + tags: + - 产品管理 + /api/v1/admin/products/{id}/documentation: + delete: + consumes: + - application/json + description: 管理员删除产品的文档 + parameters: + - description: 产品ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 文档删除成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 产品或文档不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 删除产品文档 + tags: + - 产品管理 + get: + consumes: + - application/json + description: 管理员获取产品的文档信息 + parameters: + - description: 产品ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 获取文档成功 + schema: + $ref: '#/definitions/responses.DocumentationResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 产品或文档不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 获取产品文档 + tags: + - 产品管理 + post: + consumes: + - application/json + description: 管理员创建或更新产品的文档信息,如果文档不存在则创建,存在则更新 + parameters: + - description: 产品ID + in: path + name: id + required: true + type: string + - description: 文档信息 + in: body + name: request + required: true + schema: + $ref: '#/definitions/commands.CreateDocumentationCommand' + produces: + - application/json + responses: + "200": + description: 文档操作成功 + schema: + $ref: '#/definitions/responses.DocumentationResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 产品不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 创建或更新产品文档 + tags: + - 产品管理 + /api/v1/admin/products/{id}/package-items: + post: + consumes: + - application/json + description: 管理员向组合包添加子产品 + parameters: + - description: 组合包ID + in: path + name: id + required: true + type: string + - description: 添加子产品命令 + in: body + name: command + required: true + schema: + $ref: '#/definitions/commands.AddPackageItemCommand' + produces: + - application/json + responses: + "200": + description: 添加成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 产品不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 添加组合包子产品 + tags: + - 产品管理 + /api/v1/admin/products/{id}/package-items/{item_id}: + delete: + consumes: + - application/json + description: 管理员从组合包移除子产品 + parameters: + - description: 组合包ID + in: path + name: id + required: true + type: string + - description: 子产品项目ID + in: path + name: item_id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 移除成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 产品不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 移除组合包子产品 + tags: + - 产品管理 + put: + consumes: + - application/json + description: 管理员更新组合包子产品信息 + parameters: + - description: 组合包ID + in: path + name: id + required: true + type: string + - description: 子产品项目ID + in: path + name: item_id + required: true + type: string + - description: 更新子产品命令 + in: body + name: command + required: true + schema: + $ref: '#/definitions/commands.UpdatePackageItemCommand' + produces: + - application/json + responses: + "200": + description: 更新成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 产品不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 更新组合包子产品 + tags: + - 产品管理 + /api/v1/admin/products/{id}/package-items/batch: + put: + consumes: + - application/json + description: 管理员批量更新组合包子产品配置 + parameters: + - description: 组合包ID + in: path + name: id + required: true + type: string + - description: 批量更新命令 + in: body + name: command + required: true + schema: + $ref: '#/definitions/commands.UpdatePackageItemsCommand' + produces: + - application/json + responses: + "200": + description: 更新成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 产品不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 批量更新组合包子产品 + tags: + - 产品管理 + /api/v1/admin/products/{id}/package-items/reorder: + put: + consumes: + - application/json + description: 管理员重新排序组合包子产品 + parameters: + - description: 组合包ID + in: path + name: id + required: true + type: string + - description: 重新排序命令 + in: body + name: command + required: true + schema: + $ref: '#/definitions/commands.ReorderPackageItemsCommand' + produces: + - application/json + responses: + "200": + description: 排序成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 产品不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 重新排序组合包子产品 + tags: + - 产品管理 + /api/v1/admin/products/available: + get: + consumes: + - application/json + description: 管理员获取可选作组合包子产品的产品列表 + parameters: + - description: 排除的组合包ID + in: query + name: exclude_package_id + type: string + - description: 搜索关键词 + in: query + name: keyword + type: string + - description: 分类ID + in: query + name: category_id + type: string + - default: 1 + description: 页码 + in: query + name: page + type: integer + - default: 20 + description: 每页数量 + in: query + name: page_size + type: integer + produces: + - application/json + responses: + "200": + description: 获取可选产品列表成功 + schema: + $ref: '#/definitions/responses.ProductListResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 获取可选子产品列表 + tags: + - 产品管理 + /api/v1/admin/recharge-records: + get: + consumes: + - application/json + description: 管理员获取充值记录,支持筛选和分页 + parameters: + - default: 1 + description: 页码 + in: query + name: page + type: integer + - default: 10 + description: 每页数量 + in: query + name: page_size + type: integer + - description: 用户ID + in: query + name: user_id + type: string + - description: 充值类型 + enum: + - alipay + - transfer + - gift + in: query + name: recharge_type + type: string + - description: 状态 + enum: + - pending + - success + - failed + in: query + name: status + type: string + - description: 最小金额 + in: query + name: min_amount + type: string + - description: 最大金额 + in: query + name: max_amount + type: string + - description: 开始时间 + format: date-time + in: query + name: start_time + type: string + - description: 结束时间 + format: date-time + in: query + name: end_time + type: string + - description: 排序字段 + in: query + name: sort_by + type: string + - description: 排序方向 + enum: + - asc + - desc + in: query + name: sort_order + type: string + produces: + - application/json + responses: + "200": + description: 获取充值记录成功 + schema: + $ref: '#/definitions/responses.RechargeRecordListResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 获取管理端充值记录 + tags: + - 财务管理 + /api/v1/admin/subscriptions: + get: + consumes: + - application/json + description: 管理员获取订阅列表 + parameters: + - default: 1 + description: 页码 + in: query + name: page + type: integer + - default: 10 + description: 每页数量 + in: query + name: page_size + type: integer + - description: 搜索关键词 + in: query + name: keyword + type: string + - description: 企业名称 + in: query + name: company_name + type: string + - description: 产品名称 + in: query + name: product_name + type: string + - description: 订阅开始时间 + format: date-time + in: query + name: start_time + type: string + - description: 订阅结束时间 + format: date-time + in: query + name: end_time + type: string + - description: 排序字段 + in: query + name: sort_by + type: string + - description: 排序方向 + enum: + - asc + - desc + in: query + name: sort_order + type: string + produces: + - application/json + responses: + "200": + description: 获取订阅列表成功 + schema: + $ref: '#/definitions/responses.SubscriptionListResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 获取订阅列表 + tags: + - 订阅管理 + /api/v1/admin/subscriptions/{id}/price: + put: + consumes: + - application/json + description: 管理员修改用户订阅价格 + parameters: + - description: 订阅ID + in: path + name: id + required: true + type: string + - description: 更新订阅价格请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/commands.UpdateSubscriptionPriceCommand' + produces: + - application/json + responses: + "200": + description: 订阅价格更新成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 订阅不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 更新订阅价格 + tags: + - 订阅管理 + /api/v1/admin/subscriptions/batch-update-prices: + post: + consumes: + - application/json + description: 管理员一键调整用户所有订阅的价格 + parameters: + - description: 批量改价请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/commands.BatchUpdateSubscriptionPricesCommand' + produces: + - application/json + responses: + "200": + description: 一键改价成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 一键改价 + tags: + - 订阅管理 + /api/v1/admin/subscriptions/stats: + get: + consumes: + - application/json + description: 管理员获取订阅统计信息 + produces: + - application/json + responses: + "200": + description: 获取订阅统计成功 + schema: + $ref: '#/definitions/responses.SubscriptionStatsResponse' + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 获取订阅统计 + tags: + - 订阅管理 + /api/v1/admin/wallet-transactions: + get: + consumes: + - application/json + description: 管理员获取消费记录,支持筛选和分页 + parameters: + - default: 1 + description: 页码 + in: query + name: page + type: integer + - default: 10 + description: 每页数量 + in: query + name: page_size + type: integer + - description: 用户ID + in: query + name: user_id + type: string + - description: 交易ID + in: query + name: transaction_id + type: string + - description: 产品名称 + in: query + name: product_name + type: string + - description: 最小金额 + in: query + name: min_amount + type: string + - description: 最大金额 + in: query + name: max_amount + type: string + - description: 开始时间 + format: date-time + in: query + name: start_time + type: string + - description: 结束时间 + format: date-time + in: query + name: end_time + type: string + - description: 排序字段 + in: query + name: sort_by + type: string + - description: 排序方向 + enum: + - asc + - desc + in: query + name: sort_order + type: string + produces: + - application/json + responses: + "200": + description: 获取消费记录成功 + schema: + $ref: '#/definitions/responses.WalletTransactionListResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 获取管理端消费记录 + tags: + - 财务管理 + /api/v1/articles: + get: + consumes: + - application/json + description: 分页获取文章列表 + parameters: + - default: 1 + description: 页码 + in: query + name: page + type: integer + - default: 10 + description: 每页数量 + in: query + name: page_size + type: integer + - description: 文章状态 + in: query + name: status + type: string + - description: 分类ID + in: query + name: category_id + type: string + - description: 作者ID + in: query + name: author_id + type: string + - description: 是否推荐 + in: query + name: is_featured + type: boolean + - description: 排序字段 + in: query + name: order_by + type: string + - description: 排序方向 + in: query + name: order_dir + type: string + produces: + - application/json + responses: + "200": + description: 获取文章列表成功 + schema: + $ref: '#/definitions/responses.ArticleListResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 获取文章列表 + tags: + - 文章管理 + post: + consumes: + - application/json + description: 创建新的文章 + parameters: + - description: 创建文章请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/commands.CreateArticleCommand' + produces: + - application/json + responses: + "201": + description: 文章创建成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 创建文章 + tags: + - 文章管理 + /api/v1/articles/{id}: + delete: + consumes: + - application/json + description: 删除指定文章 + parameters: + - description: 文章ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 文章删除成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 文章不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 删除文章 + tags: + - 文章管理 + get: + consumes: + - application/json + description: 根据ID获取文章详情 + parameters: + - description: 文章ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 获取文章详情成功 + schema: + $ref: '#/definitions/responses.ArticleInfoResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 文章不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 获取文章详情 + tags: + - 文章管理 + put: + consumes: + - application/json + description: 更新文章信息 + parameters: + - description: 文章ID + in: path + name: id + required: true + type: string + - description: 更新文章请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/commands.UpdateArticleCommand' + produces: + - application/json + responses: + "200": + description: 文章更新成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 文章不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 更新文章 + tags: + - 文章管理 + /api/v1/articles/{id}/archive: + post: + consumes: + - application/json + description: 将已发布文章归档 + parameters: + - description: 文章ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 文章归档成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 文章不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 归档文章 + tags: + - 文章管理 + /api/v1/articles/{id}/featured: + put: + consumes: + - application/json + description: 设置文章的推荐状态 + parameters: + - description: 文章ID + in: path + name: id + required: true + type: string + - description: 设置推荐状态请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/commands.SetFeaturedCommand' + produces: + - application/json + responses: + "200": + description: 设置推荐状态成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 文章不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 设置推荐状态 + tags: + - 文章管理 + /api/v1/articles/{id}/publish: + post: + consumes: + - application/json + description: 将草稿文章发布 + parameters: + - description: 文章ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 文章发布成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 文章不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 发布文章 + tags: + - 文章管理 + /api/v1/articles/search: + get: + consumes: + - application/json + description: 根据关键词搜索文章 + parameters: + - default: 1 + description: 页码 + in: query + name: page + type: integer + - default: 10 + description: 每页数量 + in: query + name: page_size + type: integer + - description: 搜索关键词 + in: query + name: keyword + required: true + type: string + - description: 分类ID + in: query + name: category_id + type: string + - description: 作者ID + in: query + name: author_id + type: string + - description: 文章状态 + in: query + name: status + type: string + - description: 排序字段 + in: query + name: order_by + type: string + - description: 排序方向 + in: query + name: order_dir + type: string + produces: + - application/json + responses: + "200": + description: 搜索文章成功 + schema: + $ref: '#/definitions/responses.ArticleListResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 搜索文章 + tags: + - 文章管理 + /api/v1/articles/stats: + get: + consumes: + - application/json + description: 获取文章相关统计数据 + produces: + - application/json + responses: + "200": + description: 获取统计成功 + schema: + $ref: '#/definitions/responses.ArticleStatsResponse' + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 获取文章统计 + tags: + - 文章管理 + /api/v1/categories: + get: + consumes: + - application/json + description: 获取产品分类列表,支持筛选 + parameters: + - default: 1 + description: 页码 + in: query + name: page + type: integer + - default: 10 + description: 每页数量 + in: query + name: page_size + type: integer + - description: 是否启用 + in: query + name: is_enabled + type: boolean + - description: 是否可见 + in: query + name: is_visible + type: boolean + produces: + - application/json + responses: + "200": + description: 获取分类列表成功 + schema: + $ref: '#/definitions/responses.CategoryListResponse' + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + summary: 获取分类列表 + tags: + - 数据大厅 + /api/v1/categories/{id}: + get: + consumes: + - application/json + description: 根据分类ID获取分类详细信息 + parameters: + - description: 分类ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 获取分类详情成功 + schema: + $ref: '#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "404": + description: 分类不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + summary: 获取分类详情 + tags: + - 数据大厅 + /api/v1/certifications: + get: + consumes: + - application/json + description: 管理员获取认证申请列表 + parameters: + - default: 1 + description: 页码 + in: query + name: page + type: integer + - default: 10 + description: 每页数量 + in: query + name: page_size + type: integer + - description: 排序字段 + in: query + name: sort_by + type: string + - description: 排序方向 + enum: + - asc + - desc + in: query + name: sort_order + type: string + - description: 认证状态 + in: query + name: status + type: string + - description: 用户ID + in: query + name: user_id + type: string + - description: 公司名称 + in: query + name: company_name + type: string + - description: 法人姓名 + in: query + name: legal_person_name + type: string + - description: 搜索关键词 + in: query + name: search_keyword + type: string + produces: + - application/json + responses: + "200": + description: 获取认证列表成功 + schema: + $ref: '#/definitions/responses.CertificationListResponse' + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "403": + description: 权限不足 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 获取认证列表 + tags: + - 认证管理 + /api/v1/certifications/apply-contract: + post: + consumes: + - application/json + description: 申请企业认证合同签署 + parameters: + - description: 申请合同请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/commands.ApplyContractCommand' + produces: + - application/json + responses: + "200": + description: 合同申请成功 + schema: + $ref: '#/definitions/responses.ContractSignUrlResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 认证记录不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 申请合同签署 + tags: + - 认证管理 + /api/v1/certifications/confirm-auth: + post: + consumes: + - application/json + description: 前端轮询确认企业认证是否完成 + parameters: + - description: 确认状态请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/queries.ConfirmAuthCommand' + produces: + - application/json + responses: + "200": + description: 状态确认成功 + schema: + $ref: '#/definitions/responses.ConfirmAuthResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 认证记录不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 前端确认认证状态 + tags: + - 认证管理 + /api/v1/certifications/confirm-sign: + post: + consumes: + - application/json + description: 前端轮询确认合同签署是否完成 + parameters: + - description: 确认状态请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/queries.ConfirmSignCommand' + produces: + - application/json + responses: + "200": + description: 状态确认成功 + schema: + $ref: '#/definitions/responses.ConfirmSignResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 认证记录不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 前端确认签署状态 + tags: + - 认证管理 + /api/v1/certifications/details: + get: + consumes: + - application/json + description: 根据认证ID获取认证详情 + produces: + - application/json + responses: + "200": + description: 获取认证详情成功 + schema: + $ref: '#/definitions/responses.CertificationResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 认证记录不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 获取认证详情 + tags: + - 认证管理 + /api/v1/certifications/enterprise-info: + post: + consumes: + - application/json + description: 提交企业认证所需的企业信息 + parameters: + - description: 提交企业信息请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/commands.SubmitEnterpriseInfoCommand' + produces: + - application/json + responses: + "200": + description: 企业信息提交成功 + schema: + $ref: '#/definitions/responses.CertificationResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 认证记录不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 提交企业信息 + tags: + - 认证管理 + /api/v1/certifications/esign/callback: + post: + consumes: + - application/json + description: 处理e签宝的异步回调通知 + produces: + - text/plain + responses: + "200": + description: success + schema: + type: string + "400": + description: fail + schema: + type: string + summary: 处理e签宝回调 + tags: + - 认证管理 + /api/v1/debug/event-system: + post: + consumes: + - application/json + description: 调试事件系统,用于测试事件触发和处理 + produces: + - application/json + responses: + "200": + description: 调试成功 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 调试事件系统 + tags: + - 系统调试 + /api/v1/decrypt: + post: + consumes: + - application/json + description: 使用密钥解密加密的数据 + parameters: + - description: 解密请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/commands.DecryptCommand' + produces: + - application/json + responses: + "200": + description: 解密成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未授权 + schema: + additionalProperties: true + type: object + "500": + description: 解密失败 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 解密参数 + tags: + - API调试 + /api/v1/encrypt: + post: + consumes: + - application/json + description: 用于前端调试时加密API调用参数 + parameters: + - description: 加密请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/commands.EncryptCommand' + produces: + - application/json + responses: + "200": + description: 加密成功 + schema: + $ref: '#/definitions/dto.EncryptResponse' + "400": + description: 请求参数错误 + schema: + $ref: '#/definitions/dto.EncryptResponse' + "401": + description: 未授权 + schema: + $ref: '#/definitions/dto.EncryptResponse' + summary: 加密参数 + tags: + - API调试 + /api/v1/finance/alipay/callback: + post: + consumes: + - application/x-www-form-urlencoded + description: 处理支付宝异步支付通知 + produces: + - text/plain + responses: + "200": + description: success + schema: + type: string + "400": + description: fail + schema: + type: string + summary: 支付宝支付回调 + tags: + - 支付管理 + /api/v1/finance/alipay/return: + get: + consumes: + - application/x-www-form-urlencoded + description: 处理支付宝同步支付通知,跳转到前端成功页面 + produces: + - text/html + responses: + "200": + description: 支付成功页面 + schema: + type: string + "400": + description: 支付失败页面 + schema: + type: string + summary: 支付宝同步回调 + tags: + - 支付管理 + /api/v1/finance/wallet: + get: + consumes: + - application/json + description: 获取当前用户的钱包详细信息 + produces: + - application/json + responses: + "200": + description: 获取钱包信息成功 + schema: + $ref: '#/definitions/responses.WalletResponse' + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 钱包不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 获取钱包信息 + tags: + - 钱包管理 + /api/v1/finance/wallet/alipay-order-status: + get: + consumes: + - application/json + description: 获取支付宝订单的当前状态,用于轮询查询 + parameters: + - description: 商户订单号 + in: query + name: out_trade_no + required: true + type: string + produces: + - application/json + responses: + "200": + description: 获取订单状态成功 + schema: + $ref: '#/definitions/responses.AlipayOrderStatusResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 订单不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 获取支付宝订单状态 + tags: + - 钱包管理 + /api/v1/finance/wallet/alipay-recharge: + post: + consumes: + - application/json + description: 创建支付宝充值订单并返回支付链接 + parameters: + - description: 充值请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/commands.CreateAlipayRechargeCommand' + produces: + - application/json + responses: + "200": + description: 创建充值订单成功 + schema: + $ref: '#/definitions/responses.AlipayRechargeOrderResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 创建支付宝充值订单 + tags: + - 钱包管理 + /api/v1/finance/wallet/recharge-config: + get: + consumes: + - application/json + description: 获取当前环境的充值配置信息(最低充值金额、最高充值金额等) + produces: + - application/json + responses: + "200": + description: 获取充值配置成功 + schema: + $ref: '#/definitions/responses.RechargeConfigResponse' + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + summary: 获取充值配置 + tags: + - 钱包管理 + /api/v1/finance/wallet/transactions: + get: + consumes: + - application/json + description: 获取当前用户的钱包交易记录列表,支持分页和筛选 + parameters: + - default: 1 + description: 页码 + in: query + name: page + type: integer + - default: 10 + description: 每页数量 + in: query + name: page_size + type: integer + - description: '开始时间 (格式: 2006-01-02 15:04:05)' + in: query + name: start_time + type: string + - description: '结束时间 (格式: 2006-01-02 15:04:05)' + in: query + name: end_time + type: string + - description: 交易ID + in: query + name: transaction_id + type: string + - description: 产品名称 + in: query + name: product_name + type: string + - description: 最小金额 + in: query + name: min_amount + type: string + - description: 最大金额 + in: query + name: max_amount + type: string + produces: + - application/json + responses: + "200": + description: 获取成功 + schema: + $ref: '#/definitions/responses.WalletTransactionListResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 获取用户钱包交易记录 + tags: + - 钱包管理 + /api/v1/form-config/{api_code}: + get: + consumes: + - application/json + description: 获取指定API的表单配置,用于前端动态生成表单 + parameters: + - description: API代码 + in: path + name: api_code + required: true + type: string + produces: + - application/json + responses: + "200": + description: 获取成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未授权 + schema: + additionalProperties: true + type: object + "404": + description: API接口不存在 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 获取表单配置 + tags: + - API调试 + /api/v1/invoices/{application_id}/download: + get: + description: 下载指定发票的文件 + parameters: + - description: 申请ID + in: path + name: application_id + required: true + type: string + produces: + - application/octet-stream + responses: + "200": + description: OK + schema: + type: file + "400": + description: Bad Request + schema: + $ref: '#/definitions/interfaces.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/interfaces.APIResponse' + summary: 下载发票文件 + tags: + - 发票管理 + /api/v1/invoices/apply: + post: + consumes: + - application/json + description: 用户申请开票 + parameters: + - description: 申请开票请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/finance.ApplyInvoiceRequest' + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/interfaces.APIResponse' + - properties: + data: + $ref: '#/definitions/dto.InvoiceApplicationResponse' + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/interfaces.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/interfaces.APIResponse' + summary: 申请开票 + tags: + - 发票管理 + /api/v1/invoices/available-amount: + get: + description: 获取用户当前可开票的金额 + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/interfaces.APIResponse' + - properties: + data: + $ref: '#/definitions/dto.AvailableAmountResponse' + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/interfaces.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/interfaces.APIResponse' + summary: 获取可开票金额 + tags: + - 发票管理 + /api/v1/invoices/info: + get: + description: 获取用户的发票信息 + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/interfaces.APIResponse' + - properties: + data: + $ref: '#/definitions/dto.InvoiceInfoResponse' + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/interfaces.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/interfaces.APIResponse' + summary: 获取用户发票信息 + tags: + - 发票管理 + put: + consumes: + - application/json + description: 更新用户的发票信息 + parameters: + - description: 更新发票信息请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/finance.UpdateInvoiceInfoRequest' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/interfaces.APIResponse' + "400": + description: Bad Request + schema: + $ref: '#/definitions/interfaces.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/interfaces.APIResponse' + summary: 更新用户发票信息 + tags: + - 发票管理 + /api/v1/invoices/records: + get: + description: 获取用户的开票记录列表 + parameters: + - default: 1 + description: 页码 + in: query + name: page + type: integer + - default: 10 + description: 每页数量 + in: query + name: page_size + type: integer + - description: 状态筛选 + in: query + name: status + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/interfaces.APIResponse' + - properties: + data: + $ref: '#/definitions/dto.InvoiceRecordsResponse' + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/interfaces.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/interfaces.APIResponse' + summary: 获取用户开票记录 + tags: + - 发票管理 + /api/v1/my/api-calls: + get: + consumes: + - application/json + description: 获取当前用户的API调用记录列表,支持分页和筛选 + parameters: + - default: 1 + description: 页码 + in: query + name: page + type: integer + - default: 10 + description: 每页数量 + in: query + name: page_size + type: integer + - description: '开始时间 (格式: 2006-01-02 15:04:05)' + in: query + name: start_time + type: string + - description: '结束时间 (格式: 2006-01-02 15:04:05)' + in: query + name: end_time + type: string + - description: 交易ID + in: query + name: transaction_id + type: string + - description: 产品名称 + in: query + name: product_name + type: string + - description: 状态 (pending/success/failed) + in: query + name: status + type: string + produces: + - application/json + responses: + "200": + description: 获取成功 + schema: + $ref: '#/definitions/dto.ApiCallListResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 获取用户API调用记录 + tags: + - API管理 + /api/v1/my/subscriptions: + get: + consumes: + - application/json + description: 获取当前用户的订阅列表 + parameters: + - default: 1 + description: 页码 + in: query + name: page + type: integer + - default: 10 + description: 每页数量 + in: query + name: page_size + type: integer + - description: 搜索关键词 + in: query + name: keyword + type: string + - description: 产品名称 + in: query + name: product_name + type: string + - description: 订阅开始时间 + format: date-time + in: query + name: start_time + type: string + - description: 订阅结束时间 + format: date-time + in: query + name: end_time + type: string + - description: 排序字段 + in: query + name: sort_by + type: string + - description: 排序方向 + enum: + - asc + - desc + in: query + name: sort_order + type: string + produces: + - application/json + responses: + "200": + description: 获取订阅列表成功 + schema: + $ref: '#/definitions/responses.SubscriptionListResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 获取我的订阅列表 + tags: + - 我的订阅 + /api/v1/my/subscriptions/{id}: + get: + consumes: + - application/json + description: 获取指定订阅的详细信息 + parameters: + - description: 订阅ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 获取订阅详情成功 + schema: + $ref: '#/definitions/responses.SubscriptionInfoResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 订阅不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 获取我的订阅详情 + tags: + - 我的订阅 + /api/v1/my/subscriptions/{id}/usage: + get: + consumes: + - application/json + description: 获取指定订阅的使用情况统计 + parameters: + - description: 订阅ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 获取使用情况成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 订阅不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 获取我的订阅使用情况 + tags: + - 我的订阅 + /api/v1/my/subscriptions/stats: + get: + consumes: + - application/json + description: 获取当前用户的订阅统计信息 + produces: + - application/json + responses: + "200": + description: 获取订阅统计成功 + schema: + $ref: '#/definitions/responses.SubscriptionStatsResponse' + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 获取我的订阅统计 + tags: + - 我的订阅 + /api/v1/my/whitelist/{ip}: + delete: + consumes: + - application/json + description: 从当前用户的白名单中删除指定IP地址 + parameters: + - description: IP地址 + in: path + name: ip + required: true + type: string + produces: + - application/json + responses: + "200": + description: 删除白名单IP成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 删除白名单IP + tags: + - API管理 + /api/v1/products: + get: + consumes: + - application/json + description: 分页获取可用的产品列表,支持筛选,默认只返回可见的产品 + parameters: + - default: 1 + description: 页码 + in: query + name: page + type: integer + - default: 10 + description: 每页数量 + in: query + name: page_size + type: integer + - description: 搜索关键词 + in: query + name: keyword + type: string + - description: 分类ID + in: query + name: category_id + type: string + - description: 是否启用 + in: query + name: is_enabled + type: boolean + - description: 是否可见 + in: query + name: is_visible + type: boolean + - description: 是否组合包 + in: query + name: is_package + type: boolean + - description: 是否已订阅(需要认证) + in: query + name: is_subscribed + type: boolean + - description: 排序字段 + in: query + name: sort_by + type: string + - description: 排序方向 + enum: + - asc + - desc + in: query + name: sort_order + type: string + produces: + - application/json + responses: + "200": + description: 获取产品列表成功 + schema: + $ref: '#/definitions/responses.ProductListResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + summary: 获取产品列表 + tags: + - 数据大厅 + /api/v1/products/{id}: + get: + consumes: + - application/json + description: 获取产品详细信息,用户端只能查看可见的产品 + parameters: + - description: 产品ID + in: path + name: id + required: true + type: string + - description: 是否包含文档信息 + in: query + name: with_document + type: boolean + produces: + - application/json + responses: + "200": + description: 获取产品详情成功 + schema: + $ref: '#/definitions/responses.ProductInfoWithDocumentResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "404": + description: 产品不存在或不可见 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + summary: 获取产品详情 + tags: + - 数据大厅 + /api/v1/products/{id}/api-config: + get: + consumes: + - application/json + description: 根据产品ID获取API配置信息 + parameters: + - description: 产品ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 获取成功 + schema: + $ref: '#/definitions/responses.ProductApiConfigResponse' + "400": + description: 请求参数错误 + schema: + $ref: '#/definitions/interfaces.APIResponse' + "404": + description: 配置不存在 + schema: + $ref: '#/definitions/interfaces.APIResponse' + summary: 获取产品API配置 + tags: + - 产品API配置 + /api/v1/products/{id}/documentation: + get: + consumes: + - application/json + description: 获取指定产品的文档信息 + parameters: + - description: 产品ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 获取产品文档成功 + schema: + $ref: '#/definitions/responses.DocumentationResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "404": + description: 产品不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + summary: 获取产品文档 + tags: + - 数据大厅 + /api/v1/products/{id}/subscribe: + post: + consumes: + - application/json + description: 用户订阅指定产品 + parameters: + - description: 产品ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 订阅成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 产品不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 订阅产品 + tags: + - 数据大厅 + /api/v1/products/code/{product_code}/api-config: + get: + consumes: + - application/json + description: 根据产品代码获取API配置信息 + parameters: + - description: 产品代码 + in: path + name: product_code + required: true + type: string + produces: + - application/json + responses: + "200": + description: 获取成功 + schema: + $ref: '#/definitions/responses.ProductApiConfigResponse' + "400": + description: 请求参数错误 + schema: + $ref: '#/definitions/interfaces.APIResponse' + "404": + description: 配置不存在 + schema: + $ref: '#/definitions/interfaces.APIResponse' + summary: 根据产品代码获取API配置 + tags: + - 产品API配置 + /api/v1/products/stats: + get: + consumes: + - application/json + description: 获取产品相关的统计信息 + produces: + - application/json + responses: + "200": + description: 获取统计信息成功 + schema: + $ref: '#/definitions/responses.ProductStatsResponse' + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + summary: 获取产品统计 + tags: + - 数据大厅 + /api/v1/users/admin/{user_id}: + get: + consumes: + - application/json + description: 管理员获取指定用户的详细信息 + parameters: + - description: 用户ID + in: path + name: user_id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 用户详情 + schema: + $ref: '#/definitions/responses.UserDetailResponse' + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "403": + description: 权限不足 + schema: + additionalProperties: true + type: object + "404": + description: 用户不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 管理员获取用户详情 + tags: + - 用户管理 + /api/v1/users/admin/list: + get: + consumes: + - application/json + description: 管理员查看用户列表,支持分页和筛选 + parameters: + - default: 1 + description: 页码 + in: query + name: page + type: integer + - default: 10 + description: 每页数量 + in: query + name: page_size + type: integer + - description: 手机号筛选 + in: query + name: phone + type: string + - description: 用户类型筛选 + enum: + - user + - admin + in: query + name: user_type + type: string + - description: 是否激活筛选 + in: query + name: is_active + type: boolean + - description: 是否已认证筛选 + in: query + name: is_certified + type: boolean + - description: 企业名称筛选 + in: query + name: company_name + type: string + - description: 开始日期 + format: date + in: query + name: start_date + type: string + - description: 结束日期 + format: date + in: query + name: end_date + type: string + produces: + - application/json + responses: + "200": + description: 用户列表 + schema: + $ref: '#/definitions/responses.UserListResponse' + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "403": + description: 权限不足 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 管理员查看用户列表 + tags: + - 用户管理 + /api/v1/users/admin/stats: + get: + consumes: + - application/json + description: 管理员获取用户相关的统计信息 + produces: + - application/json + responses: + "200": + description: 用户统计信息 + schema: + $ref: '#/definitions/responses.UserStatsResponse' + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "403": + description: 权限不足 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 获取用户统计信息 + tags: + - 用户管理 + /api/v1/users/login-password: + post: + consumes: + - application/json + description: 使用手机号和密码进行用户登录,返回JWT令牌 + parameters: + - description: 密码登录请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/commands.LoginWithPasswordCommand' + produces: + - application/json + responses: + "200": + description: 登录成功 + schema: + $ref: '#/definitions/responses.LoginUserResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 用户名或密码错误 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + summary: 用户密码登录 + tags: + - 用户认证 + /api/v1/users/login-sms: + post: + consumes: + - application/json + description: 使用手机号和短信验证码进行用户登录,返回JWT令牌 + parameters: + - description: 短信登录请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/commands.LoginWithSMSCommand' + produces: + - application/json + responses: + "200": + description: 登录成功 + schema: + $ref: '#/definitions/responses.LoginUserResponse' + "400": + description: 请求参数错误或验证码无效 + schema: + additionalProperties: true + type: object + "401": + description: 认证失败 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + summary: 用户短信验证码登录 + tags: + - 用户认证 + /api/v1/users/me: + get: + consumes: + - application/json + description: 根据JWT令牌获取当前登录用户的详细信息 + produces: + - application/json + responses: + "200": + description: 用户信息 + schema: + $ref: '#/definitions/responses.UserProfileResponse' + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 用户不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 获取当前用户信息 + tags: + - 用户管理 + /api/v1/users/me/password: + put: + consumes: + - application/json + description: 使用旧密码、新密码确认和验证码修改当前用户的密码 + parameters: + - description: 修改密码请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/commands.ChangePasswordCommand' + produces: + - application/json + responses: + "200": + description: 密码修改成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误或验证码无效 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 修改密码 + tags: + - 用户管理 + /api/v1/users/register: + post: + consumes: + - application/json + description: 使用手机号、密码和验证码进行用户注册,需要确认密码 + parameters: + - description: 用户注册请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/commands.RegisterUserCommand' + produces: + - application/json + responses: + "201": + description: 注册成功 + schema: + $ref: '#/definitions/responses.RegisterUserResponse' + "400": + description: 请求参数错误或验证码无效 + schema: + additionalProperties: true + type: object + "409": + description: 手机号已存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + summary: 用户注册 + tags: + - 用户认证 + /api/v1/users/reset-password: + post: + consumes: + - application/json + description: 使用手机号、验证码和新密码重置用户密码(忘记密码时使用) + parameters: + - description: 重置密码请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/commands.ResetPasswordCommand' + produces: + - application/json + responses: + "200": + description: 密码重置成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误或验证码无效 + schema: + additionalProperties: true + type: object + "404": + description: 用户不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + summary: 重置密码 + tags: + - 用户认证 + /api/v1/users/send-code: + post: + consumes: + - application/json + description: 向指定手机号发送验证码,支持注册、登录、修改密码等场景 + parameters: + - description: 发送验证码请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/commands.SendCodeCommand' + produces: + - application/json + responses: + "200": + description: 验证码发送成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "429": + description: 请求频率限制 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + summary: 发送短信验证码 + tags: + - 用户认证 +securityDefinitions: + Bearer: + description: Type "Bearer" followed by a space and JWT token. + in: header + name: Authorization + type: apiKey +swagger: "2.0" diff --git a/docs/swagger/docs.go b/docs/swagger/docs.go index e57b59f..562b7be 100644 --- a/docs/swagger/docs.go +++ b/docs/swagger/docs.go @@ -23,6 +23,929 @@ const docTemplate = `{ "host": "{{.Host}}", "basePath": "{{.BasePath}}", "paths": { + "/api/v1/:api_name": { + "post": { + "description": "统一API调用入口,参数加密传输", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "API调用" + ], + "summary": "API调用", + "parameters": [ + { + "description": "API调用请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.ApiCallCommand" + } + } + ], + "responses": { + "200": { + "description": "调用成功", + "schema": { + "$ref": "#/definitions/dto.ApiCallResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "$ref": "#/definitions/dto.ApiCallResponse" + } + }, + "401": { + "description": "未授权", + "schema": { + "$ref": "#/definitions/dto.ApiCallResponse" + } + }, + "429": { + "description": "请求过于频繁", + "schema": { + "$ref": "#/definitions/dto.ApiCallResponse" + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "$ref": "#/definitions/dto.ApiCallResponse" + } + } + } + } + }, + "/api/v1/admin/api-calls": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取API调用记录,支持筛选和分页", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "API管理" + ], + "summary": "获取管理端API调用记录", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "用户ID", + "name": "user_id", + "in": "query" + }, + { + "type": "string", + "description": "交易ID", + "name": "transaction_id", + "in": "query" + }, + { + "type": "string", + "description": "产品名称", + "name": "product_name", + "in": "query" + }, + { + "type": "string", + "description": "状态", + "name": "status", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "开始时间", + "name": "start_time", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "结束时间", + "name": "end_time", + "in": "query" + }, + { + "type": "string", + "description": "排序字段", + "name": "sort_by", + "in": "query" + }, + { + "enum": [ + "asc", + "desc" + ], + "type": "string", + "description": "排序方向", + "name": "sort_order", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取API调用记录成功", + "schema": { + "$ref": "#/definitions/dto.ApiCallListResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/article-categories": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "创建新的文章分类", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章分类管理" + ], + "summary": "创建分类", + "parameters": [ + { + "description": "创建分类请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/tyapi-server_internal_application_article_dto_commands.CreateCategoryCommand" + } + } + ], + "responses": { + "201": { + "description": "分类创建成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/article-categories/{id}": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "更新分类信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章分类管理" + ], + "summary": "更新分类", + "parameters": [ + { + "type": "string", + "description": "分类ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "更新分类请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/tyapi-server_internal_application_article_dto_commands.UpdateCategoryCommand" + } + } + ], + "responses": { + "200": { + "description": "分类更新成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "分类不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "delete": { + "security": [ + { + "Bearer": [] + } + ], + "description": "删除指定分类", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章分类管理" + ], + "summary": "删除分类", + "parameters": [ + { + "type": "string", + "description": "分类ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "分类删除成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "分类不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/article-tags": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "创建新的文章标签", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章标签管理" + ], + "summary": "创建标签", + "parameters": [ + { + "description": "创建标签请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.CreateTagCommand" + } + } + ], + "responses": { + "201": { + "description": "标签创建成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/article-tags/{id}": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "更新标签信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章标签管理" + ], + "summary": "更新标签", + "parameters": [ + { + "type": "string", + "description": "标签ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "更新标签请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.UpdateTagCommand" + } + } + ], + "responses": { + "200": { + "description": "标签更新成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "标签不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "delete": { + "security": [ + { + "Bearer": [] + } + ], + "description": "删除指定标签", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章标签管理" + ], + "summary": "删除标签", + "parameters": [ + { + "type": "string", + "description": "标签ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "标签删除成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "标签不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/articles/stats": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取文章相关统计数据", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章管理" + ], + "summary": "获取文章统计", + "responses": { + "200": { + "description": "获取统计成功", + "schema": { + "$ref": "#/definitions/responses.ArticleStatsResponse" + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/articles/{id}/schedule-publish": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "设置文章的定时发布时间", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章管理" + ], + "summary": "定时发布文章", + "parameters": [ + { + "type": "string", + "description": "文章ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "定时发布请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.SchedulePublishCommand" + } + } + ], + "responses": { + "200": { + "description": "定时发布设置成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "文章不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/invoices/pending": { + "get": { + "description": "管理员获取发票申请列表,支持状态和时间范围筛选", + "produces": [ + "application/json" + ], + "tags": [ + "管理员-发票管理" + ], + "summary": "获取发票申请列表", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "状态筛选:pending/completed/rejected", + "name": "status", + "in": "query" + }, + { + "type": "string", + "description": "开始时间 (格式: 2006-01-02 15:04:05)", + "name": "start_time", + "in": "query" + }, + { + "type": "string", + "description": "结束时间 (格式: 2006-01-02 15:04:05)", + "name": "end_time", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/interfaces.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.PendingApplicationsResponse" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, + "/api/v1/admin/invoices/{application_id}/approve": { + "post": { + "description": "管理员通过发票申请并上传发票文件", + "consumes": [ + "multipart/form-data" + ], + "produces": [ + "application/json" + ], + "tags": [ + "管理员-发票管理" + ], + "summary": "通过发票申请", + "parameters": [ + { + "type": "string", + "description": "申请ID", + "name": "application_id", + "in": "path", + "required": true + }, + { + "type": "file", + "description": "发票文件", + "name": "file", + "in": "formData", + "required": true + }, + { + "type": "string", + "description": "管理员备注", + "name": "admin_notes", + "in": "formData" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, + "/api/v1/admin/invoices/{application_id}/download": { + "get": { + "description": "管理员下载指定发票的文件", + "produces": [ + "application/octet-stream" + ], + "tags": [ + "管理员-发票管理" + ], + "summary": "管理员下载发票文件", + "parameters": [ + { + "type": "string", + "description": "申请ID", + "name": "application_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "file" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, + "/api/v1/admin/invoices/{application_id}/reject": { + "post": { + "description": "管理员拒绝发票申请", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "管理员-发票管理" + ], + "summary": "拒绝发票申请", + "parameters": [ + { + "type": "string", + "description": "申请ID", + "name": "application_id", + "in": "path", + "required": true + }, + { + "description": "拒绝申请请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/finance.RejectInvoiceRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, "/api/v1/admin/product-categories": { "get": { "security": [ @@ -61,7 +984,7 @@ const docTemplate = `{ "200": { "description": "获取分类列表成功", "schema": { - "$ref": "#/definitions/responses.CategoryListResponse" + "$ref": "#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryListResponse" } }, "400": { @@ -111,7 +1034,7 @@ const docTemplate = `{ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/commands.CreateCategoryCommand" + "$ref": "#/definitions/tyapi-server_internal_application_product_dto_commands.CreateCategoryCommand" } } ], @@ -178,7 +1101,7 @@ const docTemplate = `{ "200": { "description": "获取分类详情成功", "schema": { - "$ref": "#/definitions/responses.CategoryInfoResponse" + "$ref": "#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse" } }, "400": { @@ -242,7 +1165,7 @@ const docTemplate = `{ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/commands.UpdateCategoryCommand" + "$ref": "#/definitions/tyapi-server_internal_application_product_dto_commands.UpdateCategoryCommand" } } ], @@ -356,7 +1279,7 @@ const docTemplate = `{ "Bearer": [] } ], - "description": "管理员获取产品列表,支持筛选", + "description": "管理员获取产品列表,支持筛选和分页,包含所有产品(包括隐藏的)", "consumes": [ "application/json" ], @@ -394,10 +1317,38 @@ const docTemplate = `{ "name": "category_id", "in": "query" }, + { + "type": "boolean", + "description": "是否启用", + "name": "is_enabled", + "in": "query" + }, + { + "type": "boolean", + "description": "是否可见", + "name": "is_visible", + "in": "query" + }, + { + "type": "boolean", + "description": "是否组合包", + "name": "is_package", + "in": "query" + }, { "type": "string", - "description": "产品状态", - "name": "status", + "description": "排序字段", + "name": "sort_by", + "in": "query" + }, + { + "enum": [ + "asc", + "desc" + ], + "type": "string", + "description": "排序方向", + "name": "sort_order", "in": "query" } ], @@ -405,7 +1356,7 @@ const docTemplate = `{ "200": { "description": "获取产品列表成功", "schema": { - "$ref": "#/definitions/responses.ProductListResponse" + "$ref": "#/definitions/responses.ProductAdminListResponse" } }, "400": { @@ -491,6 +1442,89 @@ const docTemplate = `{ } } }, + "/api/v1/admin/products/available": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取可选作组合包子产品的产品列表", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "获取可选子产品列表", + "parameters": [ + { + "type": "string", + "description": "排除的组合包ID", + "name": "exclude_package_id", + "in": "query" + }, + { + "type": "string", + "description": "搜索关键词", + "name": "keyword", + "in": "query" + }, + { + "type": "string", + "description": "分类ID", + "name": "category_id", + "in": "query" + }, + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 20, + "description": "每页数量", + "name": "page_size", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取可选产品列表成功", + "schema": { + "$ref": "#/definitions/responses.ProductListResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, "/api/v1/admin/products/{id}": { "get": { "security": [ @@ -516,13 +1550,19 @@ const docTemplate = `{ "name": "id", "in": "path", "required": true + }, + { + "type": "boolean", + "description": "是否包含文档信息", + "name": "with_document", + "in": "query" } ], "responses": { "200": { "description": "获取产品详情成功", "schema": { - "$ref": "#/definitions/responses.ProductInfoResponse" + "$ref": "#/definitions/responses.ProductAdminInfoResponse" } }, "400": { @@ -693,6 +1733,995 @@ const docTemplate = `{ } } }, + "/api/v1/admin/products/{id}/api-config": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取产品的API配置信息,如果不存在则返回空配置", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "获取产品API配置", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "获取API配置成功", + "schema": { + "$ref": "#/definitions/responses.ProductApiConfigResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员更新产品的API配置", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "更新产品API配置", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "API配置信息", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/responses.ProductApiConfigResponse" + } + } + ], + "responses": { + "200": { + "description": "API配置更新成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品或配置不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员为产品创建API配置", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "创建产品API配置", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "API配置信息", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/responses.ProductApiConfigResponse" + } + } + ], + "responses": { + "201": { + "description": "API配置创建成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "409": { + "description": "API配置已存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "delete": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员删除产品的API配置", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "删除产品API配置", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "API配置删除成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品或API配置不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/products/{id}/documentation": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取产品的文档信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "获取产品文档", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "获取文档成功", + "schema": { + "$ref": "#/definitions/responses.DocumentationResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品或文档不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员创建或更新产品的文档信息,如果文档不存在则创建,存在则更新", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "创建或更新产品文档", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "文档信息", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.CreateDocumentationCommand" + } + } + ], + "responses": { + "200": { + "description": "文档操作成功", + "schema": { + "$ref": "#/definitions/responses.DocumentationResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "delete": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员删除产品的文档", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "删除产品文档", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "文档删除成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品或文档不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/products/{id}/package-items": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员向组合包添加子产品", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "添加组合包子产品", + "parameters": [ + { + "type": "string", + "description": "组合包ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "添加子产品命令", + "name": "command", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.AddPackageItemCommand" + } + } + ], + "responses": { + "200": { + "description": "添加成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/products/{id}/package-items/batch": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员批量更新组合包子产品配置", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "批量更新组合包子产品", + "parameters": [ + { + "type": "string", + "description": "组合包ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "批量更新命令", + "name": "command", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.UpdatePackageItemsCommand" + } + } + ], + "responses": { + "200": { + "description": "更新成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/products/{id}/package-items/reorder": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员重新排序组合包子产品", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "重新排序组合包子产品", + "parameters": [ + { + "type": "string", + "description": "组合包ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "重新排序命令", + "name": "command", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.ReorderPackageItemsCommand" + } + } + ], + "responses": { + "200": { + "description": "排序成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/products/{id}/package-items/{item_id}": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员更新组合包子产品信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "更新组合包子产品", + "parameters": [ + { + "type": "string", + "description": "组合包ID", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "子产品项目ID", + "name": "item_id", + "in": "path", + "required": true + }, + { + "description": "更新子产品命令", + "name": "command", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.UpdatePackageItemCommand" + } + } + ], + "responses": { + "200": { + "description": "更新成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "delete": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员从组合包移除子产品", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "移除组合包子产品", + "parameters": [ + { + "type": "string", + "description": "组合包ID", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "子产品项目ID", + "name": "item_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "移除成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/recharge-records": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取充值记录,支持筛选和分页", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "财务管理" + ], + "summary": "获取管理端充值记录", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "用户ID", + "name": "user_id", + "in": "query" + }, + { + "enum": [ + "alipay", + "transfer", + "gift" + ], + "type": "string", + "description": "充值类型", + "name": "recharge_type", + "in": "query" + }, + { + "enum": [ + "pending", + "success", + "failed" + ], + "type": "string", + "description": "状态", + "name": "status", + "in": "query" + }, + { + "type": "string", + "description": "最小金额", + "name": "min_amount", + "in": "query" + }, + { + "type": "string", + "description": "最大金额", + "name": "max_amount", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "开始时间", + "name": "start_time", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "结束时间", + "name": "end_time", + "in": "query" + }, + { + "type": "string", + "description": "排序字段", + "name": "sort_by", + "in": "query" + }, + { + "enum": [ + "asc", + "desc" + ], + "type": "string", + "description": "排序方向", + "name": "sort_order", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取充值记录成功", + "schema": { + "$ref": "#/definitions/responses.RechargeRecordListResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, "/api/v1/admin/subscriptions": { "get": { "security": [ @@ -728,8 +2757,50 @@ const docTemplate = `{ }, { "type": "string", - "description": "订阅状态", - "name": "status", + "description": "搜索关键词", + "name": "keyword", + "in": "query" + }, + { + "type": "string", + "description": "企业名称", + "name": "company_name", + "in": "query" + }, + { + "type": "string", + "description": "产品名称", + "name": "product_name", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "订阅开始时间", + "name": "start_time", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "订阅结束时间", + "name": "end_time", + "in": "query" + }, + { + "type": "string", + "description": "排序字段", + "name": "sort_by", + "in": "query" + }, + { + "enum": [ + "asc", + "desc" + ], + "type": "string", + "description": "排序方向", + "name": "sort_order", "in": "query" } ], @@ -764,6 +2835,67 @@ const docTemplate = `{ } } }, + "/api/v1/admin/subscriptions/batch-update-prices": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员一键调整用户所有订阅的价格", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "订阅管理" + ], + "summary": "一键改价", + "parameters": [ + { + "description": "批量改价请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.BatchUpdateSubscriptionPricesCommand" + } + } + ], + "responses": { + "200": { + "description": "一键改价成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, "/api/v1/admin/subscriptions/stats": { "get": { "security": [ @@ -881,6 +3013,866 @@ const docTemplate = `{ } } }, + "/api/v1/admin/wallet-transactions": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取消费记录,支持筛选和分页", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "财务管理" + ], + "summary": "获取管理端消费记录", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "用户ID", + "name": "user_id", + "in": "query" + }, + { + "type": "string", + "description": "交易ID", + "name": "transaction_id", + "in": "query" + }, + { + "type": "string", + "description": "产品名称", + "name": "product_name", + "in": "query" + }, + { + "type": "string", + "description": "最小金额", + "name": "min_amount", + "in": "query" + }, + { + "type": "string", + "description": "最大金额", + "name": "max_amount", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "开始时间", + "name": "start_time", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "结束时间", + "name": "end_time", + "in": "query" + }, + { + "type": "string", + "description": "排序字段", + "name": "sort_by", + "in": "query" + }, + { + "enum": [ + "asc", + "desc" + ], + "type": "string", + "description": "排序方向", + "name": "sort_order", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取消费记录成功", + "schema": { + "$ref": "#/definitions/responses.WalletTransactionListResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/article-categories": { + "get": { + "description": "获取所有文章分类", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章分类" + ], + "summary": "获取分类列表", + "responses": { + "200": { + "description": "获取分类列表成功", + "schema": { + "$ref": "#/definitions/tyapi-server_internal_application_article_dto_responses.CategoryListResponse" + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/article-categories/{id}": { + "get": { + "description": "根据ID获取分类详情", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章分类" + ], + "summary": "获取分类详情", + "parameters": [ + { + "type": "string", + "description": "分类ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "获取分类详情成功", + "schema": { + "$ref": "#/definitions/tyapi-server_internal_application_article_dto_responses.CategoryInfoResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "分类不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/article-tags": { + "get": { + "description": "获取所有文章标签", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章标签" + ], + "summary": "获取标签列表", + "responses": { + "200": { + "description": "获取标签列表成功", + "schema": { + "$ref": "#/definitions/responses.TagListResponse" + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/article-tags/{id}": { + "get": { + "description": "根据ID获取标签详情", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章标签" + ], + "summary": "获取标签详情", + "parameters": [ + { + "type": "string", + "description": "标签ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "获取标签详情成功", + "schema": { + "$ref": "#/definitions/responses.TagInfoResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "标签不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/articles": { + "get": { + "description": "分页获取文章列表,支持多种筛选条件", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章管理" + ], + "summary": "获取文章列表", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "文章状态", + "name": "status", + "in": "query" + }, + { + "type": "string", + "description": "分类ID", + "name": "category_id", + "in": "query" + }, + { + "type": "string", + "description": "标签ID", + "name": "tag_id", + "in": "query" + }, + { + "type": "string", + "description": "标题关键词", + "name": "title", + "in": "query" + }, + { + "type": "string", + "description": "摘要关键词", + "name": "summary", + "in": "query" + }, + { + "type": "boolean", + "description": "是否推荐", + "name": "is_featured", + "in": "query" + }, + { + "type": "string", + "description": "排序字段", + "name": "order_by", + "in": "query" + }, + { + "type": "string", + "description": "排序方向", + "name": "order_dir", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取文章列表成功", + "schema": { + "$ref": "#/definitions/responses.ArticleListResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "创建新的文章", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章管理" + ], + "summary": "创建文章", + "parameters": [ + { + "description": "创建文章请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.CreateArticleCommand" + } + } + ], + "responses": { + "201": { + "description": "文章创建成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/articles/{id}": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "根据ID获取文章详情", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章管理" + ], + "summary": "获取文章详情", + "parameters": [ + { + "type": "string", + "description": "文章ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "获取文章详情成功", + "schema": { + "$ref": "#/definitions/responses.ArticleInfoResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "文章不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "更新文章信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章管理" + ], + "summary": "更新文章", + "parameters": [ + { + "type": "string", + "description": "文章ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "更新文章请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.UpdateArticleCommand" + } + } + ], + "responses": { + "200": { + "description": "文章更新成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "文章不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "delete": { + "security": [ + { + "Bearer": [] + } + ], + "description": "删除指定文章", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章管理" + ], + "summary": "删除文章", + "parameters": [ + { + "type": "string", + "description": "文章ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "文章删除成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "文章不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/articles/{id}/archive": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "将已发布文章归档", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章管理" + ], + "summary": "归档文章", + "parameters": [ + { + "type": "string", + "description": "文章ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "文章归档成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "文章不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/articles/{id}/featured": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "设置文章的推荐状态", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章管理" + ], + "summary": "设置推荐状态", + "parameters": [ + { + "type": "string", + "description": "文章ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "设置推荐状态请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.SetFeaturedCommand" + } + } + ], + "responses": { + "200": { + "description": "设置推荐状态成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "文章不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/articles/{id}/publish": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "将草稿文章发布", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章管理" + ], + "summary": "发布文章", + "parameters": [ + { + "type": "string", + "description": "文章ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "文章发布成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "文章不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, "/api/v1/categories": { "get": { "description": "获取产品分类列表,支持筛选", @@ -926,7 +3918,7 @@ const docTemplate = `{ "200": { "description": "获取分类列表成功", "schema": { - "$ref": "#/definitions/responses.CategoryListResponse" + "$ref": "#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryListResponse" } }, "500": { @@ -965,7 +3957,7 @@ const docTemplate = `{ "200": { "description": "获取分类详情成功", "schema": { - "$ref": "#/definitions/responses.CategoryInfoResponse" + "$ref": "#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse" } }, "400": { @@ -1170,9 +4162,14 @@ const docTemplate = `{ } } }, - "/api/v1/certifications/callbacks": { + "/api/v1/certifications/confirm-auth": { "post": { - "description": "处理e签宝的企业认证和合同签署回调", + "security": [ + { + "Bearer": [] + } + ], + "description": "前端轮询确认企业认证是否完成", "consumes": [ "application/json" ], @@ -1182,23 +4179,23 @@ const docTemplate = `{ "tags": [ "认证管理" ], - "summary": "处理e签宝回调", + "summary": "前端确认认证状态", "parameters": [ { - "description": "e签宝回调数据", + "description": "确认状态请求", "name": "request", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/commands.EsignCallbackCommand" + "$ref": "#/definitions/queries.ConfirmAuthCommand" } } ], "responses": { "200": { - "description": "回调处理成功", + "description": "状态确认成功", "schema": { - "$ref": "#/definitions/responses.CallbackResponse" + "$ref": "#/definitions/responses.ConfirmAuthResponse" } }, "400": { @@ -1208,6 +4205,87 @@ const docTemplate = `{ "additionalProperties": true } }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "认证记录不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/certifications/confirm-sign": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "前端轮询确认合同签署是否完成", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "认证管理" + ], + "summary": "前端确认签署状态", + "parameters": [ + { + "description": "确认状态请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/queries.ConfirmSignCommand" + } + } + ], + "responses": { + "200": { + "description": "状态确认成功", + "schema": { + "$ref": "#/definitions/responses.ConfirmSignResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "认证记录不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, "500": { "description": "服务器内部错误", "schema": { @@ -1341,14 +4419,43 @@ const docTemplate = `{ } } }, - "/api/v1/finance/secrets": { - "get": { + "/api/v1/certifications/esign/callback": { + "post": { + "description": "处理e签宝的异步回调通知", + "consumes": [ + "application/json" + ], + "produces": [ + "text/plain" + ], + "tags": [ + "认证管理" + ], + "summary": "处理e签宝回调", + "responses": { + "200": { + "description": "success", + "schema": { + "type": "string" + } + }, + "400": { + "description": "fail", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/debug/event-system": { + "post": { "security": [ { "Bearer": [] } ], - "description": "获取当前用户的API访问密钥信息", + "description": "调试事件系统,用于测试事件触发和处理", "consumes": [ "application/json" ], @@ -1356,25 +4463,12 @@ const docTemplate = `{ "application/json" ], "tags": [ - "用户密钥管理" + "系统调试" ], - "summary": "获取用户密钥", + "summary": "调试事件系统", "responses": { "200": { - "description": "获取用户密钥成功", - "schema": { - "$ref": "#/definitions/responses.UserSecretsResponse" - } - }, - "401": { - "description": "未认证", - "schema": { - "type": "object", - "additionalProperties": true - } - }, - "404": { - "description": "密钥不存在", + "description": "调试成功", "schema": { "type": "object", "additionalProperties": true @@ -1388,14 +4482,16 @@ const docTemplate = `{ } } } - }, + } + }, + "/api/v1/decrypt": { "post": { "security": [ { "Bearer": [] } ], - "description": "为用户创建API访问密钥", + "description": "使用密钥解密加密的数据", "consumes": [ "application/json" ], @@ -1403,25 +4499,26 @@ const docTemplate = `{ "application/json" ], "tags": [ - "用户密钥管理" + "API调试" ], - "summary": "创建用户密钥", + "summary": "解密参数", "parameters": [ { - "description": "创建密钥请求", + "description": "解密请求", "name": "request", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/commands.CreateUserSecretsCommand" + "$ref": "#/definitions/commands.DecryptCommand" } } ], "responses": { - "201": { - "description": "用户密钥创建成功", + "200": { + "description": "解密成功", "schema": { - "$ref": "#/definitions/responses.UserSecretsResponse" + "type": "object", + "additionalProperties": true } }, "400": { @@ -1432,21 +4529,14 @@ const docTemplate = `{ } }, "401": { - "description": "未认证", - "schema": { - "type": "object", - "additionalProperties": true - } - }, - "409": { - "description": "密钥已存在", + "description": "未授权", "schema": { "type": "object", "additionalProperties": true } }, "500": { - "description": "服务器内部错误", + "description": "解密失败", "schema": { "type": "object", "additionalProperties": true @@ -1455,14 +4545,9 @@ const docTemplate = `{ } } }, - "/api/v1/finance/secrets/deactivate": { + "/api/v1/encrypt": { "post": { - "security": [ - { - "Bearer": [] - } - ], - "description": "停用用户的API访问密钥", + "description": "用于前端调试时加密API调用参数", "consumes": [ "application/json" ], @@ -1470,85 +4555,95 @@ const docTemplate = `{ "application/json" ], "tags": [ - "用户密钥管理" + "API调试" + ], + "summary": "加密参数", + "parameters": [ + { + "description": "加密请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.EncryptCommand" + } + } ], - "summary": "停用用户密钥", "responses": { "200": { - "description": "用户密钥停用成功", + "description": "加密成功", "schema": { - "type": "object", - "additionalProperties": true + "$ref": "#/definitions/dto.EncryptResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "$ref": "#/definitions/dto.EncryptResponse" } }, "401": { - "description": "未认证", + "description": "未授权", "schema": { - "type": "object", - "additionalProperties": true - } - }, - "404": { - "description": "密钥不存在", - "schema": { - "type": "object", - "additionalProperties": true - } - }, - "500": { - "description": "服务器内部错误", - "schema": { - "type": "object", - "additionalProperties": true + "$ref": "#/definitions/dto.EncryptResponse" } } } } }, - "/api/v1/finance/secrets/regenerate": { + "/api/v1/finance/alipay/callback": { "post": { - "security": [ - { - "Bearer": [] - } - ], - "description": "重新生成用户的API访问密钥", + "description": "处理支付宝异步支付通知", "consumes": [ - "application/json" + "application/x-www-form-urlencoded" ], "produces": [ - "application/json" + "text/plain" ], "tags": [ - "用户密钥管理" + "支付管理" ], - "summary": "重新生成访问密钥", + "summary": "支付宝支付回调", "responses": { "200": { - "description": "访问密钥重新生成成功", + "description": "success", "schema": { - "$ref": "#/definitions/responses.UserSecretsResponse" + "type": "string" } }, - "401": { - "description": "未认证", + "400": { + "description": "fail", "schema": { - "type": "object", - "additionalProperties": true + "type": "string" + } + } + } + } + }, + "/api/v1/finance/alipay/return": { + "get": { + "description": "处理支付宝同步支付通知,跳转到前端成功页面", + "consumes": [ + "application/x-www-form-urlencoded" + ], + "produces": [ + "text/html" + ], + "tags": [ + "支付管理" + ], + "summary": "支付宝同步回调", + "responses": { + "200": { + "description": "支付成功页面", + "schema": { + "type": "string" } }, - "404": { - "description": "密钥不存在", + "400": { + "description": "支付失败页面", "schema": { - "type": "object", - "additionalProperties": true - } - }, - "500": { - "description": "服务器内部错误", - "schema": { - "type": "object", - "additionalProperties": true + "type": "string" } } } @@ -1601,14 +4696,16 @@ const docTemplate = `{ } } } - }, - "put": { + } + }, + "/api/v1/finance/wallet/alipay-order-status": { + "get": { "security": [ { "Bearer": [] } ], - "description": "更新当前用户的钱包基本信息", + "description": "获取支付宝订单的当前状态,用于轮询查询", "consumes": [ "application/json" ], @@ -1618,24 +4715,21 @@ const docTemplate = `{ "tags": [ "钱包管理" ], - "summary": "更新钱包信息", + "summary": "获取支付宝订单状态", "parameters": [ { - "description": "更新钱包请求", - "name": "request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/commands.UpdateWalletCommand" - } + "type": "string", + "description": "商户订单号", + "name": "out_trade_no", + "in": "query", + "required": true } ], "responses": { "200": { - "description": "钱包更新成功", + "description": "获取订单状态成功", "schema": { - "type": "object", - "additionalProperties": true + "$ref": "#/definitions/responses.AlipayOrderStatusResponse" } }, "400": { @@ -1652,54 +4746,8 @@ const docTemplate = `{ "additionalProperties": true } }, - "500": { - "description": "服务器内部错误", - "schema": { - "type": "object", - "additionalProperties": true - } - } - } - }, - "post": { - "description": "为用户创建新的钱包账户", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "钱包管理" - ], - "summary": "创建钱包", - "parameters": [ - { - "description": "创建钱包请求", - "name": "request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/commands.CreateWalletCommand" - } - } - ], - "responses": { - "201": { - "description": "钱包创建成功", - "schema": { - "$ref": "#/definitions/responses.WalletResponse" - } - }, - "400": { - "description": "请求参数错误", - "schema": { - "type": "object", - "additionalProperties": true - } - }, - "409": { - "description": "钱包已存在", + "404": { + "description": "订单不存在", "schema": { "type": "object", "additionalProperties": true @@ -1715,14 +4763,14 @@ const docTemplate = `{ } } }, - "/api/v1/finance/wallet/recharge": { + "/api/v1/finance/wallet/alipay-recharge": { "post": { "security": [ { "Bearer": [] } ], - "description": "为钱包进行充值操作", + "description": "创建支付宝充值订单并返回支付链接", "consumes": [ "application/json" ], @@ -1732,7 +4780,7 @@ const docTemplate = `{ "tags": [ "钱包管理" ], - "summary": "钱包充值", + "summary": "创建支付宝充值订单", "parameters": [ { "description": "充值请求", @@ -1740,15 +4788,15 @@ const docTemplate = `{ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/commands.RechargeWalletCommand" + "$ref": "#/definitions/commands.CreateAlipayRechargeCommand" } } ], "responses": { "200": { - "description": "充值成功", + "description": "创建充值订单成功", "schema": { - "$ref": "#/definitions/responses.TransactionResponse" + "$ref": "#/definitions/responses.AlipayRechargeOrderResponse" } }, "400": { @@ -1775,14 +4823,44 @@ const docTemplate = `{ } } }, - "/api/v1/finance/wallet/stats": { + "/api/v1/finance/wallet/recharge-config": { + "get": { + "description": "获取当前环境的充值配置信息(最低充值金额、最高充值金额等)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "钱包管理" + ], + "summary": "获取充值配置", + "responses": { + "200": { + "description": "获取充值配置成功", + "schema": { + "$ref": "#/definitions/responses.RechargeConfigResponse" + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/finance/wallet/transactions": { "get": { "security": [ { "Bearer": [] } ], - "description": "获取钱包相关的统计数据", + "description": "获取当前用户的钱包交易记录列表,支持分页和筛选", "consumes": [ "application/json" ], @@ -1792,65 +4870,64 @@ const docTemplate = `{ "tags": [ "钱包管理" ], - "summary": "获取钱包统计", - "responses": { - "200": { - "description": "获取钱包统计成功", - "schema": { - "$ref": "#/definitions/responses.WalletStatsResponse" - } - }, - "401": { - "description": "未认证", - "schema": { - "type": "object", - "additionalProperties": true - } - }, - "500": { - "description": "服务器内部错误", - "schema": { - "type": "object", - "additionalProperties": true - } - } - } - } - }, - "/api/v1/finance/wallet/transaction": { - "post": { - "security": [ - { - "Bearer": [] - } - ], - "description": "执行钱包内部交易操作", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "钱包管理" - ], - "summary": "钱包交易", + "summary": "获取用户钱包交易记录", "parameters": [ { - "description": "交易请求", - "name": "request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/commands.WalletTransactionCommand" - } + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "开始时间 (格式: 2006-01-02 15:04:05)", + "name": "start_time", + "in": "query" + }, + { + "type": "string", + "description": "结束时间 (格式: 2006-01-02 15:04:05)", + "name": "end_time", + "in": "query" + }, + { + "type": "string", + "description": "交易ID", + "name": "transaction_id", + "in": "query" + }, + { + "type": "string", + "description": "产品名称", + "name": "product_name", + "in": "query" + }, + { + "type": "string", + "description": "最小金额", + "name": "min_amount", + "in": "query" + }, + { + "type": "string", + "description": "最大金额", + "name": "max_amount", + "in": "query" } ], "responses": { "200": { - "description": "交易成功", + "description": "获取成功", "schema": { - "$ref": "#/definitions/responses.TransactionResponse" + "$ref": "#/definitions/responses.WalletTransactionListResponse" } }, "400": { @@ -1877,14 +4954,14 @@ const docTemplate = `{ } } }, - "/api/v1/finance/wallet/withdraw": { - "post": { + "/api/v1/form-config/{api_code}": { + "get": { "security": [ { "Bearer": [] } ], - "description": "从钱包进行提现操作", + "description": "获取指定API的表单配置,用于前端动态生成表单", "consumes": [ "application/json" ], @@ -1892,25 +4969,416 @@ const docTemplate = `{ "application/json" ], "tags": [ - "钱包管理" + "API调试" ], - "summary": "钱包提现", + "summary": "获取表单配置", "parameters": [ { - "description": "提现请求", + "type": "string", + "description": "API代码", + "name": "api_code", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "获取成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未授权", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "API接口不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/invoices/apply": { + "post": { + "description": "用户申请开票", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "发票管理" + ], + "summary": "申请开票", + "parameters": [ + { + "description": "申请开票请求", "name": "request", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/commands.WithdrawWalletCommand" + "$ref": "#/definitions/finance.ApplyInvoiceRequest" } } ], "responses": { "200": { - "description": "提现申请已提交", + "description": "OK", "schema": { - "$ref": "#/definitions/responses.TransactionResponse" + "allOf": [ + { + "$ref": "#/definitions/interfaces.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.InvoiceApplicationResponse" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, + "/api/v1/invoices/available-amount": { + "get": { + "description": "获取用户当前可开票的金额", + "produces": [ + "application/json" + ], + "tags": [ + "发票管理" + ], + "summary": "获取可开票金额", + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/interfaces.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.AvailableAmountResponse" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, + "/api/v1/invoices/info": { + "get": { + "description": "获取用户的发票信息", + "produces": [ + "application/json" + ], + "tags": [ + "发票管理" + ], + "summary": "获取用户发票信息", + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/interfaces.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.InvoiceInfoResponse" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + }, + "put": { + "description": "更新用户的发票信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "发票管理" + ], + "summary": "更新用户发票信息", + "parameters": [ + { + "description": "更新发票信息请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/finance.UpdateInvoiceInfoRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, + "/api/v1/invoices/records": { + "get": { + "description": "获取用户的开票记录列表", + "produces": [ + "application/json" + ], + "tags": [ + "发票管理" + ], + "summary": "获取用户开票记录", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "状态筛选", + "name": "status", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/interfaces.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.InvoiceRecordsResponse" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, + "/api/v1/invoices/{application_id}/download": { + "get": { + "description": "下载指定发票的文件", + "produces": [ + "application/octet-stream" + ], + "tags": [ + "发票管理" + ], + "summary": "下载发票文件", + "parameters": [ + { + "type": "string", + "description": "申请ID", + "name": "application_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "file" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, + "/api/v1/my/api-calls": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取当前用户的API调用记录列表,支持分页和筛选", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "API管理" + ], + "summary": "获取用户API调用记录", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "开始时间 (格式: 2006-01-02 15:04:05)", + "name": "start_time", + "in": "query" + }, + { + "type": "string", + "description": "结束时间 (格式: 2006-01-02 15:04:05)", + "name": "end_time", + "in": "query" + }, + { + "type": "string", + "description": "交易ID", + "name": "transaction_id", + "in": "query" + }, + { + "type": "string", + "description": "产品名称", + "name": "product_name", + "in": "query" + }, + { + "type": "string", + "description": "状态 (pending/success/failed)", + "name": "status", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取成功", + "schema": { + "$ref": "#/definitions/dto.ApiCallListResponse" } }, "400": { @@ -1972,8 +5440,28 @@ const docTemplate = `{ }, { "type": "string", - "description": "订阅状态", - "name": "status", + "description": "搜索关键词", + "name": "keyword", + "in": "query" + }, + { + "type": "string", + "description": "产品名称", + "name": "product_name", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "订阅开始时间", + "name": "start_time", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "订阅结束时间", + "name": "end_time", "in": "query" }, { @@ -2162,7 +5650,8 @@ const docTemplate = `{ "200": { "description": "获取使用情况成功", "schema": { - "$ref": "#/definitions/responses.SubscriptionUsageResponse" + "type": "object", + "additionalProperties": true } }, "400": { @@ -2196,9 +5685,68 @@ const docTemplate = `{ } } }, + "/api/v1/my/whitelist/{ip}": { + "delete": { + "security": [ + { + "Bearer": [] + } + ], + "description": "从当前用户的白名单中删除指定IP地址", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "API管理" + ], + "summary": "删除白名单IP", + "parameters": [ + { + "type": "string", + "description": "IP地址", + "name": "ip", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "删除白名单IP成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, "/api/v1/products": { "get": { - "description": "分页获取可用的产品列表,支持筛选", + "description": "分页获取可用的产品列表,支持筛选,默认只返回可见的产品", "consumes": [ "application/json" ], @@ -2236,18 +5784,6 @@ const docTemplate = `{ "name": "category_id", "in": "query" }, - { - "type": "number", - "description": "最低价格", - "name": "min_price", - "in": "query" - }, - { - "type": "number", - "description": "最高价格", - "name": "max_price", - "in": "query" - }, { "type": "boolean", "description": "是否启用", @@ -2266,6 +5802,12 @@ const docTemplate = `{ "name": "is_package", "in": "query" }, + { + "type": "boolean", + "description": "是否已订阅(需要认证)", + "name": "is_subscribed", + "in": "query" + }, { "type": "string", "description": "排序字段", @@ -2307,6 +5849,50 @@ const docTemplate = `{ } } }, + "/api/v1/products/code/{product_code}/api-config": { + "get": { + "description": "根据产品代码获取API配置信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品API配置" + ], + "summary": "根据产品代码获取API配置", + "parameters": [ + { + "type": "string", + "description": "产品代码", + "name": "product_code", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "获取成功", + "schema": { + "$ref": "#/definitions/responses.ProductApiConfigResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "404": { + "description": "配置不存在", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, "/api/v1/products/stats": { "get": { "description": "获取产品相关的统计信息", @@ -2339,7 +5925,7 @@ const docTemplate = `{ }, "/api/v1/products/{id}": { "get": { - "description": "根据产品ID获取产品详细信息", + "description": "获取产品详细信息,用户端只能查看可见的产品", "consumes": [ "application/json" ], @@ -2357,13 +5943,116 @@ const docTemplate = `{ "name": "id", "in": "path", "required": true + }, + { + "type": "boolean", + "description": "是否包含文档信息", + "name": "with_document", + "in": "query" } ], "responses": { "200": { "description": "获取产品详情成功", "schema": { - "$ref": "#/definitions/responses.ProductInfoResponse" + "$ref": "#/definitions/responses.ProductInfoWithDocumentResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在或不可见", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/products/{id}/api-config": { + "get": { + "description": "根据产品ID获取API配置信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品API配置" + ], + "summary": "获取产品API配置", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "获取成功", + "schema": { + "$ref": "#/definitions/responses.ProductApiConfigResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "404": { + "description": "配置不存在", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, + "/api/v1/products/{id}/documentation": { + "get": { + "description": "获取指定产品的文档信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "数据大厅" + ], + "summary": "获取产品文档", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "获取产品文档成功", + "schema": { + "$ref": "#/definitions/responses.DocumentationResponse" } }, "400": { @@ -2456,6 +6145,233 @@ const docTemplate = `{ } } }, + "/api/v1/users/admin/list": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员查看用户列表,支持分页和筛选", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "用户管理" + ], + "summary": "管理员查看用户列表", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "手机号筛选", + "name": "phone", + "in": "query" + }, + { + "enum": [ + "user", + "admin" + ], + "type": "string", + "description": "用户类型筛选", + "name": "user_type", + "in": "query" + }, + { + "type": "boolean", + "description": "是否激活筛选", + "name": "is_active", + "in": "query" + }, + { + "type": "boolean", + "description": "是否已认证筛选", + "name": "is_certified", + "in": "query" + }, + { + "type": "string", + "description": "企业名称筛选", + "name": "company_name", + "in": "query" + }, + { + "type": "string", + "format": "date", + "description": "开始日期", + "name": "start_date", + "in": "query" + }, + { + "type": "string", + "format": "date", + "description": "结束日期", + "name": "end_date", + "in": "query" + } + ], + "responses": { + "200": { + "description": "用户列表", + "schema": { + "$ref": "#/definitions/responses.UserListResponse" + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "403": { + "description": "权限不足", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/users/admin/stats": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取用户相关的统计信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "用户管理" + ], + "summary": "获取用户统计信息", + "responses": { + "200": { + "description": "用户统计信息", + "schema": { + "$ref": "#/definitions/responses.UserStatsResponse" + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "403": { + "description": "权限不足", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/users/admin/{user_id}": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取指定用户的详细信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "用户管理" + ], + "summary": "管理员获取用户详情", + "parameters": [ + { + "type": "string", + "description": "用户ID", + "name": "user_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "用户详情", + "schema": { + "$ref": "#/definitions/responses.UserDetailResponse" + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "403": { + "description": "权限不足", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "用户不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, "/api/v1/users/login-password": { "post": { "description": "使用手机号和密码进行用户登录,返回JWT令牌", @@ -2845,15 +6761,74 @@ const docTemplate = `{ } }, "definitions": { + "commands.AddPackageItemCommand": { + "type": "object", + "required": [ + "product_id" + ], + "properties": { + "product_id": { + "type": "string" + } + } + }, + "commands.ApiCallCommand": { + "type": "object", + "required": [ + "data" + ], + "properties": { + "data": { + "type": "string" + }, + "options": { + "$ref": "#/definitions/commands.ApiCallOptions" + } + } + }, + "commands.ApiCallOptions": { + "type": "object", + "properties": { + "is_debug": { + "description": "是否为调试调用", + "type": "boolean" + }, + "json": { + "description": "是否返回JSON格式", + "type": "boolean" + } + } + }, "commands.ApplyContractCommand": { "type": "object", "required": [ - "certification_id", "user_id" ], "properties": { - "certification_id": { + "user_id": { "type": "string" + } + } + }, + "commands.BatchUpdateSubscriptionPricesCommand": { + "type": "object", + "required": [ + "discount", + "scope", + "user_id" + ], + "properties": { + "discount": { + "type": "number", + "maximum": 10, + "minimum": 0.1 + }, + "scope": { + "type": "string", + "enum": [ + "undiscounted", + "all" + ] }, "user_id": { "type": "string" @@ -2890,35 +6865,94 @@ const docTemplate = `{ } } }, - "commands.CreateCategoryCommand": { + "commands.CreateAlipayRechargeCommand": { "type": "object", "required": [ - "code", - "name" + "amount", + "platform" ], "properties": { - "code": { + "amount": { + "description": "充值金额", "type": "string" }, - "description": { + "platform": { + "description": "支付平台:app/h5/pc", "type": "string", - "maxLength": 200 + "enum": [ + "app", + "h5", + "pc" + ] + } + } + }, + "commands.CreateArticleCommand": { + "type": "object", + "required": [ + "content", + "title" + ], + "properties": { + "category_id": { + "type": "string" }, - "is_enabled": { + "content": { + "type": "string" + }, + "cover_image": { + "type": "string" + }, + "is_featured": { "type": "boolean" }, - "is_visible": { - "type": "boolean" + "summary": { + "type": "string" }, - "name": { - "type": "string", - "maxLength": 50, - "minLength": 2 + "tag_ids": { + "type": "array", + "items": { + "type": "string" + } }, - "sort": { - "type": "integer", - "maximum": 9999, - "minimum": 0 + "title": { + "type": "string" + } + } + }, + "commands.CreateDocumentationCommand": { + "type": "object", + "required": [ + "basic_info", + "product_id", + "request_method", + "request_params", + "request_url" + ], + "properties": { + "basic_info": { + "type": "string" + }, + "error_codes": { + "type": "string" + }, + "product_id": { + "type": "string" + }, + "request_method": { + "type": "string" + }, + "request_params": { + "type": "string" + }, + "request_url": { + "type": "string" + }, + "response_example": { + "type": "string" + }, + "response_fields": { + "type": "string" } } }, @@ -2977,63 +7011,50 @@ const docTemplate = `{ } } }, - "commands.CreateUserSecretsCommand": { + "commands.CreateTagCommand": { "type": "object", "required": [ - "user_id" + "color", + "name" ], "properties": { - "expires_at": { + "color": { "type": "string" }, - "user_id": { - "type": "string" - } - } - }, - "commands.CreateWalletCommand": { - "type": "object", - "required": [ - "user_id" - ], - "properties": { - "user_id": { - "type": "string" - } - } - }, - "commands.EsignCallbackCommand": { - "type": "object", - "required": [ - "callback_type", - "certification_id", - "raw_data" - ], - "properties": { - "callback_type": { + "name": { "type": "string", - "enum": [ - "auth_result", - "sign_result", - "flow_status" - ] - }, - "certification_id": { + "maxLength": 30, + "minLength": 1 + } + } + }, + "commands.DecryptCommand": { + "type": "object", + "required": [ + "encrypted_data", + "secret_key" + ], + "properties": { + "encrypted_data": { "type": "string" }, - "headers": { + "secret_key": { + "type": "string" + } + } + }, + "commands.EncryptCommand": { + "type": "object", + "required": [ + "data", + "secret_key" + ], + "properties": { + "data": { "type": "object", - "additionalProperties": { - "type": "string" - } + "additionalProperties": true }, - "query_params": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "raw_data": { + "secret_key": { "type": "string" } } @@ -3076,18 +7097,19 @@ const docTemplate = `{ } } }, - "commands.RechargeWalletCommand": { + "commands.PackageItemData": { "type": "object", "required": [ - "amount", - "user_id" + "product_id", + "sort_order" ], "properties": { - "amount": { - "type": "number" - }, - "user_id": { + "product_id": { "type": "string" + }, + "sort_order": { + "type": "integer", + "minimum": 0 } } }, @@ -3119,6 +7141,20 @@ const docTemplate = `{ } } }, + "commands.ReorderPackageItemsCommand": { + "type": "object", + "required": [ + "item_ids" + ], + "properties": { + "item_ids": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, "commands.ResetPasswordCommand": { "description": "重置用户密码请求参数(忘记密码时使用)", "type": "object", @@ -3147,6 +7183,17 @@ const docTemplate = `{ } } }, + "commands.SchedulePublishCommand": { + "type": "object", + "required": [ + "scheduled_time" + ], + "properties": { + "scheduled_time": { + "type": "string" + } + } + }, "commands.SendCodeCommand": { "description": "发送短信验证码请求参数", "type": "object", @@ -3174,10 +7221,22 @@ const docTemplate = `{ } } }, + "commands.SetFeaturedCommand": { + "type": "object", + "required": [ + "is_featured" + ], + "properties": { + "is_featured": { + "type": "boolean" + } + } + }, "commands.SubmitEnterpriseInfoCommand": { "type": "object", "required": [ "company_name", + "enterprise_address", "legal_person_id", "legal_person_name", "legal_person_phone", @@ -3190,6 +7249,9 @@ const docTemplate = `{ "maxLength": 100, "minLength": 2 }, + "enterprise_address": { + "type": "string" + }, "legal_person_id": { "type": "string" }, @@ -3209,38 +7271,61 @@ const docTemplate = `{ } } }, - "commands.UpdateCategoryCommand": { + "commands.UpdateArticleCommand": { "type": "object", - "required": [ - "code", - "name" - ], "properties": { - "code": { + "category_id": { "type": "string" }, - "description": { - "type": "string", - "maxLength": 200 + "content": { + "type": "string" }, - "is_enabled": { + "cover_image": { + "type": "string" + }, + "is_featured": { "type": "boolean" }, - "is_visible": { - "type": "boolean" + "summary": { + "type": "string" }, - "name": { - "type": "string", - "maxLength": 50, - "minLength": 2 + "tag_ids": { + "type": "array", + "items": { + "type": "string" + } }, - "sort": { + "title": { + "type": "string" + } + } + }, + "commands.UpdatePackageItemCommand": { + "type": "object", + "required": [ + "sort_order" + ], + "properties": { + "sort_order": { "type": "integer", - "maximum": 9999, "minimum": 0 } } }, + "commands.UpdatePackageItemsCommand": { + "type": "object", + "required": [ + "items" + ], + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/commands.PackageItemData" + } + } + } + }, "commands.UpdateProductCommand": { "type": "object", "required": [ @@ -3305,43 +7390,290 @@ const docTemplate = `{ } } }, - "commands.UpdateWalletCommand": { + "commands.UpdateTagCommand": { "type": "object", "required": [ - "user_id" + "color", + "name" ], "properties": { - "balance": { + "color": { + "type": "string" + }, + "name": { + "type": "string", + "maxLength": 30, + "minLength": 1 + } + } + }, + "dto.ApiCallListResponse": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.ApiCallRecordResponse" + } + }, + "page": { + "type": "integer" + }, + "size": { + "type": "integer" + }, + "total": { + "type": "integer" + } + } + }, + "dto.ApiCallRecordResponse": { + "type": "object", + "properties": { + "access_id": { + "type": "string" + }, + "client_ip": { + "type": "string" + }, + "company_name": { + "type": "string" + }, + "cost": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "end_at": { + "type": "string" + }, + "error_msg": { + "type": "string" + }, + "error_type": { + "type": "string" + }, + "id": { + "type": "string" + }, + "product_id": { + "type": "string" + }, + "product_name": { + "type": "string" + }, + "start_at": { + "type": "string" + }, + "status": { + "type": "string" + }, + "transaction_id": { + "type": "string" + }, + "translated_error_msg": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "user": { + "$ref": "#/definitions/dto.UserSimpleResponse" + }, + "user_id": { + "type": "string" + } + } + }, + "dto.ApiCallResponse": { + "type": "object", + "properties": { + "code": { + "type": "integer" + }, + "data": { + "type": "string" + }, + "message": { + "type": "string" + }, + "transaction_id": { + "type": "string" + } + } + }, + "dto.AvailableAmountResponse": { + "type": "object", + "properties": { + "available_amount": { + "description": "可开票金额", "type": "number" }, - "is_active": { + "pending_applications": { + "description": "待处理申请金额", + "type": "number" + }, + "total_gifted": { + "description": "总赠送金额", + "type": "number" + }, + "total_invoiced": { + "description": "已开票金额", + "type": "number" + }, + "total_recharged": { + "description": "总充值金额", + "type": "number" + } + } + }, + "dto.EncryptResponse": { + "type": "object", + "properties": { + "encrypted_data": { + "type": "string" + } + } + }, + "dto.InvoiceApplicationResponse": { + "type": "object", + "properties": { + "amount": { + "type": "number" + }, + "created_at": { + "type": "string" + }, + "id": { + "type": "string" + }, + "invoice_info": { + "$ref": "#/definitions/value_objects.InvoiceInfo" + }, + "invoice_type": { + "$ref": "#/definitions/value_objects.InvoiceType" + }, + "status": { + "$ref": "#/definitions/entities.ApplicationStatus" + }, + "user_id": { + "type": "string" + } + } + }, + "dto.InvoiceInfoResponse": { + "type": "object", + "properties": { + "bank_account": { + "description": "用户可编辑", + "type": "string" + }, + "bank_name": { + "description": "用户可编辑", + "type": "string" + }, + "company_address": { + "description": "用户可编辑", + "type": "string" + }, + "company_name": { + "description": "从企业认证信息获取,只读", + "type": "string" + }, + "company_name_read_only": { + "description": "字段权限标识", "type": "boolean" }, - "user_id": { + "company_phone": { + "description": "用户可编辑", "type": "string" + }, + "is_complete": { + "type": "boolean" + }, + "missing_fields": { + "type": "array", + "items": { + "type": "string" + } + }, + "receiving_email": { + "description": "用户可编辑", + "type": "string" + }, + "taxpayer_id": { + "description": "从企业认证信息获取,只读", + "type": "string" + }, + "taxpayer_id_read_only": { + "description": "纳税人识别号是否只读", + "type": "boolean" } } }, - "commands.WalletTransactionCommand": { + "dto.InvoiceRecordResponse": { "type": "object", - "required": [ - "amount", - "from_user_id", - "to_user_id", - "user_id" - ], "properties": { "amount": { "type": "number" }, - "from_user_id": { + "bank_account": { + "description": "银行账号", "type": "string" }, - "notes": { - "type": "string", - "maxLength": 200 + "bank_name": { + "description": "开户银行", + "type": "string" }, - "to_user_id": { + "company_address": { + "description": "企业地址", + "type": "string" + }, + "company_name": { + "description": "开票信息(快照数据)", + "type": "string" + }, + "company_phone": { + "description": "企业电话", + "type": "string" + }, + "created_at": { + "type": "string" + }, + "file_name": { + "description": "文件信息", + "type": "string" + }, + "file_size": { + "type": "integer" + }, + "file_url": { + "type": "string" + }, + "id": { + "type": "string" + }, + "invoice_type": { + "$ref": "#/definitions/value_objects.InvoiceType" + }, + "processed_at": { + "description": "时间信息", + "type": "string" + }, + "receiving_email": { + "description": "接收邮箱", + "type": "string" + }, + "reject_reason": { + "description": "拒绝原因", + "type": "string" + }, + "status": { + "$ref": "#/definitions/entities.ApplicationStatus" + }, + "taxpayer_id": { + "description": "纳税人识别号", "type": "string" }, "user_id": { @@ -3349,21 +7681,148 @@ const docTemplate = `{ } } }, - "commands.WithdrawWalletCommand": { + "dto.InvoiceRecordsResponse": { + "type": "object", + "properties": { + "page": { + "type": "integer" + }, + "page_size": { + "type": "integer" + }, + "records": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.InvoiceRecordResponse" + } + }, + "total": { + "type": "integer" + }, + "total_pages": { + "type": "integer" + } + } + }, + "dto.PendingApplicationResponse": { "type": "object", - "required": [ - "amount", - "user_id" - ], "properties": { "amount": { "type": "number" }, + "bank_account": { + "type": "string" + }, + "bank_name": { + "type": "string" + }, + "company_address": { + "type": "string" + }, + "company_name": { + "type": "string" + }, + "company_phone": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "file_name": { + "type": "string" + }, + "file_size": { + "type": "integer" + }, + "file_url": { + "type": "string" + }, + "id": { + "type": "string" + }, + "invoice_type": { + "$ref": "#/definitions/value_objects.InvoiceType" + }, + "processed_at": { + "type": "string" + }, + "receiving_email": { + "type": "string" + }, + "reject_reason": { + "type": "string" + }, + "status": { + "$ref": "#/definitions/entities.ApplicationStatus" + }, + "taxpayer_id": { + "type": "string" + }, "user_id": { "type": "string" } } }, + "dto.PendingApplicationsResponse": { + "type": "object", + "properties": { + "applications": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.PendingApplicationResponse" + } + }, + "page": { + "type": "integer" + }, + "page_size": { + "type": "integer" + }, + "total": { + "type": "integer" + }, + "total_pages": { + "type": "integer" + } + } + }, + "dto.UserSimpleResponse": { + "type": "object", + "properties": { + "company_name": { + "type": "string" + }, + "id": { + "type": "string" + }, + "phone": { + "type": "string" + } + } + }, + "entities.ApplicationStatus": { + "type": "string", + "enum": [ + "pending", + "completed", + "rejected" + ], + "x-enum-comments": { + "ApplicationStatusCompleted": "已完成(已上传发票)", + "ApplicationStatusPending": "待处理", + "ApplicationStatusRejected": "已拒绝" + }, + "x-enum-descriptions": [ + "待处理", + "已完成(已上传发票)", + "已拒绝" + ], + "x-enum-varnames": [ + "ApplicationStatusPending", + "ApplicationStatusCompleted", + "ApplicationStatusRejected" + ] + }, "enums.CertificationStatus": { "type": "string", "enum": [ @@ -3372,11 +7831,13 @@ const docTemplate = `{ "enterprise_verified", "contract_applied", "contract_signed", + "completed", "info_rejected", "contract_rejected", "contract_expired" ], "x-enum-comments": { + "StatusCompleted": "认证完成", "StatusContractApplied": "已申请签署合同", "StatusContractExpired": "合同签署超时", "StatusContractRejected": "合同被拒签", @@ -3386,12 +7847,24 @@ const docTemplate = `{ "StatusInfoSubmitted": "已提交企业信息", "StatusPending": "待认证" }, + "x-enum-descriptions": [ + "待认证", + "已提交企业信息", + "已企业认证", + "已申请签署合同", + "已签署合同", + "认证完成", + "企业信息被拒绝", + "合同被拒签", + "合同签署超时" + ], "x-enum-varnames": [ "StatusPending", "StatusInfoSubmitted", "StatusEnterpriseVerified", "StatusContractApplied", "StatusContractSigned", + "StatusCompleted", "StatusInfoRejected", "StatusContractRejected", "StatusContractExpired" @@ -3433,6 +7906,23 @@ const docTemplate = `{ "FailureReasonTimeout": "操作超时", "FailureReasonUnknownError": "未知错误" }, + "x-enum-descriptions": [ + "企业不存在", + "企业信息不匹配", + "企业状态异常", + "法定代表人信息不匹配", + "e签宝验证失败", + "证件信息无效", + "用户拒绝签署", + "合同签署超时", + "签署流程失败", + "合同生成失败", + "e签宝流程错误", + "系统错误", + "网络错误", + "操作超时", + "未知错误" + ], "x-enum-varnames": [ "FailureReasonEnterpriseNotExists", "FailureReasonEnterpriseInfoMismatch", @@ -3451,71 +7941,280 @@ const docTemplate = `{ "FailureReasonUnknownError" ] }, - "responses.CallbackResponse": { + "finance.ApplyInvoiceRequest": { + "type": "object", + "required": [ + "amount", + "invoice_type" + ], + "properties": { + "amount": { + "description": "开票金额", + "type": "string" + }, + "invoice_type": { + "description": "发票类型:general/special", + "type": "string" + } + } + }, + "finance.RejectInvoiceRequest": { + "type": "object", + "required": [ + "reason" + ], + "properties": { + "reason": { + "description": "拒绝原因", + "type": "string" + } + } + }, + "finance.UpdateInvoiceInfoRequest": { + "type": "object", + "required": [ + "receiving_email" + ], + "properties": { + "bank_account": { + "description": "银行账户", + "type": "string" + }, + "bank_name": { + "description": "银行名称", + "type": "string" + }, + "company_address": { + "description": "公司地址", + "type": "string" + }, + "company_name": { + "description": "公司名称(从企业认证信息获取,用户不可修改)", + "type": "string" + }, + "company_phone": { + "description": "企业注册电话", + "type": "string" + }, + "receiving_email": { + "description": "发票接收邮箱", + "type": "string" + }, + "taxpayer_id": { + "description": "纳税人识别号(从企业认证信息获取,用户不可修改)", + "type": "string" + } + } + }, + "interfaces.APIResponse": { "type": "object", "properties": { - "callback_type": { - "type": "string" - }, - "certification_id": { - "type": "string" - }, + "data": {}, + "errors": {}, "message": { "type": "string" }, - "new_status": { - "$ref": "#/definitions/enums.CertificationStatus" + "meta": { + "type": "object", + "additionalProperties": true }, - "old_status": { - "$ref": "#/definitions/enums.CertificationStatus" + "pagination": { + "$ref": "#/definitions/interfaces.PaginationMeta" }, - "processed_at": { + "request_id": { "type": "string" }, "success": { "type": "boolean" + }, + "timestamp": { + "type": "integer" } } }, - "responses.CategoryInfoResponse": { + "interfaces.PaginationMeta": { "type": "object", "properties": { - "code": { + "has_next": { + "type": "boolean" + }, + "has_prev": { + "type": "boolean" + }, + "page": { + "type": "integer" + }, + "page_size": { + "type": "integer" + }, + "total": { + "type": "integer" + }, + "total_pages": { + "type": "integer" + } + } + }, + "queries.ConfirmAuthCommand": { + "type": "object" + }, + "queries.ConfirmSignCommand": { + "type": "object" + }, + "responses.AlipayOrderStatusResponse": { + "type": "object", + "properties": { + "amount": { + "description": "订单金额", + "type": "number" + }, + "can_retry": { + "description": "是否可以重试", + "type": "boolean" + }, + "created_at": { + "description": "创建时间", + "type": "string" + }, + "error_code": { + "description": "错误码", + "type": "string" + }, + "error_message": { + "description": "错误信息", + "type": "string" + }, + "is_processing": { + "description": "是否处理中", + "type": "boolean" + }, + "notify_time": { + "description": "异步通知时间", + "type": "string" + }, + "out_trade_no": { + "description": "商户订单号", + "type": "string" + }, + "platform": { + "description": "支付平台", + "type": "string" + }, + "return_time": { + "description": "同步返回时间", + "type": "string" + }, + "status": { + "description": "订单状态", + "type": "string" + }, + "subject": { + "description": "订单标题", + "type": "string" + }, + "trade_no": { + "description": "支付宝交易号", + "type": "string" + }, + "updated_at": { + "description": "更新时间", + "type": "string" + } + } + }, + "responses.AlipayRechargeBonusRuleResponse": { + "type": "object", + "properties": { + "bonus_amount": { + "type": "number" + }, + "recharge_amount": { + "type": "number" + } + } + }, + "responses.AlipayRechargeOrderResponse": { + "type": "object", + "properties": { + "amount": { + "description": "充值金额", + "type": "number" + }, + "out_trade_no": { + "description": "商户订单号", + "type": "string" + }, + "pay_url": { + "description": "支付链接", + "type": "string" + }, + "platform": { + "description": "支付平台", + "type": "string" + }, + "subject": { + "description": "订单标题", + "type": "string" + } + } + }, + "responses.ArticleInfoResponse": { + "type": "object", + "properties": { + "category": { + "$ref": "#/definitions/tyapi-server_internal_application_article_dto_responses.CategoryInfoResponse" + }, + "category_id": { + "type": "string" + }, + "content": { + "type": "string" + }, + "cover_image": { "type": "string" }, "created_at": { "type": "string" }, - "description": { - "type": "string" - }, "id": { "type": "string" }, - "is_enabled": { + "is_featured": { "type": "boolean" }, - "is_visible": { - "type": "boolean" - }, - "name": { + "published_at": { "type": "string" }, - "sort": { - "type": "integer" + "status": { + "type": "string" + }, + "summary": { + "type": "string" + }, + "tags": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.TagInfoResponse" + } + }, + "title": { + "type": "string" }, "updated_at": { "type": "string" + }, + "view_count": { + "type": "integer" } } }, - "responses.CategoryListResponse": { + "responses.ArticleListResponse": { "type": "object", "properties": { "items": { "type": "array", "items": { - "$ref": "#/definitions/responses.CategoryInfoResponse" + "$ref": "#/definitions/responses.ArticleInfoResponse" } }, "page": { @@ -3529,6 +8228,26 @@ const docTemplate = `{ } } }, + "responses.ArticleStatsResponse": { + "type": "object", + "properties": { + "archived_articles": { + "type": "integer" + }, + "draft_articles": { + "type": "integer" + }, + "published_articles": { + "type": "integer" + }, + "total_articles": { + "type": "integer" + }, + "total_views": { + "type": "integer" + } + } + }, "responses.CategorySimpleResponse": { "type": "object", "properties": { @@ -3578,6 +8297,9 @@ const docTemplate = `{ "can_retry": { "type": "boolean" }, + "completed_at": { + "type": "string" + }, "contract_applied_at": { "type": "string" }, @@ -3666,6 +8388,53 @@ const docTemplate = `{ } } }, + "responses.ConfirmAuthResponse": { + "type": "object", + "properties": { + "reason": { + "type": "string" + }, + "status": { + "$ref": "#/definitions/enums.CertificationStatus" + } + } + }, + "responses.ConfirmSignResponse": { + "type": "object", + "properties": { + "reason": { + "type": "string" + }, + "status": { + "$ref": "#/definitions/enums.CertificationStatus" + } + } + }, + "responses.ContractInfoItem": { + "type": "object", + "properties": { + "contract_file_url": { + "type": "string" + }, + "contract_name": { + "type": "string" + }, + "contract_type": { + "description": "合同类型代码", + "type": "string" + }, + "contract_type_name": { + "description": "合同类型中文名称", + "type": "string" + }, + "created_at": { + "type": "string" + }, + "id": { + "type": "string" + } + } + }, "responses.ContractSignUrlResponse": { "type": "object", "properties": { @@ -3689,6 +8458,80 @@ const docTemplate = `{ } } }, + "responses.DocumentationResponse": { + "type": "object", + "properties": { + "basic_info": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "error_codes": { + "type": "string" + }, + "id": { + "type": "string" + }, + "product_id": { + "type": "string" + }, + "request_method": { + "type": "string" + }, + "request_params": { + "type": "string" + }, + "request_url": { + "type": "string" + }, + "response_example": { + "type": "string" + }, + "response_fields": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "version": { + "type": "string" + } + } + }, + "responses.EnterpriseInfoItem": { + "type": "object", + "properties": { + "company_name": { + "type": "string" + }, + "contracts": { + "description": "合同信息", + "type": "array", + "items": { + "$ref": "#/definitions/responses.ContractInfoItem" + } + }, + "created_at": { + "type": "string" + }, + "enterprise_address": { + "type": "string" + }, + "id": { + "type": "string" + }, + "legal_person_name": { + "type": "string" + }, + "legal_person_phone": { + "type": "string" + }, + "unified_social_code": { + "type": "string" + } + } + }, "responses.EnterpriseInfoResponse": { "description": "企业信息响应", "type": "object", @@ -3705,22 +8548,14 @@ const docTemplate = `{ "type": "string", "example": "2024-01-01T00:00:00Z" }, + "enterprise_address": { + "type": "string", + "example": "北京市朝阳区xxx街道xxx号" + }, "id": { "type": "string", "example": "123e4567-e89b-12d3-a456-426614174000" }, - "is_certified": { - "type": "boolean", - "example": false - }, - "is_face_verified": { - "type": "boolean", - "example": false - }, - "is_ocr_verified": { - "type": "boolean", - "example": false - }, "legal_person_id": { "type": "string", "example": "110101199001011234" @@ -3729,6 +8564,10 @@ const docTemplate = `{ "type": "string", "example": "张三" }, + "legal_person_phone": { + "type": "string", + "example": "13800138000" + }, "unified_social_code": { "type": "string", "example": "91110000123456789X" @@ -3764,6 +8603,159 @@ const docTemplate = `{ } } }, + "responses.PackageItemResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "price": { + "type": "number" + }, + "product_code": { + "type": "string" + }, + "product_id": { + "type": "string" + }, + "product_name": { + "type": "string" + }, + "sort_order": { + "type": "integer" + } + } + }, + "responses.ProductAdminInfoResponse": { + "type": "object", + "properties": { + "category": { + "description": "关联信息", + "allOf": [ + { + "$ref": "#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse" + } + ] + }, + "category_id": { + "type": "string" + }, + "code": { + "type": "string" + }, + "content": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "description": { + "type": "string" + }, + "documentation": { + "description": "文档信息", + "allOf": [ + { + "$ref": "#/definitions/responses.DocumentationResponse" + } + ] + }, + "id": { + "type": "string" + }, + "is_enabled": { + "type": "boolean" + }, + "is_package": { + "type": "boolean" + }, + "is_visible": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "old_id": { + "type": "string" + }, + "package_items": { + "description": "组合包信息", + "type": "array", + "items": { + "$ref": "#/definitions/responses.PackageItemResponse" + } + }, + "price": { + "type": "number" + }, + "seo_description": { + "type": "string" + }, + "seo_keywords": { + "type": "string" + }, + "seo_title": { + "description": "SEO信息", + "type": "string" + }, + "updated_at": { + "type": "string" + } + } + }, + "responses.ProductAdminListResponse": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.ProductAdminInfoResponse" + } + }, + "page": { + "type": "integer" + }, + "size": { + "type": "integer" + }, + "total": { + "type": "integer" + } + } + }, + "responses.ProductApiConfigResponse": { + "type": "object", + "properties": { + "created_at": { + "type": "string" + }, + "id": { + "type": "string" + }, + "product_id": { + "type": "string" + }, + "request_params": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.RequestParamResponse" + } + }, + "response_example": { + "type": "object", + "additionalProperties": true + }, + "response_fields": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.ResponseFieldResponse" + } + }, + "updated_at": { + "type": "string" + } + } + }, "responses.ProductInfoResponse": { "type": "object", "properties": { @@ -3771,7 +8763,7 @@ const docTemplate = `{ "description": "关联信息", "allOf": [ { - "$ref": "#/definitions/responses.CategoryInfoResponse" + "$ref": "#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse" } ] }, @@ -3799,12 +8791,94 @@ const docTemplate = `{ "is_package": { "type": "boolean" }, - "is_visible": { + "is_subscribed": { "type": "boolean" }, "name": { "type": "string" }, + "old_id": { + "type": "string" + }, + "package_items": { + "description": "组合包信息", + "type": "array", + "items": { + "$ref": "#/definitions/responses.PackageItemResponse" + } + }, + "price": { + "type": "number" + }, + "seo_description": { + "type": "string" + }, + "seo_keywords": { + "type": "string" + }, + "seo_title": { + "description": "SEO信息", + "type": "string" + }, + "updated_at": { + "type": "string" + } + } + }, + "responses.ProductInfoWithDocumentResponse": { + "type": "object", + "properties": { + "category": { + "description": "关联信息", + "allOf": [ + { + "$ref": "#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse" + } + ] + }, + "category_id": { + "type": "string" + }, + "code": { + "type": "string" + }, + "content": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "description": { + "type": "string" + }, + "documentation": { + "$ref": "#/definitions/responses.DocumentationResponse" + }, + "id": { + "type": "string" + }, + "is_enabled": { + "type": "boolean" + }, + "is_package": { + "type": "boolean" + }, + "is_subscribed": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "old_id": { + "type": "string" + }, + "package_items": { + "description": "组合包信息", + "type": "array", + "items": { + "$ref": "#/definitions/responses.PackageItemResponse" + } + }, "price": { "type": "number" }, @@ -3861,9 +8935,15 @@ const docTemplate = `{ "is_package": { "type": "boolean" }, + "is_subscribed": { + "type": "boolean" + }, "name": { "type": "string" }, + "old_id": { + "type": "string" + }, "price": { "type": "number" } @@ -3886,6 +8966,89 @@ const docTemplate = `{ } } }, + "responses.RechargeConfigResponse": { + "type": "object", + "properties": { + "alipay_recharge_bonus": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.AlipayRechargeBonusRuleResponse" + } + }, + "max_amount": { + "description": "最高充值金额", + "type": "string" + }, + "min_amount": { + "description": "最低充值金额", + "type": "string" + } + } + }, + "responses.RechargeRecordListResponse": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.RechargeRecordResponse" + } + }, + "page": { + "type": "integer" + }, + "size": { + "type": "integer" + }, + "total": { + "type": "integer" + } + } + }, + "responses.RechargeRecordResponse": { + "type": "object", + "properties": { + "alipay_order_id": { + "type": "string" + }, + "amount": { + "type": "number" + }, + "company_name": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "id": { + "type": "string" + }, + "notes": { + "type": "string" + }, + "operator_id": { + "type": "string" + }, + "recharge_type": { + "type": "string" + }, + "status": { + "type": "string" + }, + "transfer_order_id": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "user": { + "$ref": "#/definitions/tyapi-server_internal_application_finance_dto_responses.UserSimpleResponse" + }, + "user_id": { + "type": "string" + } + } + }, "responses.RegisterUserResponse": { "description": "用户注册成功响应", "type": "object", @@ -3900,6 +9063,55 @@ const docTemplate = `{ } } }, + "responses.RequestParamResponse": { + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "example": { + "type": "string" + }, + "field": { + "type": "string" + }, + "name": { + "type": "string" + }, + "required": { + "type": "boolean" + }, + "type": { + "type": "string" + }, + "validation": { + "type": "string" + } + } + }, + "responses.ResponseFieldResponse": { + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "example": { + "type": "string" + }, + "name": { + "type": "string" + }, + "path": { + "type": "string" + }, + "required": { + "type": "boolean" + }, + "type": { + "type": "string" + } + } + }, "responses.SubscriptionInfoResponse": { "type": "object", "properties": { @@ -3916,12 +9128,7 @@ const docTemplate = `{ "type": "number" }, "product": { - "description": "关联信息", - "allOf": [ - { - "$ref": "#/definitions/responses.ProductSimpleResponse" - } - ] + "$ref": "#/definitions/responses.ProductSimpleResponse" }, "product_id": { "type": "string" @@ -3929,6 +9136,14 @@ const docTemplate = `{ "updated_at": { "type": "string" }, + "user": { + "description": "关联信息", + "allOf": [ + { + "$ref": "#/definitions/tyapi-server_internal_application_product_dto_responses.UserSimpleResponse" + } + ] + }, "user_id": { "type": "string" } @@ -3965,46 +9180,148 @@ const docTemplate = `{ } } }, - "responses.SubscriptionUsageResponse": { + "responses.TagInfoResponse": { "type": "object", "properties": { - "api_used": { - "type": "integer" - }, - "id": { + "color": { "type": "string" }, - "product_id": { - "type": "string" - } - } - }, - "responses.TransactionResponse": { - "type": "object", - "properties": { - "amount": { - "type": "number" - }, "created_at": { "type": "string" }, - "from_balance": { - "type": "number" - }, - "from_user_id": { + "id": { "type": "string" }, - "notes": { + "name": { + "type": "string" + } + } + }, + "responses.TagListResponse": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.TagInfoResponse" + } + }, + "total": { + "type": "integer" + } + } + }, + "responses.UserDetailResponse": { + "type": "object", + "properties": { + "created_at": { "type": "string" }, - "to_balance": { - "type": "number" + "enterprise_info": { + "description": "企业信息", + "allOf": [ + { + "$ref": "#/definitions/responses.EnterpriseInfoItem" + } + ] }, - "to_user_id": { + "id": { "type": "string" }, - "transaction_id": { + "is_active": { + "type": "boolean" + }, + "is_certified": { + "type": "boolean" + }, + "last_login_at": { "type": "string" + }, + "login_count": { + "type": "integer" + }, + "phone": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "user_type": { + "type": "string" + }, + "username": { + "type": "string" + }, + "wallet_balance": { + "description": "钱包信息", + "type": "string" + } + } + }, + "responses.UserListItem": { + "type": "object", + "properties": { + "created_at": { + "type": "string" + }, + "enterprise_info": { + "description": "企业信息", + "allOf": [ + { + "$ref": "#/definitions/responses.EnterpriseInfoItem" + } + ] + }, + "id": { + "type": "string" + }, + "is_active": { + "type": "boolean" + }, + "is_certified": { + "type": "boolean" + }, + "last_login_at": { + "type": "string" + }, + "login_count": { + "type": "integer" + }, + "phone": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "user_type": { + "type": "string" + }, + "username": { + "type": "string" + }, + "wallet_balance": { + "description": "钱包信息", + "type": "string" + } + } + }, + "responses.UserListResponse": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.UserListItem" + } + }, + "page": { + "type": "integer" + }, + "size": { + "type": "integer" + }, + "total": { + "type": "integer" } } }, @@ -4067,35 +9384,17 @@ const docTemplate = `{ } } }, - "responses.UserSecretsResponse": { + "responses.UserStatsResponse": { "type": "object", "properties": { - "access_id": { - "type": "string" + "active_users": { + "type": "integer" }, - "access_key": { - "type": "string" + "certified_users": { + "type": "integer" }, - "created_at": { - "type": "string" - }, - "expires_at": { - "type": "string" - }, - "id": { - "type": "string" - }, - "is_active": { - "type": "boolean" - }, - "last_used_at": { - "type": "string" - }, - "updated_at": { - "type": "string" - }, - "user_id": { - "type": "string" + "total_users": { + "type": "integer" } } }, @@ -4105,6 +9404,10 @@ const docTemplate = `{ "balance": { "type": "number" }, + "balance_status": { + "description": "normal, low, arrears", + "type": "string" + }, "created_at": { "type": "string" }, @@ -4114,6 +9417,14 @@ const docTemplate = `{ "is_active": { "type": "boolean" }, + "is_arrears": { + "description": "是否欠费", + "type": "boolean" + }, + "is_low_balance": { + "description": "是否余额较低", + "type": "boolean" + }, "updated_at": { "type": "string" }, @@ -4122,26 +9433,276 @@ const docTemplate = `{ } } }, - "responses.WalletStatsResponse": { + "responses.WalletTransactionListResponse": { "type": "object", "properties": { - "active_wallets": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.WalletTransactionResponse" + } + }, + "page": { "type": "integer" }, - "today_transactions": { + "size": { "type": "integer" }, - "today_volume": { + "total": { + "type": "integer" + } + } + }, + "responses.WalletTransactionResponse": { + "type": "object", + "properties": { + "amount": { "type": "number" }, - "total_balance": { - "type": "number" + "api_call_id": { + "type": "string" }, - "total_wallets": { + "company_name": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "id": { + "type": "string" + }, + "product_id": { + "type": "string" + }, + "product_name": { + "type": "string" + }, + "transaction_id": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "user": { + "$ref": "#/definitions/tyapi-server_internal_application_finance_dto_responses.UserSimpleResponse" + }, + "user_id": { + "type": "string" + } + } + }, + "tyapi-server_internal_application_article_dto_commands.CreateCategoryCommand": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "description": { + "type": "string", + "maxLength": 200 + }, + "name": { + "type": "string", + "maxLength": 50, + "minLength": 1 + } + } + }, + "tyapi-server_internal_application_article_dto_commands.UpdateCategoryCommand": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "description": { + "type": "string", + "maxLength": 200 + }, + "name": { + "type": "string", + "maxLength": 50, + "minLength": 1 + } + } + }, + "tyapi-server_internal_application_article_dto_responses.CategoryInfoResponse": { + "type": "object", + "properties": { + "created_at": { + "type": "string" + }, + "description": { + "type": "string" + }, + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "sort_order": { "type": "integer" } } }, + "tyapi-server_internal_application_article_dto_responses.CategoryListResponse": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/tyapi-server_internal_application_article_dto_responses.CategoryInfoResponse" + } + }, + "total": { + "type": "integer" + } + } + }, + "tyapi-server_internal_application_finance_dto_responses.UserSimpleResponse": { + "type": "object", + "properties": { + "company_name": { + "type": "string" + }, + "id": { + "type": "string" + }, + "phone": { + "type": "string" + } + } + }, + "tyapi-server_internal_application_product_dto_commands.CreateCategoryCommand": { + "type": "object", + "required": [ + "code", + "name" + ], + "properties": { + "code": { + "type": "string" + }, + "description": { + "type": "string", + "maxLength": 200 + }, + "is_enabled": { + "type": "boolean" + }, + "is_visible": { + "type": "boolean" + }, + "name": { + "type": "string", + "maxLength": 50, + "minLength": 2 + }, + "sort": { + "type": "integer", + "maximum": 9999, + "minimum": 0 + } + } + }, + "tyapi-server_internal_application_product_dto_commands.UpdateCategoryCommand": { + "type": "object", + "required": [ + "code", + "name" + ], + "properties": { + "code": { + "type": "string" + }, + "description": { + "type": "string", + "maxLength": 200 + }, + "is_enabled": { + "type": "boolean" + }, + "is_visible": { + "type": "boolean" + }, + "name": { + "type": "string", + "maxLength": 50, + "minLength": 2 + }, + "sort": { + "type": "integer", + "maximum": 9999, + "minimum": 0 + } + } + }, + "tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse": { + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "description": { + "type": "string" + }, + "id": { + "type": "string" + }, + "is_enabled": { + "type": "boolean" + }, + "is_visible": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "sort": { + "type": "integer" + }, + "updated_at": { + "type": "string" + } + } + }, + "tyapi-server_internal_application_product_dto_responses.CategoryListResponse": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse" + } + }, + "page": { + "type": "integer" + }, + "size": { + "type": "integer" + }, + "total": { + "type": "integer" + } + } + }, + "tyapi-server_internal_application_product_dto_responses.UserSimpleResponse": { + "type": "object", + "properties": { + "company_name": { + "type": "string" + }, + "id": { + "type": "string" + }, + "phone": { + "type": "string" + } + } + }, "value_objects.ContractInfo": { "type": "object", "properties": { @@ -4227,16 +9788,12 @@ const docTemplate = `{ "value_objects.EnterpriseInfo": { "type": "object", "properties": { - "business_scope": { - "description": "经营范围", - "type": "string" - }, "company_name": { "description": "企业基本信息", "type": "string" }, - "establishment_date": { - "description": "成立日期", + "enterprise_address": { + "description": "企业地址(新增)", "type": "string" }, "legal_person_id": { @@ -4255,15 +9812,63 @@ const docTemplate = `{ "description": "企业详细信息", "type": "string" }, - "registered_capital": { - "description": "注册资本", - "type": "string" - }, "unified_social_code": { "description": "统一社会信用代码", "type": "string" } } + }, + "value_objects.InvoiceInfo": { + "type": "object", + "properties": { + "bank_account": { + "description": "基本开户账号", + "type": "string" + }, + "bank_name": { + "description": "基本开户银行", + "type": "string" + }, + "company_address": { + "description": "企业注册地址", + "type": "string" + }, + "company_name": { + "description": "公司名称", + "type": "string" + }, + "company_phone": { + "description": "企业注册电话", + "type": "string" + }, + "receiving_email": { + "description": "发票接收邮箱", + "type": "string" + }, + "taxpayer_id": { + "description": "纳税人识别号", + "type": "string" + } + } + }, + "value_objects.InvoiceType": { + "type": "string", + "enum": [ + "general", + "special" + ], + "x-enum-comments": { + "InvoiceTypeGeneral": "增值税普通发票 (普票)", + "InvoiceTypeSpecial": "增值税专用发票 (专票)" + }, + "x-enum-descriptions": [ + "增值税普通发票 (普票)", + "增值税专用发票 (专票)" + ], + "x-enum-varnames": [ + "InvoiceTypeGeneral", + "InvoiceTypeSpecial" + ] } }, "securityDefinitions": { diff --git a/docs/swagger/swagger.json b/docs/swagger/swagger.json index fb5566b..08be62b 100644 --- a/docs/swagger/swagger.json +++ b/docs/swagger/swagger.json @@ -17,6 +17,929 @@ "host": "localhost:8080", "basePath": "/", "paths": { + "/api/v1/:api_name": { + "post": { + "description": "统一API调用入口,参数加密传输", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "API调用" + ], + "summary": "API调用", + "parameters": [ + { + "description": "API调用请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.ApiCallCommand" + } + } + ], + "responses": { + "200": { + "description": "调用成功", + "schema": { + "$ref": "#/definitions/dto.ApiCallResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "$ref": "#/definitions/dto.ApiCallResponse" + } + }, + "401": { + "description": "未授权", + "schema": { + "$ref": "#/definitions/dto.ApiCallResponse" + } + }, + "429": { + "description": "请求过于频繁", + "schema": { + "$ref": "#/definitions/dto.ApiCallResponse" + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "$ref": "#/definitions/dto.ApiCallResponse" + } + } + } + } + }, + "/api/v1/admin/api-calls": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取API调用记录,支持筛选和分页", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "API管理" + ], + "summary": "获取管理端API调用记录", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "用户ID", + "name": "user_id", + "in": "query" + }, + { + "type": "string", + "description": "交易ID", + "name": "transaction_id", + "in": "query" + }, + { + "type": "string", + "description": "产品名称", + "name": "product_name", + "in": "query" + }, + { + "type": "string", + "description": "状态", + "name": "status", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "开始时间", + "name": "start_time", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "结束时间", + "name": "end_time", + "in": "query" + }, + { + "type": "string", + "description": "排序字段", + "name": "sort_by", + "in": "query" + }, + { + "enum": [ + "asc", + "desc" + ], + "type": "string", + "description": "排序方向", + "name": "sort_order", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取API调用记录成功", + "schema": { + "$ref": "#/definitions/dto.ApiCallListResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/article-categories": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "创建新的文章分类", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章分类管理" + ], + "summary": "创建分类", + "parameters": [ + { + "description": "创建分类请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/tyapi-server_internal_application_article_dto_commands.CreateCategoryCommand" + } + } + ], + "responses": { + "201": { + "description": "分类创建成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/article-categories/{id}": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "更新分类信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章分类管理" + ], + "summary": "更新分类", + "parameters": [ + { + "type": "string", + "description": "分类ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "更新分类请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/tyapi-server_internal_application_article_dto_commands.UpdateCategoryCommand" + } + } + ], + "responses": { + "200": { + "description": "分类更新成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "分类不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "delete": { + "security": [ + { + "Bearer": [] + } + ], + "description": "删除指定分类", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章分类管理" + ], + "summary": "删除分类", + "parameters": [ + { + "type": "string", + "description": "分类ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "分类删除成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "分类不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/article-tags": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "创建新的文章标签", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章标签管理" + ], + "summary": "创建标签", + "parameters": [ + { + "description": "创建标签请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.CreateTagCommand" + } + } + ], + "responses": { + "201": { + "description": "标签创建成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/article-tags/{id}": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "更新标签信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章标签管理" + ], + "summary": "更新标签", + "parameters": [ + { + "type": "string", + "description": "标签ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "更新标签请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.UpdateTagCommand" + } + } + ], + "responses": { + "200": { + "description": "标签更新成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "标签不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "delete": { + "security": [ + { + "Bearer": [] + } + ], + "description": "删除指定标签", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章标签管理" + ], + "summary": "删除标签", + "parameters": [ + { + "type": "string", + "description": "标签ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "标签删除成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "标签不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/articles/stats": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取文章相关统计数据", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章管理" + ], + "summary": "获取文章统计", + "responses": { + "200": { + "description": "获取统计成功", + "schema": { + "$ref": "#/definitions/responses.ArticleStatsResponse" + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/articles/{id}/schedule-publish": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "设置文章的定时发布时间", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章管理" + ], + "summary": "定时发布文章", + "parameters": [ + { + "type": "string", + "description": "文章ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "定时发布请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.SchedulePublishCommand" + } + } + ], + "responses": { + "200": { + "description": "定时发布设置成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "文章不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/invoices/pending": { + "get": { + "description": "管理员获取发票申请列表,支持状态和时间范围筛选", + "produces": [ + "application/json" + ], + "tags": [ + "管理员-发票管理" + ], + "summary": "获取发票申请列表", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "状态筛选:pending/completed/rejected", + "name": "status", + "in": "query" + }, + { + "type": "string", + "description": "开始时间 (格式: 2006-01-02 15:04:05)", + "name": "start_time", + "in": "query" + }, + { + "type": "string", + "description": "结束时间 (格式: 2006-01-02 15:04:05)", + "name": "end_time", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/interfaces.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.PendingApplicationsResponse" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, + "/api/v1/admin/invoices/{application_id}/approve": { + "post": { + "description": "管理员通过发票申请并上传发票文件", + "consumes": [ + "multipart/form-data" + ], + "produces": [ + "application/json" + ], + "tags": [ + "管理员-发票管理" + ], + "summary": "通过发票申请", + "parameters": [ + { + "type": "string", + "description": "申请ID", + "name": "application_id", + "in": "path", + "required": true + }, + { + "type": "file", + "description": "发票文件", + "name": "file", + "in": "formData", + "required": true + }, + { + "type": "string", + "description": "管理员备注", + "name": "admin_notes", + "in": "formData" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, + "/api/v1/admin/invoices/{application_id}/download": { + "get": { + "description": "管理员下载指定发票的文件", + "produces": [ + "application/octet-stream" + ], + "tags": [ + "管理员-发票管理" + ], + "summary": "管理员下载发票文件", + "parameters": [ + { + "type": "string", + "description": "申请ID", + "name": "application_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "file" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, + "/api/v1/admin/invoices/{application_id}/reject": { + "post": { + "description": "管理员拒绝发票申请", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "管理员-发票管理" + ], + "summary": "拒绝发票申请", + "parameters": [ + { + "type": "string", + "description": "申请ID", + "name": "application_id", + "in": "path", + "required": true + }, + { + "description": "拒绝申请请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/finance.RejectInvoiceRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, "/api/v1/admin/product-categories": { "get": { "security": [ @@ -55,7 +978,7 @@ "200": { "description": "获取分类列表成功", "schema": { - "$ref": "#/definitions/responses.CategoryListResponse" + "$ref": "#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryListResponse" } }, "400": { @@ -105,7 +1028,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/commands.CreateCategoryCommand" + "$ref": "#/definitions/tyapi-server_internal_application_product_dto_commands.CreateCategoryCommand" } } ], @@ -172,7 +1095,7 @@ "200": { "description": "获取分类详情成功", "schema": { - "$ref": "#/definitions/responses.CategoryInfoResponse" + "$ref": "#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse" } }, "400": { @@ -236,7 +1159,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/commands.UpdateCategoryCommand" + "$ref": "#/definitions/tyapi-server_internal_application_product_dto_commands.UpdateCategoryCommand" } } ], @@ -350,7 +1273,7 @@ "Bearer": [] } ], - "description": "管理员获取产品列表,支持筛选", + "description": "管理员获取产品列表,支持筛选和分页,包含所有产品(包括隐藏的)", "consumes": [ "application/json" ], @@ -388,10 +1311,38 @@ "name": "category_id", "in": "query" }, + { + "type": "boolean", + "description": "是否启用", + "name": "is_enabled", + "in": "query" + }, + { + "type": "boolean", + "description": "是否可见", + "name": "is_visible", + "in": "query" + }, + { + "type": "boolean", + "description": "是否组合包", + "name": "is_package", + "in": "query" + }, { "type": "string", - "description": "产品状态", - "name": "status", + "description": "排序字段", + "name": "sort_by", + "in": "query" + }, + { + "enum": [ + "asc", + "desc" + ], + "type": "string", + "description": "排序方向", + "name": "sort_order", "in": "query" } ], @@ -399,7 +1350,7 @@ "200": { "description": "获取产品列表成功", "schema": { - "$ref": "#/definitions/responses.ProductListResponse" + "$ref": "#/definitions/responses.ProductAdminListResponse" } }, "400": { @@ -485,6 +1436,89 @@ } } }, + "/api/v1/admin/products/available": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取可选作组合包子产品的产品列表", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "获取可选子产品列表", + "parameters": [ + { + "type": "string", + "description": "排除的组合包ID", + "name": "exclude_package_id", + "in": "query" + }, + { + "type": "string", + "description": "搜索关键词", + "name": "keyword", + "in": "query" + }, + { + "type": "string", + "description": "分类ID", + "name": "category_id", + "in": "query" + }, + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 20, + "description": "每页数量", + "name": "page_size", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取可选产品列表成功", + "schema": { + "$ref": "#/definitions/responses.ProductListResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, "/api/v1/admin/products/{id}": { "get": { "security": [ @@ -510,13 +1544,19 @@ "name": "id", "in": "path", "required": true + }, + { + "type": "boolean", + "description": "是否包含文档信息", + "name": "with_document", + "in": "query" } ], "responses": { "200": { "description": "获取产品详情成功", "schema": { - "$ref": "#/definitions/responses.ProductInfoResponse" + "$ref": "#/definitions/responses.ProductAdminInfoResponse" } }, "400": { @@ -687,6 +1727,995 @@ } } }, + "/api/v1/admin/products/{id}/api-config": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取产品的API配置信息,如果不存在则返回空配置", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "获取产品API配置", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "获取API配置成功", + "schema": { + "$ref": "#/definitions/responses.ProductApiConfigResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员更新产品的API配置", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "更新产品API配置", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "API配置信息", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/responses.ProductApiConfigResponse" + } + } + ], + "responses": { + "200": { + "description": "API配置更新成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品或配置不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员为产品创建API配置", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "创建产品API配置", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "API配置信息", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/responses.ProductApiConfigResponse" + } + } + ], + "responses": { + "201": { + "description": "API配置创建成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "409": { + "description": "API配置已存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "delete": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员删除产品的API配置", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "删除产品API配置", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "API配置删除成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品或API配置不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/products/{id}/documentation": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取产品的文档信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "获取产品文档", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "获取文档成功", + "schema": { + "$ref": "#/definitions/responses.DocumentationResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品或文档不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员创建或更新产品的文档信息,如果文档不存在则创建,存在则更新", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "创建或更新产品文档", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "文档信息", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.CreateDocumentationCommand" + } + } + ], + "responses": { + "200": { + "description": "文档操作成功", + "schema": { + "$ref": "#/definitions/responses.DocumentationResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "delete": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员删除产品的文档", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "删除产品文档", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "文档删除成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品或文档不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/products/{id}/package-items": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员向组合包添加子产品", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "添加组合包子产品", + "parameters": [ + { + "type": "string", + "description": "组合包ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "添加子产品命令", + "name": "command", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.AddPackageItemCommand" + } + } + ], + "responses": { + "200": { + "description": "添加成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/products/{id}/package-items/batch": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员批量更新组合包子产品配置", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "批量更新组合包子产品", + "parameters": [ + { + "type": "string", + "description": "组合包ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "批量更新命令", + "name": "command", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.UpdatePackageItemsCommand" + } + } + ], + "responses": { + "200": { + "description": "更新成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/products/{id}/package-items/reorder": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员重新排序组合包子产品", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "重新排序组合包子产品", + "parameters": [ + { + "type": "string", + "description": "组合包ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "重新排序命令", + "name": "command", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.ReorderPackageItemsCommand" + } + } + ], + "responses": { + "200": { + "description": "排序成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/products/{id}/package-items/{item_id}": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员更新组合包子产品信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "更新组合包子产品", + "parameters": [ + { + "type": "string", + "description": "组合包ID", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "子产品项目ID", + "name": "item_id", + "in": "path", + "required": true + }, + { + "description": "更新子产品命令", + "name": "command", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.UpdatePackageItemCommand" + } + } + ], + "responses": { + "200": { + "description": "更新成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "delete": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员从组合包移除子产品", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品管理" + ], + "summary": "移除组合包子产品", + "parameters": [ + { + "type": "string", + "description": "组合包ID", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "子产品项目ID", + "name": "item_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "移除成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/admin/recharge-records": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取充值记录,支持筛选和分页", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "财务管理" + ], + "summary": "获取管理端充值记录", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "用户ID", + "name": "user_id", + "in": "query" + }, + { + "enum": [ + "alipay", + "transfer", + "gift" + ], + "type": "string", + "description": "充值类型", + "name": "recharge_type", + "in": "query" + }, + { + "enum": [ + "pending", + "success", + "failed" + ], + "type": "string", + "description": "状态", + "name": "status", + "in": "query" + }, + { + "type": "string", + "description": "最小金额", + "name": "min_amount", + "in": "query" + }, + { + "type": "string", + "description": "最大金额", + "name": "max_amount", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "开始时间", + "name": "start_time", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "结束时间", + "name": "end_time", + "in": "query" + }, + { + "type": "string", + "description": "排序字段", + "name": "sort_by", + "in": "query" + }, + { + "enum": [ + "asc", + "desc" + ], + "type": "string", + "description": "排序方向", + "name": "sort_order", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取充值记录成功", + "schema": { + "$ref": "#/definitions/responses.RechargeRecordListResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, "/api/v1/admin/subscriptions": { "get": { "security": [ @@ -722,8 +2751,50 @@ }, { "type": "string", - "description": "订阅状态", - "name": "status", + "description": "搜索关键词", + "name": "keyword", + "in": "query" + }, + { + "type": "string", + "description": "企业名称", + "name": "company_name", + "in": "query" + }, + { + "type": "string", + "description": "产品名称", + "name": "product_name", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "订阅开始时间", + "name": "start_time", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "订阅结束时间", + "name": "end_time", + "in": "query" + }, + { + "type": "string", + "description": "排序字段", + "name": "sort_by", + "in": "query" + }, + { + "enum": [ + "asc", + "desc" + ], + "type": "string", + "description": "排序方向", + "name": "sort_order", "in": "query" } ], @@ -758,6 +2829,67 @@ } } }, + "/api/v1/admin/subscriptions/batch-update-prices": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员一键调整用户所有订阅的价格", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "订阅管理" + ], + "summary": "一键改价", + "parameters": [ + { + "description": "批量改价请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.BatchUpdateSubscriptionPricesCommand" + } + } + ], + "responses": { + "200": { + "description": "一键改价成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, "/api/v1/admin/subscriptions/stats": { "get": { "security": [ @@ -875,6 +3007,866 @@ } } }, + "/api/v1/admin/wallet-transactions": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取消费记录,支持筛选和分页", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "财务管理" + ], + "summary": "获取管理端消费记录", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "用户ID", + "name": "user_id", + "in": "query" + }, + { + "type": "string", + "description": "交易ID", + "name": "transaction_id", + "in": "query" + }, + { + "type": "string", + "description": "产品名称", + "name": "product_name", + "in": "query" + }, + { + "type": "string", + "description": "最小金额", + "name": "min_amount", + "in": "query" + }, + { + "type": "string", + "description": "最大金额", + "name": "max_amount", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "开始时间", + "name": "start_time", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "结束时间", + "name": "end_time", + "in": "query" + }, + { + "type": "string", + "description": "排序字段", + "name": "sort_by", + "in": "query" + }, + { + "enum": [ + "asc", + "desc" + ], + "type": "string", + "description": "排序方向", + "name": "sort_order", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取消费记录成功", + "schema": { + "$ref": "#/definitions/responses.WalletTransactionListResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/article-categories": { + "get": { + "description": "获取所有文章分类", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章分类" + ], + "summary": "获取分类列表", + "responses": { + "200": { + "description": "获取分类列表成功", + "schema": { + "$ref": "#/definitions/tyapi-server_internal_application_article_dto_responses.CategoryListResponse" + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/article-categories/{id}": { + "get": { + "description": "根据ID获取分类详情", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章分类" + ], + "summary": "获取分类详情", + "parameters": [ + { + "type": "string", + "description": "分类ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "获取分类详情成功", + "schema": { + "$ref": "#/definitions/tyapi-server_internal_application_article_dto_responses.CategoryInfoResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "分类不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/article-tags": { + "get": { + "description": "获取所有文章标签", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章标签" + ], + "summary": "获取标签列表", + "responses": { + "200": { + "description": "获取标签列表成功", + "schema": { + "$ref": "#/definitions/responses.TagListResponse" + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/article-tags/{id}": { + "get": { + "description": "根据ID获取标签详情", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章标签" + ], + "summary": "获取标签详情", + "parameters": [ + { + "type": "string", + "description": "标签ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "获取标签详情成功", + "schema": { + "$ref": "#/definitions/responses.TagInfoResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "标签不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/articles": { + "get": { + "description": "分页获取文章列表,支持多种筛选条件", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章管理" + ], + "summary": "获取文章列表", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "文章状态", + "name": "status", + "in": "query" + }, + { + "type": "string", + "description": "分类ID", + "name": "category_id", + "in": "query" + }, + { + "type": "string", + "description": "标签ID", + "name": "tag_id", + "in": "query" + }, + { + "type": "string", + "description": "标题关键词", + "name": "title", + "in": "query" + }, + { + "type": "string", + "description": "摘要关键词", + "name": "summary", + "in": "query" + }, + { + "type": "boolean", + "description": "是否推荐", + "name": "is_featured", + "in": "query" + }, + { + "type": "string", + "description": "排序字段", + "name": "order_by", + "in": "query" + }, + { + "type": "string", + "description": "排序方向", + "name": "order_dir", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取文章列表成功", + "schema": { + "$ref": "#/definitions/responses.ArticleListResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "创建新的文章", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章管理" + ], + "summary": "创建文章", + "parameters": [ + { + "description": "创建文章请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.CreateArticleCommand" + } + } + ], + "responses": { + "201": { + "description": "文章创建成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/articles/{id}": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "根据ID获取文章详情", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章管理" + ], + "summary": "获取文章详情", + "parameters": [ + { + "type": "string", + "description": "文章ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "获取文章详情成功", + "schema": { + "$ref": "#/definitions/responses.ArticleInfoResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "文章不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "更新文章信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章管理" + ], + "summary": "更新文章", + "parameters": [ + { + "type": "string", + "description": "文章ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "更新文章请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.UpdateArticleCommand" + } + } + ], + "responses": { + "200": { + "description": "文章更新成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "文章不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "delete": { + "security": [ + { + "Bearer": [] + } + ], + "description": "删除指定文章", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章管理" + ], + "summary": "删除文章", + "parameters": [ + { + "type": "string", + "description": "文章ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "文章删除成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "文章不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/articles/{id}/archive": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "将已发布文章归档", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章管理" + ], + "summary": "归档文章", + "parameters": [ + { + "type": "string", + "description": "文章ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "文章归档成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "文章不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/articles/{id}/featured": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "设置文章的推荐状态", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章管理" + ], + "summary": "设置推荐状态", + "parameters": [ + { + "type": "string", + "description": "文章ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "设置推荐状态请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.SetFeaturedCommand" + } + } + ], + "responses": { + "200": { + "description": "设置推荐状态成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "文章不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/articles/{id}/publish": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "将草稿文章发布", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文章管理" + ], + "summary": "发布文章", + "parameters": [ + { + "type": "string", + "description": "文章ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "文章发布成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "文章不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, "/api/v1/categories": { "get": { "description": "获取产品分类列表,支持筛选", @@ -920,7 +3912,7 @@ "200": { "description": "获取分类列表成功", "schema": { - "$ref": "#/definitions/responses.CategoryListResponse" + "$ref": "#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryListResponse" } }, "500": { @@ -959,7 +3951,7 @@ "200": { "description": "获取分类详情成功", "schema": { - "$ref": "#/definitions/responses.CategoryInfoResponse" + "$ref": "#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse" } }, "400": { @@ -1164,9 +4156,14 @@ } } }, - "/api/v1/certifications/callbacks": { + "/api/v1/certifications/confirm-auth": { "post": { - "description": "处理e签宝的企业认证和合同签署回调", + "security": [ + { + "Bearer": [] + } + ], + "description": "前端轮询确认企业认证是否完成", "consumes": [ "application/json" ], @@ -1176,23 +4173,23 @@ "tags": [ "认证管理" ], - "summary": "处理e签宝回调", + "summary": "前端确认认证状态", "parameters": [ { - "description": "e签宝回调数据", + "description": "确认状态请求", "name": "request", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/commands.EsignCallbackCommand" + "$ref": "#/definitions/queries.ConfirmAuthCommand" } } ], "responses": { "200": { - "description": "回调处理成功", + "description": "状态确认成功", "schema": { - "$ref": "#/definitions/responses.CallbackResponse" + "$ref": "#/definitions/responses.ConfirmAuthResponse" } }, "400": { @@ -1202,6 +4199,87 @@ "additionalProperties": true } }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "认证记录不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/certifications/confirm-sign": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "前端轮询确认合同签署是否完成", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "认证管理" + ], + "summary": "前端确认签署状态", + "parameters": [ + { + "description": "确认状态请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/queries.ConfirmSignCommand" + } + } + ], + "responses": { + "200": { + "description": "状态确认成功", + "schema": { + "$ref": "#/definitions/responses.ConfirmSignResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "认证记录不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, "500": { "description": "服务器内部错误", "schema": { @@ -1335,14 +4413,43 @@ } } }, - "/api/v1/finance/secrets": { - "get": { + "/api/v1/certifications/esign/callback": { + "post": { + "description": "处理e签宝的异步回调通知", + "consumes": [ + "application/json" + ], + "produces": [ + "text/plain" + ], + "tags": [ + "认证管理" + ], + "summary": "处理e签宝回调", + "responses": { + "200": { + "description": "success", + "schema": { + "type": "string" + } + }, + "400": { + "description": "fail", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/debug/event-system": { + "post": { "security": [ { "Bearer": [] } ], - "description": "获取当前用户的API访问密钥信息", + "description": "调试事件系统,用于测试事件触发和处理", "consumes": [ "application/json" ], @@ -1350,25 +4457,12 @@ "application/json" ], "tags": [ - "用户密钥管理" + "系统调试" ], - "summary": "获取用户密钥", + "summary": "调试事件系统", "responses": { "200": { - "description": "获取用户密钥成功", - "schema": { - "$ref": "#/definitions/responses.UserSecretsResponse" - } - }, - "401": { - "description": "未认证", - "schema": { - "type": "object", - "additionalProperties": true - } - }, - "404": { - "description": "密钥不存在", + "description": "调试成功", "schema": { "type": "object", "additionalProperties": true @@ -1382,14 +4476,16 @@ } } } - }, + } + }, + "/api/v1/decrypt": { "post": { "security": [ { "Bearer": [] } ], - "description": "为用户创建API访问密钥", + "description": "使用密钥解密加密的数据", "consumes": [ "application/json" ], @@ -1397,25 +4493,26 @@ "application/json" ], "tags": [ - "用户密钥管理" + "API调试" ], - "summary": "创建用户密钥", + "summary": "解密参数", "parameters": [ { - "description": "创建密钥请求", + "description": "解密请求", "name": "request", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/commands.CreateUserSecretsCommand" + "$ref": "#/definitions/commands.DecryptCommand" } } ], "responses": { - "201": { - "description": "用户密钥创建成功", + "200": { + "description": "解密成功", "schema": { - "$ref": "#/definitions/responses.UserSecretsResponse" + "type": "object", + "additionalProperties": true } }, "400": { @@ -1426,21 +4523,14 @@ } }, "401": { - "description": "未认证", - "schema": { - "type": "object", - "additionalProperties": true - } - }, - "409": { - "description": "密钥已存在", + "description": "未授权", "schema": { "type": "object", "additionalProperties": true } }, "500": { - "description": "服务器内部错误", + "description": "解密失败", "schema": { "type": "object", "additionalProperties": true @@ -1449,14 +4539,9 @@ } } }, - "/api/v1/finance/secrets/deactivate": { + "/api/v1/encrypt": { "post": { - "security": [ - { - "Bearer": [] - } - ], - "description": "停用用户的API访问密钥", + "description": "用于前端调试时加密API调用参数", "consumes": [ "application/json" ], @@ -1464,85 +4549,95 @@ "application/json" ], "tags": [ - "用户密钥管理" + "API调试" + ], + "summary": "加密参数", + "parameters": [ + { + "description": "加密请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commands.EncryptCommand" + } + } ], - "summary": "停用用户密钥", "responses": { "200": { - "description": "用户密钥停用成功", + "description": "加密成功", "schema": { - "type": "object", - "additionalProperties": true + "$ref": "#/definitions/dto.EncryptResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "$ref": "#/definitions/dto.EncryptResponse" } }, "401": { - "description": "未认证", + "description": "未授权", "schema": { - "type": "object", - "additionalProperties": true - } - }, - "404": { - "description": "密钥不存在", - "schema": { - "type": "object", - "additionalProperties": true - } - }, - "500": { - "description": "服务器内部错误", - "schema": { - "type": "object", - "additionalProperties": true + "$ref": "#/definitions/dto.EncryptResponse" } } } } }, - "/api/v1/finance/secrets/regenerate": { + "/api/v1/finance/alipay/callback": { "post": { - "security": [ - { - "Bearer": [] - } - ], - "description": "重新生成用户的API访问密钥", + "description": "处理支付宝异步支付通知", "consumes": [ - "application/json" + "application/x-www-form-urlencoded" ], "produces": [ - "application/json" + "text/plain" ], "tags": [ - "用户密钥管理" + "支付管理" ], - "summary": "重新生成访问密钥", + "summary": "支付宝支付回调", "responses": { "200": { - "description": "访问密钥重新生成成功", + "description": "success", "schema": { - "$ref": "#/definitions/responses.UserSecretsResponse" + "type": "string" } }, - "401": { - "description": "未认证", + "400": { + "description": "fail", "schema": { - "type": "object", - "additionalProperties": true + "type": "string" + } + } + } + } + }, + "/api/v1/finance/alipay/return": { + "get": { + "description": "处理支付宝同步支付通知,跳转到前端成功页面", + "consumes": [ + "application/x-www-form-urlencoded" + ], + "produces": [ + "text/html" + ], + "tags": [ + "支付管理" + ], + "summary": "支付宝同步回调", + "responses": { + "200": { + "description": "支付成功页面", + "schema": { + "type": "string" } }, - "404": { - "description": "密钥不存在", + "400": { + "description": "支付失败页面", "schema": { - "type": "object", - "additionalProperties": true - } - }, - "500": { - "description": "服务器内部错误", - "schema": { - "type": "object", - "additionalProperties": true + "type": "string" } } } @@ -1595,14 +4690,16 @@ } } } - }, - "put": { + } + }, + "/api/v1/finance/wallet/alipay-order-status": { + "get": { "security": [ { "Bearer": [] } ], - "description": "更新当前用户的钱包基本信息", + "description": "获取支付宝订单的当前状态,用于轮询查询", "consumes": [ "application/json" ], @@ -1612,24 +4709,21 @@ "tags": [ "钱包管理" ], - "summary": "更新钱包信息", + "summary": "获取支付宝订单状态", "parameters": [ { - "description": "更新钱包请求", - "name": "request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/commands.UpdateWalletCommand" - } + "type": "string", + "description": "商户订单号", + "name": "out_trade_no", + "in": "query", + "required": true } ], "responses": { "200": { - "description": "钱包更新成功", + "description": "获取订单状态成功", "schema": { - "type": "object", - "additionalProperties": true + "$ref": "#/definitions/responses.AlipayOrderStatusResponse" } }, "400": { @@ -1646,54 +4740,8 @@ "additionalProperties": true } }, - "500": { - "description": "服务器内部错误", - "schema": { - "type": "object", - "additionalProperties": true - } - } - } - }, - "post": { - "description": "为用户创建新的钱包账户", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "钱包管理" - ], - "summary": "创建钱包", - "parameters": [ - { - "description": "创建钱包请求", - "name": "request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/commands.CreateWalletCommand" - } - } - ], - "responses": { - "201": { - "description": "钱包创建成功", - "schema": { - "$ref": "#/definitions/responses.WalletResponse" - } - }, - "400": { - "description": "请求参数错误", - "schema": { - "type": "object", - "additionalProperties": true - } - }, - "409": { - "description": "钱包已存在", + "404": { + "description": "订单不存在", "schema": { "type": "object", "additionalProperties": true @@ -1709,14 +4757,14 @@ } } }, - "/api/v1/finance/wallet/recharge": { + "/api/v1/finance/wallet/alipay-recharge": { "post": { "security": [ { "Bearer": [] } ], - "description": "为钱包进行充值操作", + "description": "创建支付宝充值订单并返回支付链接", "consumes": [ "application/json" ], @@ -1726,7 +4774,7 @@ "tags": [ "钱包管理" ], - "summary": "钱包充值", + "summary": "创建支付宝充值订单", "parameters": [ { "description": "充值请求", @@ -1734,15 +4782,15 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/commands.RechargeWalletCommand" + "$ref": "#/definitions/commands.CreateAlipayRechargeCommand" } } ], "responses": { "200": { - "description": "充值成功", + "description": "创建充值订单成功", "schema": { - "$ref": "#/definitions/responses.TransactionResponse" + "$ref": "#/definitions/responses.AlipayRechargeOrderResponse" } }, "400": { @@ -1769,14 +4817,44 @@ } } }, - "/api/v1/finance/wallet/stats": { + "/api/v1/finance/wallet/recharge-config": { + "get": { + "description": "获取当前环境的充值配置信息(最低充值金额、最高充值金额等)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "钱包管理" + ], + "summary": "获取充值配置", + "responses": { + "200": { + "description": "获取充值配置成功", + "schema": { + "$ref": "#/definitions/responses.RechargeConfigResponse" + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/finance/wallet/transactions": { "get": { "security": [ { "Bearer": [] } ], - "description": "获取钱包相关的统计数据", + "description": "获取当前用户的钱包交易记录列表,支持分页和筛选", "consumes": [ "application/json" ], @@ -1786,65 +4864,64 @@ "tags": [ "钱包管理" ], - "summary": "获取钱包统计", - "responses": { - "200": { - "description": "获取钱包统计成功", - "schema": { - "$ref": "#/definitions/responses.WalletStatsResponse" - } - }, - "401": { - "description": "未认证", - "schema": { - "type": "object", - "additionalProperties": true - } - }, - "500": { - "description": "服务器内部错误", - "schema": { - "type": "object", - "additionalProperties": true - } - } - } - } - }, - "/api/v1/finance/wallet/transaction": { - "post": { - "security": [ - { - "Bearer": [] - } - ], - "description": "执行钱包内部交易操作", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "钱包管理" - ], - "summary": "钱包交易", + "summary": "获取用户钱包交易记录", "parameters": [ { - "description": "交易请求", - "name": "request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/commands.WalletTransactionCommand" - } + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "开始时间 (格式: 2006-01-02 15:04:05)", + "name": "start_time", + "in": "query" + }, + { + "type": "string", + "description": "结束时间 (格式: 2006-01-02 15:04:05)", + "name": "end_time", + "in": "query" + }, + { + "type": "string", + "description": "交易ID", + "name": "transaction_id", + "in": "query" + }, + { + "type": "string", + "description": "产品名称", + "name": "product_name", + "in": "query" + }, + { + "type": "string", + "description": "最小金额", + "name": "min_amount", + "in": "query" + }, + { + "type": "string", + "description": "最大金额", + "name": "max_amount", + "in": "query" } ], "responses": { "200": { - "description": "交易成功", + "description": "获取成功", "schema": { - "$ref": "#/definitions/responses.TransactionResponse" + "$ref": "#/definitions/responses.WalletTransactionListResponse" } }, "400": { @@ -1871,14 +4948,14 @@ } } }, - "/api/v1/finance/wallet/withdraw": { - "post": { + "/api/v1/form-config/{api_code}": { + "get": { "security": [ { "Bearer": [] } ], - "description": "从钱包进行提现操作", + "description": "获取指定API的表单配置,用于前端动态生成表单", "consumes": [ "application/json" ], @@ -1886,25 +4963,416 @@ "application/json" ], "tags": [ - "钱包管理" + "API调试" ], - "summary": "钱包提现", + "summary": "获取表单配置", "parameters": [ { - "description": "提现请求", + "type": "string", + "description": "API代码", + "name": "api_code", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "获取成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未授权", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "API接口不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/invoices/apply": { + "post": { + "description": "用户申请开票", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "发票管理" + ], + "summary": "申请开票", + "parameters": [ + { + "description": "申请开票请求", "name": "request", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/commands.WithdrawWalletCommand" + "$ref": "#/definitions/finance.ApplyInvoiceRequest" } } ], "responses": { "200": { - "description": "提现申请已提交", + "description": "OK", "schema": { - "$ref": "#/definitions/responses.TransactionResponse" + "allOf": [ + { + "$ref": "#/definitions/interfaces.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.InvoiceApplicationResponse" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, + "/api/v1/invoices/available-amount": { + "get": { + "description": "获取用户当前可开票的金额", + "produces": [ + "application/json" + ], + "tags": [ + "发票管理" + ], + "summary": "获取可开票金额", + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/interfaces.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.AvailableAmountResponse" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, + "/api/v1/invoices/info": { + "get": { + "description": "获取用户的发票信息", + "produces": [ + "application/json" + ], + "tags": [ + "发票管理" + ], + "summary": "获取用户发票信息", + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/interfaces.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.InvoiceInfoResponse" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + }, + "put": { + "description": "更新用户的发票信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "发票管理" + ], + "summary": "更新用户发票信息", + "parameters": [ + { + "description": "更新发票信息请求", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/finance.UpdateInvoiceInfoRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, + "/api/v1/invoices/records": { + "get": { + "description": "获取用户的开票记录列表", + "produces": [ + "application/json" + ], + "tags": [ + "发票管理" + ], + "summary": "获取用户开票记录", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "状态筛选", + "name": "status", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/interfaces.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.InvoiceRecordsResponse" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, + "/api/v1/invoices/{application_id}/download": { + "get": { + "description": "下载指定发票的文件", + "produces": [ + "application/octet-stream" + ], + "tags": [ + "发票管理" + ], + "summary": "下载发票文件", + "parameters": [ + { + "type": "string", + "description": "申请ID", + "name": "application_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "file" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, + "/api/v1/my/api-calls": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取当前用户的API调用记录列表,支持分页和筛选", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "API管理" + ], + "summary": "获取用户API调用记录", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "开始时间 (格式: 2006-01-02 15:04:05)", + "name": "start_time", + "in": "query" + }, + { + "type": "string", + "description": "结束时间 (格式: 2006-01-02 15:04:05)", + "name": "end_time", + "in": "query" + }, + { + "type": "string", + "description": "交易ID", + "name": "transaction_id", + "in": "query" + }, + { + "type": "string", + "description": "产品名称", + "name": "product_name", + "in": "query" + }, + { + "type": "string", + "description": "状态 (pending/success/failed)", + "name": "status", + "in": "query" + } + ], + "responses": { + "200": { + "description": "获取成功", + "schema": { + "$ref": "#/definitions/dto.ApiCallListResponse" } }, "400": { @@ -1966,8 +5434,28 @@ }, { "type": "string", - "description": "订阅状态", - "name": "status", + "description": "搜索关键词", + "name": "keyword", + "in": "query" + }, + { + "type": "string", + "description": "产品名称", + "name": "product_name", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "订阅开始时间", + "name": "start_time", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "订阅结束时间", + "name": "end_time", "in": "query" }, { @@ -2156,7 +5644,8 @@ "200": { "description": "获取使用情况成功", "schema": { - "$ref": "#/definitions/responses.SubscriptionUsageResponse" + "type": "object", + "additionalProperties": true } }, "400": { @@ -2190,9 +5679,68 @@ } } }, + "/api/v1/my/whitelist/{ip}": { + "delete": { + "security": [ + { + "Bearer": [] + } + ], + "description": "从当前用户的白名单中删除指定IP地址", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "API管理" + ], + "summary": "删除白名单IP", + "parameters": [ + { + "type": "string", + "description": "IP地址", + "name": "ip", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "删除白名单IP成功", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, "/api/v1/products": { "get": { - "description": "分页获取可用的产品列表,支持筛选", + "description": "分页获取可用的产品列表,支持筛选,默认只返回可见的产品", "consumes": [ "application/json" ], @@ -2230,18 +5778,6 @@ "name": "category_id", "in": "query" }, - { - "type": "number", - "description": "最低价格", - "name": "min_price", - "in": "query" - }, - { - "type": "number", - "description": "最高价格", - "name": "max_price", - "in": "query" - }, { "type": "boolean", "description": "是否启用", @@ -2260,6 +5796,12 @@ "name": "is_package", "in": "query" }, + { + "type": "boolean", + "description": "是否已订阅(需要认证)", + "name": "is_subscribed", + "in": "query" + }, { "type": "string", "description": "排序字段", @@ -2301,6 +5843,50 @@ } } }, + "/api/v1/products/code/{product_code}/api-config": { + "get": { + "description": "根据产品代码获取API配置信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品API配置" + ], + "summary": "根据产品代码获取API配置", + "parameters": [ + { + "type": "string", + "description": "产品代码", + "name": "product_code", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "获取成功", + "schema": { + "$ref": "#/definitions/responses.ProductApiConfigResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "404": { + "description": "配置不存在", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, "/api/v1/products/stats": { "get": { "description": "获取产品相关的统计信息", @@ -2333,7 +5919,7 @@ }, "/api/v1/products/{id}": { "get": { - "description": "根据产品ID获取产品详细信息", + "description": "获取产品详细信息,用户端只能查看可见的产品", "consumes": [ "application/json" ], @@ -2351,13 +5937,116 @@ "name": "id", "in": "path", "required": true + }, + { + "type": "boolean", + "description": "是否包含文档信息", + "name": "with_document", + "in": "query" } ], "responses": { "200": { "description": "获取产品详情成功", "schema": { - "$ref": "#/definitions/responses.ProductInfoResponse" + "$ref": "#/definitions/responses.ProductInfoWithDocumentResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "产品不存在或不可见", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/products/{id}/api-config": { + "get": { + "description": "根据产品ID获取API配置信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "产品API配置" + ], + "summary": "获取产品API配置", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "获取成功", + "schema": { + "$ref": "#/definitions/responses.ProductApiConfigResponse" + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + }, + "404": { + "description": "配置不存在", + "schema": { + "$ref": "#/definitions/interfaces.APIResponse" + } + } + } + } + }, + "/api/v1/products/{id}/documentation": { + "get": { + "description": "获取指定产品的文档信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "数据大厅" + ], + "summary": "获取产品文档", + "parameters": [ + { + "type": "string", + "description": "产品ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "获取产品文档成功", + "schema": { + "$ref": "#/definitions/responses.DocumentationResponse" } }, "400": { @@ -2450,6 +6139,233 @@ } } }, + "/api/v1/users/admin/list": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员查看用户列表,支持分页和筛选", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "用户管理" + ], + "summary": "管理员查看用户列表", + "parameters": [ + { + "type": "integer", + "default": 1, + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "手机号筛选", + "name": "phone", + "in": "query" + }, + { + "enum": [ + "user", + "admin" + ], + "type": "string", + "description": "用户类型筛选", + "name": "user_type", + "in": "query" + }, + { + "type": "boolean", + "description": "是否激活筛选", + "name": "is_active", + "in": "query" + }, + { + "type": "boolean", + "description": "是否已认证筛选", + "name": "is_certified", + "in": "query" + }, + { + "type": "string", + "description": "企业名称筛选", + "name": "company_name", + "in": "query" + }, + { + "type": "string", + "format": "date", + "description": "开始日期", + "name": "start_date", + "in": "query" + }, + { + "type": "string", + "format": "date", + "description": "结束日期", + "name": "end_date", + "in": "query" + } + ], + "responses": { + "200": { + "description": "用户列表", + "schema": { + "$ref": "#/definitions/responses.UserListResponse" + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "403": { + "description": "权限不足", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/users/admin/stats": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取用户相关的统计信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "用户管理" + ], + "summary": "获取用户统计信息", + "responses": { + "200": { + "description": "用户统计信息", + "schema": { + "$ref": "#/definitions/responses.UserStatsResponse" + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "403": { + "description": "权限不足", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/api/v1/users/admin/{user_id}": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "管理员获取指定用户的详细信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "用户管理" + ], + "summary": "管理员获取用户详情", + "parameters": [ + { + "type": "string", + "description": "用户ID", + "name": "user_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "用户详情", + "schema": { + "$ref": "#/definitions/responses.UserDetailResponse" + } + }, + "401": { + "description": "未认证", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "403": { + "description": "权限不足", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "用户不存在", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, "/api/v1/users/login-password": { "post": { "description": "使用手机号和密码进行用户登录,返回JWT令牌", @@ -2839,15 +6755,74 @@ } }, "definitions": { + "commands.AddPackageItemCommand": { + "type": "object", + "required": [ + "product_id" + ], + "properties": { + "product_id": { + "type": "string" + } + } + }, + "commands.ApiCallCommand": { + "type": "object", + "required": [ + "data" + ], + "properties": { + "data": { + "type": "string" + }, + "options": { + "$ref": "#/definitions/commands.ApiCallOptions" + } + } + }, + "commands.ApiCallOptions": { + "type": "object", + "properties": { + "is_debug": { + "description": "是否为调试调用", + "type": "boolean" + }, + "json": { + "description": "是否返回JSON格式", + "type": "boolean" + } + } + }, "commands.ApplyContractCommand": { "type": "object", "required": [ - "certification_id", "user_id" ], "properties": { - "certification_id": { + "user_id": { "type": "string" + } + } + }, + "commands.BatchUpdateSubscriptionPricesCommand": { + "type": "object", + "required": [ + "discount", + "scope", + "user_id" + ], + "properties": { + "discount": { + "type": "number", + "maximum": 10, + "minimum": 0.1 + }, + "scope": { + "type": "string", + "enum": [ + "undiscounted", + "all" + ] }, "user_id": { "type": "string" @@ -2884,35 +6859,94 @@ } } }, - "commands.CreateCategoryCommand": { + "commands.CreateAlipayRechargeCommand": { "type": "object", "required": [ - "code", - "name" + "amount", + "platform" ], "properties": { - "code": { + "amount": { + "description": "充值金额", "type": "string" }, - "description": { + "platform": { + "description": "支付平台:app/h5/pc", "type": "string", - "maxLength": 200 + "enum": [ + "app", + "h5", + "pc" + ] + } + } + }, + "commands.CreateArticleCommand": { + "type": "object", + "required": [ + "content", + "title" + ], + "properties": { + "category_id": { + "type": "string" }, - "is_enabled": { + "content": { + "type": "string" + }, + "cover_image": { + "type": "string" + }, + "is_featured": { "type": "boolean" }, - "is_visible": { - "type": "boolean" + "summary": { + "type": "string" }, - "name": { - "type": "string", - "maxLength": 50, - "minLength": 2 + "tag_ids": { + "type": "array", + "items": { + "type": "string" + } }, - "sort": { - "type": "integer", - "maximum": 9999, - "minimum": 0 + "title": { + "type": "string" + } + } + }, + "commands.CreateDocumentationCommand": { + "type": "object", + "required": [ + "basic_info", + "product_id", + "request_method", + "request_params", + "request_url" + ], + "properties": { + "basic_info": { + "type": "string" + }, + "error_codes": { + "type": "string" + }, + "product_id": { + "type": "string" + }, + "request_method": { + "type": "string" + }, + "request_params": { + "type": "string" + }, + "request_url": { + "type": "string" + }, + "response_example": { + "type": "string" + }, + "response_fields": { + "type": "string" } } }, @@ -2971,63 +7005,50 @@ } } }, - "commands.CreateUserSecretsCommand": { + "commands.CreateTagCommand": { "type": "object", "required": [ - "user_id" + "color", + "name" ], "properties": { - "expires_at": { + "color": { "type": "string" }, - "user_id": { - "type": "string" - } - } - }, - "commands.CreateWalletCommand": { - "type": "object", - "required": [ - "user_id" - ], - "properties": { - "user_id": { - "type": "string" - } - } - }, - "commands.EsignCallbackCommand": { - "type": "object", - "required": [ - "callback_type", - "certification_id", - "raw_data" - ], - "properties": { - "callback_type": { + "name": { "type": "string", - "enum": [ - "auth_result", - "sign_result", - "flow_status" - ] - }, - "certification_id": { + "maxLength": 30, + "minLength": 1 + } + } + }, + "commands.DecryptCommand": { + "type": "object", + "required": [ + "encrypted_data", + "secret_key" + ], + "properties": { + "encrypted_data": { "type": "string" }, - "headers": { + "secret_key": { + "type": "string" + } + } + }, + "commands.EncryptCommand": { + "type": "object", + "required": [ + "data", + "secret_key" + ], + "properties": { + "data": { "type": "object", - "additionalProperties": { - "type": "string" - } + "additionalProperties": true }, - "query_params": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "raw_data": { + "secret_key": { "type": "string" } } @@ -3070,18 +7091,19 @@ } } }, - "commands.RechargeWalletCommand": { + "commands.PackageItemData": { "type": "object", "required": [ - "amount", - "user_id" + "product_id", + "sort_order" ], "properties": { - "amount": { - "type": "number" - }, - "user_id": { + "product_id": { "type": "string" + }, + "sort_order": { + "type": "integer", + "minimum": 0 } } }, @@ -3113,6 +7135,20 @@ } } }, + "commands.ReorderPackageItemsCommand": { + "type": "object", + "required": [ + "item_ids" + ], + "properties": { + "item_ids": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, "commands.ResetPasswordCommand": { "description": "重置用户密码请求参数(忘记密码时使用)", "type": "object", @@ -3141,6 +7177,17 @@ } } }, + "commands.SchedulePublishCommand": { + "type": "object", + "required": [ + "scheduled_time" + ], + "properties": { + "scheduled_time": { + "type": "string" + } + } + }, "commands.SendCodeCommand": { "description": "发送短信验证码请求参数", "type": "object", @@ -3168,10 +7215,22 @@ } } }, + "commands.SetFeaturedCommand": { + "type": "object", + "required": [ + "is_featured" + ], + "properties": { + "is_featured": { + "type": "boolean" + } + } + }, "commands.SubmitEnterpriseInfoCommand": { "type": "object", "required": [ "company_name", + "enterprise_address", "legal_person_id", "legal_person_name", "legal_person_phone", @@ -3184,6 +7243,9 @@ "maxLength": 100, "minLength": 2 }, + "enterprise_address": { + "type": "string" + }, "legal_person_id": { "type": "string" }, @@ -3203,38 +7265,61 @@ } } }, - "commands.UpdateCategoryCommand": { + "commands.UpdateArticleCommand": { "type": "object", - "required": [ - "code", - "name" - ], "properties": { - "code": { + "category_id": { "type": "string" }, - "description": { - "type": "string", - "maxLength": 200 + "content": { + "type": "string" }, - "is_enabled": { + "cover_image": { + "type": "string" + }, + "is_featured": { "type": "boolean" }, - "is_visible": { - "type": "boolean" + "summary": { + "type": "string" }, - "name": { - "type": "string", - "maxLength": 50, - "minLength": 2 + "tag_ids": { + "type": "array", + "items": { + "type": "string" + } }, - "sort": { + "title": { + "type": "string" + } + } + }, + "commands.UpdatePackageItemCommand": { + "type": "object", + "required": [ + "sort_order" + ], + "properties": { + "sort_order": { "type": "integer", - "maximum": 9999, "minimum": 0 } } }, + "commands.UpdatePackageItemsCommand": { + "type": "object", + "required": [ + "items" + ], + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/commands.PackageItemData" + } + } + } + }, "commands.UpdateProductCommand": { "type": "object", "required": [ @@ -3299,43 +7384,290 @@ } } }, - "commands.UpdateWalletCommand": { + "commands.UpdateTagCommand": { "type": "object", "required": [ - "user_id" + "color", + "name" ], "properties": { - "balance": { + "color": { + "type": "string" + }, + "name": { + "type": "string", + "maxLength": 30, + "minLength": 1 + } + } + }, + "dto.ApiCallListResponse": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.ApiCallRecordResponse" + } + }, + "page": { + "type": "integer" + }, + "size": { + "type": "integer" + }, + "total": { + "type": "integer" + } + } + }, + "dto.ApiCallRecordResponse": { + "type": "object", + "properties": { + "access_id": { + "type": "string" + }, + "client_ip": { + "type": "string" + }, + "company_name": { + "type": "string" + }, + "cost": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "end_at": { + "type": "string" + }, + "error_msg": { + "type": "string" + }, + "error_type": { + "type": "string" + }, + "id": { + "type": "string" + }, + "product_id": { + "type": "string" + }, + "product_name": { + "type": "string" + }, + "start_at": { + "type": "string" + }, + "status": { + "type": "string" + }, + "transaction_id": { + "type": "string" + }, + "translated_error_msg": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "user": { + "$ref": "#/definitions/dto.UserSimpleResponse" + }, + "user_id": { + "type": "string" + } + } + }, + "dto.ApiCallResponse": { + "type": "object", + "properties": { + "code": { + "type": "integer" + }, + "data": { + "type": "string" + }, + "message": { + "type": "string" + }, + "transaction_id": { + "type": "string" + } + } + }, + "dto.AvailableAmountResponse": { + "type": "object", + "properties": { + "available_amount": { + "description": "可开票金额", "type": "number" }, - "is_active": { + "pending_applications": { + "description": "待处理申请金额", + "type": "number" + }, + "total_gifted": { + "description": "总赠送金额", + "type": "number" + }, + "total_invoiced": { + "description": "已开票金额", + "type": "number" + }, + "total_recharged": { + "description": "总充值金额", + "type": "number" + } + } + }, + "dto.EncryptResponse": { + "type": "object", + "properties": { + "encrypted_data": { + "type": "string" + } + } + }, + "dto.InvoiceApplicationResponse": { + "type": "object", + "properties": { + "amount": { + "type": "number" + }, + "created_at": { + "type": "string" + }, + "id": { + "type": "string" + }, + "invoice_info": { + "$ref": "#/definitions/value_objects.InvoiceInfo" + }, + "invoice_type": { + "$ref": "#/definitions/value_objects.InvoiceType" + }, + "status": { + "$ref": "#/definitions/entities.ApplicationStatus" + }, + "user_id": { + "type": "string" + } + } + }, + "dto.InvoiceInfoResponse": { + "type": "object", + "properties": { + "bank_account": { + "description": "用户可编辑", + "type": "string" + }, + "bank_name": { + "description": "用户可编辑", + "type": "string" + }, + "company_address": { + "description": "用户可编辑", + "type": "string" + }, + "company_name": { + "description": "从企业认证信息获取,只读", + "type": "string" + }, + "company_name_read_only": { + "description": "字段权限标识", "type": "boolean" }, - "user_id": { + "company_phone": { + "description": "用户可编辑", "type": "string" + }, + "is_complete": { + "type": "boolean" + }, + "missing_fields": { + "type": "array", + "items": { + "type": "string" + } + }, + "receiving_email": { + "description": "用户可编辑", + "type": "string" + }, + "taxpayer_id": { + "description": "从企业认证信息获取,只读", + "type": "string" + }, + "taxpayer_id_read_only": { + "description": "纳税人识别号是否只读", + "type": "boolean" } } }, - "commands.WalletTransactionCommand": { + "dto.InvoiceRecordResponse": { "type": "object", - "required": [ - "amount", - "from_user_id", - "to_user_id", - "user_id" - ], "properties": { "amount": { "type": "number" }, - "from_user_id": { + "bank_account": { + "description": "银行账号", "type": "string" }, - "notes": { - "type": "string", - "maxLength": 200 + "bank_name": { + "description": "开户银行", + "type": "string" }, - "to_user_id": { + "company_address": { + "description": "企业地址", + "type": "string" + }, + "company_name": { + "description": "开票信息(快照数据)", + "type": "string" + }, + "company_phone": { + "description": "企业电话", + "type": "string" + }, + "created_at": { + "type": "string" + }, + "file_name": { + "description": "文件信息", + "type": "string" + }, + "file_size": { + "type": "integer" + }, + "file_url": { + "type": "string" + }, + "id": { + "type": "string" + }, + "invoice_type": { + "$ref": "#/definitions/value_objects.InvoiceType" + }, + "processed_at": { + "description": "时间信息", + "type": "string" + }, + "receiving_email": { + "description": "接收邮箱", + "type": "string" + }, + "reject_reason": { + "description": "拒绝原因", + "type": "string" + }, + "status": { + "$ref": "#/definitions/entities.ApplicationStatus" + }, + "taxpayer_id": { + "description": "纳税人识别号", "type": "string" }, "user_id": { @@ -3343,21 +7675,148 @@ } } }, - "commands.WithdrawWalletCommand": { + "dto.InvoiceRecordsResponse": { + "type": "object", + "properties": { + "page": { + "type": "integer" + }, + "page_size": { + "type": "integer" + }, + "records": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.InvoiceRecordResponse" + } + }, + "total": { + "type": "integer" + }, + "total_pages": { + "type": "integer" + } + } + }, + "dto.PendingApplicationResponse": { "type": "object", - "required": [ - "amount", - "user_id" - ], "properties": { "amount": { "type": "number" }, + "bank_account": { + "type": "string" + }, + "bank_name": { + "type": "string" + }, + "company_address": { + "type": "string" + }, + "company_name": { + "type": "string" + }, + "company_phone": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "file_name": { + "type": "string" + }, + "file_size": { + "type": "integer" + }, + "file_url": { + "type": "string" + }, + "id": { + "type": "string" + }, + "invoice_type": { + "$ref": "#/definitions/value_objects.InvoiceType" + }, + "processed_at": { + "type": "string" + }, + "receiving_email": { + "type": "string" + }, + "reject_reason": { + "type": "string" + }, + "status": { + "$ref": "#/definitions/entities.ApplicationStatus" + }, + "taxpayer_id": { + "type": "string" + }, "user_id": { "type": "string" } } }, + "dto.PendingApplicationsResponse": { + "type": "object", + "properties": { + "applications": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.PendingApplicationResponse" + } + }, + "page": { + "type": "integer" + }, + "page_size": { + "type": "integer" + }, + "total": { + "type": "integer" + }, + "total_pages": { + "type": "integer" + } + } + }, + "dto.UserSimpleResponse": { + "type": "object", + "properties": { + "company_name": { + "type": "string" + }, + "id": { + "type": "string" + }, + "phone": { + "type": "string" + } + } + }, + "entities.ApplicationStatus": { + "type": "string", + "enum": [ + "pending", + "completed", + "rejected" + ], + "x-enum-comments": { + "ApplicationStatusCompleted": "已完成(已上传发票)", + "ApplicationStatusPending": "待处理", + "ApplicationStatusRejected": "已拒绝" + }, + "x-enum-descriptions": [ + "待处理", + "已完成(已上传发票)", + "已拒绝" + ], + "x-enum-varnames": [ + "ApplicationStatusPending", + "ApplicationStatusCompleted", + "ApplicationStatusRejected" + ] + }, "enums.CertificationStatus": { "type": "string", "enum": [ @@ -3366,26 +7825,40 @@ "enterprise_verified", "contract_applied", "contract_signed", + "completed", "info_rejected", "contract_rejected", "contract_expired" ], "x-enum-comments": { + "StatusCompleted": "认证完成", "StatusContractApplied": "已申请签署合同", "StatusContractExpired": "合同签署超时", "StatusContractRejected": "合同被拒签", - "StatusContractSigned": "已签署合同(认证完成)", + "StatusContractSigned": "已签署合同", "StatusEnterpriseVerified": "已企业认证", "StatusInfoRejected": "企业信息被拒绝", "StatusInfoSubmitted": "已提交企业信息", "StatusPending": "待认证" }, + "x-enum-descriptions": [ + "待认证", + "已提交企业信息", + "已企业认证", + "已申请签署合同", + "已签署合同", + "认证完成", + "企业信息被拒绝", + "合同被拒签", + "合同签署超时" + ], "x-enum-varnames": [ "StatusPending", "StatusInfoSubmitted", "StatusEnterpriseVerified", "StatusContractApplied", "StatusContractSigned", + "StatusCompleted", "StatusInfoRejected", "StatusContractRejected", "StatusContractExpired" @@ -3427,6 +7900,23 @@ "FailureReasonTimeout": "操作超时", "FailureReasonUnknownError": "未知错误" }, + "x-enum-descriptions": [ + "企业不存在", + "企业信息不匹配", + "企业状态异常", + "法定代表人信息不匹配", + "e签宝验证失败", + "证件信息无效", + "用户拒绝签署", + "合同签署超时", + "签署流程失败", + "合同生成失败", + "e签宝流程错误", + "系统错误", + "网络错误", + "操作超时", + "未知错误" + ], "x-enum-varnames": [ "FailureReasonEnterpriseNotExists", "FailureReasonEnterpriseInfoMismatch", @@ -3445,71 +7935,280 @@ "FailureReasonUnknownError" ] }, - "responses.CallbackResponse": { + "finance.ApplyInvoiceRequest": { + "type": "object", + "required": [ + "amount", + "invoice_type" + ], + "properties": { + "amount": { + "description": "开票金额", + "type": "string" + }, + "invoice_type": { + "description": "发票类型:general/special", + "type": "string" + } + } + }, + "finance.RejectInvoiceRequest": { + "type": "object", + "required": [ + "reason" + ], + "properties": { + "reason": { + "description": "拒绝原因", + "type": "string" + } + } + }, + "finance.UpdateInvoiceInfoRequest": { + "type": "object", + "required": [ + "receiving_email" + ], + "properties": { + "bank_account": { + "description": "银行账户", + "type": "string" + }, + "bank_name": { + "description": "银行名称", + "type": "string" + }, + "company_address": { + "description": "公司地址", + "type": "string" + }, + "company_name": { + "description": "公司名称(从企业认证信息获取,用户不可修改)", + "type": "string" + }, + "company_phone": { + "description": "企业注册电话", + "type": "string" + }, + "receiving_email": { + "description": "发票接收邮箱", + "type": "string" + }, + "taxpayer_id": { + "description": "纳税人识别号(从企业认证信息获取,用户不可修改)", + "type": "string" + } + } + }, + "interfaces.APIResponse": { "type": "object", "properties": { - "callback_type": { - "type": "string" - }, - "certification_id": { - "type": "string" - }, + "data": {}, + "errors": {}, "message": { "type": "string" }, - "new_status": { - "$ref": "#/definitions/enums.CertificationStatus" + "meta": { + "type": "object", + "additionalProperties": true }, - "old_status": { - "$ref": "#/definitions/enums.CertificationStatus" + "pagination": { + "$ref": "#/definitions/interfaces.PaginationMeta" }, - "processed_at": { + "request_id": { "type": "string" }, "success": { "type": "boolean" + }, + "timestamp": { + "type": "integer" } } }, - "responses.CategoryInfoResponse": { + "interfaces.PaginationMeta": { "type": "object", "properties": { - "code": { + "has_next": { + "type": "boolean" + }, + "has_prev": { + "type": "boolean" + }, + "page": { + "type": "integer" + }, + "page_size": { + "type": "integer" + }, + "total": { + "type": "integer" + }, + "total_pages": { + "type": "integer" + } + } + }, + "queries.ConfirmAuthCommand": { + "type": "object" + }, + "queries.ConfirmSignCommand": { + "type": "object" + }, + "responses.AlipayOrderStatusResponse": { + "type": "object", + "properties": { + "amount": { + "description": "订单金额", + "type": "number" + }, + "can_retry": { + "description": "是否可以重试", + "type": "boolean" + }, + "created_at": { + "description": "创建时间", + "type": "string" + }, + "error_code": { + "description": "错误码", + "type": "string" + }, + "error_message": { + "description": "错误信息", + "type": "string" + }, + "is_processing": { + "description": "是否处理中", + "type": "boolean" + }, + "notify_time": { + "description": "异步通知时间", + "type": "string" + }, + "out_trade_no": { + "description": "商户订单号", + "type": "string" + }, + "platform": { + "description": "支付平台", + "type": "string" + }, + "return_time": { + "description": "同步返回时间", + "type": "string" + }, + "status": { + "description": "订单状态", + "type": "string" + }, + "subject": { + "description": "订单标题", + "type": "string" + }, + "trade_no": { + "description": "支付宝交易号", + "type": "string" + }, + "updated_at": { + "description": "更新时间", + "type": "string" + } + } + }, + "responses.AlipayRechargeBonusRuleResponse": { + "type": "object", + "properties": { + "bonus_amount": { + "type": "number" + }, + "recharge_amount": { + "type": "number" + } + } + }, + "responses.AlipayRechargeOrderResponse": { + "type": "object", + "properties": { + "amount": { + "description": "充值金额", + "type": "number" + }, + "out_trade_no": { + "description": "商户订单号", + "type": "string" + }, + "pay_url": { + "description": "支付链接", + "type": "string" + }, + "platform": { + "description": "支付平台", + "type": "string" + }, + "subject": { + "description": "订单标题", + "type": "string" + } + } + }, + "responses.ArticleInfoResponse": { + "type": "object", + "properties": { + "category": { + "$ref": "#/definitions/tyapi-server_internal_application_article_dto_responses.CategoryInfoResponse" + }, + "category_id": { + "type": "string" + }, + "content": { + "type": "string" + }, + "cover_image": { "type": "string" }, "created_at": { "type": "string" }, - "description": { - "type": "string" - }, "id": { "type": "string" }, - "is_enabled": { + "is_featured": { "type": "boolean" }, - "is_visible": { - "type": "boolean" - }, - "name": { + "published_at": { "type": "string" }, - "sort": { - "type": "integer" + "status": { + "type": "string" + }, + "summary": { + "type": "string" + }, + "tags": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.TagInfoResponse" + } + }, + "title": { + "type": "string" }, "updated_at": { "type": "string" + }, + "view_count": { + "type": "integer" } } }, - "responses.CategoryListResponse": { + "responses.ArticleListResponse": { "type": "object", "properties": { "items": { "type": "array", "items": { - "$ref": "#/definitions/responses.CategoryInfoResponse" + "$ref": "#/definitions/responses.ArticleInfoResponse" } }, "page": { @@ -3523,6 +8222,26 @@ } } }, + "responses.ArticleStatsResponse": { + "type": "object", + "properties": { + "archived_articles": { + "type": "integer" + }, + "draft_articles": { + "type": "integer" + }, + "published_articles": { + "type": "integer" + }, + "total_articles": { + "type": "integer" + }, + "total_views": { + "type": "integer" + } + } + }, "responses.CategorySimpleResponse": { "type": "object", "properties": { @@ -3572,6 +8291,9 @@ "can_retry": { "type": "boolean" }, + "completed_at": { + "type": "string" + }, "contract_applied_at": { "type": "string" }, @@ -3660,6 +8382,53 @@ } } }, + "responses.ConfirmAuthResponse": { + "type": "object", + "properties": { + "reason": { + "type": "string" + }, + "status": { + "$ref": "#/definitions/enums.CertificationStatus" + } + } + }, + "responses.ConfirmSignResponse": { + "type": "object", + "properties": { + "reason": { + "type": "string" + }, + "status": { + "$ref": "#/definitions/enums.CertificationStatus" + } + } + }, + "responses.ContractInfoItem": { + "type": "object", + "properties": { + "contract_file_url": { + "type": "string" + }, + "contract_name": { + "type": "string" + }, + "contract_type": { + "description": "合同类型代码", + "type": "string" + }, + "contract_type_name": { + "description": "合同类型中文名称", + "type": "string" + }, + "created_at": { + "type": "string" + }, + "id": { + "type": "string" + } + } + }, "responses.ContractSignUrlResponse": { "type": "object", "properties": { @@ -3683,6 +8452,80 @@ } } }, + "responses.DocumentationResponse": { + "type": "object", + "properties": { + "basic_info": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "error_codes": { + "type": "string" + }, + "id": { + "type": "string" + }, + "product_id": { + "type": "string" + }, + "request_method": { + "type": "string" + }, + "request_params": { + "type": "string" + }, + "request_url": { + "type": "string" + }, + "response_example": { + "type": "string" + }, + "response_fields": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "version": { + "type": "string" + } + } + }, + "responses.EnterpriseInfoItem": { + "type": "object", + "properties": { + "company_name": { + "type": "string" + }, + "contracts": { + "description": "合同信息", + "type": "array", + "items": { + "$ref": "#/definitions/responses.ContractInfoItem" + } + }, + "created_at": { + "type": "string" + }, + "enterprise_address": { + "type": "string" + }, + "id": { + "type": "string" + }, + "legal_person_name": { + "type": "string" + }, + "legal_person_phone": { + "type": "string" + }, + "unified_social_code": { + "type": "string" + } + } + }, "responses.EnterpriseInfoResponse": { "description": "企业信息响应", "type": "object", @@ -3699,22 +8542,14 @@ "type": "string", "example": "2024-01-01T00:00:00Z" }, + "enterprise_address": { + "type": "string", + "example": "北京市朝阳区xxx街道xxx号" + }, "id": { "type": "string", "example": "123e4567-e89b-12d3-a456-426614174000" }, - "is_certified": { - "type": "boolean", - "example": false - }, - "is_face_verified": { - "type": "boolean", - "example": false - }, - "is_ocr_verified": { - "type": "boolean", - "example": false - }, "legal_person_id": { "type": "string", "example": "110101199001011234" @@ -3723,6 +8558,10 @@ "type": "string", "example": "张三" }, + "legal_person_phone": { + "type": "string", + "example": "13800138000" + }, "unified_social_code": { "type": "string", "example": "91110000123456789X" @@ -3758,6 +8597,159 @@ } } }, + "responses.PackageItemResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "price": { + "type": "number" + }, + "product_code": { + "type": "string" + }, + "product_id": { + "type": "string" + }, + "product_name": { + "type": "string" + }, + "sort_order": { + "type": "integer" + } + } + }, + "responses.ProductAdminInfoResponse": { + "type": "object", + "properties": { + "category": { + "description": "关联信息", + "allOf": [ + { + "$ref": "#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse" + } + ] + }, + "category_id": { + "type": "string" + }, + "code": { + "type": "string" + }, + "content": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "description": { + "type": "string" + }, + "documentation": { + "description": "文档信息", + "allOf": [ + { + "$ref": "#/definitions/responses.DocumentationResponse" + } + ] + }, + "id": { + "type": "string" + }, + "is_enabled": { + "type": "boolean" + }, + "is_package": { + "type": "boolean" + }, + "is_visible": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "old_id": { + "type": "string" + }, + "package_items": { + "description": "组合包信息", + "type": "array", + "items": { + "$ref": "#/definitions/responses.PackageItemResponse" + } + }, + "price": { + "type": "number" + }, + "seo_description": { + "type": "string" + }, + "seo_keywords": { + "type": "string" + }, + "seo_title": { + "description": "SEO信息", + "type": "string" + }, + "updated_at": { + "type": "string" + } + } + }, + "responses.ProductAdminListResponse": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.ProductAdminInfoResponse" + } + }, + "page": { + "type": "integer" + }, + "size": { + "type": "integer" + }, + "total": { + "type": "integer" + } + } + }, + "responses.ProductApiConfigResponse": { + "type": "object", + "properties": { + "created_at": { + "type": "string" + }, + "id": { + "type": "string" + }, + "product_id": { + "type": "string" + }, + "request_params": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.RequestParamResponse" + } + }, + "response_example": { + "type": "object", + "additionalProperties": true + }, + "response_fields": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.ResponseFieldResponse" + } + }, + "updated_at": { + "type": "string" + } + } + }, "responses.ProductInfoResponse": { "type": "object", "properties": { @@ -3765,7 +8757,7 @@ "description": "关联信息", "allOf": [ { - "$ref": "#/definitions/responses.CategoryInfoResponse" + "$ref": "#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse" } ] }, @@ -3793,12 +8785,94 @@ "is_package": { "type": "boolean" }, - "is_visible": { + "is_subscribed": { "type": "boolean" }, "name": { "type": "string" }, + "old_id": { + "type": "string" + }, + "package_items": { + "description": "组合包信息", + "type": "array", + "items": { + "$ref": "#/definitions/responses.PackageItemResponse" + } + }, + "price": { + "type": "number" + }, + "seo_description": { + "type": "string" + }, + "seo_keywords": { + "type": "string" + }, + "seo_title": { + "description": "SEO信息", + "type": "string" + }, + "updated_at": { + "type": "string" + } + } + }, + "responses.ProductInfoWithDocumentResponse": { + "type": "object", + "properties": { + "category": { + "description": "关联信息", + "allOf": [ + { + "$ref": "#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse" + } + ] + }, + "category_id": { + "type": "string" + }, + "code": { + "type": "string" + }, + "content": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "description": { + "type": "string" + }, + "documentation": { + "$ref": "#/definitions/responses.DocumentationResponse" + }, + "id": { + "type": "string" + }, + "is_enabled": { + "type": "boolean" + }, + "is_package": { + "type": "boolean" + }, + "is_subscribed": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "old_id": { + "type": "string" + }, + "package_items": { + "description": "组合包信息", + "type": "array", + "items": { + "$ref": "#/definitions/responses.PackageItemResponse" + } + }, "price": { "type": "number" }, @@ -3855,9 +8929,15 @@ "is_package": { "type": "boolean" }, + "is_subscribed": { + "type": "boolean" + }, "name": { "type": "string" }, + "old_id": { + "type": "string" + }, "price": { "type": "number" } @@ -3880,6 +8960,89 @@ } } }, + "responses.RechargeConfigResponse": { + "type": "object", + "properties": { + "alipay_recharge_bonus": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.AlipayRechargeBonusRuleResponse" + } + }, + "max_amount": { + "description": "最高充值金额", + "type": "string" + }, + "min_amount": { + "description": "最低充值金额", + "type": "string" + } + } + }, + "responses.RechargeRecordListResponse": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.RechargeRecordResponse" + } + }, + "page": { + "type": "integer" + }, + "size": { + "type": "integer" + }, + "total": { + "type": "integer" + } + } + }, + "responses.RechargeRecordResponse": { + "type": "object", + "properties": { + "alipay_order_id": { + "type": "string" + }, + "amount": { + "type": "number" + }, + "company_name": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "id": { + "type": "string" + }, + "notes": { + "type": "string" + }, + "operator_id": { + "type": "string" + }, + "recharge_type": { + "type": "string" + }, + "status": { + "type": "string" + }, + "transfer_order_id": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "user": { + "$ref": "#/definitions/tyapi-server_internal_application_finance_dto_responses.UserSimpleResponse" + }, + "user_id": { + "type": "string" + } + } + }, "responses.RegisterUserResponse": { "description": "用户注册成功响应", "type": "object", @@ -3894,6 +9057,55 @@ } } }, + "responses.RequestParamResponse": { + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "example": { + "type": "string" + }, + "field": { + "type": "string" + }, + "name": { + "type": "string" + }, + "required": { + "type": "boolean" + }, + "type": { + "type": "string" + }, + "validation": { + "type": "string" + } + } + }, + "responses.ResponseFieldResponse": { + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "example": { + "type": "string" + }, + "name": { + "type": "string" + }, + "path": { + "type": "string" + }, + "required": { + "type": "boolean" + }, + "type": { + "type": "string" + } + } + }, "responses.SubscriptionInfoResponse": { "type": "object", "properties": { @@ -3910,12 +9122,7 @@ "type": "number" }, "product": { - "description": "关联信息", - "allOf": [ - { - "$ref": "#/definitions/responses.ProductSimpleResponse" - } - ] + "$ref": "#/definitions/responses.ProductSimpleResponse" }, "product_id": { "type": "string" @@ -3923,6 +9130,14 @@ "updated_at": { "type": "string" }, + "user": { + "description": "关联信息", + "allOf": [ + { + "$ref": "#/definitions/tyapi-server_internal_application_product_dto_responses.UserSimpleResponse" + } + ] + }, "user_id": { "type": "string" } @@ -3959,46 +9174,148 @@ } } }, - "responses.SubscriptionUsageResponse": { + "responses.TagInfoResponse": { "type": "object", "properties": { - "api_used": { - "type": "integer" - }, - "id": { + "color": { "type": "string" }, - "product_id": { - "type": "string" - } - } - }, - "responses.TransactionResponse": { - "type": "object", - "properties": { - "amount": { - "type": "number" - }, "created_at": { "type": "string" }, - "from_balance": { - "type": "number" - }, - "from_user_id": { + "id": { "type": "string" }, - "notes": { + "name": { + "type": "string" + } + } + }, + "responses.TagListResponse": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.TagInfoResponse" + } + }, + "total": { + "type": "integer" + } + } + }, + "responses.UserDetailResponse": { + "type": "object", + "properties": { + "created_at": { "type": "string" }, - "to_balance": { - "type": "number" + "enterprise_info": { + "description": "企业信息", + "allOf": [ + { + "$ref": "#/definitions/responses.EnterpriseInfoItem" + } + ] }, - "to_user_id": { + "id": { "type": "string" }, - "transaction_id": { + "is_active": { + "type": "boolean" + }, + "is_certified": { + "type": "boolean" + }, + "last_login_at": { "type": "string" + }, + "login_count": { + "type": "integer" + }, + "phone": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "user_type": { + "type": "string" + }, + "username": { + "type": "string" + }, + "wallet_balance": { + "description": "钱包信息", + "type": "string" + } + } + }, + "responses.UserListItem": { + "type": "object", + "properties": { + "created_at": { + "type": "string" + }, + "enterprise_info": { + "description": "企业信息", + "allOf": [ + { + "$ref": "#/definitions/responses.EnterpriseInfoItem" + } + ] + }, + "id": { + "type": "string" + }, + "is_active": { + "type": "boolean" + }, + "is_certified": { + "type": "boolean" + }, + "last_login_at": { + "type": "string" + }, + "login_count": { + "type": "integer" + }, + "phone": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "user_type": { + "type": "string" + }, + "username": { + "type": "string" + }, + "wallet_balance": { + "description": "钱包信息", + "type": "string" + } + } + }, + "responses.UserListResponse": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.UserListItem" + } + }, + "page": { + "type": "integer" + }, + "size": { + "type": "integer" + }, + "total": { + "type": "integer" } } }, @@ -4061,35 +9378,17 @@ } } }, - "responses.UserSecretsResponse": { + "responses.UserStatsResponse": { "type": "object", "properties": { - "access_id": { - "type": "string" + "active_users": { + "type": "integer" }, - "access_key": { - "type": "string" + "certified_users": { + "type": "integer" }, - "created_at": { - "type": "string" - }, - "expires_at": { - "type": "string" - }, - "id": { - "type": "string" - }, - "is_active": { - "type": "boolean" - }, - "last_used_at": { - "type": "string" - }, - "updated_at": { - "type": "string" - }, - "user_id": { - "type": "string" + "total_users": { + "type": "integer" } } }, @@ -4099,6 +9398,10 @@ "balance": { "type": "number" }, + "balance_status": { + "description": "normal, low, arrears", + "type": "string" + }, "created_at": { "type": "string" }, @@ -4108,6 +9411,14 @@ "is_active": { "type": "boolean" }, + "is_arrears": { + "description": "是否欠费", + "type": "boolean" + }, + "is_low_balance": { + "description": "是否余额较低", + "type": "boolean" + }, "updated_at": { "type": "string" }, @@ -4116,26 +9427,276 @@ } } }, - "responses.WalletStatsResponse": { + "responses.WalletTransactionListResponse": { "type": "object", "properties": { - "active_wallets": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/responses.WalletTransactionResponse" + } + }, + "page": { "type": "integer" }, - "today_transactions": { + "size": { "type": "integer" }, - "today_volume": { + "total": { + "type": "integer" + } + } + }, + "responses.WalletTransactionResponse": { + "type": "object", + "properties": { + "amount": { "type": "number" }, - "total_balance": { - "type": "number" + "api_call_id": { + "type": "string" }, - "total_wallets": { + "company_name": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "id": { + "type": "string" + }, + "product_id": { + "type": "string" + }, + "product_name": { + "type": "string" + }, + "transaction_id": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "user": { + "$ref": "#/definitions/tyapi-server_internal_application_finance_dto_responses.UserSimpleResponse" + }, + "user_id": { + "type": "string" + } + } + }, + "tyapi-server_internal_application_article_dto_commands.CreateCategoryCommand": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "description": { + "type": "string", + "maxLength": 200 + }, + "name": { + "type": "string", + "maxLength": 50, + "minLength": 1 + } + } + }, + "tyapi-server_internal_application_article_dto_commands.UpdateCategoryCommand": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "description": { + "type": "string", + "maxLength": 200 + }, + "name": { + "type": "string", + "maxLength": 50, + "minLength": 1 + } + } + }, + "tyapi-server_internal_application_article_dto_responses.CategoryInfoResponse": { + "type": "object", + "properties": { + "created_at": { + "type": "string" + }, + "description": { + "type": "string" + }, + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "sort_order": { "type": "integer" } } }, + "tyapi-server_internal_application_article_dto_responses.CategoryListResponse": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/tyapi-server_internal_application_article_dto_responses.CategoryInfoResponse" + } + }, + "total": { + "type": "integer" + } + } + }, + "tyapi-server_internal_application_finance_dto_responses.UserSimpleResponse": { + "type": "object", + "properties": { + "company_name": { + "type": "string" + }, + "id": { + "type": "string" + }, + "phone": { + "type": "string" + } + } + }, + "tyapi-server_internal_application_product_dto_commands.CreateCategoryCommand": { + "type": "object", + "required": [ + "code", + "name" + ], + "properties": { + "code": { + "type": "string" + }, + "description": { + "type": "string", + "maxLength": 200 + }, + "is_enabled": { + "type": "boolean" + }, + "is_visible": { + "type": "boolean" + }, + "name": { + "type": "string", + "maxLength": 50, + "minLength": 2 + }, + "sort": { + "type": "integer", + "maximum": 9999, + "minimum": 0 + } + } + }, + "tyapi-server_internal_application_product_dto_commands.UpdateCategoryCommand": { + "type": "object", + "required": [ + "code", + "name" + ], + "properties": { + "code": { + "type": "string" + }, + "description": { + "type": "string", + "maxLength": 200 + }, + "is_enabled": { + "type": "boolean" + }, + "is_visible": { + "type": "boolean" + }, + "name": { + "type": "string", + "maxLength": 50, + "minLength": 2 + }, + "sort": { + "type": "integer", + "maximum": 9999, + "minimum": 0 + } + } + }, + "tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse": { + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "description": { + "type": "string" + }, + "id": { + "type": "string" + }, + "is_enabled": { + "type": "boolean" + }, + "is_visible": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "sort": { + "type": "integer" + }, + "updated_at": { + "type": "string" + } + } + }, + "tyapi-server_internal_application_product_dto_responses.CategoryListResponse": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse" + } + }, + "page": { + "type": "integer" + }, + "size": { + "type": "integer" + }, + "total": { + "type": "integer" + } + } + }, + "tyapi-server_internal_application_product_dto_responses.UserSimpleResponse": { + "type": "object", + "properties": { + "company_name": { + "type": "string" + }, + "id": { + "type": "string" + }, + "phone": { + "type": "string" + } + } + }, "value_objects.ContractInfo": { "type": "object", "properties": { @@ -4221,16 +9782,12 @@ "value_objects.EnterpriseInfo": { "type": "object", "properties": { - "business_scope": { - "description": "经营范围", - "type": "string" - }, "company_name": { "description": "企业基本信息", "type": "string" }, - "establishment_date": { - "description": "成立日期", + "enterprise_address": { + "description": "企业地址(新增)", "type": "string" }, "legal_person_id": { @@ -4249,15 +9806,63 @@ "description": "企业详细信息", "type": "string" }, - "registered_capital": { - "description": "注册资本", - "type": "string" - }, "unified_social_code": { "description": "统一社会信用代码", "type": "string" } } + }, + "value_objects.InvoiceInfo": { + "type": "object", + "properties": { + "bank_account": { + "description": "基本开户账号", + "type": "string" + }, + "bank_name": { + "description": "基本开户银行", + "type": "string" + }, + "company_address": { + "description": "企业注册地址", + "type": "string" + }, + "company_name": { + "description": "公司名称", + "type": "string" + }, + "company_phone": { + "description": "企业注册电话", + "type": "string" + }, + "receiving_email": { + "description": "发票接收邮箱", + "type": "string" + }, + "taxpayer_id": { + "description": "纳税人识别号", + "type": "string" + } + } + }, + "value_objects.InvoiceType": { + "type": "string", + "enum": [ + "general", + "special" + ], + "x-enum-comments": { + "InvoiceTypeGeneral": "增值税普通发票 (普票)", + "InvoiceTypeSpecial": "增值税专用发票 (专票)" + }, + "x-enum-descriptions": [ + "增值税普通发票 (普票)", + "增值税专用发票 (专票)" + ], + "x-enum-varnames": [ + "InvoiceTypeGeneral", + "InvoiceTypeSpecial" + ] } }, "securityDefinitions": { diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index e9a6558..d8d6951 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -1,13 +1,53 @@ basePath: / definitions: + commands.AddPackageItemCommand: + properties: + product_id: + type: string + required: + - product_id + type: object + commands.ApiCallCommand: + properties: + data: + type: string + options: + $ref: '#/definitions/commands.ApiCallOptions' + required: + - data + type: object + commands.ApiCallOptions: + properties: + is_debug: + description: 是否为调试调用 + type: boolean + json: + description: 是否返回JSON格式 + type: boolean + type: object commands.ApplyContractCommand: properties: - certification_id: + user_id: + type: string + required: + - user_id + type: object + commands.BatchUpdateSubscriptionPricesCommand: + properties: + discount: + maximum: 10 + minimum: 0.1 + type: number + scope: + enum: + - undiscounted + - all type: string user_id: type: string required: - - certification_id + - discount + - scope - user_id type: object commands.ChangePasswordCommand: @@ -33,28 +73,68 @@ definitions: - new_password - old_password type: object - commands.CreateCategoryCommand: + commands.CreateAlipayRechargeCommand: properties: - code: + amount: + description: 充值金额 type: string - description: - maxLength: 200 + platform: + description: 支付平台:app/h5/pc + enum: + - app + - h5 + - pc type: string - is_enabled: - type: boolean - is_visible: - type: boolean - name: - maxLength: 50 - minLength: 2 - type: string - sort: - maximum: 9999 - minimum: 0 - type: integer required: - - code - - name + - amount + - platform + type: object + commands.CreateArticleCommand: + properties: + category_id: + type: string + content: + type: string + cover_image: + type: string + is_featured: + type: boolean + summary: + type: string + tag_ids: + items: + type: string + type: array + title: + type: string + required: + - content + - title + type: object + commands.CreateDocumentationCommand: + properties: + basic_info: + type: string + error_codes: + type: string + product_id: + type: string + request_method: + type: string + request_params: + type: string + request_url: + type: string + response_example: + type: string + response_fields: + type: string + required: + - basic_info + - product_id + - request_method + - request_params + - request_url type: object commands.CreateProductCommand: properties: @@ -96,46 +176,38 @@ definitions: - code - name type: object - commands.CreateUserSecretsCommand: + commands.CreateTagCommand: properties: - expires_at: + color: type: string - user_id: + name: + maxLength: 30 + minLength: 1 type: string required: - - user_id + - color + - name type: object - commands.CreateWalletCommand: + commands.DecryptCommand: properties: - user_id: + encrypted_data: + type: string + secret_key: type: string required: - - user_id + - encrypted_data + - secret_key type: object - commands.EsignCallbackCommand: + commands.EncryptCommand: properties: - callback_type: - enum: - - auth_result - - sign_result - - flow_status - type: string - certification_id: - type: string - headers: - additionalProperties: - type: string + data: + additionalProperties: true type: object - query_params: - additionalProperties: - type: string - type: object - raw_data: + secret_key: type: string required: - - callback_type - - certification_id - - raw_data + - data + - secret_key type: object commands.LoginWithPasswordCommand: description: 使用密码进行用户登录请求参数 @@ -165,15 +237,16 @@ definitions: - code - phone type: object - commands.RechargeWalletCommand: + commands.PackageItemData: properties: - amount: - type: number - user_id: + product_id: type: string + sort_order: + minimum: 0 + type: integer required: - - amount - - user_id + - product_id + - sort_order type: object commands.RegisterUserCommand: description: 用户注册请求参数 @@ -196,6 +269,15 @@ definitions: - password - phone type: object + commands.ReorderPackageItemsCommand: + properties: + item_ids: + items: + type: string + type: array + required: + - item_ids + type: object commands.ResetPasswordCommand: description: 重置用户密码请求参数(忘记密码时使用) properties: @@ -217,6 +299,13 @@ definitions: - new_password - phone type: object + commands.SchedulePublishCommand: + properties: + scheduled_time: + type: string + required: + - scheduled_time + type: object commands.SendCodeCommand: description: 发送短信验证码请求参数 properties: @@ -238,12 +327,21 @@ definitions: - phone - scene type: object + commands.SetFeaturedCommand: + properties: + is_featured: + type: boolean + required: + - is_featured + type: object commands.SubmitEnterpriseInfoCommand: properties: company_name: maxLength: 100 minLength: 2 type: string + enterprise_address: + type: string legal_person_id: type: string legal_person_name: @@ -258,34 +356,48 @@ definitions: type: string required: - company_name + - enterprise_address - legal_person_id - legal_person_name - legal_person_phone - unified_social_code - verification_code type: object - commands.UpdateCategoryCommand: + commands.UpdateArticleCommand: properties: - code: + category_id: type: string - description: - maxLength: 200 + content: type: string - is_enabled: + cover_image: + type: string + is_featured: type: boolean - is_visible: - type: boolean - name: - maxLength: 50 - minLength: 2 + summary: type: string - sort: - maximum: 9999 + tag_ids: + items: + type: string + type: array + title: + type: string + type: object + commands.UpdatePackageItemCommand: + properties: + sort_order: minimum: 0 type: integer required: - - code - - name + - sort_order + type: object + commands.UpdatePackageItemsCommand: + properties: + items: + items: + $ref: '#/definitions/commands.PackageItemData' + type: array + required: + - items type: object commands.UpdateProductCommand: properties: @@ -333,46 +445,302 @@ definitions: minimum: 0 type: number type: object - commands.UpdateWalletCommand: + commands.UpdateTagCommand: properties: - balance: + color: + type: string + name: + maxLength: 30 + minLength: 1 + type: string + required: + - color + - name + type: object + dto.ApiCallListResponse: + properties: + items: + items: + $ref: '#/definitions/dto.ApiCallRecordResponse' + type: array + page: + type: integer + size: + type: integer + total: + type: integer + type: object + dto.ApiCallRecordResponse: + properties: + access_id: + type: string + client_ip: + type: string + company_name: + type: string + cost: + type: string + created_at: + type: string + end_at: + type: string + error_msg: + type: string + error_type: + type: string + id: + type: string + product_id: + type: string + product_name: + type: string + start_at: + type: string + status: + type: string + transaction_id: + type: string + translated_error_msg: + type: string + updated_at: + type: string + user: + $ref: '#/definitions/dto.UserSimpleResponse' + user_id: + type: string + type: object + dto.ApiCallResponse: + properties: + code: + type: integer + data: + type: string + message: + type: string + transaction_id: + type: string + type: object + dto.AvailableAmountResponse: + properties: + available_amount: + description: 可开票金额 type: number - is_active: + pending_applications: + description: 待处理申请金额 + type: number + total_gifted: + description: 总赠送金额 + type: number + total_invoiced: + description: 已开票金额 + type: number + total_recharged: + description: 总充值金额 + type: number + type: object + dto.EncryptResponse: + properties: + encrypted_data: + type: string + type: object + dto.InvoiceApplicationResponse: + properties: + amount: + type: number + created_at: + type: string + id: + type: string + invoice_info: + $ref: '#/definitions/value_objects.InvoiceInfo' + invoice_type: + $ref: '#/definitions/value_objects.InvoiceType' + status: + $ref: '#/definitions/entities.ApplicationStatus' + user_id: + type: string + type: object + dto.InvoiceInfoResponse: + properties: + bank_account: + description: 用户可编辑 + type: string + bank_name: + description: 用户可编辑 + type: string + company_address: + description: 用户可编辑 + type: string + company_name: + description: 从企业认证信息获取,只读 + type: string + company_name_read_only: + description: 字段权限标识 type: boolean - user_id: + company_phone: + description: 用户可编辑 type: string - required: - - user_id + is_complete: + type: boolean + missing_fields: + items: + type: string + type: array + receiving_email: + description: 用户可编辑 + type: string + taxpayer_id: + description: 从企业认证信息获取,只读 + type: string + taxpayer_id_read_only: + description: 纳税人识别号是否只读 + type: boolean type: object - commands.WalletTransactionCommand: + dto.InvoiceRecordResponse: properties: amount: type: number - from_user_id: + bank_account: + description: 银行账号 type: string - notes: - maxLength: 200 + bank_name: + description: 开户银行 type: string - to_user_id: + company_address: + description: 企业地址 + type: string + company_name: + description: 开票信息(快照数据) + type: string + company_phone: + description: 企业电话 + type: string + created_at: + type: string + file_name: + description: 文件信息 + type: string + file_size: + type: integer + file_url: + type: string + id: + type: string + invoice_type: + $ref: '#/definitions/value_objects.InvoiceType' + processed_at: + description: 时间信息 + type: string + receiving_email: + description: 接收邮箱 + type: string + reject_reason: + description: 拒绝原因 + type: string + status: + $ref: '#/definitions/entities.ApplicationStatus' + taxpayer_id: + description: 纳税人识别号 type: string user_id: type: string - required: - - amount - - from_user_id - - to_user_id - - user_id type: object - commands.WithdrawWalletCommand: + dto.InvoiceRecordsResponse: + properties: + page: + type: integer + page_size: + type: integer + records: + items: + $ref: '#/definitions/dto.InvoiceRecordResponse' + type: array + total: + type: integer + total_pages: + type: integer + type: object + dto.PendingApplicationResponse: properties: amount: type: number + bank_account: + type: string + bank_name: + type: string + company_address: + type: string + company_name: + type: string + company_phone: + type: string + created_at: + type: string + file_name: + type: string + file_size: + type: integer + file_url: + type: string + id: + type: string + invoice_type: + $ref: '#/definitions/value_objects.InvoiceType' + processed_at: + type: string + receiving_email: + type: string + reject_reason: + type: string + status: + $ref: '#/definitions/entities.ApplicationStatus' + taxpayer_id: + type: string user_id: type: string - required: - - amount - - user_id type: object + dto.PendingApplicationsResponse: + properties: + applications: + items: + $ref: '#/definitions/dto.PendingApplicationResponse' + type: array + page: + type: integer + page_size: + type: integer + total: + type: integer + total_pages: + type: integer + type: object + dto.UserSimpleResponse: + properties: + company_name: + type: string + id: + type: string + phone: + type: string + type: object + entities.ApplicationStatus: + enum: + - pending + - completed + - rejected + type: string + x-enum-comments: + ApplicationStatusCompleted: 已完成(已上传发票) + ApplicationStatusPending: 待处理 + ApplicationStatusRejected: 已拒绝 + x-enum-descriptions: + - 待处理 + - 已完成(已上传发票) + - 已拒绝 + x-enum-varnames: + - ApplicationStatusPending + - ApplicationStatusCompleted + - ApplicationStatusRejected enums.CertificationStatus: enum: - pending @@ -380,25 +748,38 @@ definitions: - enterprise_verified - contract_applied - contract_signed + - completed - info_rejected - contract_rejected - contract_expired type: string x-enum-comments: + StatusCompleted: 认证完成 StatusContractApplied: 已申请签署合同 StatusContractExpired: 合同签署超时 StatusContractRejected: 合同被拒签 - StatusContractSigned: 已签署合同(认证完成) + StatusContractSigned: 已签署合同 StatusEnterpriseVerified: 已企业认证 StatusInfoRejected: 企业信息被拒绝 StatusInfoSubmitted: 已提交企业信息 StatusPending: 待认证 + x-enum-descriptions: + - 待认证 + - 已提交企业信息 + - 已企业认证 + - 已申请签署合同 + - 已签署合同 + - 认证完成 + - 企业信息被拒绝 + - 合同被拒签 + - 合同签署超时 x-enum-varnames: - StatusPending - StatusInfoSubmitted - StatusEnterpriseVerified - StatusContractApplied - StatusContractSigned + - StatusCompleted - StatusInfoRejected - StatusContractRejected - StatusContractExpired @@ -436,6 +817,22 @@ definitions: FailureReasonSystemError: 系统错误 FailureReasonTimeout: 操作超时 FailureReasonUnknownError: 未知错误 + x-enum-descriptions: + - 企业不存在 + - 企业信息不匹配 + - 企业状态异常 + - 法定代表人信息不匹配 + - e签宝验证失败 + - 证件信息无效 + - 用户拒绝签署 + - 合同签署超时 + - 签署流程失败 + - 合同生成失败 + - e签宝流程错误 + - 系统错误 + - 网络错误 + - 操作超时 + - 未知错误 x-enum-varnames: - FailureReasonEnterpriseNotExists - FailureReasonEnterpriseInfoMismatch @@ -452,49 +849,197 @@ definitions: - FailureReasonNetworkError - FailureReasonTimeout - FailureReasonUnknownError - responses.CallbackResponse: + finance.ApplyInvoiceRequest: properties: - callback_type: + amount: + description: 开票金额 type: string - certification_id: + invoice_type: + description: 发票类型:general/special type: string + required: + - amount + - invoice_type + type: object + finance.RejectInvoiceRequest: + properties: + reason: + description: 拒绝原因 + type: string + required: + - reason + type: object + finance.UpdateInvoiceInfoRequest: + properties: + bank_account: + description: 银行账户 + type: string + bank_name: + description: 银行名称 + type: string + company_address: + description: 公司地址 + type: string + company_name: + description: 公司名称(从企业认证信息获取,用户不可修改) + type: string + company_phone: + description: 企业注册电话 + type: string + receiving_email: + description: 发票接收邮箱 + type: string + taxpayer_id: + description: 纳税人识别号(从企业认证信息获取,用户不可修改) + type: string + required: + - receiving_email + type: object + interfaces.APIResponse: + properties: + data: {} + errors: {} message: type: string - new_status: - $ref: '#/definitions/enums.CertificationStatus' - old_status: - $ref: '#/definitions/enums.CertificationStatus' - processed_at: + meta: + additionalProperties: true + type: object + pagination: + $ref: '#/definitions/interfaces.PaginationMeta' + request_id: type: string success: type: boolean + timestamp: + type: integer type: object - responses.CategoryInfoResponse: + interfaces.PaginationMeta: properties: - code: + has_next: + type: boolean + has_prev: + type: boolean + page: + type: integer + page_size: + type: integer + total: + type: integer + total_pages: + type: integer + type: object + queries.ConfirmAuthCommand: + type: object + queries.ConfirmSignCommand: + type: object + responses.AlipayOrderStatusResponse: + properties: + amount: + description: 订单金额 + type: number + can_retry: + description: 是否可以重试 + type: boolean + created_at: + description: 创建时间 + type: string + error_code: + description: 错误码 + type: string + error_message: + description: 错误信息 + type: string + is_processing: + description: 是否处理中 + type: boolean + notify_time: + description: 异步通知时间 + type: string + out_trade_no: + description: 商户订单号 + type: string + platform: + description: 支付平台 + type: string + return_time: + description: 同步返回时间 + type: string + status: + description: 订单状态 + type: string + subject: + description: 订单标题 + type: string + trade_no: + description: 支付宝交易号 + type: string + updated_at: + description: 更新时间 + type: string + type: object + responses.AlipayRechargeBonusRuleResponse: + properties: + bonus_amount: + type: number + recharge_amount: + type: number + type: object + responses.AlipayRechargeOrderResponse: + properties: + amount: + description: 充值金额 + type: number + out_trade_no: + description: 商户订单号 + type: string + pay_url: + description: 支付链接 + type: string + platform: + description: 支付平台 + type: string + subject: + description: 订单标题 + type: string + type: object + responses.ArticleInfoResponse: + properties: + category: + $ref: '#/definitions/tyapi-server_internal_application_article_dto_responses.CategoryInfoResponse' + category_id: + type: string + content: + type: string + cover_image: type: string created_at: type: string - description: - type: string id: type: string - is_enabled: + is_featured: type: boolean - is_visible: - type: boolean - name: + published_at: + type: string + status: + type: string + summary: + type: string + tags: + items: + $ref: '#/definitions/responses.TagInfoResponse' + type: array + title: type: string - sort: - type: integer updated_at: type: string + view_count: + type: integer type: object - responses.CategoryListResponse: + responses.ArticleListResponse: properties: items: items: - $ref: '#/definitions/responses.CategoryInfoResponse' + $ref: '#/definitions/responses.ArticleInfoResponse' type: array page: type: integer @@ -503,6 +1048,19 @@ definitions: total: type: integer type: object + responses.ArticleStatsResponse: + properties: + archived_articles: + type: integer + draft_articles: + type: integer + published_articles: + type: integer + total_articles: + type: integer + total_views: + type: integer + type: object responses.CategorySimpleResponse: properties: code: @@ -535,6 +1093,8 @@ definitions: type: array can_retry: type: boolean + completed_at: + type: string contract_applied_at: type: string contract_info: @@ -591,6 +1151,37 @@ definitions: user_id: type: string type: object + responses.ConfirmAuthResponse: + properties: + reason: + type: string + status: + $ref: '#/definitions/enums.CertificationStatus' + type: object + responses.ConfirmSignResponse: + properties: + reason: + type: string + status: + $ref: '#/definitions/enums.CertificationStatus' + type: object + responses.ContractInfoItem: + properties: + contract_file_url: + type: string + contract_name: + type: string + contract_type: + description: 合同类型代码 + type: string + contract_type_name: + description: 合同类型中文名称 + type: string + created_at: + type: string + id: + type: string + type: object responses.ContractSignUrlResponse: properties: certification_id: @@ -606,6 +1197,55 @@ definitions: next_action: type: string type: object + responses.DocumentationResponse: + properties: + basic_info: + type: string + created_at: + type: string + error_codes: + type: string + id: + type: string + product_id: + type: string + request_method: + type: string + request_params: + type: string + request_url: + type: string + response_example: + type: string + response_fields: + type: string + updated_at: + type: string + version: + type: string + type: object + responses.EnterpriseInfoItem: + properties: + company_name: + type: string + contracts: + description: 合同信息 + items: + $ref: '#/definitions/responses.ContractInfoItem' + type: array + created_at: + type: string + enterprise_address: + type: string + id: + type: string + legal_person_name: + type: string + legal_person_phone: + type: string + unified_social_code: + type: string + type: object responses.EnterpriseInfoResponse: description: 企业信息响应 properties: @@ -618,24 +1258,21 @@ definitions: created_at: example: "2024-01-01T00:00:00Z" type: string + enterprise_address: + example: 北京市朝阳区xxx街道xxx号 + type: string id: example: 123e4567-e89b-12d3-a456-426614174000 type: string - is_certified: - example: false - type: boolean - is_face_verified: - example: false - type: boolean - is_ocr_verified: - example: false - type: boolean legal_person_id: example: "110101199001011234" type: string legal_person_name: example: 张三 type: string + legal_person_phone: + example: "13800138000" + type: string unified_social_code: example: 91110000123456789X type: string @@ -661,11 +1298,110 @@ definitions: user: $ref: '#/definitions/responses.UserProfileResponse' type: object + responses.PackageItemResponse: + properties: + id: + type: string + price: + type: number + product_code: + type: string + product_id: + type: string + product_name: + type: string + sort_order: + type: integer + type: object + responses.ProductAdminInfoResponse: + properties: + category: + allOf: + - $ref: '#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse' + description: 关联信息 + category_id: + type: string + code: + type: string + content: + type: string + created_at: + type: string + description: + type: string + documentation: + allOf: + - $ref: '#/definitions/responses.DocumentationResponse' + description: 文档信息 + id: + type: string + is_enabled: + type: boolean + is_package: + type: boolean + is_visible: + type: boolean + name: + type: string + old_id: + type: string + package_items: + description: 组合包信息 + items: + $ref: '#/definitions/responses.PackageItemResponse' + type: array + price: + type: number + seo_description: + type: string + seo_keywords: + type: string + seo_title: + description: SEO信息 + type: string + updated_at: + type: string + type: object + responses.ProductAdminListResponse: + properties: + items: + items: + $ref: '#/definitions/responses.ProductAdminInfoResponse' + type: array + page: + type: integer + size: + type: integer + total: + type: integer + type: object + responses.ProductApiConfigResponse: + properties: + created_at: + type: string + id: + type: string + product_id: + type: string + request_params: + items: + $ref: '#/definitions/responses.RequestParamResponse' + type: array + response_example: + additionalProperties: true + type: object + response_fields: + items: + $ref: '#/definitions/responses.ResponseFieldResponse' + type: array + updated_at: + type: string + type: object responses.ProductInfoResponse: properties: category: allOf: - - $ref: '#/definitions/responses.CategoryInfoResponse' + - $ref: '#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse' description: 关联信息 category_id: type: string @@ -683,10 +1419,64 @@ definitions: type: boolean is_package: type: boolean - is_visible: + is_subscribed: type: boolean name: type: string + old_id: + type: string + package_items: + description: 组合包信息 + items: + $ref: '#/definitions/responses.PackageItemResponse' + type: array + price: + type: number + seo_description: + type: string + seo_keywords: + type: string + seo_title: + description: SEO信息 + type: string + updated_at: + type: string + type: object + responses.ProductInfoWithDocumentResponse: + properties: + category: + allOf: + - $ref: '#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse' + description: 关联信息 + category_id: + type: string + code: + type: string + content: + type: string + created_at: + type: string + description: + type: string + documentation: + $ref: '#/definitions/responses.DocumentationResponse' + id: + type: string + is_enabled: + type: boolean + is_package: + type: boolean + is_subscribed: + type: boolean + name: + type: string + old_id: + type: string + package_items: + description: 组合包信息 + items: + $ref: '#/definitions/responses.PackageItemResponse' + type: array price: type: number seo_description: @@ -724,8 +1514,12 @@ definitions: type: string is_package: type: boolean + is_subscribed: + type: boolean name: type: string + old_id: + type: string price: type: number type: object @@ -740,6 +1534,61 @@ definitions: visible_products: type: integer type: object + responses.RechargeConfigResponse: + properties: + alipay_recharge_bonus: + items: + $ref: '#/definitions/responses.AlipayRechargeBonusRuleResponse' + type: array + max_amount: + description: 最高充值金额 + type: string + min_amount: + description: 最低充值金额 + type: string + type: object + responses.RechargeRecordListResponse: + properties: + items: + items: + $ref: '#/definitions/responses.RechargeRecordResponse' + type: array + page: + type: integer + size: + type: integer + total: + type: integer + type: object + responses.RechargeRecordResponse: + properties: + alipay_order_id: + type: string + amount: + type: number + company_name: + type: string + created_at: + type: string + id: + type: string + notes: + type: string + operator_id: + type: string + recharge_type: + type: string + status: + type: string + transfer_order_id: + type: string + updated_at: + type: string + user: + $ref: '#/definitions/tyapi-server_internal_application_finance_dto_responses.UserSimpleResponse' + user_id: + type: string + type: object responses.RegisterUserResponse: description: 用户注册成功响应 properties: @@ -750,6 +1599,38 @@ definitions: example: "13800138000" type: string type: object + responses.RequestParamResponse: + properties: + description: + type: string + example: + type: string + field: + type: string + name: + type: string + required: + type: boolean + type: + type: string + validation: + type: string + type: object + responses.ResponseFieldResponse: + properties: + description: + type: string + example: + type: string + name: + type: string + path: + type: string + required: + type: boolean + type: + type: string + type: object responses.SubscriptionInfoResponse: properties: api_used: @@ -761,13 +1642,15 @@ definitions: price: type: number product: - allOf: - - $ref: '#/definitions/responses.ProductSimpleResponse' - description: 关联信息 + $ref: '#/definitions/responses.ProductSimpleResponse' product_id: type: string updated_at: type: string + user: + allOf: + - $ref: '#/definitions/tyapi-server_internal_application_product_dto_responses.UserSimpleResponse' + description: 关联信息 user_id: type: string type: object @@ -791,33 +1674,98 @@ definitions: total_subscriptions: type: integer type: object - responses.SubscriptionUsageResponse: + responses.TagInfoResponse: properties: - api_used: - type: integer - id: + color: type: string - product_id: - type: string - type: object - responses.TransactionResponse: - properties: - amount: - type: number created_at: type: string - from_balance: - type: number - from_user_id: + id: type: string - notes: + name: type: string - to_balance: - type: number - to_user_id: + type: object + responses.TagListResponse: + properties: + items: + items: + $ref: '#/definitions/responses.TagInfoResponse' + type: array + total: + type: integer + type: object + responses.UserDetailResponse: + properties: + created_at: type: string - transaction_id: + enterprise_info: + allOf: + - $ref: '#/definitions/responses.EnterpriseInfoItem' + description: 企业信息 + id: type: string + is_active: + type: boolean + is_certified: + type: boolean + last_login_at: + type: string + login_count: + type: integer + phone: + type: string + updated_at: + type: string + user_type: + type: string + username: + type: string + wallet_balance: + description: 钱包信息 + type: string + type: object + responses.UserListItem: + properties: + created_at: + type: string + enterprise_info: + allOf: + - $ref: '#/definitions/responses.EnterpriseInfoItem' + description: 企业信息 + id: + type: string + is_active: + type: boolean + is_certified: + type: boolean + last_login_at: + type: string + login_count: + type: integer + phone: + type: string + updated_at: + type: string + user_type: + type: string + username: + type: string + wallet_balance: + description: 钱包信息 + type: string + type: object + responses.UserListResponse: + properties: + items: + items: + $ref: '#/definitions/responses.UserListItem' + type: array + page: + type: integer + size: + type: integer + total: + type: integer type: object responses.UserProfileResponse: description: 用户基本信息 @@ -862,55 +1810,221 @@ definitions: example: admin type: string type: object - responses.UserSecretsResponse: + responses.UserStatsResponse: properties: - access_id: - type: string - access_key: - type: string - created_at: - type: string - expires_at: - type: string - id: - type: string - is_active: - type: boolean - last_used_at: - type: string - updated_at: - type: string - user_id: - type: string + active_users: + type: integer + certified_users: + type: integer + total_users: + type: integer type: object responses.WalletResponse: properties: balance: type: number + balance_status: + description: normal, low, arrears + type: string created_at: type: string id: type: string is_active: type: boolean + is_arrears: + description: 是否欠费 + type: boolean + is_low_balance: + description: 是否余额较低 + type: boolean updated_at: type: string user_id: type: string type: object - responses.WalletStatsResponse: + responses.WalletTransactionListResponse: properties: - active_wallets: + items: + items: + $ref: '#/definitions/responses.WalletTransactionResponse' + type: array + page: type: integer - today_transactions: + size: type: integer - today_volume: + total: + type: integer + type: object + responses.WalletTransactionResponse: + properties: + amount: type: number - total_balance: - type: number - total_wallets: + api_call_id: + type: string + company_name: + type: string + created_at: + type: string + id: + type: string + product_id: + type: string + product_name: + type: string + transaction_id: + type: string + updated_at: + type: string + user: + $ref: '#/definitions/tyapi-server_internal_application_finance_dto_responses.UserSimpleResponse' + user_id: + type: string + type: object + tyapi-server_internal_application_article_dto_commands.CreateCategoryCommand: + properties: + description: + maxLength: 200 + type: string + name: + maxLength: 50 + minLength: 1 + type: string + required: + - name + type: object + tyapi-server_internal_application_article_dto_commands.UpdateCategoryCommand: + properties: + description: + maxLength: 200 + type: string + name: + maxLength: 50 + minLength: 1 + type: string + required: + - name + type: object + tyapi-server_internal_application_article_dto_responses.CategoryInfoResponse: + properties: + created_at: + type: string + description: + type: string + id: + type: string + name: + type: string + sort_order: type: integer type: object + tyapi-server_internal_application_article_dto_responses.CategoryListResponse: + properties: + items: + items: + $ref: '#/definitions/tyapi-server_internal_application_article_dto_responses.CategoryInfoResponse' + type: array + total: + type: integer + type: object + tyapi-server_internal_application_finance_dto_responses.UserSimpleResponse: + properties: + company_name: + type: string + id: + type: string + phone: + type: string + type: object + tyapi-server_internal_application_product_dto_commands.CreateCategoryCommand: + properties: + code: + type: string + description: + maxLength: 200 + type: string + is_enabled: + type: boolean + is_visible: + type: boolean + name: + maxLength: 50 + minLength: 2 + type: string + sort: + maximum: 9999 + minimum: 0 + type: integer + required: + - code + - name + type: object + tyapi-server_internal_application_product_dto_commands.UpdateCategoryCommand: + properties: + code: + type: string + description: + maxLength: 200 + type: string + is_enabled: + type: boolean + is_visible: + type: boolean + name: + maxLength: 50 + minLength: 2 + type: string + sort: + maximum: 9999 + minimum: 0 + type: integer + required: + - code + - name + type: object + tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse: + properties: + code: + type: string + created_at: + type: string + description: + type: string + id: + type: string + is_enabled: + type: boolean + is_visible: + type: boolean + name: + type: string + sort: + type: integer + updated_at: + type: string + type: object + tyapi-server_internal_application_product_dto_responses.CategoryListResponse: + properties: + items: + items: + $ref: '#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse' + type: array + page: + type: integer + size: + type: integer + total: + type: integer + type: object + tyapi-server_internal_application_product_dto_responses.UserSimpleResponse: + properties: + company_name: + type: string + id: + type: string + phone: + type: string + type: object value_objects.ContractInfo: properties: contract_file_id: @@ -974,14 +2088,11 @@ definitions: type: object value_objects.EnterpriseInfo: properties: - business_scope: - description: 经营范围 - type: string company_name: description: 企业基本信息 type: string - establishment_date: - description: 成立日期 + enterprise_address: + description: 企业地址(新增) type: string legal_person_id: description: 法定代表人身份证号 @@ -995,13 +2106,48 @@ definitions: registered_address: description: 企业详细信息 type: string - registered_capital: - description: 注册资本 - type: string unified_social_code: description: 统一社会信用代码 type: string type: object + value_objects.InvoiceInfo: + properties: + bank_account: + description: 基本开户账号 + type: string + bank_name: + description: 基本开户银行 + type: string + company_address: + description: 企业注册地址 + type: string + company_name: + description: 公司名称 + type: string + company_phone: + description: 企业注册电话 + type: string + receiving_email: + description: 发票接收邮箱 + type: string + taxpayer_id: + description: 纳税人识别号 + type: string + type: object + value_objects.InvoiceType: + enum: + - general + - special + type: string + x-enum-comments: + InvoiceTypeGeneral: 增值税普通发票 (普票) + InvoiceTypeSpecial: 增值税专用发票 (专票) + x-enum-descriptions: + - 增值税普通发票 (普票) + - 增值税专用发票 (专票) + x-enum-varnames: + - InvoiceTypeGeneral + - InvoiceTypeSpecial host: localhost:8080 info: contact: @@ -1017,6 +2163,616 @@ info: title: TYAPI Server API version: "1.0" paths: + /api/v1/:api_name: + post: + consumes: + - application/json + description: 统一API调用入口,参数加密传输 + parameters: + - description: API调用请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/commands.ApiCallCommand' + produces: + - application/json + responses: + "200": + description: 调用成功 + schema: + $ref: '#/definitions/dto.ApiCallResponse' + "400": + description: 请求参数错误 + schema: + $ref: '#/definitions/dto.ApiCallResponse' + "401": + description: 未授权 + schema: + $ref: '#/definitions/dto.ApiCallResponse' + "429": + description: 请求过于频繁 + schema: + $ref: '#/definitions/dto.ApiCallResponse' + "500": + description: 服务器内部错误 + schema: + $ref: '#/definitions/dto.ApiCallResponse' + summary: API调用 + tags: + - API调用 + /api/v1/admin/api-calls: + get: + consumes: + - application/json + description: 管理员获取API调用记录,支持筛选和分页 + parameters: + - default: 1 + description: 页码 + in: query + name: page + type: integer + - default: 10 + description: 每页数量 + in: query + name: page_size + type: integer + - description: 用户ID + in: query + name: user_id + type: string + - description: 交易ID + in: query + name: transaction_id + type: string + - description: 产品名称 + in: query + name: product_name + type: string + - description: 状态 + in: query + name: status + type: string + - description: 开始时间 + format: date-time + in: query + name: start_time + type: string + - description: 结束时间 + format: date-time + in: query + name: end_time + type: string + - description: 排序字段 + in: query + name: sort_by + type: string + - description: 排序方向 + enum: + - asc + - desc + in: query + name: sort_order + type: string + produces: + - application/json + responses: + "200": + description: 获取API调用记录成功 + schema: + $ref: '#/definitions/dto.ApiCallListResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 获取管理端API调用记录 + tags: + - API管理 + /api/v1/admin/article-categories: + post: + consumes: + - application/json + description: 创建新的文章分类 + parameters: + - description: 创建分类请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/tyapi-server_internal_application_article_dto_commands.CreateCategoryCommand' + produces: + - application/json + responses: + "201": + description: 分类创建成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 创建分类 + tags: + - 文章分类管理 + /api/v1/admin/article-categories/{id}: + delete: + consumes: + - application/json + description: 删除指定分类 + parameters: + - description: 分类ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 分类删除成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 分类不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 删除分类 + tags: + - 文章分类管理 + put: + consumes: + - application/json + description: 更新分类信息 + parameters: + - description: 分类ID + in: path + name: id + required: true + type: string + - description: 更新分类请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/tyapi-server_internal_application_article_dto_commands.UpdateCategoryCommand' + produces: + - application/json + responses: + "200": + description: 分类更新成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 分类不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 更新分类 + tags: + - 文章分类管理 + /api/v1/admin/article-tags: + post: + consumes: + - application/json + description: 创建新的文章标签 + parameters: + - description: 创建标签请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/commands.CreateTagCommand' + produces: + - application/json + responses: + "201": + description: 标签创建成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 创建标签 + tags: + - 文章标签管理 + /api/v1/admin/article-tags/{id}: + delete: + consumes: + - application/json + description: 删除指定标签 + parameters: + - description: 标签ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 标签删除成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 标签不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 删除标签 + tags: + - 文章标签管理 + put: + consumes: + - application/json + description: 更新标签信息 + parameters: + - description: 标签ID + in: path + name: id + required: true + type: string + - description: 更新标签请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/commands.UpdateTagCommand' + produces: + - application/json + responses: + "200": + description: 标签更新成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 标签不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 更新标签 + tags: + - 文章标签管理 + /api/v1/admin/articles/{id}/schedule-publish: + post: + consumes: + - application/json + description: 设置文章的定时发布时间 + parameters: + - description: 文章ID + in: path + name: id + required: true + type: string + - description: 定时发布请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/commands.SchedulePublishCommand' + produces: + - application/json + responses: + "200": + description: 定时发布设置成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 文章不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 定时发布文章 + tags: + - 文章管理 + /api/v1/admin/articles/stats: + get: + consumes: + - application/json + description: 获取文章相关统计数据 + produces: + - application/json + responses: + "200": + description: 获取统计成功 + schema: + $ref: '#/definitions/responses.ArticleStatsResponse' + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 获取文章统计 + tags: + - 文章管理 + /api/v1/admin/invoices/{application_id}/approve: + post: + consumes: + - multipart/form-data + description: 管理员通过发票申请并上传发票文件 + parameters: + - description: 申请ID + in: path + name: application_id + required: true + type: string + - description: 发票文件 + in: formData + name: file + required: true + type: file + - description: 管理员备注 + in: formData + name: admin_notes + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/interfaces.APIResponse' + "400": + description: Bad Request + schema: + $ref: '#/definitions/interfaces.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/interfaces.APIResponse' + summary: 通过发票申请 + tags: + - 管理员-发票管理 + /api/v1/admin/invoices/{application_id}/download: + get: + description: 管理员下载指定发票的文件 + parameters: + - description: 申请ID + in: path + name: application_id + required: true + type: string + produces: + - application/octet-stream + responses: + "200": + description: OK + schema: + type: file + "400": + description: Bad Request + schema: + $ref: '#/definitions/interfaces.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/interfaces.APIResponse' + summary: 管理员下载发票文件 + tags: + - 管理员-发票管理 + /api/v1/admin/invoices/{application_id}/reject: + post: + consumes: + - application/json + description: 管理员拒绝发票申请 + parameters: + - description: 申请ID + in: path + name: application_id + required: true + type: string + - description: 拒绝申请请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/finance.RejectInvoiceRequest' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/interfaces.APIResponse' + "400": + description: Bad Request + schema: + $ref: '#/definitions/interfaces.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/interfaces.APIResponse' + summary: 拒绝发票申请 + tags: + - 管理员-发票管理 + /api/v1/admin/invoices/pending: + get: + description: 管理员获取发票申请列表,支持状态和时间范围筛选 + parameters: + - default: 1 + description: 页码 + in: query + name: page + type: integer + - default: 10 + description: 每页数量 + in: query + name: page_size + type: integer + - description: 状态筛选:pending/completed/rejected + in: query + name: status + type: string + - description: '开始时间 (格式: 2006-01-02 15:04:05)' + in: query + name: start_time + type: string + - description: '结束时间 (格式: 2006-01-02 15:04:05)' + in: query + name: end_time + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/interfaces.APIResponse' + - properties: + data: + $ref: '#/definitions/dto.PendingApplicationsResponse' + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/interfaces.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/interfaces.APIResponse' + summary: 获取发票申请列表 + tags: + - 管理员-发票管理 /api/v1/admin/product-categories: get: consumes: @@ -1039,7 +2795,7 @@ paths: "200": description: 获取分类列表成功 schema: - $ref: '#/definitions/responses.CategoryListResponse' + $ref: '#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryListResponse' "400": description: 请求参数错误 schema: @@ -1070,7 +2826,7 @@ paths: name: request required: true schema: - $ref: '#/definitions/commands.CreateCategoryCommand' + $ref: '#/definitions/tyapi-server_internal_application_product_dto_commands.CreateCategoryCommand' produces: - application/json responses: @@ -1159,7 +2915,7 @@ paths: "200": description: 获取分类详情成功 schema: - $ref: '#/definitions/responses.CategoryInfoResponse' + $ref: '#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse' "400": description: 请求参数错误 schema: @@ -1200,7 +2956,7 @@ paths: name: request required: true schema: - $ref: '#/definitions/commands.UpdateCategoryCommand' + $ref: '#/definitions/tyapi-server_internal_application_product_dto_commands.UpdateCategoryCommand' produces: - application/json responses: @@ -1238,7 +2994,7 @@ paths: get: consumes: - application/json - description: 管理员获取产品列表,支持筛选 + description: 管理员获取产品列表,支持筛选和分页,包含所有产品(包括隐藏的) parameters: - default: 1 description: 页码 @@ -1258,9 +3014,28 @@ paths: in: query name: category_id type: string - - description: 产品状态 + - description: 是否启用 in: query - name: status + name: is_enabled + type: boolean + - description: 是否可见 + in: query + name: is_visible + type: boolean + - description: 是否组合包 + in: query + name: is_package + type: boolean + - description: 排序字段 + in: query + name: sort_by + type: string + - description: 排序方向 + enum: + - asc + - desc + in: query + name: sort_order type: string produces: - application/json @@ -1268,7 +3043,7 @@ paths: "200": description: 获取产品列表成功 schema: - $ref: '#/definitions/responses.ProductListResponse' + $ref: '#/definitions/responses.ProductAdminListResponse' "400": description: 请求参数错误 schema: @@ -1382,13 +3157,17 @@ paths: name: id required: true type: string + - description: 是否包含文档信息 + in: query + name: with_document + type: boolean produces: - application/json responses: "200": description: 获取产品详情成功 schema: - $ref: '#/definitions/responses.ProductInfoResponse' + $ref: '#/definitions/responses.ProductAdminInfoResponse' "400": description: 请求参数错误 schema: @@ -1463,6 +3242,724 @@ paths: summary: 更新产品 tags: - 产品管理 + /api/v1/admin/products/{id}/api-config: + delete: + consumes: + - application/json + description: 管理员删除产品的API配置 + parameters: + - description: 产品ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: API配置删除成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 产品或API配置不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 删除产品API配置 + tags: + - 产品管理 + get: + consumes: + - application/json + description: 管理员获取产品的API配置信息,如果不存在则返回空配置 + parameters: + - description: 产品ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 获取API配置成功 + schema: + $ref: '#/definitions/responses.ProductApiConfigResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 产品不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 获取产品API配置 + tags: + - 产品管理 + post: + consumes: + - application/json + description: 管理员为产品创建API配置 + parameters: + - description: 产品ID + in: path + name: id + required: true + type: string + - description: API配置信息 + in: body + name: request + required: true + schema: + $ref: '#/definitions/responses.ProductApiConfigResponse' + produces: + - application/json + responses: + "201": + description: API配置创建成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "409": + description: API配置已存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 创建产品API配置 + tags: + - 产品管理 + put: + consumes: + - application/json + description: 管理员更新产品的API配置 + parameters: + - description: 产品ID + in: path + name: id + required: true + type: string + - description: API配置信息 + in: body + name: request + required: true + schema: + $ref: '#/definitions/responses.ProductApiConfigResponse' + produces: + - application/json + responses: + "200": + description: API配置更新成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 产品或配置不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 更新产品API配置 + tags: + - 产品管理 + /api/v1/admin/products/{id}/documentation: + delete: + consumes: + - application/json + description: 管理员删除产品的文档 + parameters: + - description: 产品ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 文档删除成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 产品或文档不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 删除产品文档 + tags: + - 产品管理 + get: + consumes: + - application/json + description: 管理员获取产品的文档信息 + parameters: + - description: 产品ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 获取文档成功 + schema: + $ref: '#/definitions/responses.DocumentationResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 产品或文档不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 获取产品文档 + tags: + - 产品管理 + post: + consumes: + - application/json + description: 管理员创建或更新产品的文档信息,如果文档不存在则创建,存在则更新 + parameters: + - description: 产品ID + in: path + name: id + required: true + type: string + - description: 文档信息 + in: body + name: request + required: true + schema: + $ref: '#/definitions/commands.CreateDocumentationCommand' + produces: + - application/json + responses: + "200": + description: 文档操作成功 + schema: + $ref: '#/definitions/responses.DocumentationResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 产品不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 创建或更新产品文档 + tags: + - 产品管理 + /api/v1/admin/products/{id}/package-items: + post: + consumes: + - application/json + description: 管理员向组合包添加子产品 + parameters: + - description: 组合包ID + in: path + name: id + required: true + type: string + - description: 添加子产品命令 + in: body + name: command + required: true + schema: + $ref: '#/definitions/commands.AddPackageItemCommand' + produces: + - application/json + responses: + "200": + description: 添加成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 产品不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 添加组合包子产品 + tags: + - 产品管理 + /api/v1/admin/products/{id}/package-items/{item_id}: + delete: + consumes: + - application/json + description: 管理员从组合包移除子产品 + parameters: + - description: 组合包ID + in: path + name: id + required: true + type: string + - description: 子产品项目ID + in: path + name: item_id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 移除成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 产品不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 移除组合包子产品 + tags: + - 产品管理 + put: + consumes: + - application/json + description: 管理员更新组合包子产品信息 + parameters: + - description: 组合包ID + in: path + name: id + required: true + type: string + - description: 子产品项目ID + in: path + name: item_id + required: true + type: string + - description: 更新子产品命令 + in: body + name: command + required: true + schema: + $ref: '#/definitions/commands.UpdatePackageItemCommand' + produces: + - application/json + responses: + "200": + description: 更新成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 产品不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 更新组合包子产品 + tags: + - 产品管理 + /api/v1/admin/products/{id}/package-items/batch: + put: + consumes: + - application/json + description: 管理员批量更新组合包子产品配置 + parameters: + - description: 组合包ID + in: path + name: id + required: true + type: string + - description: 批量更新命令 + in: body + name: command + required: true + schema: + $ref: '#/definitions/commands.UpdatePackageItemsCommand' + produces: + - application/json + responses: + "200": + description: 更新成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 产品不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 批量更新组合包子产品 + tags: + - 产品管理 + /api/v1/admin/products/{id}/package-items/reorder: + put: + consumes: + - application/json + description: 管理员重新排序组合包子产品 + parameters: + - description: 组合包ID + in: path + name: id + required: true + type: string + - description: 重新排序命令 + in: body + name: command + required: true + schema: + $ref: '#/definitions/commands.ReorderPackageItemsCommand' + produces: + - application/json + responses: + "200": + description: 排序成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 产品不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 重新排序组合包子产品 + tags: + - 产品管理 + /api/v1/admin/products/available: + get: + consumes: + - application/json + description: 管理员获取可选作组合包子产品的产品列表 + parameters: + - description: 排除的组合包ID + in: query + name: exclude_package_id + type: string + - description: 搜索关键词 + in: query + name: keyword + type: string + - description: 分类ID + in: query + name: category_id + type: string + - default: 1 + description: 页码 + in: query + name: page + type: integer + - default: 20 + description: 每页数量 + in: query + name: page_size + type: integer + produces: + - application/json + responses: + "200": + description: 获取可选产品列表成功 + schema: + $ref: '#/definitions/responses.ProductListResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 获取可选子产品列表 + tags: + - 产品管理 + /api/v1/admin/recharge-records: + get: + consumes: + - application/json + description: 管理员获取充值记录,支持筛选和分页 + parameters: + - default: 1 + description: 页码 + in: query + name: page + type: integer + - default: 10 + description: 每页数量 + in: query + name: page_size + type: integer + - description: 用户ID + in: query + name: user_id + type: string + - description: 充值类型 + enum: + - alipay + - transfer + - gift + in: query + name: recharge_type + type: string + - description: 状态 + enum: + - pending + - success + - failed + in: query + name: status + type: string + - description: 最小金额 + in: query + name: min_amount + type: string + - description: 最大金额 + in: query + name: max_amount + type: string + - description: 开始时间 + format: date-time + in: query + name: start_time + type: string + - description: 结束时间 + format: date-time + in: query + name: end_time + type: string + - description: 排序字段 + in: query + name: sort_by + type: string + - description: 排序方向 + enum: + - asc + - desc + in: query + name: sort_order + type: string + produces: + - application/json + responses: + "200": + description: 获取充值记录成功 + schema: + $ref: '#/definitions/responses.RechargeRecordListResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 获取管理端充值记录 + tags: + - 财务管理 /api/v1/admin/subscriptions: get: consumes: @@ -1479,9 +3976,38 @@ paths: in: query name: page_size type: integer - - description: 订阅状态 + - description: 搜索关键词 in: query - name: status + name: keyword + type: string + - description: 企业名称 + in: query + name: company_name + type: string + - description: 产品名称 + in: query + name: product_name + type: string + - description: 订阅开始时间 + format: date-time + in: query + name: start_time + type: string + - description: 订阅结束时间 + format: date-time + in: query + name: end_time + type: string + - description: 排序字段 + in: query + name: sort_by + type: string + - description: 排序方向 + enum: + - asc + - desc + in: query + name: sort_order type: string produces: - application/json @@ -1560,6 +4086,46 @@ paths: summary: 更新订阅价格 tags: - 订阅管理 + /api/v1/admin/subscriptions/batch-update-prices: + post: + consumes: + - application/json + description: 管理员一键调整用户所有订阅的价格 + parameters: + - description: 批量改价请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/commands.BatchUpdateSubscriptionPricesCommand' + produces: + - application/json + responses: + "200": + description: 一键改价成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 一键改价 + tags: + - 订阅管理 /api/v1/admin/subscriptions/stats: get: consumes: @@ -1587,6 +4153,582 @@ paths: summary: 获取订阅统计 tags: - 订阅管理 + /api/v1/admin/wallet-transactions: + get: + consumes: + - application/json + description: 管理员获取消费记录,支持筛选和分页 + parameters: + - default: 1 + description: 页码 + in: query + name: page + type: integer + - default: 10 + description: 每页数量 + in: query + name: page_size + type: integer + - description: 用户ID + in: query + name: user_id + type: string + - description: 交易ID + in: query + name: transaction_id + type: string + - description: 产品名称 + in: query + name: product_name + type: string + - description: 最小金额 + in: query + name: min_amount + type: string + - description: 最大金额 + in: query + name: max_amount + type: string + - description: 开始时间 + format: date-time + in: query + name: start_time + type: string + - description: 结束时间 + format: date-time + in: query + name: end_time + type: string + - description: 排序字段 + in: query + name: sort_by + type: string + - description: 排序方向 + enum: + - asc + - desc + in: query + name: sort_order + type: string + produces: + - application/json + responses: + "200": + description: 获取消费记录成功 + schema: + $ref: '#/definitions/responses.WalletTransactionListResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 获取管理端消费记录 + tags: + - 财务管理 + /api/v1/article-categories: + get: + consumes: + - application/json + description: 获取所有文章分类 + produces: + - application/json + responses: + "200": + description: 获取分类列表成功 + schema: + $ref: '#/definitions/tyapi-server_internal_application_article_dto_responses.CategoryListResponse' + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + summary: 获取分类列表 + tags: + - 文章分类 + /api/v1/article-categories/{id}: + get: + consumes: + - application/json + description: 根据ID获取分类详情 + parameters: + - description: 分类ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 获取分类详情成功 + schema: + $ref: '#/definitions/tyapi-server_internal_application_article_dto_responses.CategoryInfoResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "404": + description: 分类不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + summary: 获取分类详情 + tags: + - 文章分类 + /api/v1/article-tags: + get: + consumes: + - application/json + description: 获取所有文章标签 + produces: + - application/json + responses: + "200": + description: 获取标签列表成功 + schema: + $ref: '#/definitions/responses.TagListResponse' + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + summary: 获取标签列表 + tags: + - 文章标签 + /api/v1/article-tags/{id}: + get: + consumes: + - application/json + description: 根据ID获取标签详情 + parameters: + - description: 标签ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 获取标签详情成功 + schema: + $ref: '#/definitions/responses.TagInfoResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "404": + description: 标签不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + summary: 获取标签详情 + tags: + - 文章标签 + /api/v1/articles: + get: + consumes: + - application/json + description: 分页获取文章列表,支持多种筛选条件 + parameters: + - default: 1 + description: 页码 + in: query + name: page + type: integer + - default: 10 + description: 每页数量 + in: query + name: page_size + type: integer + - description: 文章状态 + in: query + name: status + type: string + - description: 分类ID + in: query + name: category_id + type: string + - description: 标签ID + in: query + name: tag_id + type: string + - description: 标题关键词 + in: query + name: title + type: string + - description: 摘要关键词 + in: query + name: summary + type: string + - description: 是否推荐 + in: query + name: is_featured + type: boolean + - description: 排序字段 + in: query + name: order_by + type: string + - description: 排序方向 + in: query + name: order_dir + type: string + produces: + - application/json + responses: + "200": + description: 获取文章列表成功 + schema: + $ref: '#/definitions/responses.ArticleListResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + summary: 获取文章列表 + tags: + - 文章管理 + post: + consumes: + - application/json + description: 创建新的文章 + parameters: + - description: 创建文章请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/commands.CreateArticleCommand' + produces: + - application/json + responses: + "201": + description: 文章创建成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 创建文章 + tags: + - 文章管理 + /api/v1/articles/{id}: + delete: + consumes: + - application/json + description: 删除指定文章 + parameters: + - description: 文章ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 文章删除成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 文章不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 删除文章 + tags: + - 文章管理 + get: + consumes: + - application/json + description: 根据ID获取文章详情 + parameters: + - description: 文章ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 获取文章详情成功 + schema: + $ref: '#/definitions/responses.ArticleInfoResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 文章不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 获取文章详情 + tags: + - 文章管理 + put: + consumes: + - application/json + description: 更新文章信息 + parameters: + - description: 文章ID + in: path + name: id + required: true + type: string + - description: 更新文章请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/commands.UpdateArticleCommand' + produces: + - application/json + responses: + "200": + description: 文章更新成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 文章不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 更新文章 + tags: + - 文章管理 + /api/v1/articles/{id}/archive: + post: + consumes: + - application/json + description: 将已发布文章归档 + parameters: + - description: 文章ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 文章归档成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 文章不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 归档文章 + tags: + - 文章管理 + /api/v1/articles/{id}/featured: + put: + consumes: + - application/json + description: 设置文章的推荐状态 + parameters: + - description: 文章ID + in: path + name: id + required: true + type: string + - description: 设置推荐状态请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/commands.SetFeaturedCommand' + produces: + - application/json + responses: + "200": + description: 设置推荐状态成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 文章不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 设置推荐状态 + tags: + - 文章管理 + /api/v1/articles/{id}/publish: + post: + consumes: + - application/json + description: 将草稿文章发布 + parameters: + - description: 文章ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 文章发布成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 文章不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 发布文章 + tags: + - 文章管理 /api/v1/categories: get: consumes: @@ -1617,7 +4759,7 @@ paths: "200": description: 获取分类列表成功 schema: - $ref: '#/definitions/responses.CategoryListResponse' + $ref: '#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryListResponse' "500": description: 服务器内部错误 schema: @@ -1643,7 +4785,7 @@ paths: "200": description: 获取分类详情成功 schema: - $ref: '#/definitions/responses.CategoryInfoResponse' + $ref: '#/definitions/tyapi-server_internal_application_product_dto_responses.CategoryInfoResponse' "400": description: 请求参数错误 schema: @@ -1780,36 +4922,92 @@ paths: summary: 申请合同签署 tags: - 认证管理 - /api/v1/certifications/callbacks: + /api/v1/certifications/confirm-auth: post: consumes: - application/json - description: 处理e签宝的企业认证和合同签署回调 + description: 前端轮询确认企业认证是否完成 parameters: - - description: e签宝回调数据 + - description: 确认状态请求 in: body name: request required: true schema: - $ref: '#/definitions/commands.EsignCallbackCommand' + $ref: '#/definitions/queries.ConfirmAuthCommand' produces: - application/json responses: "200": - description: 回调处理成功 + description: 状态确认成功 schema: - $ref: '#/definitions/responses.CallbackResponse' + $ref: '#/definitions/responses.ConfirmAuthResponse' "400": description: 请求参数错误 schema: additionalProperties: true type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 认证记录不存在 + schema: + additionalProperties: true + type: object "500": description: 服务器内部错误 schema: additionalProperties: true type: object - summary: 处理e签宝回调 + security: + - Bearer: [] + summary: 前端确认认证状态 + tags: + - 认证管理 + /api/v1/certifications/confirm-sign: + post: + consumes: + - application/json + description: 前端轮询确认合同签署是否完成 + parameters: + - description: 确认状态请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/queries.ConfirmSignCommand' + produces: + - application/json + responses: + "200": + description: 状态确认成功 + schema: + $ref: '#/definitions/responses.ConfirmSignResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "404": + description: 认证记录不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 前端确认签署状态 tags: - 认证管理 /api/v1/certifications/details: @@ -1893,25 +5091,35 @@ paths: summary: 提交企业信息 tags: - 认证管理 - /api/v1/finance/secrets: - get: + /api/v1/certifications/esign/callback: + post: consumes: - application/json - description: 获取当前用户的API访问密钥信息 + description: 处理e签宝的异步回调通知 + produces: + - text/plain + responses: + "200": + description: success + schema: + type: string + "400": + description: fail + schema: + type: string + summary: 处理e签宝回调 + tags: + - 认证管理 + /api/v1/debug/event-system: + post: + consumes: + - application/json + description: 调试事件系统,用于测试事件触发和处理 produces: - application/json responses: "200": - description: 获取用户密钥成功 - schema: - $ref: '#/definitions/responses.UserSecretsResponse' - "401": - description: 未认证 - schema: - additionalProperties: true - type: object - "404": - description: 密钥不存在 + description: 调试成功 schema: additionalProperties: true type: object @@ -1922,117 +5130,117 @@ paths: type: object security: - Bearer: [] - summary: 获取用户密钥 + summary: 调试事件系统 tags: - - 用户密钥管理 + - 系统调试 + /api/v1/decrypt: post: consumes: - application/json - description: 为用户创建API访问密钥 + description: 使用密钥解密加密的数据 parameters: - - description: 创建密钥请求 + - description: 解密请求 in: body name: request required: true schema: - $ref: '#/definitions/commands.CreateUserSecretsCommand' + $ref: '#/definitions/commands.DecryptCommand' produces: - application/json responses: - "201": - description: 用户密钥创建成功 + "200": + description: 解密成功 schema: - $ref: '#/definitions/responses.UserSecretsResponse' + additionalProperties: true + type: object "400": description: 请求参数错误 schema: additionalProperties: true type: object "401": - description: 未认证 - schema: - additionalProperties: true - type: object - "409": - description: 密钥已存在 + description: 未授权 schema: additionalProperties: true type: object "500": - description: 服务器内部错误 + description: 解密失败 schema: additionalProperties: true type: object security: - Bearer: [] - summary: 创建用户密钥 + summary: 解密参数 tags: - - 用户密钥管理 - /api/v1/finance/secrets/deactivate: + - API调试 + /api/v1/encrypt: post: consumes: - application/json - description: 停用用户的API访问密钥 + description: 用于前端调试时加密API调用参数 + parameters: + - description: 加密请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/commands.EncryptCommand' produces: - application/json responses: "200": - description: 用户密钥停用成功 + description: 加密成功 schema: - additionalProperties: true - type: object + $ref: '#/definitions/dto.EncryptResponse' + "400": + description: 请求参数错误 + schema: + $ref: '#/definitions/dto.EncryptResponse' "401": - description: 未认证 + description: 未授权 schema: - additionalProperties: true - type: object - "404": - description: 密钥不存在 - schema: - additionalProperties: true - type: object - "500": - description: 服务器内部错误 - schema: - additionalProperties: true - type: object - security: - - Bearer: [] - summary: 停用用户密钥 + $ref: '#/definitions/dto.EncryptResponse' + summary: 加密参数 tags: - - 用户密钥管理 - /api/v1/finance/secrets/regenerate: + - API调试 + /api/v1/finance/alipay/callback: post: consumes: - - application/json - description: 重新生成用户的API访问密钥 + - application/x-www-form-urlencoded + description: 处理支付宝异步支付通知 produces: - - application/json + - text/plain responses: "200": - description: 访问密钥重新生成成功 + description: success schema: - $ref: '#/definitions/responses.UserSecretsResponse' - "401": - description: 未认证 + type: string + "400": + description: fail schema: - additionalProperties: true - type: object - "404": - description: 密钥不存在 - schema: - additionalProperties: true - type: object - "500": - description: 服务器内部错误 - schema: - additionalProperties: true - type: object - security: - - Bearer: [] - summary: 重新生成访问密钥 + type: string + summary: 支付宝支付回调 tags: - - 用户密钥管理 + - 支付管理 + /api/v1/finance/alipay/return: + get: + consumes: + - application/x-www-form-urlencoded + description: 处理支付宝同步支付通知,跳转到前端成功页面 + produces: + - text/html + responses: + "200": + description: 支付成功页面 + schema: + type: string + "400": + description: 支付失败页面 + schema: + type: string + summary: 支付宝同步回调 + tags: + - 支付管理 /api/v1/finance/wallet: get: consumes: @@ -2065,61 +5273,24 @@ paths: summary: 获取钱包信息 tags: - 钱包管理 - post: + /api/v1/finance/wallet/alipay-order-status: + get: consumes: - application/json - description: 为用户创建新的钱包账户 + description: 获取支付宝订单的当前状态,用于轮询查询 parameters: - - description: 创建钱包请求 - in: body - name: request + - description: 商户订单号 + in: query + name: out_trade_no required: true - schema: - $ref: '#/definitions/commands.CreateWalletCommand' - produces: - - application/json - responses: - "201": - description: 钱包创建成功 - schema: - $ref: '#/definitions/responses.WalletResponse' - "400": - description: 请求参数错误 - schema: - additionalProperties: true - type: object - "409": - description: 钱包已存在 - schema: - additionalProperties: true - type: object - "500": - description: 服务器内部错误 - schema: - additionalProperties: true - type: object - summary: 创建钱包 - tags: - - 钱包管理 - put: - consumes: - - application/json - description: 更新当前用户的钱包基本信息 - parameters: - - description: 更新钱包请求 - in: body - name: request - required: true - schema: - $ref: '#/definitions/commands.UpdateWalletCommand' + type: string produces: - application/json responses: "200": - description: 钱包更新成功 + description: 获取订单状态成功 schema: - additionalProperties: true - type: object + $ref: '#/definitions/responses.AlipayOrderStatusResponse' "400": description: 请求参数错误 schema: @@ -2130,6 +5301,11 @@ paths: schema: additionalProperties: true type: object + "404": + description: 订单不存在 + schema: + additionalProperties: true + type: object "500": description: 服务器内部错误 schema: @@ -2137,28 +5313,28 @@ paths: type: object security: - Bearer: [] - summary: 更新钱包信息 + summary: 获取支付宝订单状态 tags: - 钱包管理 - /api/v1/finance/wallet/recharge: + /api/v1/finance/wallet/alipay-recharge: post: consumes: - application/json - description: 为钱包进行充值操作 + description: 创建支付宝充值订单并返回支付链接 parameters: - description: 充值请求 in: body name: request required: true schema: - $ref: '#/definitions/commands.RechargeWalletCommand' + $ref: '#/definitions/commands.CreateAlipayRechargeCommand' produces: - application/json responses: "200": - description: 充值成功 + description: 创建充值订单成功 schema: - $ref: '#/definitions/responses.TransactionResponse' + $ref: '#/definitions/responses.AlipayRechargeOrderResponse' "400": description: 请求参数错误 schema: @@ -2176,55 +5352,76 @@ paths: type: object security: - Bearer: [] - summary: 钱包充值 + summary: 创建支付宝充值订单 tags: - 钱包管理 - /api/v1/finance/wallet/stats: + /api/v1/finance/wallet/recharge-config: get: consumes: - application/json - description: 获取钱包相关的统计数据 + description: 获取当前环境的充值配置信息(最低充值金额、最高充值金额等) produces: - application/json responses: "200": - description: 获取钱包统计成功 + description: 获取充值配置成功 schema: - $ref: '#/definitions/responses.WalletStatsResponse' - "401": - description: 未认证 - schema: - additionalProperties: true - type: object + $ref: '#/definitions/responses.RechargeConfigResponse' "500": description: 服务器内部错误 schema: additionalProperties: true type: object - security: - - Bearer: [] - summary: 获取钱包统计 + summary: 获取充值配置 tags: - 钱包管理 - /api/v1/finance/wallet/transaction: - post: + /api/v1/finance/wallet/transactions: + get: consumes: - application/json - description: 执行钱包内部交易操作 + description: 获取当前用户的钱包交易记录列表,支持分页和筛选 parameters: - - description: 交易请求 - in: body - name: request - required: true - schema: - $ref: '#/definitions/commands.WalletTransactionCommand' + - default: 1 + description: 页码 + in: query + name: page + type: integer + - default: 10 + description: 每页数量 + in: query + name: page_size + type: integer + - description: '开始时间 (格式: 2006-01-02 15:04:05)' + in: query + name: start_time + type: string + - description: '结束时间 (格式: 2006-01-02 15:04:05)' + in: query + name: end_time + type: string + - description: 交易ID + in: query + name: transaction_id + type: string + - description: 产品名称 + in: query + name: product_name + type: string + - description: 最小金额 + in: query + name: min_amount + type: string + - description: 最大金额 + in: query + name: max_amount + type: string produces: - application/json responses: "200": - description: 交易成功 + description: 获取成功 schema: - $ref: '#/definitions/responses.TransactionResponse' + $ref: '#/definitions/responses.WalletTransactionListResponse' "400": description: 请求参数错误 schema: @@ -2242,28 +5439,275 @@ paths: type: object security: - Bearer: [] - summary: 钱包交易 + summary: 获取用户钱包交易记录 tags: - 钱包管理 - /api/v1/finance/wallet/withdraw: - post: + /api/v1/form-config/{api_code}: + get: consumes: - application/json - description: 从钱包进行提现操作 + description: 获取指定API的表单配置,用于前端动态生成表单 parameters: - - description: 提现请求 - in: body - name: request + - description: API代码 + in: path + name: api_code required: true - schema: - $ref: '#/definitions/commands.WithdrawWalletCommand' + type: string produces: - application/json responses: "200": - description: 提现申请已提交 + description: 获取成功 schema: - $ref: '#/definitions/responses.TransactionResponse' + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未授权 + schema: + additionalProperties: true + type: object + "404": + description: API接口不存在 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 获取表单配置 + tags: + - API调试 + /api/v1/invoices/{application_id}/download: + get: + description: 下载指定发票的文件 + parameters: + - description: 申请ID + in: path + name: application_id + required: true + type: string + produces: + - application/octet-stream + responses: + "200": + description: OK + schema: + type: file + "400": + description: Bad Request + schema: + $ref: '#/definitions/interfaces.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/interfaces.APIResponse' + summary: 下载发票文件 + tags: + - 发票管理 + /api/v1/invoices/apply: + post: + consumes: + - application/json + description: 用户申请开票 + parameters: + - description: 申请开票请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/finance.ApplyInvoiceRequest' + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/interfaces.APIResponse' + - properties: + data: + $ref: '#/definitions/dto.InvoiceApplicationResponse' + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/interfaces.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/interfaces.APIResponse' + summary: 申请开票 + tags: + - 发票管理 + /api/v1/invoices/available-amount: + get: + description: 获取用户当前可开票的金额 + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/interfaces.APIResponse' + - properties: + data: + $ref: '#/definitions/dto.AvailableAmountResponse' + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/interfaces.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/interfaces.APIResponse' + summary: 获取可开票金额 + tags: + - 发票管理 + /api/v1/invoices/info: + get: + description: 获取用户的发票信息 + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/interfaces.APIResponse' + - properties: + data: + $ref: '#/definitions/dto.InvoiceInfoResponse' + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/interfaces.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/interfaces.APIResponse' + summary: 获取用户发票信息 + tags: + - 发票管理 + put: + consumes: + - application/json + description: 更新用户的发票信息 + parameters: + - description: 更新发票信息请求 + in: body + name: request + required: true + schema: + $ref: '#/definitions/finance.UpdateInvoiceInfoRequest' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/interfaces.APIResponse' + "400": + description: Bad Request + schema: + $ref: '#/definitions/interfaces.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/interfaces.APIResponse' + summary: 更新用户发票信息 + tags: + - 发票管理 + /api/v1/invoices/records: + get: + description: 获取用户的开票记录列表 + parameters: + - default: 1 + description: 页码 + in: query + name: page + type: integer + - default: 10 + description: 每页数量 + in: query + name: page_size + type: integer + - description: 状态筛选 + in: query + name: status + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/interfaces.APIResponse' + - properties: + data: + $ref: '#/definitions/dto.InvoiceRecordsResponse' + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/interfaces.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/interfaces.APIResponse' + summary: 获取用户开票记录 + tags: + - 发票管理 + /api/v1/my/api-calls: + get: + consumes: + - application/json + description: 获取当前用户的API调用记录列表,支持分页和筛选 + parameters: + - default: 1 + description: 页码 + in: query + name: page + type: integer + - default: 10 + description: 每页数量 + in: query + name: page_size + type: integer + - description: '开始时间 (格式: 2006-01-02 15:04:05)' + in: query + name: start_time + type: string + - description: '结束时间 (格式: 2006-01-02 15:04:05)' + in: query + name: end_time + type: string + - description: 交易ID + in: query + name: transaction_id + type: string + - description: 产品名称 + in: query + name: product_name + type: string + - description: 状态 (pending/success/failed) + in: query + name: status + type: string + produces: + - application/json + responses: + "200": + description: 获取成功 + schema: + $ref: '#/definitions/dto.ApiCallListResponse' "400": description: 请求参数错误 schema: @@ -2281,9 +5725,9 @@ paths: type: object security: - Bearer: [] - summary: 钱包提现 + summary: 获取用户API调用记录 tags: - - 钱包管理 + - API管理 /api/v1/my/subscriptions: get: consumes: @@ -2300,9 +5744,23 @@ paths: in: query name: page_size type: integer - - description: 订阅状态 + - description: 搜索关键词 in: query - name: status + name: keyword + type: string + - description: 产品名称 + in: query + name: product_name + type: string + - description: 订阅开始时间 + format: date-time + in: query + name: start_time + type: string + - description: 订阅结束时间 + format: date-time + in: query + name: end_time type: string - description: 排序字段 in: query @@ -2402,7 +5860,8 @@ paths: "200": description: 获取使用情况成功 schema: - $ref: '#/definitions/responses.SubscriptionUsageResponse' + additionalProperties: true + type: object "400": description: 请求参数错误 schema: @@ -2455,11 +5914,50 @@ paths: summary: 获取我的订阅统计 tags: - 我的订阅 + /api/v1/my/whitelist/{ip}: + delete: + consumes: + - application/json + description: 从当前用户的白名单中删除指定IP地址 + parameters: + - description: IP地址 + in: path + name: ip + required: true + type: string + produces: + - application/json + responses: + "200": + description: 删除白名单IP成功 + schema: + additionalProperties: true + type: object + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 删除白名单IP + tags: + - API管理 /api/v1/products: get: consumes: - application/json - description: 分页获取可用的产品列表,支持筛选 + description: 分页获取可用的产品列表,支持筛选,默认只返回可见的产品 parameters: - default: 1 description: 页码 @@ -2479,14 +5977,6 @@ paths: in: query name: category_id type: string - - description: 最低价格 - in: query - name: min_price - type: number - - description: 最高价格 - in: query - name: max_price - type: number - description: 是否启用 in: query name: is_enabled @@ -2499,6 +5989,10 @@ paths: in: query name: is_package type: boolean + - description: 是否已订阅(需要认证) + in: query + name: is_subscribed + type: boolean - description: 排序字段 in: query name: sort_by @@ -2534,7 +6028,47 @@ paths: get: consumes: - application/json - description: 根据产品ID获取产品详细信息 + description: 获取产品详细信息,用户端只能查看可见的产品 + parameters: + - description: 产品ID + in: path + name: id + required: true + type: string + - description: 是否包含文档信息 + in: query + name: with_document + type: boolean + produces: + - application/json + responses: + "200": + description: 获取产品详情成功 + schema: + $ref: '#/definitions/responses.ProductInfoWithDocumentResponse' + "400": + description: 请求参数错误 + schema: + additionalProperties: true + type: object + "404": + description: 产品不存在或不可见 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + summary: 获取产品详情 + tags: + - 数据大厅 + /api/v1/products/{id}/api-config: + get: + consumes: + - application/json + description: 根据产品ID获取API配置信息 parameters: - description: 产品ID in: path @@ -2545,9 +6079,38 @@ paths: - application/json responses: "200": - description: 获取产品详情成功 + description: 获取成功 schema: - $ref: '#/definitions/responses.ProductInfoResponse' + $ref: '#/definitions/responses.ProductApiConfigResponse' + "400": + description: 请求参数错误 + schema: + $ref: '#/definitions/interfaces.APIResponse' + "404": + description: 配置不存在 + schema: + $ref: '#/definitions/interfaces.APIResponse' + summary: 获取产品API配置 + tags: + - 产品API配置 + /api/v1/products/{id}/documentation: + get: + consumes: + - application/json + description: 获取指定产品的文档信息 + parameters: + - description: 产品ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 获取产品文档成功 + schema: + $ref: '#/definitions/responses.DocumentationResponse' "400": description: 请求参数错误 schema: @@ -2563,7 +6126,7 @@ paths: schema: additionalProperties: true type: object - summary: 获取产品详情 + summary: 获取产品文档 tags: - 数据大厅 /api/v1/products/{id}/subscribe: @@ -2610,6 +6173,35 @@ paths: summary: 订阅产品 tags: - 数据大厅 + /api/v1/products/code/{product_code}/api-config: + get: + consumes: + - application/json + description: 根据产品代码获取API配置信息 + parameters: + - description: 产品代码 + in: path + name: product_code + required: true + type: string + produces: + - application/json + responses: + "200": + description: 获取成功 + schema: + $ref: '#/definitions/responses.ProductApiConfigResponse' + "400": + description: 请求参数错误 + schema: + $ref: '#/definitions/interfaces.APIResponse' + "404": + description: 配置不存在 + schema: + $ref: '#/definitions/interfaces.APIResponse' + summary: 根据产品代码获取API配置 + tags: + - 产品API配置 /api/v1/products/stats: get: consumes: @@ -2630,6 +6222,157 @@ paths: summary: 获取产品统计 tags: - 数据大厅 + /api/v1/users/admin/{user_id}: + get: + consumes: + - application/json + description: 管理员获取指定用户的详细信息 + parameters: + - description: 用户ID + in: path + name: user_id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 用户详情 + schema: + $ref: '#/definitions/responses.UserDetailResponse' + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "403": + description: 权限不足 + schema: + additionalProperties: true + type: object + "404": + description: 用户不存在 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 管理员获取用户详情 + tags: + - 用户管理 + /api/v1/users/admin/list: + get: + consumes: + - application/json + description: 管理员查看用户列表,支持分页和筛选 + parameters: + - default: 1 + description: 页码 + in: query + name: page + type: integer + - default: 10 + description: 每页数量 + in: query + name: page_size + type: integer + - description: 手机号筛选 + in: query + name: phone + type: string + - description: 用户类型筛选 + enum: + - user + - admin + in: query + name: user_type + type: string + - description: 是否激活筛选 + in: query + name: is_active + type: boolean + - description: 是否已认证筛选 + in: query + name: is_certified + type: boolean + - description: 企业名称筛选 + in: query + name: company_name + type: string + - description: 开始日期 + format: date + in: query + name: start_date + type: string + - description: 结束日期 + format: date + in: query + name: end_date + type: string + produces: + - application/json + responses: + "200": + description: 用户列表 + schema: + $ref: '#/definitions/responses.UserListResponse' + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "403": + description: 权限不足 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 管理员查看用户列表 + tags: + - 用户管理 + /api/v1/users/admin/stats: + get: + consumes: + - application/json + description: 管理员获取用户相关的统计信息 + produces: + - application/json + responses: + "200": + description: 用户统计信息 + schema: + $ref: '#/definitions/responses.UserStatsResponse' + "401": + description: 未认证 + schema: + additionalProperties: true + type: object + "403": + description: 权限不足 + schema: + additionalProperties: true + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: true + type: object + security: + - Bearer: [] + summary: 获取用户统计信息 + tags: + - 用户管理 /api/v1/users/login-password: post: consumes: diff --git a/go.mod b/go.mod index adadce4..b563822 100644 --- a/go.mod +++ b/go.mod @@ -11,6 +11,7 @@ require ( github.com/go-playground/validator/v10 v10.26.0 github.com/golang-jwt/jwt/v5 v5.2.2 github.com/google/uuid v1.6.0 + github.com/hibiken/asynq v0.25.1 github.com/prometheus/client_golang v1.22.0 github.com/qiniu/go-sdk/v7 v7.25.4 github.com/redis/go-redis/v9 v9.11.0 @@ -84,6 +85,7 @@ require ( github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.62.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect + github.com/robfig/cron/v3 v3.0.1 // indirect github.com/sagikazarmark/locafero v0.7.0 // indirect github.com/smartwalle/ncrypto v1.0.4 // indirect github.com/smartwalle/ngx v1.0.9 // indirect diff --git a/go.sum b/go.sum index 3a4a34d..822d991 100644 --- a/go.sum +++ b/go.sum @@ -108,6 +108,8 @@ github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 h1:X5VWvz21y3gzm9Nw/kaUeku/1+uBhcekkmy4IkffJww= github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1/go.mod h1:Zanoh4+gvIgluNqcfMVTJueD4wSS5hT7zTt4Mrutd90= +github.com/hibiken/asynq v0.25.1 h1:phj028N0nm15n8O2ims+IvJ2gz4k2auvermngh9JhTw= +github.com/hibiken/asynq v0.25.1/go.mod h1:pazWNOLBu0FEynQRBvHA26qdIKRSmfdIfUm4HdsLmXg= github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= @@ -189,6 +191,8 @@ github.com/qiniu/go-sdk/v7 v7.25.4/go.mod h1:dmKtJ2ahhPWFVi9o1D5GemmWoh/ctuB9peq github.com/qiniu/x v1.10.5/go.mod h1:03Ni9tj+N2h2aKnAz+6N0Xfl8FwMEDRC2PAlxekASDs= github.com/redis/go-redis/v9 v9.11.0 h1:E3S08Gl/nJNn5vkxd2i78wZxWAPNZgUNTp8WIJUAiIs= github.com/redis/go-redis/v9 v9.11.0/go.mod h1:huWgSWd8mW6+m0VPhJjSSQ+d6Nh1VICQ6Q5lHuCH/Iw= +github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= +github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= diff --git a/internal/app/app.go b/internal/app/app.go index 397c30d..3785b57 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -22,6 +22,9 @@ import ( // 产品域实体 productEntities "tyapi-server/internal/domains/product/entities" + // 文章域实体 + articleEntities "tyapi-server/internal/domains/article/entities" + apiEntities "tyapi-server/internal/domains/api/entities" "tyapi-server/internal/infrastructure/database" ) @@ -224,6 +227,7 @@ func (a *Application) autoMigrate(db *gorm.DB) error { &financeEntities.AlipayOrder{}, &financeEntities.InvoiceApplication{}, &financeEntities.UserInvoiceInfo{}, + // 产品域 &productEntities.Product{}, &productEntities.ProductPackageItem{}, @@ -231,6 +235,12 @@ func (a *Application) autoMigrate(db *gorm.DB) error { &productEntities.Subscription{}, &productEntities.ProductDocumentation{}, &productEntities.ProductApiConfig{}, + + // 文章域 + &articleEntities.Article{}, + &articleEntities.Category{}, + &articleEntities.Tag{}, + // api &apiEntities.ApiUser{}, &apiEntities.ApiCall{}, @@ -312,3 +322,11 @@ func (a *Application) RunCommand(command string, args ...string) error { return fmt.Errorf("unknown command: %s", command) } } + +// GetArticleService 获取文章服务 (用于 Worker) +func (app *Application) GetArticleService() interface{} { + // 这里需要从容器中获取文章服务 + // 由于循环导入问题,暂时返回 nil + // 实际使用时需要通过其他方式获取 + return nil +} diff --git a/internal/application/api/api_application_service.go b/internal/application/api/api_application_service.go index 35ce201..14159f2 100644 --- a/internal/application/api/api_application_service.go +++ b/internal/application/api/api_application_service.go @@ -502,18 +502,18 @@ func (s *ApiApplicationServiceImpl) GetAdminApiCalls(ctx context.Context, filter if call.ProductId != nil && *call.ProductId != "" { item.ProductId = call.ProductId } - + // 从映射中获取产品名称 if productName, exists := productNameMap[call.ID]; exists && productName != "" { item.ProductName = &productName } - + // 安全设置结束时间 if call.EndAt != nil && !call.EndAt.IsZero() { endAt := call.EndAt.Format("2006-01-02 15:04:05") item.EndAt = &endAt } - + // 安全设置费用 if call.Cost != nil { cost := call.Cost.String() @@ -521,12 +521,12 @@ func (s *ApiApplicationServiceImpl) GetAdminApiCalls(ctx context.Context, filter item.Cost = &cost } } - + // 安全设置错误类型 if call.ErrorType != nil && *call.ErrorType != "" { item.ErrorType = call.ErrorType } - + // 安全设置错误信息 if call.ErrorMsg != nil && *call.ErrorMsg != "" { item.ErrorMsg = call.ErrorMsg @@ -541,24 +541,24 @@ func (s *ApiApplicationServiceImpl) GetAdminApiCalls(ctx context.Context, filter user, err := s.userRepo.GetByIDWithEnterpriseInfo(ctx, *call.UserId) if err == nil && user.ID != "" { companyName := "未知企业" - + // 安全获取企业名称 if user.EnterpriseInfo != nil && user.EnterpriseInfo.CompanyName != "" { companyName = user.EnterpriseInfo.CompanyName } - + item.CompanyName = &companyName - + // 安全构建用户响应 item.User = &dto.UserSimpleResponse{ ID: user.ID, CompanyName: companyName, Phone: user.Phone, } - + // 验证用户数据的完整性 if user.Phone == "" { - s.logger.Warn("用户手机号为空", + s.logger.Warn("用户手机号为空", zap.String("user_id", user.ID), zap.String("call_id", call.ID)) item.User.Phone = "未知手机号" @@ -566,16 +566,16 @@ func (s *ApiApplicationServiceImpl) GetAdminApiCalls(ctx context.Context, filter } else { // 用户查询失败或用户数据不完整时的处理 if err != nil { - s.logger.Warn("获取用户信息失败", + s.logger.Warn("获取用户信息失败", zap.String("user_id", *call.UserId), zap.String("call_id", call.ID), zap.Error(err)) } else if user.ID == "" { - s.logger.Warn("用户ID为空", + s.logger.Warn("用户ID为空", zap.String("call_user_id", *call.UserId), zap.String("call_id", call.ID)) } - + // 设置默认值 defaultCompanyName := "未知企业" item.CompanyName = &defaultCompanyName diff --git a/internal/application/article/article_application_service.go b/internal/application/article/article_application_service.go new file mode 100644 index 0000000..f622622 --- /dev/null +++ b/internal/application/article/article_application_service.go @@ -0,0 +1,45 @@ +package article + +import ( + "context" + "tyapi-server/internal/application/article/dto/commands" + appQueries "tyapi-server/internal/application/article/dto/queries" + "tyapi-server/internal/application/article/dto/responses" +) + +// ArticleApplicationService 文章应用服务接口 +type ArticleApplicationService interface { + // 文章管理 + CreateArticle(ctx context.Context, cmd *commands.CreateArticleCommand) error + UpdateArticle(ctx context.Context, cmd *commands.UpdateArticleCommand) error + DeleteArticle(ctx context.Context, cmd *commands.DeleteArticleCommand) error + GetArticleByID(ctx context.Context, query *appQueries.GetArticleQuery) (*responses.ArticleInfoResponse, error) + ListArticles(ctx context.Context, query *appQueries.ListArticleQuery) (*responses.ArticleListResponse, error) + + // 文章状态管理 + PublishArticle(ctx context.Context, cmd *commands.PublishArticleCommand) error + PublishArticleByID(ctx context.Context, articleID string) error + SchedulePublishArticle(ctx context.Context, cmd *commands.SchedulePublishCommand) error + ArchiveArticle(ctx context.Context, cmd *commands.ArchiveArticleCommand) error + SetFeatured(ctx context.Context, cmd *commands.SetFeaturedCommand) error + + // 文章交互 + RecordView(ctx context.Context, articleID string, userID string, ipAddress string, userAgent string) error + + // 统计信息 + GetArticleStats(ctx context.Context) (*responses.ArticleStatsResponse, error) + + // 分类管理 + CreateCategory(ctx context.Context, cmd *commands.CreateCategoryCommand) error + UpdateCategory(ctx context.Context, cmd *commands.UpdateCategoryCommand) error + DeleteCategory(ctx context.Context, cmd *commands.DeleteCategoryCommand) error + GetCategoryByID(ctx context.Context, query *appQueries.GetCategoryQuery) (*responses.CategoryInfoResponse, error) + ListCategories(ctx context.Context) (*responses.CategoryListResponse, error) + + // 标签管理 + CreateTag(ctx context.Context, cmd *commands.CreateTagCommand) error + UpdateTag(ctx context.Context, cmd *commands.UpdateTagCommand) error + DeleteTag(ctx context.Context, cmd *commands.DeleteTagCommand) error + GetTagByID(ctx context.Context, query *appQueries.GetTagQuery) (*responses.TagInfoResponse, error) + ListTags(ctx context.Context) (*responses.TagListResponse, error) +} diff --git a/internal/application/article/article_application_service_impl.go b/internal/application/article/article_application_service_impl.go new file mode 100644 index 0000000..6ef117e --- /dev/null +++ b/internal/application/article/article_application_service_impl.go @@ -0,0 +1,690 @@ +package article + +import ( + "context" + "fmt" + "tyapi-server/internal/application/article/dto/commands" + appQueries "tyapi-server/internal/application/article/dto/queries" + "tyapi-server/internal/application/article/dto/responses" + "tyapi-server/internal/domains/article/entities" + "tyapi-server/internal/domains/article/repositories" + repoQueries "tyapi-server/internal/domains/article/repositories/queries" + "tyapi-server/internal/domains/article/services" + "tyapi-server/internal/infrastructure/task" + "tyapi-server/internal/shared/interfaces" + + "go.uber.org/zap" +) + +// ArticleApplicationServiceImpl 文章应用服务实现 +type ArticleApplicationServiceImpl struct { + articleRepo repositories.ArticleRepository + categoryRepo repositories.CategoryRepository + tagRepo repositories.TagRepository + articleService *services.ArticleService + asynqClient *task.AsynqClient + logger *zap.Logger +} + +// NewArticleApplicationService 创建文章应用服务 +func NewArticleApplicationService( + articleRepo repositories.ArticleRepository, + categoryRepo repositories.CategoryRepository, + tagRepo repositories.TagRepository, + articleService *services.ArticleService, + asynqClient *task.AsynqClient, + logger *zap.Logger, +) ArticleApplicationService { + return &ArticleApplicationServiceImpl{ + articleRepo: articleRepo, + categoryRepo: categoryRepo, + tagRepo: tagRepo, + articleService: articleService, + asynqClient: asynqClient, + logger: logger, + } +} + +// CreateArticle 创建文章 +func (s *ArticleApplicationServiceImpl) CreateArticle(ctx context.Context, cmd *commands.CreateArticleCommand) error { + // 1. 参数验证 + if err := s.validateCreateArticle(cmd); err != nil { + return fmt.Errorf("参数验证失败: %w", err) + } + + // 2. 创建文章实体 + article := &entities.Article{ + Title: cmd.Title, + Content: cmd.Content, + Summary: cmd.Summary, + CoverImage: cmd.CoverImage, + CategoryID: cmd.CategoryID, + IsFeatured: cmd.IsFeatured, + Status: entities.ArticleStatusDraft, + } + + // 3. 调用领域服务验证 + if err := s.articleService.ValidateArticle(article); err != nil { + return fmt.Errorf("业务验证失败: %w", err) + } + + // 4. 保存文章 + _, err := s.articleRepo.Create(ctx, *article) + if err != nil { + s.logger.Error("创建文章失败", zap.Error(err)) + return fmt.Errorf("创建文章失败: %w", err) + } + + // 5. 处理标签关联 + if len(cmd.TagIDs) > 0 { + for _, tagID := range cmd.TagIDs { + if err := s.tagRepo.AddTagToArticle(ctx, article.ID, tagID); err != nil { + s.logger.Warn("添加标签失败", zap.String("article_id", article.ID), zap.String("tag_id", tagID), zap.Error(err)) + } + } + } + + s.logger.Info("创建文章成功", zap.String("id", article.ID), zap.String("title", article.Title)) + return nil +} + +// UpdateArticle 更新文章 +func (s *ArticleApplicationServiceImpl) UpdateArticle(ctx context.Context, cmd *commands.UpdateArticleCommand) error { + // 1. 获取原文章 + article, err := s.articleRepo.GetByID(ctx, cmd.ID) + if err != nil { + s.logger.Error("获取文章失败", zap.String("id", cmd.ID), zap.Error(err)) + return fmt.Errorf("文章不存在: %w", err) + } + + // 2. 检查是否可以编辑 + if !article.CanEdit() { + return fmt.Errorf("文章状态不允许编辑") + } + + // 3. 更新字段 + if cmd.Title != "" { + article.Title = cmd.Title + } + if cmd.Content != "" { + article.Content = cmd.Content + } + if cmd.Summary != "" { + article.Summary = cmd.Summary + } + if cmd.CoverImage != "" { + article.CoverImage = cmd.CoverImage + } + if cmd.CategoryID != "" { + article.CategoryID = cmd.CategoryID + } + article.IsFeatured = cmd.IsFeatured + + // 4. 验证更新后的文章 + if err := s.articleService.ValidateArticle(&article); err != nil { + return fmt.Errorf("业务验证失败: %w", err) + } + + // 5. 保存更新 + if err := s.articleRepo.Update(ctx, article); err != nil { + s.logger.Error("更新文章失败", zap.String("id", article.ID), zap.Error(err)) + return fmt.Errorf("更新文章失败: %w", err) + } + + // 6. 处理标签关联 + if len(cmd.TagIDs) > 0 { + // 先清除现有标签 + existingTags, _ := s.tagRepo.GetArticleTags(ctx, article.ID) + for _, tag := range existingTags { + s.tagRepo.RemoveTagFromArticle(ctx, article.ID, tag.ID) + } + + // 添加新标签 + for _, tagID := range cmd.TagIDs { + if err := s.tagRepo.AddTagToArticle(ctx, article.ID, tagID); err != nil { + s.logger.Warn("添加标签失败", zap.String("article_id", article.ID), zap.String("tag_id", tagID), zap.Error(err)) + } + } + } + + s.logger.Info("更新文章成功", zap.String("id", article.ID)) + return nil +} + +// DeleteArticle 删除文章 +func (s *ArticleApplicationServiceImpl) DeleteArticle(ctx context.Context, cmd *commands.DeleteArticleCommand) error { + // 1. 检查文章是否存在 + _, err := s.articleRepo.GetByID(ctx, cmd.ID) + if err != nil { + s.logger.Error("获取文章失败", zap.String("id", cmd.ID), zap.Error(err)) + return fmt.Errorf("文章不存在: %w", err) + } + + // 2. 删除文章 + if err := s.articleRepo.Delete(ctx, cmd.ID); err != nil { + s.logger.Error("删除文章失败", zap.String("id", cmd.ID), zap.Error(err)) + return fmt.Errorf("删除文章失败: %w", err) + } + + s.logger.Info("删除文章成功", zap.String("id", cmd.ID)) + return nil +} + +// GetArticleByID 根据ID获取文章 +func (s *ArticleApplicationServiceImpl) GetArticleByID(ctx context.Context, query *appQueries.GetArticleQuery) (*responses.ArticleInfoResponse, error) { + // 1. 获取文章 + article, err := s.articleRepo.GetByID(ctx, query.ID) + if err != nil { + s.logger.Error("获取文章失败", zap.String("id", query.ID), zap.Error(err)) + return nil, fmt.Errorf("文章不存在: %w", err) + } + + // 2. 转换为响应对象 + response := responses.FromArticleEntity(&article) + + s.logger.Info("获取文章成功", zap.String("id", article.ID)) + return response, nil +} + +// ListArticles 获取文章列表 +func (s *ArticleApplicationServiceImpl) ListArticles(ctx context.Context, query *appQueries.ListArticleQuery) (*responses.ArticleListResponse, error) { + // 1. 构建仓储查询 + repoQuery := &repoQueries.ListArticleQuery{ + Page: query.Page, + PageSize: query.PageSize, + Status: query.Status, + CategoryID: query.CategoryID, + TagID: query.TagID, + Title: query.Title, + Summary: query.Summary, + IsFeatured: query.IsFeatured, + OrderBy: query.OrderBy, + OrderDir: query.OrderDir, + } + + // 2. 调用仓储 + articles, total, err := s.articleRepo.ListArticles(ctx, repoQuery) + if err != nil { + s.logger.Error("获取文章列表失败", zap.Error(err)) + return nil, fmt.Errorf("获取文章列表失败: %w", err) + } + + // 3. 转换为响应对象 + items := responses.FromArticleEntities(articles) + + response := &responses.ArticleListResponse{ + Total: total, + Page: query.Page, + Size: query.PageSize, + Items: items, + } + + s.logger.Info("获取文章列表成功", zap.Int64("total", total)) + return response, nil +} + + +// PublishArticle 发布文章 +func (s *ArticleApplicationServiceImpl) PublishArticle(ctx context.Context, cmd *commands.PublishArticleCommand) error { + // 1. 获取文章 + article, err := s.articleRepo.GetByID(ctx, cmd.ID) + if err != nil { + s.logger.Error("获取文章失败", zap.String("id", cmd.ID), zap.Error(err)) + return fmt.Errorf("文章不存在: %w", err) + } + + // 2. 发布文章 + if err := article.Publish(); err != nil { + return fmt.Errorf("发布文章失败: %w", err) + } + + // 3. 保存更新 + if err := s.articleRepo.Update(ctx, article); err != nil { + s.logger.Error("更新文章失败", zap.String("id", article.ID), zap.Error(err)) + return fmt.Errorf("发布文章失败: %w", err) + } + + s.logger.Info("发布文章成功", zap.String("id", article.ID)) + return nil +} + +// PublishArticleByID 通过ID发布文章 (用于定时任务) +func (s *ArticleApplicationServiceImpl) PublishArticleByID(ctx context.Context, articleID string) error { + // 1. 获取文章 + article, err := s.articleRepo.GetByID(ctx, articleID) + if err != nil { + s.logger.Error("获取文章失败", zap.String("id", articleID), zap.Error(err)) + return fmt.Errorf("文章不存在: %w", err) + } + + // 2. 发布文章 + if err := article.Publish(); err != nil { + return fmt.Errorf("发布文章失败: %w", err) + } + + // 3. 保存更新 + if err := s.articleRepo.Update(ctx, article); err != nil { + s.logger.Error("更新文章失败", zap.String("id", article.ID), zap.Error(err)) + return fmt.Errorf("发布文章失败: %w", err) + } + + s.logger.Info("定时发布文章成功", zap.String("id", article.ID)) + return nil +} + +// SchedulePublishArticle 定时发布文章 +func (s *ArticleApplicationServiceImpl) SchedulePublishArticle(ctx context.Context, cmd *commands.SchedulePublishCommand) error { + // 1. 获取文章 + article, err := s.articleRepo.GetByID(ctx, cmd.ID) + if err != nil { + s.logger.Error("获取文章失败", zap.String("id", cmd.ID), zap.Error(err)) + return fmt.Errorf("文章不存在: %w", err) + } + + // 2. 设置定时发布 + if err := article.SchedulePublish(cmd.ScheduledTime); err != nil { + return fmt.Errorf("设置定时发布失败: %w", err) + } + + // 3. 保存更新 + if err := s.articleRepo.Update(ctx, article); err != nil { + s.logger.Error("更新文章失败", zap.String("id", article.ID), zap.Error(err)) + return fmt.Errorf("设置定时发布失败: %w", err) + } + + // 4. 调度定时发布任务 + if err := s.asynqClient.ScheduleArticlePublish(ctx, cmd.ID, cmd.ScheduledTime); err != nil { + s.logger.Error("调度定时发布任务失败", zap.String("id", cmd.ID), zap.Error(err)) + return fmt.Errorf("调度定时发布任务失败: %w", err) + } + + s.logger.Info("设置定时发布成功", zap.String("id", article.ID), zap.Time("scheduled_time", cmd.ScheduledTime)) + return nil +} + +// ArchiveArticle 归档文章 +func (s *ArticleApplicationServiceImpl) ArchiveArticle(ctx context.Context, cmd *commands.ArchiveArticleCommand) error { + // 1. 获取文章 + article, err := s.articleRepo.GetByID(ctx, cmd.ID) + if err != nil { + s.logger.Error("获取文章失败", zap.String("id", cmd.ID), zap.Error(err)) + return fmt.Errorf("文章不存在: %w", err) + } + + // 2. 归档文章 + if err := article.Archive(); err != nil { + return fmt.Errorf("归档文章失败: %w", err) + } + + // 3. 保存更新 + if err := s.articleRepo.Update(ctx, article); err != nil { + s.logger.Error("更新文章失败", zap.String("id", article.ID), zap.Error(err)) + return fmt.Errorf("归档文章失败: %w", err) + } + + s.logger.Info("归档文章成功", zap.String("id", article.ID)) + return nil +} + +// SetFeatured 设置推荐状态 +func (s *ArticleApplicationServiceImpl) SetFeatured(ctx context.Context, cmd *commands.SetFeaturedCommand) error { + // 1. 获取文章 + article, err := s.articleRepo.GetByID(ctx, cmd.ID) + if err != nil { + s.logger.Error("获取文章失败", zap.String("id", cmd.ID), zap.Error(err)) + return fmt.Errorf("文章不存在: %w", err) + } + + // 2. 设置推荐状态 + article.SetFeatured(cmd.IsFeatured) + + // 3. 保存更新 + if err := s.articleRepo.Update(ctx, article); err != nil { + s.logger.Error("更新文章失败", zap.String("id", article.ID), zap.Error(err)) + return fmt.Errorf("设置推荐状态失败: %w", err) + } + + s.logger.Info("设置推荐状态成功", zap.String("id", article.ID), zap.Bool("is_featured", cmd.IsFeatured)) + return nil +} + + + +// RecordView 记录阅读 +func (s *ArticleApplicationServiceImpl) RecordView(ctx context.Context, articleID string, userID string, ipAddress string, userAgent string) error { + // 1. 增加阅读量 + if err := s.articleRepo.IncrementViewCount(ctx, articleID); err != nil { + s.logger.Error("增加阅读量失败", zap.String("id", articleID), zap.Error(err)) + return fmt.Errorf("记录阅读失败: %w", err) + } + + s.logger.Info("记录阅读成功", zap.String("id", articleID)) + return nil +} + +// GetArticleStats 获取文章统计 +func (s *ArticleApplicationServiceImpl) GetArticleStats(ctx context.Context) (*responses.ArticleStatsResponse, error) { + // 1. 获取各种统计 + totalArticles, err := s.articleRepo.CountByStatus(ctx, "") + if err != nil { + s.logger.Error("获取文章总数失败", zap.Error(err)) + return nil, fmt.Errorf("获取统计信息失败: %w", err) + } + + publishedArticles, err := s.articleRepo.CountByStatus(ctx, entities.ArticleStatusPublished) + if err != nil { + s.logger.Error("获取已发布文章数失败", zap.Error(err)) + return nil, fmt.Errorf("获取统计信息失败: %w", err) + } + + draftArticles, err := s.articleRepo.CountByStatus(ctx, entities.ArticleStatusDraft) + if err != nil { + s.logger.Error("获取草稿文章数失败", zap.Error(err)) + return nil, fmt.Errorf("获取统计信息失败: %w", err) + } + + archivedArticles, err := s.articleRepo.CountByStatus(ctx, entities.ArticleStatusArchived) + if err != nil { + s.logger.Error("获取归档文章数失败", zap.Error(err)) + return nil, fmt.Errorf("获取统计信息失败: %w", err) + } + + response := &responses.ArticleStatsResponse{ + TotalArticles: totalArticles, + PublishedArticles: publishedArticles, + DraftArticles: draftArticles, + ArchivedArticles: archivedArticles, + TotalViews: 0, // TODO: 实现总阅读量统计 + } + + s.logger.Info("获取文章统计成功") + return response, nil +} + + +// validateCreateArticle 验证创建文章参数 +func (s *ArticleApplicationServiceImpl) validateCreateArticle(cmd *commands.CreateArticleCommand) error { + if cmd.Title == "" { + return fmt.Errorf("文章标题不能为空") + } + if cmd.Content == "" { + return fmt.Errorf("文章内容不能为空") + } + return nil +} + +// ==================== 分类相关方法 ==================== + +// CreateCategory 创建分类 +func (s *ArticleApplicationServiceImpl) CreateCategory(ctx context.Context, cmd *commands.CreateCategoryCommand) error { + // 1. 参数验证 + if err := s.validateCreateCategory(cmd); err != nil { + return fmt.Errorf("参数验证失败: %w", err) + } + + // 2. 创建分类实体 + category := &entities.Category{ + Name: cmd.Name, + Description: cmd.Description, + } + + // 3. 保存分类 + _, err := s.categoryRepo.Create(ctx, *category) + if err != nil { + s.logger.Error("创建分类失败", zap.Error(err)) + return fmt.Errorf("创建分类失败: %w", err) + } + + s.logger.Info("创建分类成功", zap.String("id", category.ID), zap.String("name", category.Name)) + return nil +} + +// UpdateCategory 更新分类 +func (s *ArticleApplicationServiceImpl) UpdateCategory(ctx context.Context, cmd *commands.UpdateCategoryCommand) error { + // 1. 获取原分类 + category, err := s.categoryRepo.GetByID(ctx, cmd.ID) + if err != nil { + s.logger.Error("获取分类失败", zap.String("id", cmd.ID), zap.Error(err)) + return fmt.Errorf("分类不存在: %w", err) + } + + // 2. 更新字段 + category.Name = cmd.Name + category.Description = cmd.Description + + // 3. 保存更新 + if err := s.categoryRepo.Update(ctx, category); err != nil { + s.logger.Error("更新分类失败", zap.String("id", category.ID), zap.Error(err)) + return fmt.Errorf("更新分类失败: %w", err) + } + + s.logger.Info("更新分类成功", zap.String("id", category.ID)) + return nil +} + +// DeleteCategory 删除分类 +func (s *ArticleApplicationServiceImpl) DeleteCategory(ctx context.Context, cmd *commands.DeleteCategoryCommand) error { + // 1. 检查分类是否存在 + category, err := s.categoryRepo.GetByID(ctx, cmd.ID) + if err != nil { + s.logger.Error("获取分类失败", zap.String("id", cmd.ID), zap.Error(err)) + return fmt.Errorf("分类不存在: %w", err) + } + + // 2. 检查是否有文章使用此分类 + count, err := s.articleRepo.CountByCategoryID(ctx, cmd.ID) + if err != nil { + s.logger.Error("检查分类使用情况失败", zap.String("id", cmd.ID), zap.Error(err)) + return fmt.Errorf("删除分类失败: %w", err) + } + + if count > 0 { + return fmt.Errorf("该分类下还有 %d 篇文章,无法删除", count) + } + + // 3. 删除分类 + if err := s.categoryRepo.Delete(ctx, cmd.ID); err != nil { + s.logger.Error("删除分类失败", zap.String("id", cmd.ID), zap.Error(err)) + return fmt.Errorf("删除分类失败: %w", err) + } + + s.logger.Info("删除分类成功", zap.String("id", cmd.ID), zap.String("name", category.Name)) + return nil +} + +// GetCategoryByID 获取分类详情 +func (s *ArticleApplicationServiceImpl) GetCategoryByID(ctx context.Context, query *appQueries.GetCategoryQuery) (*responses.CategoryInfoResponse, error) { + // 1. 获取分类 + category, err := s.categoryRepo.GetByID(ctx, query.ID) + if err != nil { + s.logger.Error("获取分类失败", zap.String("id", query.ID), zap.Error(err)) + return nil, fmt.Errorf("分类不存在: %w", err) + } + + // 2. 转换为响应对象 + response := &responses.CategoryInfoResponse{ + ID: category.ID, + Name: category.Name, + Description: category.Description, + SortOrder: category.SortOrder, + CreatedAt: category.CreatedAt, + } + + return response, nil +} + +// ListCategories 获取分类列表 +func (s *ArticleApplicationServiceImpl) ListCategories(ctx context.Context) (*responses.CategoryListResponse, error) { + // 1. 获取分类列表 + categories, err := s.categoryRepo.List(ctx, interfaces.ListOptions{}) + if err != nil { + s.logger.Error("获取分类列表失败", zap.Error(err)) + return nil, fmt.Errorf("获取分类列表失败: %w", err) + } + + // 2. 转换为响应对象 + items := make([]responses.CategoryInfoResponse, len(categories)) + for i, category := range categories { + items[i] = responses.CategoryInfoResponse{ + ID: category.ID, + Name: category.Name, + Description: category.Description, + SortOrder: category.SortOrder, + CreatedAt: category.CreatedAt, + } + } + + response := &responses.CategoryListResponse{ + Items: items, + Total: len(items), + } + + return response, nil +} + +// ==================== 标签相关方法 ==================== + +// CreateTag 创建标签 +func (s *ArticleApplicationServiceImpl) CreateTag(ctx context.Context, cmd *commands.CreateTagCommand) error { + // 1. 参数验证 + if err := s.validateCreateTag(cmd); err != nil { + return fmt.Errorf("参数验证失败: %w", err) + } + + // 2. 创建标签实体 + tag := &entities.Tag{ + Name: cmd.Name, + Color: cmd.Color, + } + + // 3. 保存标签 + _, err := s.tagRepo.Create(ctx, *tag) + if err != nil { + s.logger.Error("创建标签失败", zap.Error(err)) + return fmt.Errorf("创建标签失败: %w", err) + } + + s.logger.Info("创建标签成功", zap.String("id", tag.ID), zap.String("name", tag.Name)) + return nil +} + +// UpdateTag 更新标签 +func (s *ArticleApplicationServiceImpl) UpdateTag(ctx context.Context, cmd *commands.UpdateTagCommand) error { + // 1. 获取原标签 + tag, err := s.tagRepo.GetByID(ctx, cmd.ID) + if err != nil { + s.logger.Error("获取标签失败", zap.String("id", cmd.ID), zap.Error(err)) + return fmt.Errorf("标签不存在: %w", err) + } + + // 2. 更新字段 + tag.Name = cmd.Name + tag.Color = cmd.Color + + // 3. 保存更新 + if err := s.tagRepo.Update(ctx, tag); err != nil { + s.logger.Error("更新标签失败", zap.String("id", tag.ID), zap.Error(err)) + return fmt.Errorf("更新标签失败: %w", err) + } + + s.logger.Info("更新标签成功", zap.String("id", tag.ID)) + return nil +} + +// DeleteTag 删除标签 +func (s *ArticleApplicationServiceImpl) DeleteTag(ctx context.Context, cmd *commands.DeleteTagCommand) error { + // 1. 检查标签是否存在 + tag, err := s.tagRepo.GetByID(ctx, cmd.ID) + if err != nil { + s.logger.Error("获取标签失败", zap.String("id", cmd.ID), zap.Error(err)) + return fmt.Errorf("标签不存在: %w", err) + } + + // 2. 删除标签 + if err := s.tagRepo.Delete(ctx, cmd.ID); err != nil { + s.logger.Error("删除标签失败", zap.String("id", cmd.ID), zap.Error(err)) + return fmt.Errorf("删除标签失败: %w", err) + } + + s.logger.Info("删除标签成功", zap.String("id", cmd.ID), zap.String("name", tag.Name)) + return nil +} + +// GetTagByID 获取标签详情 +func (s *ArticleApplicationServiceImpl) GetTagByID(ctx context.Context, query *appQueries.GetTagQuery) (*responses.TagInfoResponse, error) { + // 1. 获取标签 + tag, err := s.tagRepo.GetByID(ctx, query.ID) + if err != nil { + s.logger.Error("获取标签失败", zap.String("id", query.ID), zap.Error(err)) + return nil, fmt.Errorf("标签不存在: %w", err) + } + + // 2. 转换为响应对象 + response := &responses.TagInfoResponse{ + ID: tag.ID, + Name: tag.Name, + Color: tag.Color, + CreatedAt: tag.CreatedAt, + } + + return response, nil +} + +// ListTags 获取标签列表 +func (s *ArticleApplicationServiceImpl) ListTags(ctx context.Context) (*responses.TagListResponse, error) { + // 1. 获取标签列表 + tags, err := s.tagRepo.List(ctx, interfaces.ListOptions{}) + if err != nil { + s.logger.Error("获取标签列表失败", zap.Error(err)) + return nil, fmt.Errorf("获取标签列表失败: %w", err) + } + + // 2. 转换为响应对象 + items := make([]responses.TagInfoResponse, len(tags)) + for i, tag := range tags { + items[i] = responses.TagInfoResponse{ + ID: tag.ID, + Name: tag.Name, + Color: tag.Color, + CreatedAt: tag.CreatedAt, + } + } + + response := &responses.TagListResponse{ + Items: items, + Total: len(items), + } + + return response, nil +} + +// ==================== 验证方法 ==================== + +// validateCreateCategory 验证创建分类参数 +func (s *ArticleApplicationServiceImpl) validateCreateCategory(cmd *commands.CreateCategoryCommand) error { + if cmd.Name == "" { + return fmt.Errorf("分类名称不能为空") + } + if len(cmd.Name) > 50 { + return fmt.Errorf("分类名称长度不能超过50个字符") + } + if len(cmd.Description) > 200 { + return fmt.Errorf("分类描述长度不能超过200个字符") + } + return nil +} + +// validateCreateTag 验证创建标签参数 +func (s *ArticleApplicationServiceImpl) validateCreateTag(cmd *commands.CreateTagCommand) error { + if cmd.Name == "" { + return fmt.Errorf("标签名称不能为空") + } + if len(cmd.Name) > 30 { + return fmt.Errorf("标签名称长度不能超过30个字符") + } + if cmd.Color == "" { + return fmt.Errorf("标签颜色不能为空") + } + // TODO: 添加十六进制颜色格式验证 + return nil +} diff --git a/internal/application/article/dto/commands/article_commands.go b/internal/application/article/dto/commands/article_commands.go new file mode 100644 index 0000000..7e72c1f --- /dev/null +++ b/internal/application/article/dto/commands/article_commands.go @@ -0,0 +1,47 @@ +package commands + +// CreateArticleCommand 创建文章命令 +type CreateArticleCommand struct { + Title string `json:"title" binding:"required" comment:"文章标题"` + Content string `json:"content" binding:"required" comment:"文章内容"` + Summary string `json:"summary" comment:"文章摘要"` + CoverImage string `json:"cover_image" comment:"封面图片"` + CategoryID string `json:"category_id" comment:"分类ID"` + TagIDs []string `json:"tag_ids" comment:"标签ID列表"` + IsFeatured bool `json:"is_featured" comment:"是否推荐"` +} + +// UpdateArticleCommand 更新文章命令 +type UpdateArticleCommand struct { + ID string `json:"-" uri:"id" binding:"required" comment:"文章ID"` + Title string `json:"title" comment:"文章标题"` + Content string `json:"content" comment:"文章内容"` + Summary string `json:"summary" comment:"文章摘要"` + CoverImage string `json:"cover_image" comment:"封面图片"` + CategoryID string `json:"category_id" comment:"分类ID"` + TagIDs []string `json:"tag_ids" comment:"标签ID列表"` + IsFeatured bool `json:"is_featured" comment:"是否推荐"` +} + +// DeleteArticleCommand 删除文章命令 +type DeleteArticleCommand struct { + ID string `json:"-" uri:"id" binding:"required" comment:"文章ID"` +} + +// PublishArticleCommand 发布文章命令 +type PublishArticleCommand struct { + ID string `json:"-" uri:"id" binding:"required" comment:"文章ID"` +} + +// ArchiveArticleCommand 归档文章命令 +type ArchiveArticleCommand struct { + ID string `json:"-" uri:"id" binding:"required" comment:"文章ID"` +} + +// SetFeaturedCommand 设置推荐状态命令 +type SetFeaturedCommand struct { + ID string `json:"-" uri:"id" binding:"required" comment:"文章ID"` + IsFeatured bool `json:"is_featured" binding:"required" comment:"是否推荐"` +} + + diff --git a/internal/application/article/dto/commands/category_commands.go b/internal/application/article/dto/commands/category_commands.go new file mode 100644 index 0000000..600b3fe --- /dev/null +++ b/internal/application/article/dto/commands/category_commands.go @@ -0,0 +1,19 @@ +package commands + +// CreateCategoryCommand 创建分类命令 +type CreateCategoryCommand struct { + Name string `json:"name" binding:"required" validate:"required,min=1,max=50" message:"分类名称不能为空且长度在1-50之间"` + Description string `json:"description" validate:"max=200" message:"分类描述长度不能超过200"` +} + +// UpdateCategoryCommand 更新分类命令 +type UpdateCategoryCommand struct { + ID string `json:"-" uri:"id" binding:"required" comment:"分类ID"` + Name string `json:"name" binding:"required" validate:"required,min=1,max=50" message:"分类名称不能为空且长度在1-50之间"` + Description string `json:"description" validate:"max=200" message:"分类描述长度不能超过200"` +} + +// DeleteCategoryCommand 删除分类命令 +type DeleteCategoryCommand struct { + ID string `json:"-" uri:"id" binding:"required" comment:"分类ID"` +} diff --git a/internal/application/article/dto/commands/schedule_publish_command.go b/internal/application/article/dto/commands/schedule_publish_command.go new file mode 100644 index 0000000..e21b8f7 --- /dev/null +++ b/internal/application/article/dto/commands/schedule_publish_command.go @@ -0,0 +1,9 @@ +package commands + +import "time" + +// SchedulePublishCommand 定时发布文章命令 +type SchedulePublishCommand struct { + ID string `json:"-" uri:"id" binding:"required" comment:"文章ID"` + ScheduledTime time.Time `json:"scheduled_time" binding:"required" comment:"定时发布时间"` +} diff --git a/internal/application/article/dto/commands/tag_commands.go b/internal/application/article/dto/commands/tag_commands.go new file mode 100644 index 0000000..aae85fb --- /dev/null +++ b/internal/application/article/dto/commands/tag_commands.go @@ -0,0 +1,19 @@ +package commands + +// CreateTagCommand 创建标签命令 +type CreateTagCommand struct { + Name string `json:"name" binding:"required" validate:"required,min=1,max=30" message:"标签名称不能为空且长度在1-30之间"` + Color string `json:"color" validate:"required,hexcolor" message:"标签颜色不能为空且必须是有效的十六进制颜色"` +} + +// UpdateTagCommand 更新标签命令 +type UpdateTagCommand struct { + ID string `json:"-" uri:"id" binding:"required" comment:"标签ID"` + Name string `json:"name" binding:"required" validate:"required,min=1,max=30" message:"标签名称不能为空且长度在1-30之间"` + Color string `json:"color" validate:"required,hexcolor" message:"标签颜色不能为空且必须是有效的十六进制颜色"` +} + +// DeleteTagCommand 删除标签命令 +type DeleteTagCommand struct { + ID string `json:"-" uri:"id" binding:"required" comment:"标签ID"` +} diff --git a/internal/application/article/dto/queries/article_queries.go b/internal/application/article/dto/queries/article_queries.go new file mode 100644 index 0000000..4b3c24c --- /dev/null +++ b/internal/application/article/dto/queries/article_queries.go @@ -0,0 +1,54 @@ +package queries + +import "tyapi-server/internal/domains/article/entities" + +// ListArticleQuery 文章列表查询 +type ListArticleQuery struct { + Page int `form:"page" binding:"min=1" comment:"页码"` + PageSize int `form:"page_size" binding:"min=1,max=100" comment:"每页数量"` + Status entities.ArticleStatus `form:"status" comment:"文章状态"` + CategoryID string `form:"category_id" comment:"分类ID"` + TagID string `form:"tag_id" comment:"标签ID"` + Title string `form:"title" comment:"标题关键词"` + Summary string `form:"summary" comment:"摘要关键词"` + IsFeatured *bool `form:"is_featured" comment:"是否推荐"` + OrderBy string `form:"order_by" comment:"排序字段"` + OrderDir string `form:"order_dir" comment:"排序方向"` +} + +// SearchArticleQuery 文章搜索查询 +type SearchArticleQuery struct { + Page int `form:"page" binding:"min=1" comment:"页码"` + PageSize int `form:"page_size" binding:"min=1,max=100" comment:"每页数量"` + Keyword string `form:"keyword" comment:"搜索关键词"` + CategoryID string `form:"category_id" comment:"分类ID"` + AuthorID string `form:"author_id" comment:"作者ID"` + Status entities.ArticleStatus `form:"status" comment:"文章状态"` + OrderBy string `form:"order_by" comment:"排序字段"` + OrderDir string `form:"order_dir" comment:"排序方向"` +} + +// GetArticleQuery 获取文章详情查询 +type GetArticleQuery struct { + ID string `uri:"id" binding:"required" comment:"文章ID"` +} + +// GetArticlesByAuthorQuery 获取作者文章查询 +type GetArticlesByAuthorQuery struct { + AuthorID string `uri:"author_id" binding:"required" comment:"作者ID"` + Page int `form:"page" binding:"min=1" comment:"页码"` + PageSize int `form:"page_size" binding:"min=1,max=100" comment:"每页数量"` +} + +// GetArticlesByCategoryQuery 获取分类文章查询 +type GetArticlesByCategoryQuery struct { + CategoryID string `uri:"category_id" binding:"required" comment:"分类ID"` + Page int `form:"page" binding:"min=1" comment:"页码"` + PageSize int `form:"page_size" binding:"min=1,max=100" comment:"每页数量"` +} + +// GetFeaturedArticlesQuery 获取推荐文章查询 +type GetFeaturedArticlesQuery struct { + Page int `form:"page" binding:"min=1" comment:"页码"` + PageSize int `form:"page_size" binding:"min=1,max=100" comment:"每页数量"` +} diff --git a/internal/application/article/dto/queries/category_queries.go b/internal/application/article/dto/queries/category_queries.go new file mode 100644 index 0000000..2a1e069 --- /dev/null +++ b/internal/application/article/dto/queries/category_queries.go @@ -0,0 +1,6 @@ +package queries + +// GetCategoryQuery 获取分类详情查询 +type GetCategoryQuery struct { + ID string `json:"-" uri:"id" binding:"required" comment:"分类ID"` +} diff --git a/internal/application/article/dto/queries/tag_queries.go b/internal/application/article/dto/queries/tag_queries.go new file mode 100644 index 0000000..bcc168b --- /dev/null +++ b/internal/application/article/dto/queries/tag_queries.go @@ -0,0 +1,6 @@ +package queries + +// GetTagQuery 获取标签详情查询 +type GetTagQuery struct { + ID string `json:"-" uri:"id" binding:"required" comment:"标签ID"` +} diff --git a/internal/application/article/dto/responses/article_responses.go b/internal/application/article/dto/responses/article_responses.go new file mode 100644 index 0000000..865a801 --- /dev/null +++ b/internal/application/article/dto/responses/article_responses.go @@ -0,0 +1,135 @@ +package responses + +import ( + "time" + "tyapi-server/internal/domains/article/entities" +) + +// ArticleInfoResponse 文章详情响应 +type ArticleInfoResponse struct { + ID string `json:"id" comment:"文章ID"` + Title string `json:"title" comment:"文章标题"` + Content string `json:"content" comment:"文章内容"` + Summary string `json:"summary" comment:"文章摘要"` + CoverImage string `json:"cover_image" comment:"封面图片"` + CategoryID string `json:"category_id" comment:"分类ID"` + Category *CategoryInfoResponse `json:"category,omitempty" comment:"分类信息"` + Status string `json:"status" comment:"文章状态"` + IsFeatured bool `json:"is_featured" comment:"是否推荐"` + PublishedAt *time.Time `json:"published_at" comment:"发布时间"` + ViewCount int `json:"view_count" comment:"阅读量"` + Tags []TagInfoResponse `json:"tags" comment:"标签列表"` + CreatedAt time.Time `json:"created_at" comment:"创建时间"` + UpdatedAt time.Time `json:"updated_at" comment:"更新时间"` +} + +// ArticleListResponse 文章列表响应 +type ArticleListResponse struct { + Total int64 `json:"total" comment:"总数"` + Page int `json:"page" comment:"页码"` + Size int `json:"size" comment:"每页数量"` + Items []ArticleInfoResponse `json:"items" comment:"文章列表"` +} + +// CategoryInfoResponse 分类信息响应 +type CategoryInfoResponse struct { + ID string `json:"id" comment:"分类ID"` + Name string `json:"name" comment:"分类名称"` + Description string `json:"description" comment:"分类描述"` + SortOrder int `json:"sort_order" comment:"排序"` + CreatedAt time.Time `json:"created_at" comment:"创建时间"` +} + +// TagInfoResponse 标签信息响应 +type TagInfoResponse struct { + ID string `json:"id" comment:"标签ID"` + Name string `json:"name" comment:"标签名称"` + Color string `json:"color" comment:"标签颜色"` + CreatedAt time.Time `json:"created_at" comment:"创建时间"` +} + +// CategoryListResponse 分类列表响应 +type CategoryListResponse struct { + Items []CategoryInfoResponse `json:"items" comment:"分类列表"` + Total int `json:"total" comment:"总数"` +} + +// TagListResponse 标签列表响应 +type TagListResponse struct { + Items []TagInfoResponse `json:"items" comment:"标签列表"` + Total int `json:"total" comment:"总数"` +} + + +// ArticleStatsResponse 文章统计响应 +type ArticleStatsResponse struct { + TotalArticles int64 `json:"total_articles" comment:"文章总数"` + PublishedArticles int64 `json:"published_articles" comment:"已发布文章数"` + DraftArticles int64 `json:"draft_articles" comment:"草稿文章数"` + ArchivedArticles int64 `json:"archived_articles" comment:"归档文章数"` + TotalViews int64 `json:"total_views" comment:"总阅读量"` +} + +// FromArticleEntity 从文章实体转换为响应对象 +func FromArticleEntity(article *entities.Article) *ArticleInfoResponse { + if article == nil { + return nil + } + + response := &ArticleInfoResponse{ + ID: article.ID, + Title: article.Title, + Content: article.Content, + Summary: article.Summary, + CoverImage: article.CoverImage, + CategoryID: article.CategoryID, + Status: string(article.Status), + IsFeatured: article.IsFeatured, + PublishedAt: article.PublishedAt, + ViewCount: article.ViewCount, + CreatedAt: article.CreatedAt, + UpdatedAt: article.UpdatedAt, + } + + // 转换分类信息 + if article.Category != nil { + response.Category = &CategoryInfoResponse{ + ID: article.Category.ID, + Name: article.Category.Name, + Description: article.Category.Description, + SortOrder: article.Category.SortOrder, + CreatedAt: article.Category.CreatedAt, + } + } + + // 转换标签信息 + if len(article.Tags) > 0 { + response.Tags = make([]TagInfoResponse, len(article.Tags)) + for i, tag := range article.Tags { + response.Tags[i] = TagInfoResponse{ + ID: tag.ID, + Name: tag.Name, + Color: tag.Color, + CreatedAt: tag.CreatedAt, + } + } + } + + return response +} + +// FromArticleEntities 从文章实体列表转换为响应对象列表 +func FromArticleEntities(articles []*entities.Article) []ArticleInfoResponse { + if len(articles) == 0 { + return []ArticleInfoResponse{} + } + + responses := make([]ArticleInfoResponse, len(articles)) + for i, article := range articles { + if response := FromArticleEntity(article); response != nil { + responses[i] = *response + } + } + + return responses +} diff --git a/internal/container/container.go b/internal/container/container.go index e59e960..022a9e4 100644 --- a/internal/container/container.go +++ b/internal/container/container.go @@ -2,6 +2,7 @@ package container import ( "context" + "fmt" "time" "go.uber.org/fx" @@ -9,11 +10,14 @@ import ( "go.uber.org/zap/zapcore" "gorm.io/gorm" + "tyapi-server/internal/application/article" "tyapi-server/internal/application/certification" "tyapi-server/internal/application/finance" "tyapi-server/internal/application/product" "tyapi-server/internal/application/user" "tyapi-server/internal/config" + domain_article_repo "tyapi-server/internal/domains/article/repositories" + article_service "tyapi-server/internal/domains/article/services" domain_certification_repo "tyapi-server/internal/domains/certification/repositories" certification_service "tyapi-server/internal/domains/certification/services" domain_finance_repo "tyapi-server/internal/domains/finance/repositories" @@ -23,6 +27,7 @@ import ( user_service "tyapi-server/internal/domains/user/services" "tyapi-server/internal/infrastructure/cache" "tyapi-server/internal/infrastructure/database" + article_repo "tyapi-server/internal/infrastructure/database/repositories/article" certification_repo "tyapi-server/internal/infrastructure/database/repositories/certification" finance_repo "tyapi-server/internal/infrastructure/database/repositories/finance" product_repo "tyapi-server/internal/infrastructure/database/repositories/product" @@ -38,6 +43,7 @@ import ( "tyapi-server/internal/infrastructure/external/zhicha" "tyapi-server/internal/infrastructure/http/handlers" "tyapi-server/internal/infrastructure/http/routes" + "tyapi-server/internal/infrastructure/task" shared_database "tyapi-server/internal/shared/database" "tyapi-server/internal/shared/esign" "tyapi-server/internal/shared/events" @@ -511,6 +517,25 @@ func NewContainer() *Container { ), ), + // 仓储层 - 文章域 + fx.Provide( + // 文章仓储 - 同时注册具体类型和接口类型 + fx.Annotate( + article_repo.NewGormArticleRepository, + fx.As(new(domain_article_repo.ArticleRepository)), + ), + // 分类仓储 - 同时注册具体类型和接口类型 + fx.Annotate( + article_repo.NewGormCategoryRepository, + fx.As(new(domain_article_repo.CategoryRepository)), + ), + // 标签仓储 - 同时注册具体类型和接口类型 + fx.Annotate( + article_repo.NewGormTagRepository, + fx.As(new(domain_article_repo.TagRepository)), + ), + ), + // API域仓储层 fx.Provide( fx.Annotate( @@ -576,6 +601,8 @@ func NewContainer() *Container { infra_events.NewInvoiceEventHandler, certification_service.NewCertificationAggregateService, certification_service.NewEnterpriseInfoSubmitRecordService, + // 文章领域服务 + article_service.NewArticleService, ), // API域服务层 @@ -591,6 +618,15 @@ func NewContainer() *Container { api_app.NewApiApplicationService, ), + // 任务系统 + fx.Provide( + // Asynq 客户端 + func(cfg *config.Config, logger *zap.Logger) *task.AsynqClient { + redisAddr := fmt.Sprintf("%s:%d", cfg.Redis.Host, cfg.Redis.Port) + return task.NewAsynqClient(redisAddr, logger) + }, + ), + // 应用服务 fx.Provide( // 用户应用服务 - 绑定到接口 @@ -642,6 +678,11 @@ func NewContainer() *Container { product.NewSubscriptionApplicationService, fx.As(new(product.SubscriptionApplicationService)), ), + // 文章应用服务 - 绑定到接口 + fx.Annotate( + article.NewArticleApplicationService, + fx.As(new(article.ArticleApplicationService)), + ), ), // HTTP处理器 @@ -658,6 +699,15 @@ func NewContainer() *Container { handlers.NewProductAdminHandler, // API Handler handlers.NewApiHandler, + // 文章HTTP处理器 + func( + appService article.ArticleApplicationService, + responseBuilder interfaces.ResponseBuilder, + validator interfaces.RequestValidator, + logger *zap.Logger, + ) *handlers.ArticleHandler { + return handlers.NewArticleHandler(appService, responseBuilder, validator, logger) + }, ), // 路由注册 @@ -673,6 +723,8 @@ func NewContainer() *Container { // 产品管理员路由 routes.NewProductAdminRoutes, // API路由 + // 文章路由 + routes.NewArticleRoutes, routes.NewApiRoutes, ), @@ -766,6 +818,7 @@ func RegisterRoutes( financeRoutes *routes.FinanceRoutes, productRoutes *routes.ProductRoutes, productAdminRoutes *routes.ProductAdminRoutes, + articleRoutes *routes.ArticleRoutes, apiRoutes *routes.ApiRoutes, cfg *config.Config, logger *zap.Logger, @@ -781,6 +834,7 @@ func RegisterRoutes( financeRoutes.Register(router) productRoutes.Register(router) productAdminRoutes.Register(router) + articleRoutes.Register(router) // 打印注册的路由信息 router.PrintRoutes() diff --git a/internal/domains/api/services/api_request_service.go b/internal/domains/api/services/api_request_service.go index 2180795..d4b078c 100644 --- a/internal/domains/api/services/api_request_service.go +++ b/internal/domains/api/services/api_request_service.go @@ -13,6 +13,7 @@ import ( "tyapi-server/internal/domains/api/services/processors/jrzq" "tyapi-server/internal/domains/api/services/processors/qcxg" "tyapi-server/internal/domains/api/services/processors/qygl" + "tyapi-server/internal/domains/api/services/processors/test" "tyapi-server/internal/domains/api/services/processors/yysy" "tyapi-server/internal/domains/product/services" "tyapi-server/internal/infrastructure/external/alicloud" @@ -162,6 +163,11 @@ func registerAllProcessors(combService *comb.CombService) { // FLXG系列处理器 - 风险管控 (包含原FXHY功能) "FLXG8B4D": flxg.ProcessFLXG8B4DRequest, + + // TEST系列处理器 - 测试用处理器 + "TEST001": test.ProcessTestRequest, + "TEST002": test.ProcessTestErrorRequest, + "TEST003": test.ProcessTestTimeoutRequest, } // 批量注册到组合包服务 diff --git a/internal/domains/api/services/processors/test/README.md b/internal/domains/api/services/processors/test/README.md new file mode 100644 index 0000000..b6abffc --- /dev/null +++ b/internal/domains/api/services/processors/test/README.md @@ -0,0 +1,94 @@ +# 测试处理器使用说明 + +这个目录包含了用于测试的处理器,可以模拟各种API请求场景,帮助开发和测试人员验证系统功能。 + +## 处理器列表 + +### 1. ProcessTestRequest - 基础测试处理器 +- **功能**: 模拟正常的API请求处理 +- **用途**: 测试基本的请求处理流程、参数验证、响应生成等 + +#### 请求参数 +```json +{ + "test_param": "测试参数值", + "delay": 1000 +} +``` + +#### 响应示例 +```json +{ + "message": "测试请求处理成功", + "timestamp": "2024-01-01T12:00:00Z", + "request_id": "test_20240101120000_000000000", + "test_param": "测试参数值", + "process_time_ms": 1005, + "status": "success" +} +``` + +### 2. ProcessTestErrorRequest - 错误测试处理器 +- **功能**: 模拟各种错误情况 +- **用途**: 测试错误处理机制、异常响应等 + +#### 支持的错误类型 +- `system_error`: 系统错误 +- `datasource_error`: 数据源错误 +- `not_found`: 资源未找到 +- `invalid_param`: 参数无效 + +#### 请求示例 +```json +{ + "test_param": "system_error" +} +``` + +### 3. ProcessTestTimeoutRequest - 超时测试处理器 +- **功能**: 模拟长时间处理导致的超时 +- **用途**: 测试超时处理、上下文取消等 + +## 使用场景 + +### 开发阶段 +- 验证处理器框架是否正常工作 +- 测试参数验证逻辑 +- 验证错误处理机制 + +### 测试阶段 +- 性能测试(通过delay参数) +- 超时测试 +- 错误场景测试 +- 集成测试 + +### 调试阶段 +- 快速验证API调用流程 +- 测试中间件功能 +- 验证日志记录 + +## 注意事项 + +1. **延迟参数**: `delay` 参数最大值为5000毫秒(5秒),避免测试时等待时间过长 +2. **上下文处理**: 所有处理器都正确处理上下文取消,支持超时控制 +3. **错误处理**: 遵循项目的错误处理规范,使用预定义的错误类型 +4. **参数验证**: 使用标准的参数验证机制,确保测试的真实性 + +## 集成到路由 + +要将测试处理器集成到API路由中,需要在相应的路由配置中添加: + +```go +// 在路由配置中添加测试端点 +router.POST("/api/test/basic", handlers.WrapProcessor(processors.ProcessTestRequest)) +router.POST("/api/test/error", handlers.WrapProcessor(processors.ProcessTestErrorRequest)) +router.POST("/api/test/timeout", handlers.WrapProcessor(processors.ProcessTestTimeoutRequest)) +``` + +## 测试建议 + +1. **基础功能测试**: 先使用 `ProcessTestRequest` 验证基本流程 +2. **错误场景测试**: 使用 `ProcessTestErrorRequest` 测试各种错误情况 +3. **性能测试**: 通过调整 `delay` 参数测试不同响应时间 +4. **超时测试**: 使用 `ProcessTestTimeoutRequest` 验证超时处理 +5. **压力测试**: 并发调用测试处理器的稳定性 diff --git a/internal/domains/api/services/processors/test/test_processor.go b/internal/domains/api/services/processors/test/test_processor.go new file mode 100644 index 0000000..8f7f2e3 --- /dev/null +++ b/internal/domains/api/services/processors/test/test_processor.go @@ -0,0 +1,120 @@ +package test + +import ( + "context" + "encoding/json" + "errors" + "time" + + "tyapi-server/internal/domains/api/services/processors" +) + +// TestRequest 测试请求参数 +type TestRequest struct { + TestParam string `json:"test_param" validate:"required"` + Delay int `json:"delay" validate:"min=0,max=5000"` // 延迟毫秒数,最大5秒 +} + +// TestResponse 测试响应数据 +type TestResponse struct { + Message string `json:"message"` + Timestamp time.Time `json:"timestamp"` + RequestID string `json:"request_id"` + TestParam string `json:"test_param"` + ProcessTime int64 `json:"process_time_ms"` + Status string `json:"status"` +} + +// ProcessTestRequest 测试处理器,用于模拟API请求 +func ProcessTestRequest(ctx context.Context, params []byte, deps *processors.ProcessorDependencies) ([]byte, error) { + startTime := time.Now() + + // 解析请求参数 + var req TestRequest + if err := json.Unmarshal(params, &req); err != nil { + return nil, errors.Join(processors.ErrInvalidParam, err) + } + + // 参数验证 + if err := deps.Validator.ValidateStruct(req); err != nil { + return nil, errors.Join(processors.ErrInvalidParam, err) + } + + // 模拟处理延迟 + if req.Delay > 0 { + select { + case <-ctx.Done(): + return nil, errors.Join(processors.ErrSystem, ctx.Err()) + case <-time.After(time.Duration(req.Delay) * time.Millisecond): + // 延迟完成 + } + } + + // 检查上下文是否已取消 + if ctx.Err() != nil { + return nil, errors.Join(processors.ErrSystem, ctx.Err()) + } + + // 生成响应数据 + response := TestResponse{ + Message: "测试请求处理成功", + Timestamp: time.Now(), + RequestID: generateTestRequestID(), + TestParam: req.TestParam, + ProcessTime: time.Since(startTime).Milliseconds(), + Status: "success", + } + + // 序列化响应 + result, err := json.Marshal(response) + if err != nil { + return nil, errors.Join(processors.ErrSystem, err) + } + + return result, nil +} + +// ProcessTestErrorRequest 测试错误处理的处理器 +func ProcessTestErrorRequest(ctx context.Context, params []byte, deps *processors.ProcessorDependencies) ([]byte, error) { + var req TestRequest + if err := json.Unmarshal(params, &req); err != nil { + return nil, errors.Join(processors.ErrInvalidParam, err) + } + + // 模拟不同类型的错误 + switch req.TestParam { + case "system_error": + return nil, processors.ErrSystem + case "datasource_error": + return nil, processors.ErrDatasource + case "not_found": + return nil, processors.ErrNotFound + case "invalid_param": + return nil, processors.ErrInvalidParam + default: + return nil, errors.Join(processors.ErrSystem, errors.New("未知错误类型")) + } +} + +// ProcessTestTimeoutRequest 测试超时处理的处理器 +func ProcessTestTimeoutRequest(ctx context.Context, params []byte, deps *processors.ProcessorDependencies) ([]byte, error) { + var req TestRequest + if err := json.Unmarshal(params, &req); err != nil { + return nil, errors.Join(processors.ErrInvalidParam, err) + } + + // 模拟长时间处理 + select { + case <-ctx.Done(): + return nil, errors.Join(processors.ErrSystem, ctx.Err()) + case <-time.After(10 * time.Second): // 10秒超时 + // 这里通常不会执行到,因为上下文会先超时 + } + + return nil, processors.ErrSystem +} + +// generateTestRequestID 生成测试用的请求ID +func generateTestRequestID() string { + return "test_" + time.Now().Format("20060102150405") + "_" + time.Now().Format("000000000") +} diff --git a/internal/domains/api/services/processors/yysy/yysy6f2e_processor.go b/internal/domains/api/services/processors/yysy/yysy6f2e_processor.go index 38b796b..c79e06c 100644 --- a/internal/domains/api/services/processors/yysy/yysy6f2e_processor.go +++ b/internal/domains/api/services/processors/yysy/yysy6f2e_processor.go @@ -38,10 +38,10 @@ func ProcessYYSY6F2ERequest(ctx context.Context, params []byte, deps *processors reqData := map[string]interface{}{ "data": map[string]interface{}{ - "name": encryptedName, - "idNo": encryptedIDCard, - "phone": encryptedMobileNo, - "phoneType": paramsDto.MobileType, + "name": encryptedName, + "idNo": encryptedIDCard, + "phone": encryptedMobileNo, + "phoneType": paramsDto.MobileType, }, } @@ -55,4 +55,4 @@ func ProcessYYSY6F2ERequest(ctx context.Context, params []byte, deps *processors } return respBytes, nil -} \ No newline at end of file +} diff --git a/internal/domains/article/entities/article.go b/internal/domains/article/entities/article.go new file mode 100644 index 0000000..3bba808 --- /dev/null +++ b/internal/domains/article/entities/article.go @@ -0,0 +1,195 @@ +package entities + +import ( + "time" + + "github.com/google/uuid" + "gorm.io/gorm" +) + +// ArticleStatus 文章状态枚举 +type ArticleStatus string + +const ( + ArticleStatusDraft ArticleStatus = "draft" // 草稿 + ArticleStatusPublished ArticleStatus = "published" // 已发布 + ArticleStatusArchived ArticleStatus = "archived" // 已归档 +) + +// Article 文章聚合根 +// 系统的核心内容实体,提供文章的完整生命周期管理 +// 支持草稿、发布、归档状态,实现Entity接口便于统一管理 +type Article struct { + // 基础标识 + ID string `gorm:"primaryKey;type:varchar(36)" json:"id" comment:"文章唯一标识"` + Title string `gorm:"type:varchar(200);not null" json:"title" comment:"文章标题"` + Content string `gorm:"type:text;not null" json:"content" comment:"文章内容"` + Summary string `gorm:"type:varchar(500)" json:"summary" comment:"文章摘要"` + CoverImage string `gorm:"type:varchar(500)" json:"cover_image" comment:"封面图片"` + + // 分类 + CategoryID string `gorm:"type:varchar(36)" json:"category_id" comment:"分类ID"` + + // 状态管理 + Status ArticleStatus `gorm:"type:varchar(20);not null;default:'draft'" json:"status" comment:"文章状态"` + IsFeatured bool `gorm:"default:false" json:"is_featured" comment:"是否推荐"` + PublishedAt *time.Time `json:"published_at" comment:"发布时间"` + ScheduledAt *time.Time `json:"scheduled_at" comment:"定时发布时间"` + + // 统计信息 + ViewCount int `gorm:"default:0" json:"view_count" comment:"阅读量"` + + // 时间戳字段 + CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at" comment:"创建时间"` + UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at" comment:"更新时间"` + DeletedAt gorm.DeletedAt `gorm:"index" json:"-" comment:"软删除时间"` + + // 关联关系 + Category *Category `gorm:"foreignKey:CategoryID" json:"category,omitempty" comment:"分类信息"` + Tags []Tag `gorm:"many2many:article_tag_relations;" json:"tags,omitempty" comment:"标签列表"` + + // 领域事件 (不持久化) + domainEvents []interface{} `gorm:"-" json:"-"` +} + +// TableName 指定表名 +func (Article) TableName() string { + return "articles" +} + +// BeforeCreate GORM钩子:创建前自动生成UUID +func (a *Article) BeforeCreate(tx *gorm.DB) error { + if a.ID == "" { + a.ID = uuid.New().String() + } + return nil +} + +// 实现 Entity 接口 - 提供统一的实体管理接口 +// GetID 获取实体唯一标识 +func (a *Article) GetID() string { + return a.ID +} + +// GetCreatedAt 获取创建时间 +func (a *Article) GetCreatedAt() time.Time { + return a.CreatedAt +} + +// GetUpdatedAt 获取更新时间 +func (a *Article) GetUpdatedAt() time.Time { + return a.UpdatedAt +} + +// Validate 验证文章信息 +// 检查文章必填字段是否完整,确保数据的有效性 +func (a *Article) Validate() error { + if a.Title == "" { + return NewValidationError("文章标题不能为空") + } + if a.Content == "" { + return NewValidationError("文章内容不能为空") + } + + // 验证标题长度 + if len(a.Title) > 200 { + return NewValidationError("文章标题不能超过200个字符") + } + + // 验证摘要长度 + if a.Summary != "" && len(a.Summary) > 500 { + return NewValidationError("文章摘要不能超过500个字符") + } + + return nil +} + +// Publish 发布文章 +func (a *Article) Publish() error { + if a.Status == ArticleStatusPublished { + return NewValidationError("文章已经是发布状态") + } + + a.Status = ArticleStatusPublished + now := time.Now() + a.PublishedAt = &now + a.ScheduledAt = nil // 清除定时发布时间 + + return nil +} + +// SchedulePublish 定时发布文章 +func (a *Article) SchedulePublish(scheduledTime time.Time) error { + if a.Status == ArticleStatusPublished { + return NewValidationError("文章已经是发布状态") + } + + if scheduledTime.Before(time.Now()) { + return NewValidationError("定时发布时间不能早于当前时间") + } + + a.Status = ArticleStatusDraft // 保持草稿状态,等待定时发布 + a.ScheduledAt = &scheduledTime + + return nil +} + +// IsScheduled 判断是否已设置定时发布 +func (a *Article) IsScheduled() bool { + return a.ScheduledAt != nil && a.Status == ArticleStatusDraft +} + +// GetScheduledTime 获取定时发布时间 +func (a *Article) GetScheduledTime() *time.Time { + return a.ScheduledAt +} + +// Archive 归档文章 +func (a *Article) Archive() error { + if a.Status == ArticleStatusArchived { + return NewValidationError("文章已经是归档状态") + } + + a.Status = ArticleStatusArchived + return nil +} + +// IncrementViewCount 增加阅读量 +func (a *Article) IncrementViewCount() { + a.ViewCount++ +} + +// SetFeatured 设置推荐状态 +func (a *Article) SetFeatured(featured bool) { + a.IsFeatured = featured +} + +// IsPublished 判断是否已发布 +func (a *Article) IsPublished() bool { + return a.Status == ArticleStatusPublished +} + +// IsDraft 判断是否为草稿 +func (a *Article) IsDraft() bool { + return a.Status == ArticleStatusDraft +} + +// IsArchived 判断是否已归档 +func (a *Article) IsArchived() bool { + return a.Status == ArticleStatusArchived +} + +// CanEdit 判断是否可以编辑 +func (a *Article) CanEdit() bool { + return a.Status == ArticleStatusDraft +} + +// CanPublish 判断是否可以发布 +func (a *Article) CanPublish() bool { + return a.Status == ArticleStatusDraft +} + +// CanArchive 判断是否可以归档 +func (a *Article) CanArchive() bool { + return a.Status == ArticleStatusPublished +} diff --git a/internal/domains/article/entities/category.go b/internal/domains/article/entities/category.go new file mode 100644 index 0000000..39c7d9f --- /dev/null +++ b/internal/domains/article/entities/category.go @@ -0,0 +1,78 @@ +package entities + +import ( + "time" + + "github.com/google/uuid" + "gorm.io/gorm" +) + +// Category 文章分类实体 +// 用于对文章进行分类管理,支持层级结构和排序 +type Category struct { + // 基础标识 + ID string `gorm:"primaryKey;type:varchar(36)" json:"id" comment:"分类唯一标识"` + Name string `gorm:"type:varchar(100);not null" json:"name" comment:"分类名称"` + Description string `gorm:"type:text" json:"description" comment:"分类描述"` + SortOrder int `gorm:"default:0" json:"sort_order" comment:"排序"` + + // 时间戳字段 + CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at" comment:"创建时间"` + UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at" comment:"更新时间"` + DeletedAt gorm.DeletedAt `gorm:"index" json:"-" comment:"软删除时间"` + + // 关联关系 + Articles []Article `gorm:"foreignKey:CategoryID" json:"articles,omitempty" comment:"分类下的文章"` + + // 领域事件 (不持久化) + domainEvents []interface{} `gorm:"-" json:"-"` +} + +// TableName 指定表名 +func (Category) TableName() string { + return "article_categories" +} + +// BeforeCreate GORM钩子:创建前自动生成UUID +func (c *Category) BeforeCreate(tx *gorm.DB) error { + if c.ID == "" { + c.ID = uuid.New().String() + } + return nil +} + +// 实现 Entity 接口 - 提供统一的实体管理接口 +// GetID 获取实体唯一标识 +func (c *Category) GetID() string { + return c.ID +} + +// GetCreatedAt 获取创建时间 +func (c *Category) GetCreatedAt() time.Time { + return c.CreatedAt +} + +// GetUpdatedAt 获取更新时间 +func (c *Category) GetUpdatedAt() time.Time { + return c.UpdatedAt +} + +// Validate 验证分类信息 +// 检查分类必填字段是否完整,确保数据的有效性 +func (c *Category) Validate() error { + if c.Name == "" { + return NewValidationError("分类名称不能为空") + } + + // 验证名称长度 + if len(c.Name) > 100 { + return NewValidationError("分类名称不能超过100个字符") + } + + return nil +} + +// SetSortOrder 设置排序 +func (c *Category) SetSortOrder(order int) { + c.SortOrder = order +} diff --git a/internal/domains/article/entities/errors.go b/internal/domains/article/entities/errors.go new file mode 100644 index 0000000..a0588c6 --- /dev/null +++ b/internal/domains/article/entities/errors.go @@ -0,0 +1,21 @@ +package entities + +// ValidationError 验证错误 +type ValidationError struct { + Message string +} + +func (e *ValidationError) Error() string { + return e.Message +} + +// NewValidationError 创建验证错误 +func NewValidationError(message string) *ValidationError { + return &ValidationError{Message: message} +} + +// IsValidationError 判断是否为验证错误 +func IsValidationError(err error) bool { + _, ok := err.(*ValidationError) + return ok +} diff --git a/internal/domains/article/entities/tag.go b/internal/domains/article/entities/tag.go new file mode 100644 index 0000000..8484acf --- /dev/null +++ b/internal/domains/article/entities/tag.go @@ -0,0 +1,102 @@ +package entities + +import ( + "time" + + "github.com/google/uuid" + "gorm.io/gorm" +) + +// Tag 文章标签实体 +// 用于对文章进行标签化管理,支持颜色配置 +type Tag struct { + // 基础标识 + ID string `gorm:"primaryKey;type:varchar(36)" json:"id" comment:"标签唯一标识"` + Name string `gorm:"type:varchar(50);not null" json:"name" comment:"标签名称"` + Color string `gorm:"type:varchar(20);default:'#1890ff'" json:"color" comment:"标签颜色"` + + // 时间戳字段 + CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at" comment:"创建时间"` + UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at" comment:"更新时间"` + DeletedAt gorm.DeletedAt `gorm:"index" json:"-" comment:"软删除时间"` + + // 关联关系 + Articles []Article `gorm:"many2many:article_tag_relations;" json:"articles,omitempty" comment:"标签下的文章"` + + // 领域事件 (不持久化) + domainEvents []interface{} `gorm:"-" json:"-"` +} + +// TableName 指定表名 +func (Tag) TableName() string { + return "article_tags" +} + +// BeforeCreate GORM钩子:创建前自动生成UUID +func (t *Tag) BeforeCreate(tx *gorm.DB) error { + if t.ID == "" { + t.ID = uuid.New().String() + } + return nil +} + +// 实现 Entity 接口 - 提供统一的实体管理接口 +// GetID 获取实体唯一标识 +func (t *Tag) GetID() string { + return t.ID +} + +// GetCreatedAt 获取创建时间 +func (t *Tag) GetCreatedAt() time.Time { + return t.CreatedAt +} + +// GetUpdatedAt 获取更新时间 +func (t *Tag) GetUpdatedAt() time.Time { + return t.UpdatedAt +} + +// Validate 验证标签信息 +// 检查标签必填字段是否完整,确保数据的有效性 +func (t *Tag) Validate() error { + if t.Name == "" { + return NewValidationError("标签名称不能为空") + } + + // 验证名称长度 + if len(t.Name) > 50 { + return NewValidationError("标签名称不能超过50个字符") + } + + // 验证颜色格式 + if t.Color != "" && !isValidColor(t.Color) { + return NewValidationError("标签颜色格式无效") + } + + return nil +} + +// SetColor 设置标签颜色 +func (t *Tag) SetColor(color string) error { + if color != "" && !isValidColor(color) { + return NewValidationError("标签颜色格式无效") + } + t.Color = color + return nil +} + +// isValidColor 验证颜色格式 +func isValidColor(color string) bool { + // 简单的颜色格式验证,支持 #RRGGBB 格式 + if len(color) == 7 && color[0] == '#' { + for i := 1; i < 7; i++ { + if !((color[i] >= '0' && color[i] <= '9') || + (color[i] >= 'a' && color[i] <= 'f') || + (color[i] >= 'A' && color[i] <= 'F')) { + return false + } + } + return true + } + return false +} diff --git a/internal/domains/article/repositories/article_repository_interface.go b/internal/domains/article/repositories/article_repository_interface.go new file mode 100644 index 0000000..b2c4e71 --- /dev/null +++ b/internal/domains/article/repositories/article_repository_interface.go @@ -0,0 +1,28 @@ +package repositories + +import ( + "context" + "tyapi-server/internal/domains/article/entities" + "tyapi-server/internal/domains/article/repositories/queries" + "tyapi-server/internal/shared/interfaces" +) + +// ArticleRepository 文章仓储接口 +type ArticleRepository interface { + interfaces.Repository[entities.Article] + + // 自定义查询方法 + FindByAuthorID(ctx context.Context, authorID string) ([]*entities.Article, error) + FindByCategoryID(ctx context.Context, categoryID string) ([]*entities.Article, error) + FindByStatus(ctx context.Context, status entities.ArticleStatus) ([]*entities.Article, error) + FindFeatured(ctx context.Context) ([]*entities.Article, error) + Search(ctx context.Context, query *queries.SearchArticleQuery) ([]*entities.Article, int64, error) + ListArticles(ctx context.Context, query *queries.ListArticleQuery) ([]*entities.Article, int64, error) + + // 统计方法 + CountByCategoryID(ctx context.Context, categoryID string) (int64, error) + CountByStatus(ctx context.Context, status entities.ArticleStatus) (int64, error) + + // 更新统计信息 + IncrementViewCount(ctx context.Context, articleID string) error +} diff --git a/internal/domains/article/repositories/category_repository_interface.go b/internal/domains/article/repositories/category_repository_interface.go new file mode 100644 index 0000000..d7bb0fc --- /dev/null +++ b/internal/domains/article/repositories/category_repository_interface.go @@ -0,0 +1,19 @@ +package repositories + +import ( + "context" + "tyapi-server/internal/domains/article/entities" + "tyapi-server/internal/shared/interfaces" +) + +// CategoryRepository 分类仓储接口 +type CategoryRepository interface { + interfaces.Repository[entities.Category] + + // 自定义查询方法 + FindActive(ctx context.Context) ([]*entities.Category, error) + FindBySortOrder(ctx context.Context) ([]*entities.Category, error) + + // 统计方法 + CountActive(ctx context.Context) (int64, error) +} diff --git a/internal/domains/article/repositories/queries/article_queries.go b/internal/domains/article/repositories/queries/article_queries.go new file mode 100644 index 0000000..bfce425 --- /dev/null +++ b/internal/domains/article/repositories/queries/article_queries.go @@ -0,0 +1,48 @@ +package queries + +import "tyapi-server/internal/domains/article/entities" + +// ListArticleQuery 文章列表查询 +type ListArticleQuery struct { + Page int `json:"page"` + PageSize int `json:"page_size"` + Status entities.ArticleStatus `json:"status"` + CategoryID string `json:"category_id"` + TagID string `json:"tag_id"` + Title string `json:"title"` + Summary string `json:"summary"` + IsFeatured *bool `json:"is_featured"` + OrderBy string `json:"order_by"` + OrderDir string `json:"order_dir"` +} + +// SearchArticleQuery 文章搜索查询 +type SearchArticleQuery struct { + Page int `json:"page"` + PageSize int `json:"page_size"` + Keyword string `json:"keyword"` + CategoryID string `json:"category_id"` + AuthorID string `json:"author_id"` + Status entities.ArticleStatus `json:"status"` + OrderBy string `json:"order_by"` + OrderDir string `json:"order_dir"` +} + +// GetArticleQuery 获取文章详情查询 +type GetArticleQuery struct { + ID string `json:"id"` +} + +// GetArticlesByAuthorQuery 获取作者文章查询 +type GetArticlesByAuthorQuery struct { + AuthorID string `json:"author_id"` + Page int `json:"page"` + PageSize int `json:"page_size"` +} + +// GetArticlesByCategoryQuery 获取分类文章查询 +type GetArticlesByCategoryQuery struct { + CategoryID string `json:"category_id"` + Page int `json:"page"` + PageSize int `json:"page_size"` +} diff --git a/internal/domains/article/repositories/tag_repository_interface.go b/internal/domains/article/repositories/tag_repository_interface.go new file mode 100644 index 0000000..e7ba660 --- /dev/null +++ b/internal/domains/article/repositories/tag_repository_interface.go @@ -0,0 +1,21 @@ +package repositories + +import ( + "context" + "tyapi-server/internal/domains/article/entities" + "tyapi-server/internal/shared/interfaces" +) + +// TagRepository 标签仓储接口 +type TagRepository interface { + interfaces.Repository[entities.Tag] + + // 自定义查询方法 + FindByArticleID(ctx context.Context, articleID string) ([]*entities.Tag, error) + FindByName(ctx context.Context, name string) (*entities.Tag, error) + + // 关联方法 + AddTagToArticle(ctx context.Context, articleID string, tagID string) error + RemoveTagFromArticle(ctx context.Context, articleID string, tagID string) error + GetArticleTags(ctx context.Context, articleID string) ([]*entities.Tag, error) +} diff --git a/internal/domains/article/services/article_service.go b/internal/domains/article/services/article_service.go new file mode 100644 index 0000000..75e95df --- /dev/null +++ b/internal/domains/article/services/article_service.go @@ -0,0 +1,94 @@ +package services + +import ( + "tyapi-server/internal/domains/article/entities" +) + +// ArticleService 文章领域服务 +// 处理文章相关的业务逻辑,包括验证、状态管理等 +type ArticleService struct{} + +// NewArticleService 创建文章领域服务 +func NewArticleService() *ArticleService { + return &ArticleService{} +} + +// ValidateArticle 验证文章 +// 检查文章是否符合业务规则 +func (s *ArticleService) ValidateArticle(article *entities.Article) error { + // 1. 基础验证 + if err := article.Validate(); err != nil { + return err + } + + // 2. 业务规则验证 + // 标题不能包含敏感词 + if s.containsSensitiveWords(article.Title) { + return entities.NewValidationError("文章标题包含敏感词") + } + + // 内容不能包含敏感词 + if s.containsSensitiveWords(article.Content) { + return entities.NewValidationError("文章内容包含敏感词") + } + + // 摘要长度不能超过内容长度 + if article.Summary != "" && len(article.Summary) >= len(article.Content) { + return entities.NewValidationError("文章摘要不能超过内容长度") + } + + return nil +} + +// CanPublish 检查是否可以发布 +func (s *ArticleService) CanPublish(article *entities.Article) error { + if !article.CanPublish() { + return entities.NewValidationError("文章状态不允许发布") + } + + // 检查必填字段 + if article.Title == "" { + return entities.NewValidationError("文章标题不能为空") + } + if article.Content == "" { + return entities.NewValidationError("文章内容不能为空") + } + + return nil +} + +// CanEdit 检查是否可以编辑 +func (s *ArticleService) CanEdit(article *entities.Article) error { + if !article.CanEdit() { + return entities.NewValidationError("文章状态不允许编辑") + } + + return nil +} + +// containsSensitiveWords 检查是否包含敏感词 +func (s *ArticleService) containsSensitiveWords(text string) bool { + // TODO: 实现敏感词检查逻辑 + // 这里可以集成敏感词库或调用外部服务 + sensitiveWords := []string{ + "敏感词1", + "敏感词2", + "敏感词3", + } + + for _, word := range sensitiveWords { + if len(word) > 0 && len(text) > 0 { + // 简单的字符串包含检查 + // 实际项目中应该使用更复杂的算法 + if len(text) >= len(word) { + for i := 0; i <= len(text)-len(word); i++ { + if text[i:i+len(word)] == word { + return true + } + } + } + } + } + + return false +} diff --git a/internal/infrastructure/cache/redis_cache.go b/internal/infrastructure/cache/redis_cache.go index c531e10..b7820db 100644 --- a/internal/infrastructure/cache/redis_cache.go +++ b/internal/infrastructure/cache/redis_cache.go @@ -171,9 +171,9 @@ func (r *RedisCache) GetMultiple(ctx context.Context, keys []string) (map[string var data interface{} // 修复:改进JSON反序列化错误处理 if err := json.Unmarshal([]byte(val.(string)), &data); err != nil { - r.logger.Warn("反序列化缓存数据失败", - zap.String("key", keys[i]), - zap.String("value", val.(string)), + r.logger.Warn("反序列化缓存数据失败", + zap.String("key", keys[i]), + zap.String("value", val.(string)), zap.Error(err)) continue } @@ -227,17 +227,18 @@ func (r *RedisCache) DeletePattern(ctx context.Context, pattern string) error { } else { fullPattern = r.getFullKey(pattern) } - + // 检查上下文是否已取消 if ctx.Err() != nil { return ctx.Err() } - + var cursor uint64 var totalDeleted int64 maxIterations := 100 // 防止无限循环 iteration := 0 - + + for { // 检查迭代次数限制 iteration++ @@ -249,7 +250,7 @@ func (r *RedisCache) DeletePattern(ctx context.Context, pattern string) error { ) break } - + // 检查上下文是否已取消 if ctx.Err() != nil { r.logger.Warn("缓存删除操作被取消", @@ -259,7 +260,7 @@ func (r *RedisCache) DeletePattern(ctx context.Context, pattern string) error { ) return ctx.Err() } - + // 执行SCAN操作 keys, next, err := r.client.Scan(ctx, cursor, fullPattern, 1000).Result() if err != nil { @@ -272,27 +273,27 @@ func (r *RedisCache) DeletePattern(ctx context.Context, pattern string) error { ) return err } - - r.logger.Error("扫描缓存键失败", - zap.String("pattern", fullPattern), + + r.logger.Error("扫描缓存键失败", + zap.String("pattern", fullPattern), zap.Error(err)) return err } - + // 批量删除找到的键 if len(keys) > 0 { // 使用pipeline批量删除,提高性能 pipe := r.client.Pipeline() pipe.Del(ctx, keys...) - + cmds, err := pipe.Exec(ctx) if err != nil { - r.logger.Error("批量删除缓存键失败", - zap.Strings("keys", keys), + r.logger.Error("批量删除缓存键失败", + zap.Strings("keys", keys), zap.Error(err)) return err } - + // 统计删除的键数量 for _, cmd := range cmds { if delCmd, ok := cmd.(*redis.IntCmd); ok { @@ -301,26 +302,26 @@ func (r *RedisCache) DeletePattern(ctx context.Context, pattern string) error { } } } - - r.logger.Debug("批量删除缓存键", + + r.logger.Debug("批量删除缓存键", zap.Strings("keys", keys), zap.Int("batch_size", len(keys)), zap.Int64("total_deleted", totalDeleted), ) } - + cursor = next if cursor == 0 { break } } - + r.logger.Debug("缓存模式删除完成", zap.String("pattern", fullPattern), zap.Int64("total_deleted", totalDeleted), zap.Int("iterations", iteration), ) - + return nil } diff --git a/internal/infrastructure/database/repositories/article/gorm_article_repository.go b/internal/infrastructure/database/repositories/article/gorm_article_repository.go new file mode 100644 index 0000000..7c1798c --- /dev/null +++ b/internal/infrastructure/database/repositories/article/gorm_article_repository.go @@ -0,0 +1,487 @@ +package repositories + +import ( + "context" + "fmt" + "strings" + "tyapi-server/internal/domains/article/entities" + "tyapi-server/internal/domains/article/repositories" + repoQueries "tyapi-server/internal/domains/article/repositories/queries" + "tyapi-server/internal/shared/interfaces" + + "go.uber.org/zap" + "gorm.io/gorm" +) + +// GormArticleRepository GORM文章仓储实现 +type GormArticleRepository struct { + db *gorm.DB + logger *zap.Logger +} + +// 编译时检查接口实现 +var _ repositories.ArticleRepository = (*GormArticleRepository)(nil) + +// NewGormArticleRepository 创建GORM文章仓储 +func NewGormArticleRepository(db *gorm.DB, logger *zap.Logger) *GormArticleRepository { + return &GormArticleRepository{ + db: db, + logger: logger, + } +} + +// Create 创建文章 +func (r *GormArticleRepository) Create(ctx context.Context, entity entities.Article) (entities.Article, error) { + r.logger.Info("创建文章", zap.String("id", entity.ID), zap.String("title", entity.Title)) + + err := r.db.WithContext(ctx).Create(&entity).Error + if err != nil { + r.logger.Error("创建文章失败", zap.Error(err)) + return entity, err + } + + return entity, nil +} + +// GetByID 根据ID获取文章 +func (r *GormArticleRepository) GetByID(ctx context.Context, id string) (entities.Article, error) { + var entity entities.Article + + err := r.db.WithContext(ctx). + Preload("Category"). + Preload("Tags"). + Where("id = ?", id). + First(&entity).Error + + if err != nil { + if err == gorm.ErrRecordNotFound { + return entity, fmt.Errorf("文章不存在") + } + r.logger.Error("获取文章失败", zap.String("id", id), zap.Error(err)) + return entity, err + } + + return entity, nil +} + +// Update 更新文章 +func (r *GormArticleRepository) Update(ctx context.Context, entity entities.Article) error { + r.logger.Info("更新文章", zap.String("id", entity.ID)) + + err := r.db.WithContext(ctx).Save(&entity).Error + if err != nil { + r.logger.Error("更新文章失败", zap.String("id", entity.ID), zap.Error(err)) + return err + } + + return nil +} + +// Delete 删除文章 +func (r *GormArticleRepository) Delete(ctx context.Context, id string) error { + r.logger.Info("删除文章", zap.String("id", id)) + + err := r.db.WithContext(ctx).Delete(&entities.Article{}, "id = ?", id).Error + if err != nil { + r.logger.Error("删除文章失败", zap.String("id", id), zap.Error(err)) + return err + } + + return nil +} + +// FindByAuthorID 根据作者ID查找文章 +func (r *GormArticleRepository) FindByAuthorID(ctx context.Context, authorID string) ([]*entities.Article, error) { + var articles []entities.Article + + err := r.db.WithContext(ctx). + Preload("Category"). + Preload("Tags"). + Where("author_id = ?", authorID). + Order("created_at DESC"). + Find(&articles).Error + + if err != nil { + r.logger.Error("根据作者ID查找文章失败", zap.String("author_id", authorID), zap.Error(err)) + return nil, err + } + + // 转换为指针切片 + result := make([]*entities.Article, len(articles)) + for i := range articles { + result[i] = &articles[i] + } + + return result, nil +} + +// FindByCategoryID 根据分类ID查找文章 +func (r *GormArticleRepository) FindByCategoryID(ctx context.Context, categoryID string) ([]*entities.Article, error) { + var articles []entities.Article + + err := r.db.WithContext(ctx). + Preload("Category"). + Preload("Tags"). + Where("category_id = ?", categoryID). + Order("created_at DESC"). + Find(&articles).Error + + if err != nil { + r.logger.Error("根据分类ID查找文章失败", zap.String("category_id", categoryID), zap.Error(err)) + return nil, err + } + + // 转换为指针切片 + result := make([]*entities.Article, len(articles)) + for i := range articles { + result[i] = &articles[i] + } + + return result, nil +} + +// FindByStatus 根据状态查找文章 +func (r *GormArticleRepository) FindByStatus(ctx context.Context, status entities.ArticleStatus) ([]*entities.Article, error) { + var articles []entities.Article + + err := r.db.WithContext(ctx). + Preload("Category"). + Preload("Tags"). + Where("status = ?", status). + Order("created_at DESC"). + Find(&articles).Error + + if err != nil { + r.logger.Error("根据状态查找文章失败", zap.String("status", string(status)), zap.Error(err)) + return nil, err + } + + // 转换为指针切片 + result := make([]*entities.Article, len(articles)) + for i := range articles { + result[i] = &articles[i] + } + + return result, nil +} + +// FindFeatured 查找推荐文章 +func (r *GormArticleRepository) FindFeatured(ctx context.Context) ([]*entities.Article, error) { + var articles []entities.Article + + err := r.db.WithContext(ctx). + Preload("Category"). + Preload("Tags"). + Where("is_featured = ? AND status = ?", true, entities.ArticleStatusPublished). + Order("published_at DESC"). + Find(&articles).Error + + if err != nil { + r.logger.Error("查找推荐文章失败", zap.Error(err)) + return nil, err + } + + // 转换为指针切片 + result := make([]*entities.Article, len(articles)) + for i := range articles { + result[i] = &articles[i] + } + + return result, nil +} + +// Search 搜索文章 +func (r *GormArticleRepository) Search(ctx context.Context, query *repoQueries.SearchArticleQuery) ([]*entities.Article, int64, error) { + var articles []entities.Article + var total int64 + + dbQuery := r.db.WithContext(ctx).Model(&entities.Article{}) + + // 应用搜索条件 + if query.Keyword != "" { + keyword := "%" + query.Keyword + "%" + dbQuery = dbQuery.Where("title LIKE ? OR content LIKE ? OR summary LIKE ?", keyword, keyword, keyword) + } + + if query.CategoryID != "" { + dbQuery = dbQuery.Where("category_id = ?", query.CategoryID) + } + + if query.AuthorID != "" { + dbQuery = dbQuery.Where("author_id = ?", query.AuthorID) + } + + if query.Status != "" { + dbQuery = dbQuery.Where("status = ?", query.Status) + } + + // 获取总数 + if err := dbQuery.Count(&total).Error; err != nil { + r.logger.Error("获取搜索结果总数失败", zap.Error(err)) + return nil, 0, err + } + + // 应用排序 + if query.OrderBy != "" { + orderDir := "DESC" + if query.OrderDir != "" { + orderDir = strings.ToUpper(query.OrderDir) + } + dbQuery = dbQuery.Order(fmt.Sprintf("%s %s", query.OrderBy, orderDir)) + } else { + dbQuery = dbQuery.Order("created_at DESC") + } + + // 应用分页 + if query.Page > 0 && query.PageSize > 0 { + offset := (query.Page - 1) * query.PageSize + dbQuery = dbQuery.Offset(offset).Limit(query.PageSize) + } + + // 预加载关联数据 + dbQuery = dbQuery.Preload("Category").Preload("Tags") + + // 获取数据 + if err := dbQuery.Find(&articles).Error; err != nil { + r.logger.Error("搜索文章失败", zap.Error(err)) + return nil, 0, err + } + + // 转换为指针切片 + result := make([]*entities.Article, len(articles)) + for i := range articles { + result[i] = &articles[i] + } + + return result, total, nil +} + +// ListArticles 获取文章列表 +func (r *GormArticleRepository) ListArticles(ctx context.Context, query *repoQueries.ListArticleQuery) ([]*entities.Article, int64, error) { + var articles []entities.Article + var total int64 + + dbQuery := r.db.WithContext(ctx).Model(&entities.Article{}) + + // 应用筛选条件 + if query.Status != "" { + dbQuery = dbQuery.Where("status = ?", query.Status) + } + + if query.CategoryID != "" { + dbQuery = dbQuery.Where("category_id = ?", query.CategoryID) + } + + if query.TagID != "" { + // 通过标签关联表筛选 + dbQuery = dbQuery.Joins("JOIN article_tag_relations ON articles.id = article_tag_relations.article_id"). + Where("article_tag_relations.tag_id = ?", query.TagID) + } + + if query.Title != "" { + dbQuery = dbQuery.Where("title ILIKE ?", "%"+query.Title+"%") + } + + if query.Summary != "" { + dbQuery = dbQuery.Where("summary ILIKE ?", "%"+query.Summary+"%") + } + + if query.IsFeatured != nil { + dbQuery = dbQuery.Where("is_featured = ?", *query.IsFeatured) + } + + // 获取总数 + if err := dbQuery.Count(&total).Error; err != nil { + r.logger.Error("获取文章列表总数失败", zap.Error(err)) + return nil, 0, err + } + + // 应用排序 + if query.OrderBy != "" { + orderDir := "DESC" + if query.OrderDir != "" { + orderDir = strings.ToUpper(query.OrderDir) + } + dbQuery = dbQuery.Order(fmt.Sprintf("%s %s", query.OrderBy, orderDir)) + } else { + dbQuery = dbQuery.Order("created_at DESC") + } + + // 应用分页 + if query.Page > 0 && query.PageSize > 0 { + offset := (query.Page - 1) * query.PageSize + dbQuery = dbQuery.Offset(offset).Limit(query.PageSize) + } + + // 预加载关联数据 + dbQuery = dbQuery.Preload("Category").Preload("Tags") + + // 获取数据 + if err := dbQuery.Find(&articles).Error; err != nil { + r.logger.Error("获取文章列表失败", zap.Error(err)) + return nil, 0, err + } + + // 转换为指针切片 + result := make([]*entities.Article, len(articles)) + for i := range articles { + result[i] = &articles[i] + } + + return result, total, nil +} + + + +// CountByCategoryID 统计分类文章数量 +func (r *GormArticleRepository) CountByCategoryID(ctx context.Context, categoryID string) (int64, error) { + var count int64 + + err := r.db.WithContext(ctx).Model(&entities.Article{}). + Where("category_id = ?", categoryID). + Count(&count).Error + + if err != nil { + r.logger.Error("统计分类文章数量失败", zap.String("category_id", categoryID), zap.Error(err)) + return 0, err + } + + return count, nil +} + +// CountByStatus 统计状态文章数量 +func (r *GormArticleRepository) CountByStatus(ctx context.Context, status entities.ArticleStatus) (int64, error) { + var count int64 + + dbQuery := r.db.WithContext(ctx).Model(&entities.Article{}) + + if status != "" { + dbQuery = dbQuery.Where("status = ?", status) + } + + err := dbQuery.Count(&count).Error + if err != nil { + r.logger.Error("统计状态文章数量失败", zap.String("status", string(status)), zap.Error(err)) + return 0, err + } + + return count, nil +} + +// IncrementViewCount 增加阅读量 +func (r *GormArticleRepository) IncrementViewCount(ctx context.Context, articleID string) error { + err := r.db.WithContext(ctx).Model(&entities.Article{}). + Where("id = ?", articleID). + UpdateColumn("view_count", gorm.Expr("view_count + ?", 1)).Error + + if err != nil { + r.logger.Error("增加阅读量失败", zap.String("article_id", articleID), zap.Error(err)) + return err + } + + return nil +} + + + +// 实现 BaseRepository 接口的其他方法 +func (r *GormArticleRepository) Count(ctx context.Context, options interfaces.CountOptions) (int64, error) { + dbQuery := r.db.WithContext(ctx).Model(&entities.Article{}) + + // 应用筛选条件 + if options.Filters != nil { + for key, value := range options.Filters { + dbQuery = dbQuery.Where(key+" = ?", value) + } + } + + if options.Search != "" { + search := "%" + options.Search + "%" + dbQuery = dbQuery.Where("title LIKE ? OR content LIKE ?", search, search) + } + + var count int64 + err := dbQuery.Count(&count).Error + return count, err +} + +func (r *GormArticleRepository) Exists(ctx context.Context, id string) (bool, error) { + var count int64 + err := r.db.WithContext(ctx).Model(&entities.Article{}). + Where("id = ?", id). + Count(&count).Error + return count > 0, err +} + +func (r *GormArticleRepository) SoftDelete(ctx context.Context, id string) error { + return r.db.WithContext(ctx).Delete(&entities.Article{}, "id = ?", id).Error +} + +func (r *GormArticleRepository) Restore(ctx context.Context, id string) error { + return r.db.WithContext(ctx).Unscoped().Model(&entities.Article{}). + Where("id = ?", id). + Update("deleted_at", nil).Error +} + +func (r *GormArticleRepository) CreateBatch(ctx context.Context, entities []entities.Article) error { + return r.db.WithContext(ctx).Create(&entities).Error +} + +func (r *GormArticleRepository) GetByIDs(ctx context.Context, ids []string) ([]entities.Article, error) { + var articles []entities.Article + err := r.db.WithContext(ctx).Where("id IN ?", ids).Find(&articles).Error + return articles, err +} + +func (r *GormArticleRepository) UpdateBatch(ctx context.Context, entities []entities.Article) error { + return r.db.WithContext(ctx).Save(&entities).Error +} + +func (r *GormArticleRepository) DeleteBatch(ctx context.Context, ids []string) error { + return r.db.WithContext(ctx).Delete(&entities.Article{}, "id IN ?", ids).Error +} + +func (r *GormArticleRepository) List(ctx context.Context, options interfaces.ListOptions) ([]entities.Article, error) { + var articles []entities.Article + + dbQuery := r.db.WithContext(ctx).Model(&entities.Article{}) + + // 应用筛选条件 + if options.Filters != nil { + for key, value := range options.Filters { + dbQuery = dbQuery.Where(key+" = ?", value) + } + } + + if options.Search != "" { + search := "%" + options.Search + "%" + dbQuery = dbQuery.Where("title LIKE ? OR content LIKE ?", search, search) + } + + // 应用排序 + if options.Sort != "" { + order := "DESC" + if options.Order != "" { + order = strings.ToUpper(options.Order) + } + dbQuery = dbQuery.Order(fmt.Sprintf("%s %s", options.Sort, order)) + } else { + dbQuery = dbQuery.Order("created_at DESC") + } + + // 应用分页 + if options.Page > 0 && options.PageSize > 0 { + offset := (options.Page - 1) * options.PageSize + dbQuery = dbQuery.Offset(offset).Limit(options.PageSize) + } + + // 预加载关联数据 + if len(options.Include) > 0 { + for _, include := range options.Include { + dbQuery = dbQuery.Preload(include) + } + } + + err := dbQuery.Find(&articles).Error + return articles, err +} diff --git a/internal/infrastructure/database/repositories/article/gorm_category_repository.go b/internal/infrastructure/database/repositories/article/gorm_category_repository.go new file mode 100644 index 0000000..7c3104c --- /dev/null +++ b/internal/infrastructure/database/repositories/article/gorm_category_repository.go @@ -0,0 +1,247 @@ +package repositories + +import ( + "context" + "fmt" + "tyapi-server/internal/domains/article/entities" + "tyapi-server/internal/domains/article/repositories" + "tyapi-server/internal/shared/interfaces" + + "go.uber.org/zap" + "gorm.io/gorm" +) + +// GormCategoryRepository GORM分类仓储实现 +type GormCategoryRepository struct { + db *gorm.DB + logger *zap.Logger +} + +// 编译时检查接口实现 +var _ repositories.CategoryRepository = (*GormCategoryRepository)(nil) + +// NewGormCategoryRepository 创建GORM分类仓储 +func NewGormCategoryRepository(db *gorm.DB, logger *zap.Logger) *GormCategoryRepository { + return &GormCategoryRepository{ + db: db, + logger: logger, + } +} + +// Create 创建分类 +func (r *GormCategoryRepository) Create(ctx context.Context, entity entities.Category) (entities.Category, error) { + r.logger.Info("创建分类", zap.String("id", entity.ID), zap.String("name", entity.Name)) + + err := r.db.WithContext(ctx).Create(&entity).Error + if err != nil { + r.logger.Error("创建分类失败", zap.Error(err)) + return entity, err + } + + return entity, nil +} + +// GetByID 根据ID获取分类 +func (r *GormCategoryRepository) GetByID(ctx context.Context, id string) (entities.Category, error) { + var entity entities.Category + + err := r.db.WithContext(ctx).Where("id = ?", id).First(&entity).Error + if err != nil { + if err == gorm.ErrRecordNotFound { + return entity, fmt.Errorf("分类不存在") + } + r.logger.Error("获取分类失败", zap.String("id", id), zap.Error(err)) + return entity, err + } + + return entity, nil +} + +// Update 更新分类 +func (r *GormCategoryRepository) Update(ctx context.Context, entity entities.Category) error { + r.logger.Info("更新分类", zap.String("id", entity.ID)) + + err := r.db.WithContext(ctx).Save(&entity).Error + if err != nil { + r.logger.Error("更新分类失败", zap.String("id", entity.ID), zap.Error(err)) + return err + } + + return nil +} + +// Delete 删除分类 +func (r *GormCategoryRepository) Delete(ctx context.Context, id string) error { + r.logger.Info("删除分类", zap.String("id", id)) + + err := r.db.WithContext(ctx).Delete(&entities.Category{}, "id = ?", id).Error + if err != nil { + r.logger.Error("删除分类失败", zap.String("id", id), zap.Error(err)) + return err + } + + return nil +} + +// FindActive 查找启用的分类 +func (r *GormCategoryRepository) FindActive(ctx context.Context) ([]*entities.Category, error) { + var categories []entities.Category + + err := r.db.WithContext(ctx). + Where("active = ?", true). + Order("sort_order ASC, created_at ASC"). + Find(&categories).Error + + if err != nil { + r.logger.Error("查找启用分类失败", zap.Error(err)) + return nil, err + } + + // 转换为指针切片 + result := make([]*entities.Category, len(categories)) + for i := range categories { + result[i] = &categories[i] + } + + return result, nil +} + +// FindBySortOrder 按排序查找分类 +func (r *GormCategoryRepository) FindBySortOrder(ctx context.Context) ([]*entities.Category, error) { + var categories []entities.Category + + err := r.db.WithContext(ctx). + Order("sort_order ASC, created_at ASC"). + Find(&categories).Error + + if err != nil { + r.logger.Error("按排序查找分类失败", zap.Error(err)) + return nil, err + } + + // 转换为指针切片 + result := make([]*entities.Category, len(categories)) + for i := range categories { + result[i] = &categories[i] + } + + return result, nil +} + +// CountActive 统计启用分类数量 +func (r *GormCategoryRepository) CountActive(ctx context.Context) (int64, error) { + var count int64 + + err := r.db.WithContext(ctx).Model(&entities.Category{}). + Where("active = ?", true). + Count(&count).Error + + if err != nil { + r.logger.Error("统计启用分类数量失败", zap.Error(err)) + return 0, err + } + + return count, nil +} + +// 实现 BaseRepository 接口的其他方法 +func (r *GormCategoryRepository) Count(ctx context.Context, options interfaces.CountOptions) (int64, error) { + dbQuery := r.db.WithContext(ctx).Model(&entities.Category{}) + + // 应用筛选条件 + if options.Filters != nil { + for key, value := range options.Filters { + dbQuery = dbQuery.Where(key+" = ?", value) + } + } + + if options.Search != "" { + search := "%" + options.Search + "%" + dbQuery = dbQuery.Where("name LIKE ? OR description LIKE ?", search, search) + } + + var count int64 + err := dbQuery.Count(&count).Error + return count, err +} + +func (r *GormCategoryRepository) Exists(ctx context.Context, id string) (bool, error) { + var count int64 + err := r.db.WithContext(ctx).Model(&entities.Category{}). + Where("id = ?", id). + Count(&count).Error + return count > 0, err +} + +func (r *GormCategoryRepository) SoftDelete(ctx context.Context, id string) error { + return r.db.WithContext(ctx).Delete(&entities.Category{}, "id = ?", id).Error +} + +func (r *GormCategoryRepository) Restore(ctx context.Context, id string) error { + return r.db.WithContext(ctx).Unscoped().Model(&entities.Category{}). + Where("id = ?", id). + Update("deleted_at", nil).Error +} + +func (r *GormCategoryRepository) CreateBatch(ctx context.Context, entities []entities.Category) error { + return r.db.WithContext(ctx).Create(&entities).Error +} + +func (r *GormCategoryRepository) GetByIDs(ctx context.Context, ids []string) ([]entities.Category, error) { + var categories []entities.Category + err := r.db.WithContext(ctx).Where("id IN ?", ids).Find(&categories).Error + return categories, err +} + +func (r *GormCategoryRepository) UpdateBatch(ctx context.Context, entities []entities.Category) error { + return r.db.WithContext(ctx).Save(&entities).Error +} + +func (r *GormCategoryRepository) DeleteBatch(ctx context.Context, ids []string) error { + return r.db.WithContext(ctx).Delete(&entities.Category{}, "id IN ?", ids).Error +} + +func (r *GormCategoryRepository) List(ctx context.Context, options interfaces.ListOptions) ([]entities.Category, error) { + var categories []entities.Category + + dbQuery := r.db.WithContext(ctx).Model(&entities.Category{}) + + // 应用筛选条件 + if options.Filters != nil { + for key, value := range options.Filters { + dbQuery = dbQuery.Where(key+" = ?", value) + } + } + + if options.Search != "" { + search := "%" + options.Search + "%" + dbQuery = dbQuery.Where("name LIKE ? OR description LIKE ?", search, search) + } + + // 应用排序 + if options.Sort != "" { + order := "DESC" + if options.Order != "" { + order = options.Order + } + dbQuery = dbQuery.Order(fmt.Sprintf("%s %s", options.Sort, order)) + } else { + dbQuery = dbQuery.Order("sort_order ASC, created_at ASC") + } + + // 应用分页 + if options.Page > 0 && options.PageSize > 0 { + offset := (options.Page - 1) * options.PageSize + dbQuery = dbQuery.Offset(offset).Limit(options.PageSize) + } + + // 预加载关联数据 + if len(options.Include) > 0 { + for _, include := range options.Include { + dbQuery = dbQuery.Preload(include) + } + } + + err := dbQuery.Find(&categories).Error + return categories, err +} diff --git a/internal/infrastructure/database/repositories/article/gorm_tag_repository.go b/internal/infrastructure/database/repositories/article/gorm_tag_repository.go new file mode 100644 index 0000000..9e9c618 --- /dev/null +++ b/internal/infrastructure/database/repositories/article/gorm_tag_repository.go @@ -0,0 +1,279 @@ +package repositories + +import ( + "context" + "fmt" + "tyapi-server/internal/domains/article/entities" + "tyapi-server/internal/domains/article/repositories" + "tyapi-server/internal/shared/interfaces" + + "go.uber.org/zap" + "gorm.io/gorm" +) + +// GormTagRepository GORM标签仓储实现 +type GormTagRepository struct { + db *gorm.DB + logger *zap.Logger +} + +// 编译时检查接口实现 +var _ repositories.TagRepository = (*GormTagRepository)(nil) + +// NewGormTagRepository 创建GORM标签仓储 +func NewGormTagRepository(db *gorm.DB, logger *zap.Logger) *GormTagRepository { + return &GormTagRepository{ + db: db, + logger: logger, + } +} + +// Create 创建标签 +func (r *GormTagRepository) Create(ctx context.Context, entity entities.Tag) (entities.Tag, error) { + r.logger.Info("创建标签", zap.String("id", entity.ID), zap.String("name", entity.Name)) + + err := r.db.WithContext(ctx).Create(&entity).Error + if err != nil { + r.logger.Error("创建标签失败", zap.Error(err)) + return entity, err + } + + return entity, nil +} + +// GetByID 根据ID获取标签 +func (r *GormTagRepository) GetByID(ctx context.Context, id string) (entities.Tag, error) { + var entity entities.Tag + + err := r.db.WithContext(ctx).Where("id = ?", id).First(&entity).Error + if err != nil { + if err == gorm.ErrRecordNotFound { + return entity, fmt.Errorf("标签不存在") + } + r.logger.Error("获取标签失败", zap.String("id", id), zap.Error(err)) + return entity, err + } + + return entity, nil +} + +// Update 更新标签 +func (r *GormTagRepository) Update(ctx context.Context, entity entities.Tag) error { + r.logger.Info("更新标签", zap.String("id", entity.ID)) + + err := r.db.WithContext(ctx).Save(&entity).Error + if err != nil { + r.logger.Error("更新标签失败", zap.String("id", entity.ID), zap.Error(err)) + return err + } + + return nil +} + +// Delete 删除标签 +func (r *GormTagRepository) Delete(ctx context.Context, id string) error { + r.logger.Info("删除标签", zap.String("id", id)) + + err := r.db.WithContext(ctx).Delete(&entities.Tag{}, "id = ?", id).Error + if err != nil { + r.logger.Error("删除标签失败", zap.String("id", id), zap.Error(err)) + return err + } + + return nil +} + +// FindByArticleID 根据文章ID查找标签 +func (r *GormTagRepository) FindByArticleID(ctx context.Context, articleID string) ([]*entities.Tag, error) { + var tags []entities.Tag + + err := r.db.WithContext(ctx). + Joins("JOIN article_tag_relations ON article_tag_relations.tag_id = tags.id"). + Where("article_tag_relations.article_id = ?", articleID). + Find(&tags).Error + + if err != nil { + r.logger.Error("根据文章ID查找标签失败", zap.String("article_id", articleID), zap.Error(err)) + return nil, err + } + + // 转换为指针切片 + result := make([]*entities.Tag, len(tags)) + for i := range tags { + result[i] = &tags[i] + } + + return result, nil +} + +// FindByName 根据名称查找标签 +func (r *GormTagRepository) FindByName(ctx context.Context, name string) (*entities.Tag, error) { + var tag entities.Tag + + err := r.db.WithContext(ctx).Where("name = ?", name).First(&tag).Error + if err != nil { + if err == gorm.ErrRecordNotFound { + return nil, nil + } + r.logger.Error("根据名称查找标签失败", zap.String("name", name), zap.Error(err)) + return nil, err + } + + return &tag, nil +} + +// AddTagToArticle 为文章添加标签 +func (r *GormTagRepository) AddTagToArticle(ctx context.Context, articleID string, tagID string) error { + // 检查关联是否已存在 + var count int64 + err := r.db.WithContext(ctx).Table("article_tag_relations"). + Where("article_id = ? AND tag_id = ?", articleID, tagID). + Count(&count).Error + + if err != nil { + r.logger.Error("检查标签关联失败", zap.String("article_id", articleID), zap.String("tag_id", tagID), zap.Error(err)) + return err + } + + if count > 0 { + // 关联已存在,不需要重复添加 + return nil + } + + // 创建关联 + err = r.db.WithContext(ctx).Exec(` + INSERT INTO article_tag_relations (id, article_id, tag_id, created_at) + VALUES (UUID(), ?, ?, NOW()) + `, articleID, tagID).Error + + if err != nil { + r.logger.Error("添加标签到文章失败", zap.String("article_id", articleID), zap.String("tag_id", tagID), zap.Error(err)) + return err + } + + r.logger.Info("添加标签到文章成功", zap.String("article_id", articleID), zap.String("tag_id", tagID)) + return nil +} + +// RemoveTagFromArticle 从文章移除标签 +func (r *GormTagRepository) RemoveTagFromArticle(ctx context.Context, articleID string, tagID string) error { + err := r.db.WithContext(ctx).Exec(` + DELETE FROM article_tag_relations + WHERE article_id = ? AND tag_id = ? + `, articleID, tagID).Error + + if err != nil { + r.logger.Error("从文章移除标签失败", zap.String("article_id", articleID), zap.String("tag_id", tagID), zap.Error(err)) + return err + } + + r.logger.Info("从文章移除标签成功", zap.String("article_id", articleID), zap.String("tag_id", tagID)) + return nil +} + +// GetArticleTags 获取文章的所有标签 +func (r *GormTagRepository) GetArticleTags(ctx context.Context, articleID string) ([]*entities.Tag, error) { + return r.FindByArticleID(ctx, articleID) +} + +// 实现 BaseRepository 接口的其他方法 +func (r *GormTagRepository) Count(ctx context.Context, options interfaces.CountOptions) (int64, error) { + dbQuery := r.db.WithContext(ctx).Model(&entities.Tag{}) + + // 应用筛选条件 + if options.Filters != nil { + for key, value := range options.Filters { + dbQuery = dbQuery.Where(key+" = ?", value) + } + } + + if options.Search != "" { + search := "%" + options.Search + "%" + dbQuery = dbQuery.Where("name LIKE ?", search) + } + + var count int64 + err := dbQuery.Count(&count).Error + return count, err +} + +func (r *GormTagRepository) Exists(ctx context.Context, id string) (bool, error) { + var count int64 + err := r.db.WithContext(ctx).Model(&entities.Tag{}). + Where("id = ?", id). + Count(&count).Error + return count > 0, err +} + +func (r *GormTagRepository) SoftDelete(ctx context.Context, id string) error { + return r.db.WithContext(ctx).Delete(&entities.Tag{}, "id = ?", id).Error +} + +func (r *GormTagRepository) Restore(ctx context.Context, id string) error { + return r.db.WithContext(ctx).Unscoped().Model(&entities.Tag{}). + Where("id = ?", id). + Update("deleted_at", nil).Error +} + +func (r *GormTagRepository) CreateBatch(ctx context.Context, entities []entities.Tag) error { + return r.db.WithContext(ctx).Create(&entities).Error +} + +func (r *GormTagRepository) GetByIDs(ctx context.Context, ids []string) ([]entities.Tag, error) { + var tags []entities.Tag + err := r.db.WithContext(ctx).Where("id IN ?", ids).Find(&tags).Error + return tags, err +} + +func (r *GormTagRepository) UpdateBatch(ctx context.Context, entities []entities.Tag) error { + return r.db.WithContext(ctx).Save(&entities).Error +} + +func (r *GormTagRepository) DeleteBatch(ctx context.Context, ids []string) error { + return r.db.WithContext(ctx).Delete(&entities.Tag{}, "id IN ?", ids).Error +} + +func (r *GormTagRepository) List(ctx context.Context, options interfaces.ListOptions) ([]entities.Tag, error) { + var tags []entities.Tag + + dbQuery := r.db.WithContext(ctx).Model(&entities.Tag{}) + + // 应用筛选条件 + if options.Filters != nil { + for key, value := range options.Filters { + dbQuery = dbQuery.Where(key+" = ?", value) + } + } + + if options.Search != "" { + search := "%" + options.Search + "%" + dbQuery = dbQuery.Where("name LIKE ?", search) + } + + // 应用排序 + if options.Sort != "" { + order := "DESC" + if options.Order != "" { + order = options.Order + } + dbQuery = dbQuery.Order(fmt.Sprintf("%s %s", options.Sort, order)) + } else { + dbQuery = dbQuery.Order("created_at ASC") + } + + // 应用分页 + if options.Page > 0 && options.PageSize > 0 { + offset := (options.Page - 1) * options.PageSize + dbQuery = dbQuery.Offset(offset).Limit(options.PageSize) + } + + // 预加载关联数据 + if len(options.Include) > 0 { + for _, include := range options.Include { + dbQuery = dbQuery.Preload(include) + } + } + + err := dbQuery.Find(&tags).Error + return tags, err +} diff --git a/internal/infrastructure/http/handlers/api_handler.go b/internal/infrastructure/http/handlers/api_handler.go index 6e757aa..d067fe8 100644 --- a/internal/infrastructure/http/handlers/api_handler.go +++ b/internal/infrastructure/http/handlers/api_handler.go @@ -145,6 +145,18 @@ func (h *ApiHandler) AddWhiteListIP(c *gin.Context) { } // DeleteWhiteListIP 删除白名单IP +// @Summary 删除白名单IP +// @Description 从当前用户的白名单中删除指定IP地址 +// @Tags API管理 +// @Accept json +// @Produce json +// @Security Bearer +// @Param ip path string true "IP地址" +// @Success 200 {object} map[string]interface{} "删除白名单IP成功" +// @Failure 400 {object} map[string]interface{} "请求参数错误" +// @Failure 401 {object} map[string]interface{} "未认证" +// @Failure 500 {object} map[string]interface{} "服务器内部错误" +// @Router /api/v1/my/whitelist/{ip} [delete] func (h *ApiHandler) DeleteWhiteListIP(c *gin.Context) { userID := h.getCurrentUserID(c) if userID == "" { diff --git a/internal/infrastructure/http/handlers/article_handler.go b/internal/infrastructure/http/handlers/article_handler.go new file mode 100644 index 0000000..a52fb6b --- /dev/null +++ b/internal/infrastructure/http/handlers/article_handler.go @@ -0,0 +1,650 @@ +//nolint:unused +package handlers + +import ( + "tyapi-server/internal/application/article" + "tyapi-server/internal/application/article/dto/commands" + appQueries "tyapi-server/internal/application/article/dto/queries" + _ "tyapi-server/internal/application/article/dto/responses" + "tyapi-server/internal/shared/interfaces" + + "github.com/gin-gonic/gin" + "go.uber.org/zap" +) + +// ArticleHandler 文章HTTP处理器 +type ArticleHandler struct { + appService article.ArticleApplicationService + responseBuilder interfaces.ResponseBuilder + validator interfaces.RequestValidator + logger *zap.Logger +} + +// NewArticleHandler 创建文章HTTP处理器 +func NewArticleHandler( + appService article.ArticleApplicationService, + responseBuilder interfaces.ResponseBuilder, + validator interfaces.RequestValidator, + logger *zap.Logger, +) *ArticleHandler { + return &ArticleHandler{ + appService: appService, + responseBuilder: responseBuilder, + validator: validator, + logger: logger, + } +} + +// CreateArticle 创建文章 +// @Summary 创建文章 +// @Description 创建新的文章 +// @Tags 文章管理 +// @Accept json +// @Produce json +// @Security Bearer +// @Param request body commands.CreateArticleCommand true "创建文章请求" +// @Success 201 {object} map[string]interface{} "文章创建成功" +// @Failure 400 {object} map[string]interface{} "请求参数错误" +// @Failure 401 {object} map[string]interface{} "未认证" +// @Failure 500 {object} map[string]interface{} "服务器内部错误" +// @Router /api/v1/articles [post] +func (h *ArticleHandler) CreateArticle(c *gin.Context) { + var cmd commands.CreateArticleCommand + if err := h.validator.BindAndValidate(c, &cmd); err != nil { + return + } + + // 验证用户是否已登录 + if _, exists := c.Get("user_id"); !exists { + h.responseBuilder.Unauthorized(c, "用户未登录") + return + } + + if err := h.appService.CreateArticle(c.Request.Context(), &cmd); err != nil { + h.logger.Error("创建文章失败", zap.Error(err)) + h.responseBuilder.BadRequest(c, err.Error()) + return + } + + h.responseBuilder.Created(c, nil, "文章创建成功") +} + +// GetArticleByID 获取文章详情 +// @Summary 获取文章详情 +// @Description 根据ID获取文章详情 +// @Tags 文章管理 +// @Accept json +// @Produce json +// @Security Bearer +// @Param id path string true "文章ID" +// @Success 200 {object} responses.ArticleInfoResponse "获取文章详情成功" +// @Failure 400 {object} map[string]interface{} "请求参数错误" +// @Failure 401 {object} map[string]interface{} "未认证" +// @Failure 404 {object} map[string]interface{} "文章不存在" +// @Failure 500 {object} map[string]interface{} "服务器内部错误" +// @Router /api/v1/articles/{id} [get] +func (h *ArticleHandler) GetArticleByID(c *gin.Context) { + var query appQueries.GetArticleQuery + query.ID = c.Param("id") + if query.ID == "" { + h.responseBuilder.BadRequest(c, "文章ID不能为空") + return + } + + response, err := h.appService.GetArticleByID(c.Request.Context(), &query) + if err != nil { + h.logger.Error("获取文章详情失败", zap.Error(err)) + h.responseBuilder.NotFound(c, "文章不存在") + return + } + + h.responseBuilder.Success(c, response, "获取文章详情成功") +} + +// ListArticles 获取文章列表 +// @Summary 获取文章列表 +// @Description 分页获取文章列表,支持多种筛选条件 +// @Tags 文章管理 +// @Accept json +// @Produce json +// @Param page query int false "页码" default(1) +// @Param page_size query int false "每页数量" default(10) +// @Param status query string false "文章状态" +// @Param category_id query string false "分类ID" +// @Param tag_id query string false "标签ID" +// @Param title query string false "标题关键词" +// @Param summary query string false "摘要关键词" +// @Param is_featured query bool false "是否推荐" +// @Param order_by query string false "排序字段" +// @Param order_dir query string false "排序方向" +// @Success 200 {object} responses.ArticleListResponse "获取文章列表成功" +// @Failure 400 {object} map[string]interface{} "请求参数错误" +// @Failure 500 {object} map[string]interface{} "服务器内部错误" +// @Router /api/v1/articles [get] +func (h *ArticleHandler) ListArticles(c *gin.Context) { + var query appQueries.ListArticleQuery + if err := h.validator.ValidateQuery(c, &query); err != nil { + return + } + + // 设置默认值 + if query.Page <= 0 { + query.Page = 1 + } + if query.PageSize <= 0 { + query.PageSize = 10 + } + if query.PageSize > 100 { + query.PageSize = 100 + } + + response, err := h.appService.ListArticles(c.Request.Context(), &query) + if err != nil { + h.logger.Error("获取文章列表失败", zap.Error(err)) + h.responseBuilder.InternalError(c, "获取文章列表失败") + return + } + + h.responseBuilder.Success(c, response, "获取文章列表成功") +} + + + +// UpdateArticle 更新文章 +// @Summary 更新文章 +// @Description 更新文章信息 +// @Tags 文章管理 +// @Accept json +// @Produce json +// @Security Bearer +// @Param id path string true "文章ID" +// @Param request body commands.UpdateArticleCommand true "更新文章请求" +// @Success 200 {object} map[string]interface{} "文章更新成功" +// @Failure 400 {object} map[string]interface{} "请求参数错误" +// @Failure 401 {object} map[string]interface{} "未认证" +// @Failure 404 {object} map[string]interface{} "文章不存在" +// @Failure 500 {object} map[string]interface{} "服务器内部错误" +// @Router /api/v1/articles/{id} [put] +func (h *ArticleHandler) UpdateArticle(c *gin.Context) { + var cmd commands.UpdateArticleCommand + cmd.ID = c.Param("id") + if cmd.ID == "" { + h.responseBuilder.BadRequest(c, "文章ID不能为空") + return + } + if err := h.validator.BindAndValidate(c, &cmd); err != nil { + return + } + + if err := h.appService.UpdateArticle(c.Request.Context(), &cmd); err != nil { + h.logger.Error("更新文章失败", zap.Error(err)) + h.responseBuilder.BadRequest(c, err.Error()) + return + } + + h.responseBuilder.Success(c, nil, "文章更新成功") +} + +// DeleteArticle 删除文章 +// @Summary 删除文章 +// @Description 删除指定文章 +// @Tags 文章管理 +// @Accept json +// @Produce json +// @Security Bearer +// @Param id path string true "文章ID" +// @Success 200 {object} map[string]interface{} "文章删除成功" +// @Failure 400 {object} map[string]interface{} "请求参数错误" +// @Failure 401 {object} map[string]interface{} "未认证" +// @Failure 404 {object} map[string]interface{} "文章不存在" +// @Failure 500 {object} map[string]interface{} "服务器内部错误" +// @Router /api/v1/articles/{id} [delete] +func (h *ArticleHandler) DeleteArticle(c *gin.Context) { + var cmd commands.DeleteArticleCommand + if err := h.validator.ValidateParam(c, &cmd); err != nil { + return + } + + if err := h.appService.DeleteArticle(c.Request.Context(), &cmd); err != nil { + h.logger.Error("删除文章失败", zap.Error(err)) + h.responseBuilder.BadRequest(c, err.Error()) + return + } + + h.responseBuilder.Success(c, nil, "文章删除成功") +} + +// PublishArticle 发布文章 +// @Summary 发布文章 +// @Description 将草稿文章发布 +// @Tags 文章管理 +// @Accept json +// @Produce json +// @Security Bearer +// @Param id path string true "文章ID" +// @Success 200 {object} map[string]interface{} "文章发布成功" +// @Failure 400 {object} map[string]interface{} "请求参数错误" +// @Failure 401 {object} map[string]interface{} "未认证" +// @Failure 404 {object} map[string]interface{} "文章不存在" +// @Failure 500 {object} map[string]interface{} "服务器内部错误" +// @Router /api/v1/articles/{id}/publish [post] +func (h *ArticleHandler) PublishArticle(c *gin.Context) { + var cmd commands.PublishArticleCommand + if err := h.validator.ValidateParam(c, &cmd); err != nil { + return + } + + if err := h.appService.PublishArticle(c.Request.Context(), &cmd); err != nil { + h.logger.Error("发布文章失败", zap.Error(err)) + h.responseBuilder.BadRequest(c, err.Error()) + return + } + + h.responseBuilder.Success(c, nil, "文章发布成功") +} + +// SchedulePublishArticle 定时发布文章 +// @Summary 定时发布文章 +// @Description 设置文章的定时发布时间 +// @Tags 文章管理 +// @Accept json +// @Produce json +// @Security Bearer +// @Param id path string true "文章ID" +// @Param request body commands.SchedulePublishCommand true "定时发布请求" +// @Success 200 {object} map[string]interface{} "定时发布设置成功" +// @Failure 400 {object} map[string]interface{} "请求参数错误" +// @Failure 401 {object} map[string]interface{} "未认证" +// @Failure 404 {object} map[string]interface{} "文章不存在" +// @Failure 500 {object} map[string]interface{} "服务器内部错误" +// @Router /api/v1/admin/articles/{id}/schedule-publish [post] +func (h *ArticleHandler) SchedulePublishArticle(c *gin.Context) { + var cmd commands.SchedulePublishCommand + if err := h.validator.ValidateParam(c, &cmd); err != nil { + return + } + if err := h.validator.BindAndValidate(c, &cmd); err != nil { + return + } + + if err := h.appService.SchedulePublishArticle(c.Request.Context(), &cmd); err != nil { + h.logger.Error("设置定时发布失败", zap.Error(err)) + h.responseBuilder.BadRequest(c, err.Error()) + return + } + + h.responseBuilder.Success(c, nil, "定时发布设置成功") +} + +// ArchiveArticle 归档文章 +// @Summary 归档文章 +// @Description 将已发布文章归档 +// @Tags 文章管理 +// @Accept json +// @Produce json +// @Security Bearer +// @Param id path string true "文章ID" +// @Success 200 {object} map[string]interface{} "文章归档成功" +// @Failure 400 {object} map[string]interface{} "请求参数错误" +// @Failure 401 {object} map[string]interface{} "未认证" +// @Failure 404 {object} map[string]interface{} "文章不存在" +// @Failure 500 {object} map[string]interface{} "服务器内部错误" +// @Router /api/v1/articles/{id}/archive [post] +func (h *ArticleHandler) ArchiveArticle(c *gin.Context) { + var cmd commands.ArchiveArticleCommand + if err := h.validator.ValidateParam(c, &cmd); err != nil { + return + } + + if err := h.appService.ArchiveArticle(c.Request.Context(), &cmd); err != nil { + h.logger.Error("归档文章失败", zap.Error(err)) + h.responseBuilder.BadRequest(c, err.Error()) + return + } + + h.responseBuilder.Success(c, nil, "文章归档成功") +} + +// SetFeatured 设置推荐状态 +// @Summary 设置推荐状态 +// @Description 设置文章的推荐状态 +// @Tags 文章管理 +// @Accept json +// @Produce json +// @Security Bearer +// @Param id path string true "文章ID" +// @Param request body commands.SetFeaturedCommand true "设置推荐状态请求" +// @Success 200 {object} map[string]interface{} "设置推荐状态成功" +// @Failure 400 {object} map[string]interface{} "请求参数错误" +// @Failure 401 {object} map[string]interface{} "未认证" +// @Failure 404 {object} map[string]interface{} "文章不存在" +// @Failure 500 {object} map[string]interface{} "服务器内部错误" +// @Router /api/v1/articles/{id}/featured [put] +func (h *ArticleHandler) SetFeatured(c *gin.Context) { + var cmd commands.SetFeaturedCommand + if err := h.validator.ValidateParam(c, &cmd); err != nil { + return + } + if err := h.validator.BindAndValidate(c, &cmd); err != nil { + return + } + + if err := h.appService.SetFeatured(c.Request.Context(), &cmd); err != nil { + h.logger.Error("设置推荐状态失败", zap.Error(err)) + h.responseBuilder.BadRequest(c, err.Error()) + return + } + + h.responseBuilder.Success(c, nil, "设置推荐状态成功") +} + +// GetArticleStats 获取文章统计 +// @Summary 获取文章统计 +// @Description 获取文章相关统计数据 +// @Tags 文章管理 +// @Accept json +// @Produce json +// @Security Bearer +// @Success 200 {object} responses.ArticleStatsResponse "获取统计成功" +// @Failure 401 {object} map[string]interface{} "未认证" +// @Failure 500 {object} map[string]interface{} "服务器内部错误" +// @Router /api/v1/admin/articles/stats [get] +func (h *ArticleHandler) GetArticleStats(c *gin.Context) { + response, err := h.appService.GetArticleStats(c.Request.Context()) + if err != nil { + h.logger.Error("获取文章统计失败", zap.Error(err)) + h.responseBuilder.InternalError(c, "获取文章统计失败") + return + } + + h.responseBuilder.Success(c, response, "获取统计成功") +} + + +// ==================== 分类相关方法 ==================== + +// ListCategories 获取分类列表 +// @Summary 获取分类列表 +// @Description 获取所有文章分类 +// @Tags 文章分类 +// @Accept json +// @Produce json +// @Success 200 {object} responses.CategoryListResponse "获取分类列表成功" +// @Failure 500 {object} map[string]interface{} "服务器内部错误" +// @Router /api/v1/article-categories [get] +func (h *ArticleHandler) ListCategories(c *gin.Context) { + response, err := h.appService.ListCategories(c.Request.Context()) + if err != nil { + h.logger.Error("获取分类列表失败", zap.Error(err)) + h.responseBuilder.InternalError(c, "获取分类列表失败") + return + } + + h.responseBuilder.Success(c, response, "获取分类列表成功") +} + +// GetCategoryByID 获取分类详情 +// @Summary 获取分类详情 +// @Description 根据ID获取分类详情 +// @Tags 文章分类 +// @Accept json +// @Produce json +// @Param id path string true "分类ID" +// @Success 200 {object} responses.CategoryInfoResponse "获取分类详情成功" +// @Failure 400 {object} map[string]interface{} "请求参数错误" +// @Failure 404 {object} map[string]interface{} "分类不存在" +// @Failure 500 {object} map[string]interface{} "服务器内部错误" +// @Router /api/v1/article-categories/{id} [get] +func (h *ArticleHandler) GetCategoryByID(c *gin.Context) { + var query appQueries.GetCategoryQuery + query.ID = c.Param("id") + if query.ID == "" { + h.responseBuilder.BadRequest(c, "分类ID不能为空") + return + } + + response, err := h.appService.GetCategoryByID(c.Request.Context(), &query) + if err != nil { + h.logger.Error("获取分类详情失败", zap.Error(err)) + h.responseBuilder.NotFound(c, "分类不存在") + return + } + + h.responseBuilder.Success(c, response, "获取分类详情成功") +} + +// CreateCategory 创建分类 +// @Summary 创建分类 +// @Description 创建新的文章分类 +// @Tags 文章分类管理 +// @Accept json +// @Produce json +// @Security Bearer +// @Param request body commands.CreateCategoryCommand true "创建分类请求" +// @Success 201 {object} map[string]interface{} "分类创建成功" +// @Failure 400 {object} map[string]interface{} "请求参数错误" +// @Failure 401 {object} map[string]interface{} "未认证" +// @Failure 500 {object} map[string]interface{} "服务器内部错误" +// @Router /api/v1/admin/article-categories [post] +func (h *ArticleHandler) CreateCategory(c *gin.Context) { + var cmd commands.CreateCategoryCommand + if err := h.validator.BindAndValidate(c, &cmd); err != nil { + return + } + + if err := h.appService.CreateCategory(c.Request.Context(), &cmd); err != nil { + h.logger.Error("创建分类失败", zap.Error(err)) + h.responseBuilder.BadRequest(c, err.Error()) + return + } + + h.responseBuilder.Created(c, nil, "分类创建成功") +} + +// UpdateCategory 更新分类 +// @Summary 更新分类 +// @Description 更新分类信息 +// @Tags 文章分类管理 +// @Accept json +// @Produce json +// @Security Bearer +// @Param id path string true "分类ID" +// @Param request body commands.UpdateCategoryCommand true "更新分类请求" +// @Success 200 {object} map[string]interface{} "分类更新成功" +// @Failure 400 {object} map[string]interface{} "请求参数错误" +// @Failure 401 {object} map[string]interface{} "未认证" +// @Failure 404 {object} map[string]interface{} "分类不存在" +// @Failure 500 {object} map[string]interface{} "服务器内部错误" +// @Router /api/v1/admin/article-categories/{id} [put] +func (h *ArticleHandler) UpdateCategory(c *gin.Context) { + var cmd commands.UpdateCategoryCommand + cmd.ID = c.Param("id") + if cmd.ID == "" { + h.responseBuilder.BadRequest(c, "分类ID不能为空") + return + } + if err := h.validator.BindAndValidate(c, &cmd); err != nil { + return + } + + if err := h.appService.UpdateCategory(c.Request.Context(), &cmd); err != nil { + h.logger.Error("更新分类失败", zap.Error(err)) + h.responseBuilder.BadRequest(c, err.Error()) + return + } + + h.responseBuilder.Success(c, nil, "分类更新成功") +} + +// DeleteCategory 删除分类 +// @Summary 删除分类 +// @Description 删除指定分类 +// @Tags 文章分类管理 +// @Accept json +// @Produce json +// @Security Bearer +// @Param id path string true "分类ID" +// @Success 200 {object} map[string]interface{} "分类删除成功" +// @Failure 400 {object} map[string]interface{} "请求参数错误" +// @Failure 401 {object} map[string]interface{} "未认证" +// @Failure 404 {object} map[string]interface{} "分类不存在" +// @Failure 500 {object} map[string]interface{} "服务器内部错误" +// @Router /api/v1/admin/article-categories/{id} [delete] +func (h *ArticleHandler) DeleteCategory(c *gin.Context) { + var cmd commands.DeleteCategoryCommand + if err := h.validator.ValidateParam(c, &cmd); err != nil { + return + } + + if err := h.appService.DeleteCategory(c.Request.Context(), &cmd); err != nil { + h.logger.Error("删除分类失败", zap.Error(err)) + h.responseBuilder.BadRequest(c, err.Error()) + return + } + + h.responseBuilder.Success(c, nil, "分类删除成功") +} + +// ==================== 标签相关方法 ==================== + +// ListTags 获取标签列表 +// @Summary 获取标签列表 +// @Description 获取所有文章标签 +// @Tags 文章标签 +// @Accept json +// @Produce json +// @Success 200 {object} responses.TagListResponse "获取标签列表成功" +// @Failure 500 {object} map[string]interface{} "服务器内部错误" +// @Router /api/v1/article-tags [get] +func (h *ArticleHandler) ListTags(c *gin.Context) { + response, err := h.appService.ListTags(c.Request.Context()) + if err != nil { + h.logger.Error("获取标签列表失败", zap.Error(err)) + h.responseBuilder.InternalError(c, "获取标签列表失败") + return + } + + h.responseBuilder.Success(c, response, "获取标签列表成功") +} + +// GetTagByID 获取标签详情 +// @Summary 获取标签详情 +// @Description 根据ID获取标签详情 +// @Tags 文章标签 +// @Accept json +// @Produce json +// @Param id path string true "标签ID" +// @Success 200 {object} responses.TagInfoResponse "获取标签详情成功" +// @Failure 400 {object} map[string]interface{} "请求参数错误" +// @Failure 404 {object} map[string]interface{} "标签不存在" +// @Failure 500 {object} map[string]interface{} "服务器内部错误" +// @Router /api/v1/article-tags/{id} [get] +func (h *ArticleHandler) GetTagByID(c *gin.Context) { + var query appQueries.GetTagQuery + query.ID = c.Param("id") + if query.ID == "" { + h.responseBuilder.BadRequest(c, "标签ID不能为空") + return + } + + response, err := h.appService.GetTagByID(c.Request.Context(), &query) + if err != nil { + h.logger.Error("获取标签详情失败", zap.Error(err)) + h.responseBuilder.NotFound(c, "标签不存在") + return + } + + h.responseBuilder.Success(c, response, "获取标签详情成功") +} + +// CreateTag 创建标签 +// @Summary 创建标签 +// @Description 创建新的文章标签 +// @Tags 文章标签管理 +// @Accept json +// @Produce json +// @Security Bearer +// @Param request body commands.CreateTagCommand true "创建标签请求" +// @Success 201 {object} map[string]interface{} "标签创建成功" +// @Failure 400 {object} map[string]interface{} "请求参数错误" +// @Failure 401 {object} map[string]interface{} "未认证" +// @Failure 500 {object} map[string]interface{} "服务器内部错误" +// @Router /api/v1/admin/article-tags [post] +func (h *ArticleHandler) CreateTag(c *gin.Context) { + var cmd commands.CreateTagCommand + if err := h.validator.BindAndValidate(c, &cmd); err != nil { + return + } + + if err := h.appService.CreateTag(c.Request.Context(), &cmd); err != nil { + h.logger.Error("创建标签失败", zap.Error(err)) + h.responseBuilder.BadRequest(c, err.Error()) + return + } + + h.responseBuilder.Created(c, nil, "标签创建成功") +} + +// UpdateTag 更新标签 +// @Summary 更新标签 +// @Description 更新标签信息 +// @Tags 文章标签管理 +// @Accept json +// @Produce json +// @Security Bearer +// @Param id path string true "标签ID" +// @Param request body commands.UpdateTagCommand true "更新标签请求" +// @Success 200 {object} map[string]interface{} "标签更新成功" +// @Failure 400 {object} map[string]interface{} "请求参数错误" +// @Failure 401 {object} map[string]interface{} "未认证" +// @Failure 404 {object} map[string]interface{} "标签不存在" +// @Failure 500 {object} map[string]interface{} "服务器内部错误" +// @Router /api/v1/admin/article-tags/{id} [put] +func (h *ArticleHandler) UpdateTag(c *gin.Context) { + var cmd commands.UpdateTagCommand + cmd.ID = c.Param("id") + if cmd.ID == "" { + h.responseBuilder.BadRequest(c, "标签ID不能为空") + return + } + if err := h.validator.BindAndValidate(c, &cmd); err != nil { + return + } + + if err := h.appService.UpdateTag(c.Request.Context(), &cmd); err != nil { + h.logger.Error("更新标签失败", zap.Error(err)) + h.responseBuilder.BadRequest(c, err.Error()) + return + } + + h.responseBuilder.Success(c, nil, "标签更新成功") +} + +// DeleteTag 删除标签 +// @Summary 删除标签 +// @Description 删除指定标签 +// @Tags 文章标签管理 +// @Accept json +// @Produce json +// @Security Bearer +// @Param id path string true "标签ID" +// @Success 200 {object} map[string]interface{} "标签删除成功" +// @Failure 400 {object} map[string]interface{} "请求参数错误" +// @Failure 401 {object} map[string]interface{} "未认证" +// @Failure 404 {object} map[string]interface{} "标签不存在" +// @Failure 500 {object} map[string]interface{} "服务器内部错误" +// @Router /api/v1/admin/article-tags/{id} [delete] +func (h *ArticleHandler) DeleteTag(c *gin.Context) { + var cmd commands.DeleteTagCommand + if err := h.validator.ValidateParam(c, &cmd); err != nil { + return + } + + if err := h.appService.DeleteTag(c.Request.Context(), &cmd); err != nil { + h.logger.Error("删除标签失败", zap.Error(err)) + h.responseBuilder.BadRequest(c, err.Error()) + return + } + + h.responseBuilder.Success(c, nil, "标签删除成功") +} diff --git a/internal/infrastructure/http/handlers/certification_handler.go b/internal/infrastructure/http/handlers/certification_handler.go index 3e1c4a2..d61b028 100644 --- a/internal/infrastructure/http/handlers/certification_handler.go +++ b/internal/infrastructure/http/handlers/certification_handler.go @@ -1,3 +1,4 @@ +//nolint:unused package handlers import ( @@ -12,6 +13,7 @@ import ( "tyapi-server/internal/application/certification" "tyapi-server/internal/application/certification/dto/commands" "tyapi-server/internal/application/certification/dto/queries" + _ "tyapi-server/internal/application/certification/dto/responses" "tyapi-server/internal/shared/interfaces" "tyapi-server/internal/shared/middleware" ) @@ -123,8 +125,8 @@ func (h *CertificationHandler) SubmitEnterpriseInfo(c *gin.Context) { // @Accept json // @Produce json // @Security Bearer -// @Param request body commands.ConfirmAuthCommand true "确认状态请求" -// @Success 200 {object} responses.ConfirmStatusResponse "状态确认成功" +// @Param request body queries.ConfirmAuthCommand true "确认状态请求" +// @Success 200 {object} responses.ConfirmAuthResponse "状态确认成功" // @Failure 400 {object} map[string]interface{} "请求参数错误" // @Failure 401 {object} map[string]interface{} "未认证" // @Failure 404 {object} map[string]interface{} "认证记录不存在" @@ -155,8 +157,8 @@ func (h *CertificationHandler) ConfirmAuth(c *gin.Context) { // @Accept json // @Produce json // @Security Bearer -// @Param request body commands.ConfirmSignCommand true "确认状态请求" -// @Success 200 {object} responses.ConfirmStatusResponse "状态确认成功" +// @Param request body queries.ConfirmSignCommand true "确认状态请求" +// @Success 200 {object} responses.ConfirmSignResponse "状态确认成功" // @Failure 400 {object} map[string]interface{} "请求参数错误" // @Failure 401 {object} map[string]interface{} "未认证" // @Failure 404 {object} map[string]interface{} "认证记录不存在" @@ -260,15 +262,13 @@ func (h *CertificationHandler) ListCertifications(c *gin.Context) { // HandleEsignCallback 处理e签宝回调 // @Summary 处理e签宝回调 -// @Description 处理e签宝的企业认证和合同签署回调 +// @Description 处理e签宝的异步回调通知 // @Tags 认证管理 -// @Accept json -// @Produce json -// @Param request body commands.EsignCallbackCommand true "e签宝回调数据" -// @Success 200 {object} responses.CallbackResponse "回调处理成功" -// @Failure 400 {object} map[string]interface{} "请求参数错误" -// @Failure 500 {object} map[string]interface{} "服务器内部错误" -// @Router /api/v1/certifications/callbacks/esign [post] +// @Accept application/json +// @Produce text/plain +// @Success 200 {string} string "success" +// @Failure 400 {string} string "fail" +// @Router /api/v1/certifications/esign/callback [post] func (h *CertificationHandler) HandleEsignCallback(c *gin.Context) { // 记录请求基本信息 h.logger.Info("收到e签宝回调请求", diff --git a/internal/infrastructure/http/handlers/finance_handler.go b/internal/infrastructure/http/handlers/finance_handler.go index 3e4a5e7..693a276 100644 --- a/internal/infrastructure/http/handlers/finance_handler.go +++ b/internal/infrastructure/http/handlers/finance_handler.go @@ -1,3 +1,4 @@ +//nolint:unused package handlers import ( @@ -12,6 +13,7 @@ import ( "tyapi-server/internal/application/finance" "tyapi-server/internal/application/finance/dto/commands" "tyapi-server/internal/application/finance/dto/queries" + _ "tyapi-server/internal/application/finance/dto/responses" "tyapi-server/internal/shared/interfaces" ) @@ -570,9 +572,9 @@ func (h *FinanceHandler) GetAlipayOrderStatus(c *gin.Context) { // @Accept json // @Produce json // @Param request body finance.ApplyInvoiceRequest true "申请开票请求" -// @Success 200 {object} response.Response{data=finance.InvoiceApplicationResponse} -// @Failure 400 {object} response.Response -// @Failure 500 {object} response.Response +// @Success 200 {object} interfaces.APIResponse{data=dto.InvoiceApplicationResponse} +// @Failure 400 {object} interfaces.APIResponse +// @Failure 500 {object} interfaces.APIResponse // @Router /api/v1/invoices/apply [post] func (h *FinanceHandler) ApplyInvoice(c *gin.Context) { var req finance.ApplyInvoiceRequest @@ -601,9 +603,9 @@ func (h *FinanceHandler) ApplyInvoice(c *gin.Context) { // @Description 获取用户的发票信息 // @Tags 发票管理 // @Produce json -// @Success 200 {object} response.Response{data=finance.InvoiceInfoResponse} -// @Failure 400 {object} response.Response -// @Failure 500 {object} response.Response +// @Success 200 {object} interfaces.APIResponse{data=dto.InvoiceInfoResponse} +// @Failure 400 {object} interfaces.APIResponse +// @Failure 500 {object} interfaces.APIResponse // @Router /api/v1/invoices/info [get] func (h *FinanceHandler) GetUserInvoiceInfo(c *gin.Context) { userID := c.GetString("user_id") @@ -628,9 +630,9 @@ func (h *FinanceHandler) GetUserInvoiceInfo(c *gin.Context) { // @Accept json // @Produce json // @Param request body finance.UpdateInvoiceInfoRequest true "更新发票信息请求" -// @Success 200 {object} response.Response -// @Failure 400 {object} response.Response -// @Failure 500 {object} response.Response +// @Success 200 {object} interfaces.APIResponse +// @Failure 400 {object} interfaces.APIResponse +// @Failure 500 {object} interfaces.APIResponse // @Router /api/v1/invoices/info [put] func (h *FinanceHandler) UpdateUserInvoiceInfo(c *gin.Context) { var req finance.UpdateInvoiceInfoRequest @@ -662,9 +664,9 @@ func (h *FinanceHandler) UpdateUserInvoiceInfo(c *gin.Context) { // @Param page query int false "页码" default(1) // @Param page_size query int false "每页数量" default(10) // @Param status query string false "状态筛选" -// @Success 200 {object} response.Response{data=finance.InvoiceRecordsResponse} -// @Failure 400 {object} response.Response -// @Failure 500 {object} response.Response +// @Success 200 {object} interfaces.APIResponse{data=dto.InvoiceRecordsResponse} +// @Failure 400 {object} interfaces.APIResponse +// @Failure 500 {object} interfaces.APIResponse // @Router /api/v1/invoices/records [get] func (h *FinanceHandler) GetUserInvoiceRecords(c *gin.Context) { userID := c.GetString("user_id") @@ -703,8 +705,8 @@ func (h *FinanceHandler) GetUserInvoiceRecords(c *gin.Context) { // @Produce application/octet-stream // @Param application_id path string true "申请ID" // @Success 200 {file} file -// @Failure 400 {object} response.Response -// @Failure 500 {object} response.Response +// @Failure 400 {object} interfaces.APIResponse +// @Failure 500 {object} interfaces.APIResponse // @Router /api/v1/invoices/{application_id}/download [get] func (h *FinanceHandler) DownloadInvoiceFile(c *gin.Context) { userID := c.GetString("user_id") @@ -739,9 +741,9 @@ func (h *FinanceHandler) DownloadInvoiceFile(c *gin.Context) { // @Description 获取用户当前可开票的金额 // @Tags 发票管理 // @Produce json -// @Success 200 {object} response.Response{data=finance.AvailableAmountResponse} -// @Failure 400 {object} response.Response -// @Failure 500 {object} response.Response +// @Success 200 {object} interfaces.APIResponse{data=dto.AvailableAmountResponse} +// @Failure 400 {object} interfaces.APIResponse +// @Failure 500 {object} interfaces.APIResponse // @Router /api/v1/invoices/available-amount [get] func (h *FinanceHandler) GetAvailableAmount(c *gin.Context) { userID := c.GetString("user_id") @@ -771,9 +773,9 @@ func (h *FinanceHandler) GetAvailableAmount(c *gin.Context) { // @Param status query string false "状态筛选:pending/completed/rejected" // @Param start_time query string false "开始时间 (格式: 2006-01-02 15:04:05)" // @Param end_time query string false "结束时间 (格式: 2006-01-02 15:04:05)" -// @Success 200 {object} response.Response{data=finance.PendingApplicationsResponse} -// @Failure 400 {object} response.Response -// @Failure 500 {object} response.Response +// @Success 200 {object} interfaces.APIResponse{data=dto.PendingApplicationsResponse} +// @Failure 400 {object} interfaces.APIResponse +// @Failure 500 {object} interfaces.APIResponse // @Router /api/v1/admin/invoices/pending [get] func (h *FinanceHandler) GetPendingApplications(c *gin.Context) { page, _ := strconv.Atoi(c.DefaultQuery("page", "1")) @@ -808,9 +810,9 @@ func (h *FinanceHandler) GetPendingApplications(c *gin.Context) { // @Param application_id path string true "申请ID" // @Param file formData file true "发票文件" // @Param admin_notes formData string false "管理员备注" -// @Success 200 {object} response.Response -// @Failure 400 {object} response.Response -// @Failure 500 {object} response.Response +// @Success 200 {object} interfaces.APIResponse +// @Failure 400 {object} interfaces.APIResponse +// @Failure 500 {object} interfaces.APIResponse // @Router /api/v1/admin/invoices/{application_id}/approve [post] func (h *FinanceHandler) ApproveInvoiceApplication(c *gin.Context) { applicationID := c.Param("application_id") @@ -860,9 +862,9 @@ func (h *FinanceHandler) ApproveInvoiceApplication(c *gin.Context) { // @Produce json // @Param application_id path string true "申请ID" // @Param request body finance.RejectInvoiceRequest true "拒绝申请请求" -// @Success 200 {object} response.Response -// @Failure 400 {object} response.Response -// @Failure 500 {object} response.Response +// @Success 200 {object} interfaces.APIResponse +// @Failure 400 {object} interfaces.APIResponse +// @Failure 500 {object} interfaces.APIResponse // @Router /api/v1/admin/invoices/{application_id}/reject [post] func (h *FinanceHandler) RejectInvoiceApplication(c *gin.Context) { applicationID := c.Param("application_id") @@ -893,8 +895,8 @@ func (h *FinanceHandler) RejectInvoiceApplication(c *gin.Context) { // @Produce application/octet-stream // @Param application_id path string true "申请ID" // @Success 200 {file} file -// @Failure 400 {object} response.Response -// @Failure 500 {object} response.Response +// @Failure 400 {object} interfaces.APIResponse +// @Failure 500 {object} interfaces.APIResponse // @Router /api/v1/admin/invoices/{application_id}/download [get] func (h *FinanceHandler) AdminDownloadInvoiceFile(c *gin.Context) { applicationID := c.Param("application_id") @@ -918,13 +920,16 @@ func (h *FinanceHandler) AdminDownloadInvoiceFile(c *gin.Context) { c.Data(http.StatusOK, "application/pdf", result.FileContent) } -// DebugEventSystem 调试事件系统状态 -// @Summary 调试事件系统状态 -// @Description 获取事件系统的调试信息 -// @Tags 调试 +// DebugEventSystem 调试事件系统 +// @Summary 调试事件系统 +// @Description 调试事件系统,用于测试事件触发和处理 +// @Tags 系统调试 +// @Accept json // @Produce json -// @Success 200 {object} map[string]interface{} -// @Router /api/v1/debug/events [get] +// @Security Bearer +// @Success 200 {object} map[string]interface{} "调试成功" +// @Failure 500 {object} map[string]interface{} "服务器内部错误" +// @Router /api/v1/debug/event-system [post] func (h *FinanceHandler) DebugEventSystem(c *gin.Context) { h.logger.Info("🔍 请求事件系统调试信息") diff --git a/internal/infrastructure/http/handlers/product_admin_handler.go b/internal/infrastructure/http/handlers/product_admin_handler.go index 6504315..a73b778 100644 --- a/internal/infrastructure/http/handlers/product_admin_handler.go +++ b/internal/infrastructure/http/handlers/product_admin_handler.go @@ -1113,85 +1113,7 @@ func (h *ProductAdminHandler) DeleteProductDocumentation(c *gin.Context) { h.responseBuilder.Success(c, nil, "文档删除成功") } -// GetAdminApiCalls 获取管理端API调用记录 -// @Summary 获取管理端API调用记录 -// @Description 管理员获取API调用记录,支持筛选和分页 -// @Tags API管理 -// @Accept json -// @Produce json -// @Security Bearer -// @Param page query int false "页码" default(1) -// @Param page_size query int false "每页数量" default(10) -// @Param user_id query string false "用户ID" -// @Param transaction_id query string false "交易ID" -// @Param product_name query string false "产品名称" -// @Param status query string false "状态" -// @Param start_time query string false "开始时间" format(date-time) -// @Param end_time query string false "结束时间" format(date-time) -// @Param sort_by query string false "排序字段" -// @Param sort_order query string false "排序方向" Enums(asc, desc) -// @Success 200 {object} dto.ApiCallListResponse "获取API调用记录成功" -// @Failure 400 {object} map[string]interface{} "请求参数错误" -// @Failure 401 {object} map[string]interface{} "未认证" -// @Failure 500 {object} map[string]interface{} "服务器内部错误" -// @Router /api/v1/admin/api-calls [get] -func (h *ProductAdminHandler) GetAdminApiCalls(c *gin.Context) { - // 解析查询参数 - page := h.getIntQuery(c, "page", 1) - pageSize := h.getIntQuery(c, "page_size", 10) - // 构建筛选条件 - filters := make(map[string]interface{}) - - // 用户ID筛选 - if userId := c.Query("user_id"); userId != "" { - filters["user_id"] = userId - } - - // 时间范围筛选 - if startTime := c.Query("start_time"); startTime != "" { - if t, err := time.Parse("2006-01-02 15:04:05", startTime); err == nil { - filters["start_time"] = t - } - } - if endTime := c.Query("end_time"); endTime != "" { - if t, err := time.Parse("2006-01-02 15:04:05", endTime); err == nil { - filters["end_time"] = t - } - } - - // 交易ID筛选 - if transactionId := c.Query("transaction_id"); transactionId != "" { - filters["transaction_id"] = transactionId - } - - // 产品名称筛选 - if productName := c.Query("product_name"); productName != "" { - filters["product_name"] = productName - } - - // 状态筛选 - if status := c.Query("status"); status != "" { - filters["status"] = status - } - - // 构建分页选项 - options := interfaces.ListOptions{ - Page: page, - PageSize: pageSize, - Sort: "created_at", - Order: "desc", - } - - result, err := h.apiAppService.GetAdminApiCalls(c.Request.Context(), filters, options) - if err != nil { - h.logger.Error("获取管理端API调用记录失败", zap.Error(err)) - h.responseBuilder.BadRequest(c, "获取API调用记录失败") - return - } - - h.responseBuilder.Success(c, result, "获取API调用记录成功") -} // GetAdminWalletTransactions 获取管理端消费记录 // @Summary 获取管理端消费记录 @@ -1211,7 +1133,7 @@ func (h *ProductAdminHandler) GetAdminApiCalls(c *gin.Context) { // @Param end_time query string false "结束时间" format(date-time) // @Param sort_by query string false "排序字段" // @Param sort_order query string false "排序方向" Enums(asc, desc) -// @Success 200 {object} dto.WalletTransactionListResponse "获取消费记录成功" +// @Success 200 {object} responses.WalletTransactionListResponse "获取消费记录成功" // @Failure 400 {object} map[string]interface{} "请求参数错误" // @Failure 401 {object} map[string]interface{} "未认证" // @Failure 500 {object} map[string]interface{} "服务器内部错误" @@ -1295,7 +1217,7 @@ func (h *ProductAdminHandler) GetAdminWalletTransactions(c *gin.Context) { // @Param end_time query string false "结束时间" format(date-time) // @Param sort_by query string false "排序字段" // @Param sort_order query string false "排序方向" Enums(asc, desc) -// @Success 200 {object} dto.RechargeRecordListResponse "获取充值记录成功" +// @Success 200 {object} responses.RechargeRecordListResponse "获取充值记录成功" // @Failure 400 {object} map[string]interface{} "请求参数错误" // @Failure 401 {object} map[string]interface{} "未认证" // @Failure 500 {object} map[string]interface{} "服务器内部错误" diff --git a/internal/infrastructure/http/handlers/product_handler.go b/internal/infrastructure/http/handlers/product_handler.go index b73767f..7ca63e1 100644 --- a/internal/infrastructure/http/handlers/product_handler.go +++ b/internal/infrastructure/http/handlers/product_handler.go @@ -1,3 +1,4 @@ +//nolint:unused package handlers import ( @@ -5,6 +6,7 @@ import ( "tyapi-server/internal/application/product" "tyapi-server/internal/application/product/dto/commands" "tyapi-server/internal/application/product/dto/queries" + _ "tyapi-server/internal/application/product/dto/responses" "tyapi-server/internal/shared/interfaces" "github.com/gin-gonic/gin" @@ -607,9 +609,9 @@ func (h *ProductHandler) GetMySubscriptionUsage(c *gin.Context) { // @Accept json // @Produce json // @Param id path string true "产品ID" -// @Success 200 {object} responses.DocumentationResponse "获取文档成功" +// @Success 200 {object} responses.DocumentationResponse "获取产品文档成功" // @Failure 400 {object} map[string]interface{} "请求参数错误" -// @Failure 404 {object} map[string]interface{} "产品或文档不存在" +// @Failure 404 {object} map[string]interface{} "产品不存在" // @Failure 500 {object} map[string]interface{} "服务器内部错误" // @Router /api/v1/products/{id}/documentation [get] func (h *ProductHandler) GetProductDocumentation(c *gin.Context) { diff --git a/internal/infrastructure/http/handlers/user_handler.go b/internal/infrastructure/http/handlers/user_handler.go index 35dbc3a..fb12ec0 100644 --- a/internal/infrastructure/http/handlers/user_handler.go +++ b/internal/infrastructure/http/handlers/user_handler.go @@ -1,3 +1,4 @@ +//nolint:unused package handlers import ( @@ -9,6 +10,7 @@ import ( "tyapi-server/internal/application/user" "tyapi-server/internal/application/user/dto/commands" "tyapi-server/internal/application/user/dto/queries" + _ "tyapi-server/internal/application/user/dto/responses" "tyapi-server/internal/shared/interfaces" "tyapi-server/internal/shared/middleware" ) @@ -362,9 +364,9 @@ func (h *UserHandler) GetUserDetail(c *gin.Context) { h.response.Success(c, resp, "获取用户详情成功") } -// GetUserStats 管理员获取用户统计信息 -// @Summary 管理员获取用户统计信息 -// @Description 管理员获取用户统计信息,包括总用户数、活跃用户数、已认证用户数 +// GetUserStats 获取用户统计信息 +// @Summary 获取用户统计信息 +// @Description 管理员获取用户相关的统计信息 // @Tags 用户管理 // @Accept json // @Produce json diff --git a/internal/infrastructure/http/routes/article_routes.go b/internal/infrastructure/http/routes/article_routes.go new file mode 100644 index 0000000..5501376 --- /dev/null +++ b/internal/infrastructure/http/routes/article_routes.go @@ -0,0 +1,104 @@ +package routes + +import ( + "tyapi-server/internal/infrastructure/http/handlers" + sharedhttp "tyapi-server/internal/shared/http" + "tyapi-server/internal/shared/middleware" + + "go.uber.org/zap" +) + +// ArticleRoutes 文章路由 +type ArticleRoutes struct { + handler *handlers.ArticleHandler + auth *middleware.JWTAuthMiddleware + admin *middleware.AdminAuthMiddleware + logger *zap.Logger +} + +// NewArticleRoutes 创建文章路由 +func NewArticleRoutes( + handler *handlers.ArticleHandler, + auth *middleware.JWTAuthMiddleware, + admin *middleware.AdminAuthMiddleware, + logger *zap.Logger, +) *ArticleRoutes { + return &ArticleRoutes{ + handler: handler, + auth: auth, + admin: admin, + logger: logger, + } +} + +// Register 注册路由 +func (r *ArticleRoutes) Register(router *sharedhttp.GinRouter) { + engine := router.GetEngine() + + // ==================== 用户端路由 ==================== + // 文章相关路由 - 用户端 + articleGroup := engine.Group("/api/v1/articles") + { + // 公开路由 - 不需要认证 + articleGroup.GET("/:id", r.handler.GetArticleByID) // 获取文章详情 + articleGroup.GET("", r.handler.ListArticles) // 获取文章列表(支持筛选:标题、分类、摘要、标签、推荐状态) + } + + // 分类相关路由 - 用户端 + categoryGroup := engine.Group("/api/v1/article-categories") + { + // 公开路由 - 不需要认证 + categoryGroup.GET("", r.handler.ListCategories) // 获取分类列表 + categoryGroup.GET("/:id", r.handler.GetCategoryByID) // 获取分类详情 + } + + // 标签相关路由 - 用户端 + tagGroup := engine.Group("/api/v1/article-tags") + { + // 公开路由 - 不需要认证 + tagGroup.GET("", r.handler.ListTags) // 获取标签列表 + tagGroup.GET("/:id", r.handler.GetTagByID) // 获取标签详情 + } + + // ==================== 管理员端路由 ==================== + // 管理员文章管理路由 + adminArticleGroup := engine.Group("/api/v1/admin/articles") + adminArticleGroup.Use(r.admin.Handle()) + { + // 统计信息 + adminArticleGroup.GET("/stats", r.handler.GetArticleStats) // 获取文章统计 + + // 文章管理 + adminArticleGroup.POST("", r.handler.CreateArticle) // 创建文章 + adminArticleGroup.PUT("/:id", r.handler.UpdateArticle) // 更新文章 + adminArticleGroup.DELETE("/:id", r.handler.DeleteArticle) // 删除文章 + + // 文章状态管理 + adminArticleGroup.POST("/:id/publish", r.handler.PublishArticle) // 发布文章 + adminArticleGroup.POST("/:id/schedule-publish", r.handler.SchedulePublishArticle) // 定时发布文章 + adminArticleGroup.POST("/:id/archive", r.handler.ArchiveArticle) // 归档文章 + adminArticleGroup.PUT("/:id/featured", r.handler.SetFeatured) // 设置推荐状态 + } + + // 管理员分类管理路由 + adminCategoryGroup := engine.Group("/api/v1/admin/article-categories") + adminCategoryGroup.Use(r.admin.Handle()) + { + // 分类管理 + adminCategoryGroup.POST("", r.handler.CreateCategory) // 创建分类 + adminCategoryGroup.PUT("/:id", r.handler.UpdateCategory) // 更新分类 + adminCategoryGroup.DELETE("/:id", r.handler.DeleteCategory) // 删除分类 + } + + // 管理员标签管理路由 + adminTagGroup := engine.Group("/api/v1/admin/article-tags") + adminTagGroup.Use(r.admin.Handle()) + { + // 标签管理 + adminTagGroup.POST("", r.handler.CreateTag) // 创建标签 + adminTagGroup.PUT("/:id", r.handler.UpdateTag) // 更新标签 + adminTagGroup.DELETE("/:id", r.handler.DeleteTag) // 删除标签 + } + + r.logger.Info("文章路由注册完成") +} diff --git a/internal/infrastructure/http/routes/product_admin_routes.go b/internal/infrastructure/http/routes/product_admin_routes.go index abfbb40..3295c6d 100644 --- a/internal/infrastructure/http/routes/product_admin_routes.go +++ b/internal/infrastructure/http/routes/product_admin_routes.go @@ -81,11 +81,7 @@ func (r *ProductAdminRoutes) Register(router *sharedhttp.GinRouter) { subscriptions.POST("/batch-update-prices", r.handler.BatchUpdateSubscriptionPrices) } - // API调用记录管理 - apiCalls := adminGroup.Group("/api-calls") - { - apiCalls.GET("", r.handler.GetAdminApiCalls) - } + // 消费记录管理 walletTransactions := adminGroup.Group("/wallet-transactions") diff --git a/internal/infrastructure/task/article_task_handler.go b/internal/infrastructure/task/article_task_handler.go new file mode 100644 index 0000000..60a1697 --- /dev/null +++ b/internal/infrastructure/task/article_task_handler.go @@ -0,0 +1,58 @@ +package task + +import ( + "context" + "encoding/json" + "fmt" + + "github.com/hibiken/asynq" + "go.uber.org/zap" +) + +// ArticlePublisher 文章发布接口 +type ArticlePublisher interface { + PublishArticleByID(ctx context.Context, articleID string) error +} + +// ArticleTaskHandler 文章任务处理器 +type ArticleTaskHandler struct { + publisher ArticlePublisher + logger *zap.Logger +} + +// NewArticleTaskHandler 创建文章任务处理器 +func NewArticleTaskHandler( + publisher ArticlePublisher, + logger *zap.Logger, +) *ArticleTaskHandler { + return &ArticleTaskHandler{ + publisher: publisher, + logger: logger, + } +} + +// HandleArticlePublish 处理文章定时发布任务 +func (h *ArticleTaskHandler) HandleArticlePublish(ctx context.Context, t *asynq.Task) error { + var payload map[string]interface{} + if err := json.Unmarshal(t.Payload(), &payload); err != nil { + h.logger.Error("解析任务载荷失败", zap.Error(err)) + return fmt.Errorf("解析任务载荷失败: %w", err) + } + + articleID, ok := payload["article_id"].(string) + if !ok { + h.logger.Error("任务载荷中缺少文章ID") + return fmt.Errorf("任务载荷中缺少文章ID") + } + + // 执行文章发布 + if err := h.publisher.PublishArticleByID(ctx, articleID); err != nil { + h.logger.Error("定时发布文章失败", + zap.String("article_id", articleID), + zap.Error(err)) + return fmt.Errorf("定时发布文章失败: %w", err) + } + + h.logger.Info("定时发布文章成功", zap.String("article_id", articleID)) + return nil +} diff --git a/internal/infrastructure/task/asynq_client.go b/internal/infrastructure/task/asynq_client.go new file mode 100644 index 0000000..bb80bc6 --- /dev/null +++ b/internal/infrastructure/task/asynq_client.go @@ -0,0 +1,75 @@ +package task + +import ( + "context" + "encoding/json" + "fmt" + "time" + + "github.com/hibiken/asynq" + "go.uber.org/zap" +) + +// AsynqClient Asynq 客户端 +type AsynqClient struct { + client *asynq.Client + logger *zap.Logger +} + +// NewAsynqClient 创建 Asynq 客户端 +func NewAsynqClient(redisAddr string, logger *zap.Logger) *AsynqClient { + client := asynq.NewClient(asynq.RedisClientOpt{Addr: redisAddr}) + return &AsynqClient{ + client: client, + logger: logger, + } +} + +// Close 关闭客户端 +func (c *AsynqClient) Close() error { + return c.client.Close() +} + +// ScheduleArticlePublish 调度文章定时发布任务 +func (c *AsynqClient) ScheduleArticlePublish(ctx context.Context, articleID string, publishTime time.Time) error { + payload := map[string]interface{}{ + "article_id": articleID, + } + + payloadBytes, err := json.Marshal(payload) + if err != nil { + c.logger.Error("序列化任务载荷失败", zap.Error(err)) + return fmt.Errorf("创建任务失败: %w", err) + } + + task := asynq.NewTask(TaskTypeArticlePublish, payloadBytes) + + // 计算延迟时间 + delay := publishTime.Sub(time.Now()) + if delay <= 0 { + return fmt.Errorf("定时发布时间不能早于当前时间") + } + + // 设置任务选项 + opts := []asynq.Option{ + asynq.ProcessIn(delay), + asynq.MaxRetry(3), + asynq.Timeout(5 * time.Minute), + } + + info, err := c.client.Enqueue(task, opts...) + if err != nil { + c.logger.Error("调度定时发布任务失败", + zap.String("article_id", articleID), + zap.Time("publish_time", publishTime), + zap.Error(err)) + return fmt.Errorf("调度任务失败: %w", err) + } + + c.logger.Info("定时发布任务调度成功", + zap.String("article_id", articleID), + zap.Time("publish_time", publishTime), + zap.String("task_id", info.ID)) + + return nil +} diff --git a/internal/infrastructure/task/asynq_worker.go b/internal/infrastructure/task/asynq_worker.go new file mode 100644 index 0000000..138b06c --- /dev/null +++ b/internal/infrastructure/task/asynq_worker.go @@ -0,0 +1,98 @@ +package task + +import ( + "fmt" + + "github.com/hibiken/asynq" + "go.uber.org/zap" +) + +// AsynqWorker Asynq Worker +type AsynqWorker struct { + server *asynq.Server + mux *asynq.ServeMux + taskHandler *ArticleTaskHandler + logger *zap.Logger +} + +// NewAsynqWorker 创建 Asynq Worker +func NewAsynqWorker( + redisAddr string, + taskHandler *ArticleTaskHandler, + logger *zap.Logger, +) *AsynqWorker { + server := asynq.NewServer( + asynq.RedisClientOpt{Addr: redisAddr}, + asynq.Config{ + Concurrency: 10, // 并发数 + Queues: map[string]int{ + "critical": 6, + "default": 3, + "low": 1, + }, + Logger: NewAsynqLogger(logger), + }, + ) + + mux := asynq.NewServeMux() + + return &AsynqWorker{ + server: server, + mux: mux, + taskHandler: taskHandler, + logger: logger, + } +} + +// RegisterHandlers 注册任务处理器 +func (w *AsynqWorker) RegisterHandlers() { + // 注册文章定时发布任务处理器 + w.mux.HandleFunc(TaskTypeArticlePublish, w.taskHandler.HandleArticlePublish) + + w.logger.Info("任务处理器注册完成") +} + +// Start 启动 Worker +func (w *AsynqWorker) Start() error { + w.RegisterHandlers() + + w.logger.Info("启动 Asynq Worker") + return w.server.Run(w.mux) +} + +// Stop 停止 Worker +func (w *AsynqWorker) Stop() { + w.logger.Info("停止 Asynq Worker") + w.server.Stop() + w.server.Shutdown() +} + +// AsynqLogger Asynq 日志适配器 +type AsynqLogger struct { + logger *zap.Logger +} + +// NewAsynqLogger 创建 Asynq 日志适配器 +func NewAsynqLogger(logger *zap.Logger) *AsynqLogger { + return &AsynqLogger{logger: logger} +} + +func (l *AsynqLogger) Debug(args ...interface{}) { + l.logger.Debug(fmt.Sprint(args...)) +} + +func (l *AsynqLogger) Info(args ...interface{}) { + l.logger.Info(fmt.Sprint(args...)) +} + +func (l *AsynqLogger) Warn(args ...interface{}) { + l.logger.Warn(fmt.Sprint(args...)) +} + +func (l *AsynqLogger) Error(args ...interface{}) { + l.logger.Error(fmt.Sprint(args...)) +} + +func (l *AsynqLogger) Fatal(args ...interface{}) { + l.logger.Fatal(fmt.Sprint(args...)) +} diff --git a/internal/infrastructure/task/task_types.go b/internal/infrastructure/task/task_types.go new file mode 100644 index 0000000..affa4e7 --- /dev/null +++ b/internal/infrastructure/task/task_types.go @@ -0,0 +1,7 @@ +package task + +// 任务类型常量 +const ( + // TaskTypeArticlePublish 文章定时发布任务 + TaskTypeArticlePublish = "article:publish" +) diff --git a/scripts/migrations/001_create_article_tables.sql b/scripts/migrations/001_create_article_tables.sql new file mode 100644 index 0000000..2be773d --- /dev/null +++ b/scripts/migrations/001_create_article_tables.sql @@ -0,0 +1,96 @@ +-- 文章系统数据库迁移脚本 +-- 创建时间: 2024-01-01 +-- 描述: 创建文章相关的数据库表结构 + +-- 文章分类表 +CREATE TABLE IF NOT EXISTS article_categories ( + id VARCHAR(36) PRIMARY KEY COMMENT '分类唯一标识', + name VARCHAR(100) NOT NULL COMMENT '分类名称', + description TEXT COMMENT '分类描述', + sort_order INT DEFAULT 0 COMMENT '排序', + active BOOLEAN DEFAULT TRUE COMMENT '是否启用', + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + deleted_at TIMESTAMP NULL COMMENT '软删除时间', + INDEX idx_article_categories_active (active), + INDEX idx_article_categories_sort_order (sort_order), + INDEX idx_article_categories_deleted_at (deleted_at) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='文章分类表'; + +-- 文章标签表 +CREATE TABLE IF NOT EXISTS article_tags ( + id VARCHAR(36) PRIMARY KEY COMMENT '标签唯一标识', + name VARCHAR(50) NOT NULL COMMENT '标签名称', + color VARCHAR(20) DEFAULT '#1890ff' COMMENT '标签颜色', + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + deleted_at TIMESTAMP NULL COMMENT '软删除时间', + UNIQUE KEY uk_article_tags_name (name), + INDEX idx_article_tags_deleted_at (deleted_at) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='文章标签表'; + +-- 文章表 +CREATE TABLE IF NOT EXISTS articles ( + id VARCHAR(36) PRIMARY KEY COMMENT '文章唯一标识', + title VARCHAR(200) NOT NULL COMMENT '文章标题', + content TEXT NOT NULL COMMENT '文章内容', + summary VARCHAR(500) COMMENT '文章摘要', + cover_image VARCHAR(500) COMMENT '封面图片', + category_id VARCHAR(36) COMMENT '分类ID', + status ENUM('draft', 'published', 'archived') DEFAULT 'draft' COMMENT '文章状态', + is_featured BOOLEAN DEFAULT FALSE COMMENT '是否推荐', + published_at TIMESTAMP NULL COMMENT '发布时间', + view_count INT DEFAULT 0 COMMENT '阅读量', + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + deleted_at TIMESTAMP NULL COMMENT '软删除时间', + INDEX idx_articles_category_id (category_id), + INDEX idx_articles_status (status), + INDEX idx_articles_is_featured (is_featured), + INDEX idx_articles_published_at (published_at), + INDEX idx_articles_created_at (created_at), + INDEX idx_articles_deleted_at (deleted_at), + FOREIGN KEY (category_id) REFERENCES article_categories(id) ON DELETE SET NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='文章表'; + +-- 文章标签关联表 +CREATE TABLE IF NOT EXISTS article_tag_relations ( + id VARCHAR(36) PRIMARY KEY COMMENT '关联记录唯一标识', + article_id VARCHAR(36) NOT NULL COMMENT '文章ID', + tag_id VARCHAR(36) NOT NULL COMMENT '标签ID', + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + UNIQUE KEY uk_article_tag_relation (article_id, tag_id), + INDEX idx_article_tag_relations_article_id (article_id), + INDEX idx_article_tag_relations_tag_id (tag_id), + FOREIGN KEY (article_id) REFERENCES articles(id) ON DELETE CASCADE, + FOREIGN KEY (tag_id) REFERENCES article_tags(id) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='文章标签关联表'; + + + +-- 插入默认分类数据 +INSERT INTO article_categories (id, name, description, sort_order, active) VALUES +('cat-001', '技术分享', '技术相关的文章分享', 1, true), +('cat-002', '产品介绍', '产品功能介绍和使用指南', 2, true), +('cat-003', '公司动态', '公司最新动态和新闻', 3, true), +('cat-004', '行业资讯', '行业相关的最新资讯', 4, true), +('cat-005', '用户指南', '用户使用指南和帮助文档', 5, true) +ON DUPLICATE KEY UPDATE +name = VALUES(name), +description = VALUES(description), +sort_order = VALUES(sort_order), +active = VALUES(active); + +-- 插入默认标签数据 +INSERT INTO article_tags (id, name, color) VALUES +('tag-001', '技术', '#1890ff'), +('tag-002', '产品', '#52c41a'), +('tag-003', '新闻', '#faad14'), +('tag-004', '教程', '#722ed1'), +('tag-005', '更新', '#13c2c2'), +('tag-006', 'API', '#eb2f96'), +('tag-007', '文档', '#fa8c16'), +('tag-008', '公告', '#f5222d') +ON DUPLICATE KEY UPDATE +name = VALUES(name), +color = VALUES(color); diff --git a/test_article_simple.bat b/test_article_simple.bat new file mode 100644 index 0000000..491f505 --- /dev/null +++ b/test_article_simple.bat @@ -0,0 +1,30 @@ +@echo off +REM 文章系统API简单测试脚本 +REM 使用方法: test_article_simple.bat + +set BASE_URL=http://localhost:8080/api/v1 + +echo === 文章系统API测试 === +echo. + +REM 测试1: 获取文章列表 +echo 1. 测试获取文章列表... +curl -s -X GET "%BASE_URL%/articles?page=1&page_size=5" -H "Content-Type: application/json" +echo. +echo. + +REM 测试2: 获取文章统计 +echo 2. 测试获取文章统计... +curl -s -X GET "%BASE_URL%/articles/stats" -H "Content-Type: application/json" +echo. +echo. + +REM 测试3: 搜索文章 +echo 3. 测试搜索文章... +curl -s -X GET "%BASE_URL%/articles/search?keyword=技术&page=1&page_size=5" -H "Content-Type: application/json" +echo. +echo. + +echo === 测试完成 === +echo 注意: 需要认证的接口需要JWT token,请先登录获取token +pause diff --git a/test_article_simple.sh b/test_article_simple.sh new file mode 100644 index 0000000..c7a6364 --- /dev/null +++ b/test_article_simple.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# 文章系统API简单测试脚本 +# 使用方法: ./test_article_simple.sh + +BASE_URL="http://localhost:8080/api/v1" + +echo "=== 文章系统API测试 ===" +echo "" + +# 测试1: 获取文章列表 +echo "1. 测试获取文章列表..." +curl -s -X GET "$BASE_URL/articles?page=1&page_size=5" \ + -H "Content-Type: application/json" | jq . +echo "" +echo "" + +# 测试2: 获取文章统计 +echo "2. 测试获取文章统计..." +curl -s -X GET "$BASE_URL/articles/stats" \ + -H "Content-Type: application/json" | jq . +echo "" +echo "" + +# 测试3: 搜索文章 +echo "3. 测试搜索文章..." +curl -s -X GET "$BASE_URL/articles/search?keyword=技术&page=1&page_size=5" \ + -H "Content-Type: application/json" | jq . +echo "" +echo "" + +echo "=== 测试完成 ===" +echo "注意: 需要认证的接口需要JWT token,请先登录获取token"