From 6b0ebff07acc0310f42d1d1c0776566f393f048a Mon Sep 17 00:00:00 2001 From: mike Date: Sat, 14 Nov 2026 02:14:42 +0800 Subject: [PATCH] Update public-api.js via upload script - 2026-11-14 02:14:24 --- public-api.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public-api.js b/public-api.js index eaee8b0..6bd4bb7 100644 --- a/public-api.js +++ b/public-api.js @@ -1660,7 +1660,7 @@ ${dialog}`; } /* ---------------- 预约拜访(网站 /visit/ 页面提交) ---------------- */ - // 客户填写日期、时间(北京时间整点)、人数、职位、公司、营业执照(图片或 PDF)、网站、电话/WhatsApp、邮箱、感兴趣的产品、拜访地点。 + // 客户填写日期、时间(北京时间整点)、人数、职位、公司、网站、电话/WhatsApp、邮箱、感兴趣的产品、拜访地点。 // 记录存在 chat-data.json 的 visits 里,营业执照存在 visit-files/ 目录;后台"网站管理 → 预约拜访"查看。 const VISIT_DIR = path.join(path.dirname(dataFile), 'visit-files'); const VISIT_HOURS = [9, 10, 11, 12, 14, 15, 16, 17, 18]; @@ -1745,9 +1745,9 @@ ${dialog}`; if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(v.email)) bad.push('email'); if (!v.places.length) bad.push('places'); const f = req.file, kind = f && sniffLicense(f.buffer); - if (!f) bad.push('license'); else if (!kind) bad.push('license_type'); + if (f && !kind) bad.push('license_type'); // 营业执照已从网站表单去掉;万一带了文件,仍只收图片或 PDF if (bad.length) return res.status(400).json({ error: 'invalid', fields: bad }); - try { + if (f) try { fs.mkdirSync(VISIT_DIR, { recursive: true }); const stored = v.id + kind.ext; fs.writeFileSync(path.join(VISIT_DIR, stored), f.buffer);