fix(api): 移除YMT无效字段并隐藏key批次字段

在exports.go中过滤掉YMT数据源的无效字段order.key_batch_id和order.key_batch_name
在metadata.go中将order.key_batch_id字段标记为隐藏
This commit is contained in:
zhouyonggao 2025-12-12 18:17:21 +08:00
parent 50ba8f7780
commit a2c6f2a08d
2 changed files with 12 additions and 1 deletions

View File

@ -218,6 +218,17 @@ func (a *ExportsAPI) create(w http.ResponseWriter, r *http.Request) {
}
normalized = append(normalized, tf)
}
// 移除 YMT 无效字段key批次
if ds == "ymt" {
tmp := make([]string, 0, len(normalized))
for _, tf := range normalized {
if tf == "order.key_batch_id" || tf == "order.key_batch_name" {
continue
}
tmp = append(tmp, tf)
}
normalized = tmp
}
// whitelist validation & soft removal of disallowed fields
bad := []string{}
filtered = make([]string, 0, len(normalized))

View File

@ -448,7 +448,7 @@ func ymtMetadataTables() []tableInfo {
{Key: "order.num", Field: "num", Label: "购买数量", Hidden: false},
{Key: "order.pay_status", Field: "pay_status", Label: "支付状态", Hidden: false},
{Key: "order.supplier_product_name", Field: "supplier_product_name", Label: "供应商产品名称", Hidden: false},
{Key: "order.key_batch_id", Field: "key_batch_id", Label: "key批次", Hidden: false},
{Key: "order.key_batch_id", Field: "key_batch_id", Label: "key批次", Hidden: true},
{Key: "order.is_inner", Field: "is_inner", Label: "是否内部供应商订单", Hidden: false},
{Key: "order.icon", Field: "icon", Label: "订单图片", Hidden: false},
{Key: "order.cost_price", Field: "cost_price", Label: "成本单价", Hidden: false},