feat: 后台订单按平台、代理商、在线支付拆分列表与导出
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 9m34s

- 新增 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>
This commit is contained in:
邹进
2026-10-26 12:53:24 +09:00
parent 3618fc2b20
commit eb9f12d160
16 changed files with 700 additions and 25 deletions

View File

@@ -7,7 +7,9 @@ import (
"time"
"github.com/break/junhong_cmp_fiber/internal/model"
"github.com/break/junhong_cmp_fiber/internal/query/ordercategory"
"github.com/break/junhong_cmp_fiber/internal/store"
"github.com/break/junhong_cmp_fiber/pkg/errors"
"github.com/break/junhong_cmp_fiber/pkg/middleware"
"github.com/redis/go-redis/v9"
"gorm.io/gorm"
@@ -90,6 +92,15 @@ func (s *OrderStore) List(ctx context.Context, opts *store.QueryOptions, filters
query = s.applyOrderScope(ctx, query)
// 订单类别是内部过滤键,由后台按类别拆分的列表接口固定写入,不来自请求参数。
if v, ok := filters["order_category"].(string); ok && v != "" {
condition, args, valid := ordercategory.Condition("", v)
if !valid {
return nil, 0, errors.New(errors.CodeInvalidParam, "不支持的订单类别")
}
query = query.Where(condition, args...)
}
if v, ok := filters["payment_status"]; ok {
query = query.Where("payment_status = ?", v)
}