feat: 后台订单按平台、代理商、在线支付拆分列表与导出
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 9m34s
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:
35
internal/query/ordercategory/condition.go
Normal file
35
internal/query/ordercategory/condition.go
Normal file
@@ -0,0 +1,35 @@
|
||||
// Package ordercategory 定义后台订单类别的查询条件,供订单列表与订单导出共用,保证两边口径一致
|
||||
// (split-admin-order-list-by-category)。
|
||||
package ordercategory
|
||||
|
||||
import (
|
||||
"github.com/break/junhong_cmp_fiber/internal/model"
|
||||
"github.com/break/junhong_cmp_fiber/pkg/constants"
|
||||
)
|
||||
|
||||
// Condition 按表别名生成订单类别条件;alias 为空时不加前缀。类别不受支持时 ok 为 false。
|
||||
//
|
||||
// 按钱从哪来划分,不按操作人:
|
||||
// - 在线支付:客户端下单;
|
||||
// - 代理商:后台下单且以代理钱包支付(含平台代扣代理钱包);
|
||||
// - 平台:后台下单且不走代理钱包(线下支付,支付方式为空也归此类,含平台代购)。
|
||||
func Condition(alias, category string) (string, []any, bool) {
|
||||
prefix := ""
|
||||
if alias != "" {
|
||||
prefix = alias + "."
|
||||
}
|
||||
source := prefix + "source"
|
||||
paymentMethod := prefix + "payment_method"
|
||||
switch category {
|
||||
case constants.OrderCategoryOnline:
|
||||
return source + " = ?", []any{constants.OrderSourceClient}, true
|
||||
case constants.OrderCategoryAgent:
|
||||
return source + " = ? AND " + paymentMethod + " = ?",
|
||||
[]any{constants.OrderSourceAdmin, model.PaymentMethodWallet}, true
|
||||
case constants.OrderCategoryPlatform:
|
||||
return source + " = ? AND (" + paymentMethod + " IS NULL OR " + paymentMethod + " <> ?)",
|
||||
[]any{constants.OrderSourceAdmin, model.PaymentMethodWallet}, true
|
||||
default:
|
||||
return "", nil, false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user