From 11167434acb36313752d2ec2d3739d7034326d2b Mon Sep 17 00:00:00 2001 From: liufumingren Date: Wed, 5 Aug 2026 22:54:25 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BB=93=E5=BA=93=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=20string=5Farray=20=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E5=8F=8A=E8=87=AA=E5=8A=A8=E5=88=86=E9=85=8D=E5=BF=AB=E9=80=92?= =?UTF-8?q?=E6=8E=92=E9=99=A4=E5=A4=87=E6=B3=A8=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增字段 auto_allocate_express_exclude_remarks,类型 string_array,默认 [],用于控制订单备注命中关键字时跳过自动分配快递。 修改文件: WAREHOUSE_SETTING_FIELDS 新增元数据定义; Store model DEFAULT_SUBJECT_CONFIG 补默认值 + normalizeSubjectConfig 补校验。 --- app/model/store.js | 22 ++++++++++++++++++++++ app/service/systems/setting/warehouse.js | 8 ++++++++ 2 files changed, 30 insertions(+) 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: '默认快递编码',