Files
junhong_cmp_fiber/internal/routes/export_task.go
邹进 eb9f12d160
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 9m34s
feat: 后台订单按平台、代理商、在线支付拆分列表与导出
- 新增 GET /orders/platform、/orders/agent、/orders/online,类别由路径固定,参数、响应、权限同原订单列表
- 新增导出场景 order_platform、order_agent、order_online,筛选与表头同 order
- 类别按钱从哪来划分:客户端下单为在线支付;后台代理钱包扣款(含平台代扣)为代理商;其余后台订单为平台
- 列表与导出共用 internal/query/ordercategory 的类别条件
- 企业账号访问订单列表、详情、购买预检改为无权限,修复其可看到全部订单的问题
- 原订单列表与 order 导出场景保留不变

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 12:53:24 +09:00

54 lines
3.0 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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"
)
func registerExportTaskRoutes(router fiber.Router, handler *admin.ExportTaskHandler, doc *openapi.Generator, basePath string) {
exportTasks := router.Group("/export-tasks")
groupPath := basePath + "/export-tasks"
Register(exportTasks, doc, groupPath, "POST", "", handler.Create, RouteSpec{
Summary: "创建导出任务",
Description: "创建统一导出任务,支持场景 scene=device/iot_card/order/order_platform/order_agent/order_online/package/agent_wallet_transaction/agent_recharge/refund/exchange/commission_record/package_traffic_alert/expiring_asset/operations_activation/operations_renewal/stop_resume_rule_dry_run/polling_pause/polling_stop_refused_alert 和格式 format=xlsx/csv。" +
"polling_pause 的 query.filters 同 GET /card-polling-pauses(asset_type、carrier_id、source、status、identifier、operator_id、start_time、end_time);polling_stop_refused_alert 的 query.filters 为 carrier_id、status、iccid、start_time、end_time;两者仅超级管理员与平台账号可导出。device、iot_card 场景支持 enable_polling 筛选,导出最后一列为「是否轮询」。" +
"order_platform、order_agent、order_online 分别导出平台订单、代理商订单、在线支付订单(与 GET /orders/platform、/orders/agent、/orders/online 一一对应),query.filters、表头与数据范围同 order,不接收类别参数。" +
"受影响场景的时间筛选固定为 query.filters.start_time 与 query.filters.end_time,取值必须为带显式时区的 RFC3339 秒级时间,创建时规范化为 UTC 秒级字符串后冻结。",
Tags: []string{"导出任务"},
Input: new(dto.CreateExportTaskRequest),
Output: new(dto.CreateExportTaskResponse),
Auth: true,
})
Register(exportTasks, doc, groupPath, "GET", "", handler.List, RouteSpec{
Summary: "导出任务列表",
Description: "支持按 scene/status/time 过滤,分页默认 20,最大 100。",
Tags: []string{"导出任务"},
Input: new(dto.ListExportTaskRequest),
Output: new(dto.ListExportTaskResponse),
Auth: true,
})
Register(exportTasks, doc, groupPath, "GET", "/:id", handler.GetByID, RouteSpec{
Summary: "导出任务详情",
Description: "已完成任务返回 download_url,链接固定有效期 24 小时。",
Tags: []string{"导出任务"},
Input: new(dto.GetExportTaskRequest),
Output: new(dto.ExportTaskDetailResponse),
Auth: true,
})
Register(exportTasks, doc, groupPath, "POST", "/:id/cancel", handler.Cancel, RouteSpec{
Summary: "取消导出任务",
Description: "支持取消待处理/处理中任务;已完成/已失败/已取消任务不可取消。",
Tags: []string{"导出任务"},
Input: new(dto.CancelExportTaskRequest),
Output: new(dto.CancelExportTaskResponse),
Auth: true,
})
}