feat: 仓库设置新增 string_array 类型及自动分配快递排除备注配置

新增字段 auto_allocate_express_exclude_remarks,类型 string_array,默认 [],用于控制订单备注命中关键字时跳过自动分配快递。

修改文件: WAREHOUSE_SETTING_FIELDS 新增元数据定义; Store model DEFAULT_SUBJECT_CONFIG 补默认值 + normalizeSubjectConfig 补校验。
This commit is contained in:
liufumingren 2026-08-05 22:54:25 +08:00
parent 4f41e735a9
commit 11167434ac
2 changed files with 30 additions and 0 deletions

View File

@ -46,6 +46,7 @@ module.exports = app => {
max_notice_webhook_count: DEFAULT_MAX_NOTICE_WEBHOOK_COUNT,
max_wave_quantity: DEFAULT_MAX_WAVE_QUANTITY,
min_group_order_fetch_quantity: 13,
auto_allocate_express_exclude_remarks: [],
default_express_code: 'STO',
default_platform_code: 'TB',
sender_name: '',
@ -240,6 +241,27 @@ module.exports = app => {
normalized.min_group_order_fetch_quantity = minGroupOrderFetchQuantity;
}
const rawExcludeRemarks = parsed.auto_allocate_express_exclude_remarks;
if (rawExcludeRemarks === undefined || rawExcludeRemarks === null || rawExcludeRemarks === '') {
normalized.auto_allocate_express_exclude_remarks = [];
} else {
if (!Array.isArray(rawExcludeRemarks)) {
throw new Error('subject_config.auto_allocate_express_exclude_remarks 必须是字符串数组');
}
normalized.auto_allocate_express_exclude_remarks = rawExcludeRemarks
.map((item, index) => {
if (item === undefined || item === null || item === '') {
return null;
}
const trimmed = String(item).trim();
if (trimmed === '') {
throw new Error(`subject_config.auto_allocate_express_exclude_remarks[${index}] 不能为空字符串`);
}
return trimmed;
})
.filter(Boolean);
}
normalized.default_express_code = normalizeSubjectConfigText(
parsed.default_express_code,
DEFAULT_SUBJECT_CONFIG.default_express_code

View File

@ -51,6 +51,14 @@ const WAREHOUSE_SETTING_FIELDS = Object.freeze([
required: false,
description: '是否启用订单创建后自动加入团购波次,默认 false(关闭)',
}),
Object.freeze({
key: 'auto_allocate_express_exclude_remarks',
name: '自动分配快递排除备注',
type: 'string_array',
default: [],
required: false,
description: '订单备注命中任一关键字时,跳过自动分配快递,默认 [](不排除任何订单)',
}),
Object.freeze({
key: 'default_express_code',
name: '默认快递编码',