diff --git a/app/model/store.js b/app/model/store.js index 4708ea4..d31fb6a 100644 --- a/app/model/store.js +++ b/app/model/store.js @@ -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 diff --git a/app/service/systems/setting/warehouse.js b/app/service/systems/setting/warehouse.js index 8dd1bfa..5cf0ca6 100644 --- a/app/service/systems/setting/warehouse.js +++ b/app/service/systems/setting/warehouse.js @@ -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: '默认快递编码',