v1.0.47: 新增弹窗按类型动态字段(企业:名称/行业/注册号/联系人/电话邮箱/身份证/社媒;人员:姓名/电话邮箱/身份证/社媒;产品:名称/品类;需求:名称/需求类别)+各类型转软碎片要求(企业需名称+行业+注册号,人员需姓名+联系方式,产品需品类,需求需类别,前后端双校验)+preliminary_data加行业/注册号列

This commit is contained in:
nanguaboss
2026-08-10 00:45:29 +08:00
parent f8dfd0492b
commit 6cf2aabc91
6 changed files with 153 additions and 23 deletions
+11 -2
View File
@@ -39,6 +39,10 @@ $idNumber = trim($_POST['id_number'] ?? '');
$platform = trim($_POST['platform'] ?? '');
$accountId = trim($_POST['account_id'] ?? '');
$profileUrl = trim($_POST['profile_url'] ?? '');
$industry = trim($_POST['industry'] ?? ''); // 企业:行业
$registrationNum = trim($_POST['registration_number'] ?? ''); // 企业:注册号
$category = trim($_POST['target_product_category'] ?? ''); // 产品:品类
$needCategory = trim($_POST['need_category'] ?? ''); // 需求:需求类别
if (!in_array($sourceType, ['company', 'person', 'product', 'need', 'mixed'], true)) {
Response::error('碎片类型不合法', 400);
}
@@ -80,7 +84,7 @@ if ($accountId !== '' && $platform !== '') {
}
if (!empty($dups)) Response::duplicates($dups);
// extra_info 合并更新(身份证/平台/账号ID/主页链接)
// extra_info 合并更新(身份证/平台/账号ID/主页链接/品类/需求类别)
$extra = json_decode($frag['extra_info'] ?? 'null', true);
if (!is_array($extra)) {
$extra = [];
@@ -89,14 +93,19 @@ if ($idNumber !== '') $extra['id_number'] = $idNumber; else unset($extra['id_num
if ($platform !== '') $extra['platform'] = $platform; else unset($extra['platform']);
if ($accountId !== '') $extra['account_id'] = $accountId; else unset($extra['account_id']);
if ($profileUrl !== '') $extra['profile_url'] = $profileUrl; else unset($extra['profile_url']);
if ($category !== '') $extra['category'] = $category; else unset($extra['category']);
if ($needCategory !== '') $extra['need_category'] = $needCategory; else unset($extra['need_category']);
$pdo->prepare(
"UPDATE preliminary_data
SET source_type = ?, company_name = ?, person_name = ?, contact_phone = ?, contact_email = ?, extra_info = ?
SET source_type = ?, company_name = ?, industry = ?, registration_number = ?, person_name = ?,
contact_phone = ?, contact_email = ?, extra_info = ?
WHERE id = ?"
)->execute([
$sourceType,
$companyName !== '' ? $companyName : null,
$industry !== '' ? $industry : null,
$registrationNum !== '' ? $registrationNum : null,
$personName !== '' ? $personName : null,
$phone !== '' ? $phone : null,
$email !== '' ? $email : null,