Update public-api.js via upload script - 2026-11-14 02:14:24

This commit is contained in:
mike 2026-11-14 02:14:42 +08:00
parent ecfb870444
commit 6b0ebff07a
1 changed files with 3 additions and 3 deletions

View File

@ -1660,7 +1660,7 @@ ${dialog}`;
} }
/* ---------------- 预约拜访(网站 /visit/ 页面提交) ---------------- */ /* ---------------- 预约拜访(网站 /visit/ 页面提交) ---------------- */
// 客户填写日期、时间(北京时间整点)、人数、职位、公司、营业执照(图片或 PDF)、网站、电话/WhatsApp、邮箱、感兴趣的产品、拜访地点。 // 客户填写日期、时间(北京时间整点)、人数、职位、公司、网站、电话/WhatsApp、邮箱、感兴趣的产品、拜访地点。
// 记录存在 chat-data.json 的 visits 里,营业执照存在 visit-files/ 目录;后台"网站管理 → 预约拜访"查看。 // 记录存在 chat-data.json 的 visits 里,营业执照存在 visit-files/ 目录;后台"网站管理 → 预约拜访"查看。
const VISIT_DIR = path.join(path.dirname(dataFile), 'visit-files'); const VISIT_DIR = path.join(path.dirname(dataFile), 'visit-files');
const VISIT_HOURS = [9, 10, 11, 12, 14, 15, 16, 17, 18]; 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 (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(v.email)) bad.push('email');
if (!v.places.length) bad.push('places'); if (!v.places.length) bad.push('places');
const f = req.file, kind = f && sniffLicense(f.buffer); 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 }); if (bad.length) return res.status(400).json({ error: 'invalid', fields: bad });
try { if (f) try {
fs.mkdirSync(VISIT_DIR, { recursive: true }); fs.mkdirSync(VISIT_DIR, { recursive: true });
const stored = v.id + kind.ext; const stored = v.id + kind.ext;
fs.writeFileSync(path.join(VISIT_DIR, stored), f.buffer); fs.writeFileSync(path.join(VISIT_DIR, stored), f.buffer);