From 48c996d1d2a79b700272343f21af00fda7c39bd4 Mon Sep 17 00:00:00 2001 From: nanguaboss <602995148@qq.com> Date: Sun, 9 Aug 2026 22:41:24 +0800 Subject: [PATCH] =?UTF-8?q?v1.0.36:=20=E7=A2=8E=E7=89=87=E5=A4=84=E7=90=86?= =?UTF-8?q?=E8=A1=A5=E5=85=A8/=E8=BD=AC=E6=8D=A2=E6=8E=A5=E5=85=A5?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E6=A0=A1=E9=AA=8C=20-=20soft=5Fupdate.php=20?= =?UTF-8?q?=E8=BD=AF=E7=A2=8E=E7=89=87=E8=A1=A5=E5=85=A8(persons=E8=BA=AB?= =?UTF-8?q?=E4=BB=BD=E8=AF=81=E6=89=8B=E6=9C=BA=E9=82=AE=E7=AE=B1/companie?= =?UTF-8?q?s=E4=BC=81=E4=B8=9A=E5=90=8D=E6=B3=A8=E5=86=8C=E5=8F=B7/social?= =?UTF-8?q?=5Faccounts=E8=B4=A6=E5=8F=B7=E4=B8=BB=E9=A1=B5)=E6=94=B6?= =?UTF-8?q?=E9=9B=86=E5=85=A8=E9=83=A8=E9=87=8D=E5=A4=8D=E5=BC=B9=E7=AA=97?= =?UTF-8?q?,hard=5Fconvert=20=E5=B7=B2=E9=9A=8F=20v1.0.35=20=E7=94=9F?= =?UTF-8?q?=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/fragment/soft_update.php | 35 +++++++++++++++++++++++++++++++++++ static/js/config.js | 2 +- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/api/fragment/soft_update.php b/api/fragment/soft_update.php index 7e7cb42..ac0b943 100644 --- a/api/fragment/soft_update.php +++ b/api/fragment/soft_update.php @@ -11,6 +11,7 @@ require_once __DIR__ . '/../common/auth.php'; require_once __DIR__ . '/../common/logger.php'; require_once __DIR__ . '/../common/helpers.php'; require_once __DIR__ . '/../common/completeness.php'; +require_once __DIR__ . '/../common/duplicate_check.php'; checkAjax(); checkPermission('preliminary'); @@ -56,6 +57,20 @@ switch ($table) { 'graduated_from' => 's', 'hometown' => 's', 'work_location' => 's', 'id_type' => 's', 'id_number' => 's', 'source_channel' => 's', 'source_detail' => 's', ]); + // 唯一性校验(排除自身):身份证 / 手机 / 邮箱 + $dups = []; + if (!empty($fields['id_number'])) { + $dup = findDuplicate($pdo, 'id_number', $fields['id_number'], [$id]); + if ($dup) $dups[] = $dup; + } + $ownAccountIds = $pdo->query("SELECT id FROM social_accounts WHERE owner_type = 'person' AND owner_id = $id")->fetchAll(PDO::FETCH_COLUMN); + if (isset($_POST['phone'])) { + $dups = array_merge($dups, checkSingleAccountDuplicate($pdo, $_POST['phone'] !== '' ? 'phone' : '', $_POST['phone'], '', $ownAccountIds)); + } + if (isset($_POST['email'])) { + $dups = array_merge($dups, checkSingleAccountDuplicate($pdo, $_POST['email'] !== '' ? 'email' : '', $_POST['email'], '', $ownAccountIds)); + } + if (!empty($dups)) Response::duplicates($dups); if (!empty($fields)) { [$sets, $params] = buildUpdate($fields); $params[] = $id; @@ -96,6 +111,17 @@ switch ($table) { 'latest_employee_count' => 'i', 'latest_annual_revenue' => 's', 'is_listed' => 'i', 'stock_code' => 's', 'website' => 's', ]); + // 唯一性校验(排除自身):企业名称 / 注册号 + $dups = []; + if (!empty($fields['name_zh']) || !empty($fields['display_name'])) { + $dup = findDuplicate($pdo, 'company_name', $fields['name_zh'] ?? $fields['display_name'] ?? '', [$id]); + if ($dup) $dups[] = $dup; + } + if (!empty($fields['registration_number'])) { + $dup = findDuplicate($pdo, 'registration_number', $fields['registration_number'], [$id]); + if ($dup) $dups[] = $dup; + } + if (!empty($dups)) Response::duplicates($dups); if (!empty($fields)) { [$sets, $params] = buildUpdate($fields); $params[] = $id; @@ -108,6 +134,15 @@ switch ($table) { $collect([ 'platform' => 's', 'account_id' => 's', 'is_primary' => 'i', 'profile_url' => 's', 'remark' => 's', ]); + // 唯一性校验(排除自身):社媒账号ID(同平台,取当前行 platform)/ 主页链接 + $curAcc = $pdo->prepare("SELECT * FROM social_accounts WHERE id = ?"); + $curAcc->execute([$id]); + $curAccRow = $curAcc->fetch(); + $platformVal = $fields['platform'] ?? ($curAccRow['platform'] ?? ''); + $accountIdVal = $fields['account_id'] ?? ($curAccRow['account_id'] ?? ''); + $profileUrlVal = $fields['profile_url'] ?? ($curAccRow['profile_url'] ?? ''); + $dups = checkSingleAccountDuplicate($pdo, $platformVal, $accountIdVal, $profileUrlVal, [$id]); + if (!empty($dups)) Response::duplicates($dups); if (!empty($fields)) { [$sets, $params] = buildUpdate($fields); $params[] = $id; diff --git a/static/js/config.js b/static/js/config.js index 49331eb..147f0ad 100644 --- a/static/js/config.js +++ b/static/js/config.js @@ -5,7 +5,7 @@ var BASE_URL = '/api/'; var PAGE_SIZE = 20; /** 系统版本号(logo旁展示):修改代码后运行 tools/bump_version.php 自动递增 */ -var APP_VERSION = 'v1.0.35'; +var APP_VERSION = 'v1.0.36'; /** 页脚版权/备案信息(在 config.js 中修改) */ var FOOTER_TEXT = '© 2026 SuperLink 管理系统 版权所有 | 备案号:请替换为真实备案号';