v1.0.35: 重复校验支持多字段同时提示 - 校验引擎改收集模式返回全部重复,Response::duplicates单弹窗列出,前端遍历展示所有重复项
This commit is contained in:
@@ -45,17 +45,17 @@ $sourceChannel = $frag['source_channel'] ?? null;
|
||||
|
||||
$convertedId = 0;
|
||||
|
||||
// 唯一性校验:按目标类型
|
||||
// 唯一性校验:按目标类型,收集全部重复
|
||||
$dups = [];
|
||||
if ($targetType === 'company' && $companyName !== '') {
|
||||
$dup = findDuplicate($pdo, 'company_name', $companyName);
|
||||
if ($dup) Response::duplicate($dup);
|
||||
if ($dup) $dups[] = $dup;
|
||||
}
|
||||
if (in_array($targetType, ['person', 'company'], true)) {
|
||||
$dup = checkSingleAccountDuplicate($pdo, $phone !== '' ? 'phone' : '', $phone, '');
|
||||
if ($dup) Response::duplicate($dup);
|
||||
$dup = checkSingleAccountDuplicate($pdo, $email !== '' ? 'email' : '', $email, '');
|
||||
if ($dup) Response::duplicate($dup);
|
||||
$dups = array_merge($dups, checkSingleAccountDuplicate($pdo, $phone !== '' ? 'phone' : '', $phone, ''));
|
||||
$dups = array_merge($dups, checkSingleAccountDuplicate($pdo, $email !== '' ? 'email' : '', $email, ''));
|
||||
}
|
||||
if (!empty($dups)) Response::duplicates($dups);
|
||||
|
||||
/** 创建 social_accounts(phone/email,常用) */
|
||||
$saveContacts = function ($ownerType, $ownerId) use ($pdo, $phone, $email) {
|
||||
|
||||
Reference in New Issue
Block a user