package routes import ( "github.com/gofiber/fiber/v2" "github.com/break/junhong_cmp_fiber/internal/handler/admin" "github.com/break/junhong_cmp_fiber/internal/model/dto" "github.com/break/junhong_cmp_fiber/pkg/openapi" ) // recordQueryDescription 是记录查询接口的公共说明。 const recordQueryDescription = "identifier 选填:传入时只查该卡(设备取其绑定卡),解析不到资产返回空页;不传查全部,仅平台账号。" + "时间范围必填,跨度不超过 31 天;按记录时间倒序分页,每页默认 20、最大 100。" func registerRecordQueryRoutes(router fiber.Router, asset *admin.AssetHandler, refund *admin.RefundHandler, doc *openapi.Generator, basePath string) { Register(router, doc, basePath, "GET", "/traffic-collections", asset.ListTrafficCollectionRecords, RouteSpec{ Summary: "运营商流量采集成功记录", Description: recordQueryDescription + "只含读数有效的采集,带网关原始请求与响应;在线保留当月加最近 2 个整月。", Tags: []string{"记录查询"}, Input: new(dto.TrafficCollectionListRequest), Output: new(dto.TrafficCollectionRecordListResponse), Auth: true, }) Register(router, doc, basePath, "GET", "/traffic-collection-failures", asset.ListTrafficCollectionFailures, RouteSpec{ Summary: "运营商流量采集失败记录", Description: recordQueryDescription + "含失败、限流、响应无效、无读数、读数无效,带错误类别、上游返回与原始数据;observation_id 等于对接日志 integration_id。", Tags: []string{"记录查询"}, Input: new(dto.TrafficCollectionFailureListRequest), Output: new(dto.TrafficCollectionFailureListResponse), Auth: true, }) Register(router, doc, basePath, "GET", "/card-daily-usages", asset.ListCardDailyUsages, RouteSpec{ Summary: "卡日流量记录", Description: recordQueryDescription + "数据来自卡日快照(每卡每天一条);按日期范围(含首尾)查询;min_usage_mb 按当日已结算增量筛异常大流量。", Tags: []string{"记录查询"}, Input: new(dto.CardDailyUsageListRequest), Output: new(dto.CardDailyUsageListResponse), Auth: true, }) Register(router, doc, basePath, "GET", "/package-usage-daily-records", asset.ListPackageUsageDailyRecords, RouteSpec{ Summary: "套餐日流量详单记录", Description: recordQueryDescription + "按日期范围(含首尾)查询;设备标识同时匹配设备套餐与其绑定卡的套餐。", Tags: []string{"记录查询"}, Input: new(dto.PackageUsageDailyRecordListRequest), Output: new(dto.PackageUsageDailyRecordListResponse), Auth: true, }) Register(router, doc, basePath, "GET", "/package-traffic-adjustments", asset.ListPackageTrafficAdjustmentRecords, RouteSpec{ Summary: "套餐流量冲正流水记录", Description: recordQueryDescription + "direction=deduct 为补扣(增量为正),refund 为退回(增量为负)。", Tags: []string{"记录查询"}, Input: new(dto.PackageTrafficAdjustmentQueryRequest), Output: new(dto.PackageTrafficAdjustmentRecordListResponse), Auth: true, }) Register(router, doc, basePath, "GET", "/refund-post-process-attempts", refund.ListAssetPostProcessAttempts, RouteSpec{ Summary: "退款资产后处理尝试记录", Description: "仅平台账号。可按退款单 ID 或单号、资产标识、步骤、结果、错误码、触发方式筛选,不传条件查全部;时间范围必填,跨度不超过 31 天;按时间倒序分页,每页默认 20、最大 100。", Tags: []string{"记录查询"}, Input: new(dto.RefundPostProcessAttemptListRequest), Output: new(dto.RefundPostProcessAttemptListResponse), Auth: true, }) }