diff --git a/app/inquiry/service/FbFileImportService.php b/app/inquiry/service/FbFileImportService.php index 93c3474..9c7e9dd 100644 --- a/app/inquiry/service/FbFileImportService.php +++ b/app/inquiry/service/FbFileImportService.php @@ -114,6 +114,11 @@ class FbFileImportService $item['phone'] = $this->normalizePhone($raw); break; + // ✅ 姓名:去掉粘连的 URL,并截断到下游 inquiry_log.contacts 列长度(255) + case 'full_name': + $item['full_name'] = $this->normalizeFullName($raw); + break; + default: if (is_string($raw)) $raw = trim($raw); $item[$field] = $raw; @@ -192,6 +197,27 @@ class FbFileImportService return $s; } + /** + * 姓名清洗: + * - 去掉粘连的 URL(如 "Saif Ullahhttps://..." → "Saif Ullah") + * - 纯链接记录清洗后为空字符串 + * - 截断到 255(下游 inquiry_log.contacts 列长度,避免同步入库时超长报错) + */ + protected function normalizeFullName($raw): string + { + if ($raw === null) return ''; + + $s = trim((string)$raw); + if ($s === '') return ''; + + // 去掉 URL(连同前面可能的空白/不可见字符) + $s = preg_replace('#\s*https?://\S+#i', '', $s); + $s = trim($s); + + // 截断到下游 contacts 列长度兜底 + return mb_substr($s, 0, 255); + } + /** * 规范化 is_organic 字段为 0/1