v1.0.33: 全局唯一性校验 - 手机号/邮箱/身份证/企业注册号/社媒账号ID/主页链接/企业名称 新增与修改时校验,重复弹窗提示并跳转定位(后端duplicate_check引擎+code 1001,前端弹窗+person/company/media页?id=跳转)

This commit is contained in:
nanguaboss
2026-08-09 22:27:05 +08:00
parent de1c227727
commit 76593d4dce
15 changed files with 393 additions and 17 deletions
+13
View File
@@ -11,6 +11,7 @@ require_once __DIR__ . '/../common/response.php';
require_once __DIR__ . '/../common/auth.php';
require_once __DIR__ . '/../common/logger.php';
require_once __DIR__ . '/../common/completeness.php';
require_once __DIR__ . '/../common/duplicate_check.php';
checkAjax();
checkPermission('preliminary');
@@ -44,6 +45,18 @@ $sourceChannel = $frag['source_channel'] ?? null;
$convertedId = 0;
// 唯一性校验:按目标类型
if ($targetType === 'company' && $companyName !== '') {
$dup = findDuplicate($pdo, 'company_name', $companyName);
if ($dup) Response::duplicate($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);
}
/** 创建 social_accounts(phone/email,常用) */
$saveContacts = function ($ownerType, $ownerId) use ($pdo, $phone, $email) {
if ($phone !== '') {