diff --git a/api/common/completeness.php b/api/common/completeness.php index cc41eee..91f6e71 100644 --- a/api/common/completeness.php +++ b/api/common/completeness.php @@ -20,7 +20,7 @@ const COMPLETENESS_LAYERS = [ 'virtual' => ['phone' => 'core', 'email' => 'core'], // 关联 social_accounts.platform ], 'companies' => [ - 'core' => ['display_name', 'name_zh', 'name_en', 'business_role', 'industry'], + 'core' => ['display_name', 'name_zh', 'business_role', 'industry'], 'important' => ['address', 'country'], 'optional' => ['registration_number', 'legal_form', 'legal_representative', 'business_scope', 'established_date', 'registered_capital', 'industry_subdivision', @@ -50,7 +50,7 @@ const COMPLETENESS_LABELS = [ 'gender' => '性别', 'nationality' => '国籍', 'education' => '学历', 'graduated_from' => '毕业院校', 'hometown' => '家乡', 'id_type' => '证件类型', 'id_number' => '证件号码', 'display_name' => '名称', 'industry' => '行业', 'address' => '地址', 'business_role' => '业务类型', - 'country' => '国家/地区', 'name_zh' => '中文名', 'name_en' => '英文名', 'registration_number' => '注册号', + 'country' => '国家/地区', 'name_zh' => '中文名', 'registration_number' => '注册号', 'legal_form' => '企业类型', 'legal_representative' => '法定代表人', 'business_scope' => '经营范围', 'established_date' => '成立日期', 'registered_capital' => '注册资本', 'industry_subdivision' => '行业细分', 'latest_employee_count' => '员工数', 'latest_annual_revenue' => '年营收', 'is_listed' => '是否上市', diff --git a/api/common/helpers.php b/api/common/helpers.php index 0160fd3..f868a57 100644 --- a/api/common/helpers.php +++ b/api/common/helpers.php @@ -7,7 +7,7 @@ require_once __DIR__ . '/response.php'; /** 企业表可写入字段白名单(key => 类型标记:s字符串/i整数/d日期/n数字) */ const COMPANY_FIELDS = [ - 'name_zh' => 's', 'name_en' => 's', 'display_name' => 's', + 'name_zh' => 's', 'display_name' => 's', 'business_role' => 's', 'country' => 's', 'registration_number' => 's', 'address' => 's', 'legal_form' => 's', 'legal_representative' => 's', 'business_scope' => 's', 'established_date' => 'd', 'registered_capital' => 's', diff --git a/api/company/add.php b/api/company/add.php index e543113..1e51d36 100644 --- a/api/company/add.php +++ b/api/company/add.php @@ -14,12 +14,12 @@ checkAjax(); checkPermission('company'); $data = extractFields(COMPANY_FIELDS); -// 显示名称不再单独录入:优先取中文名称,其次英文名称(数据库 display_name 为 NOT NULL) +// 显示名称不再单独录入:取中文名称(数据库 display_name 为 NOT NULL) if (empty($data['display_name'])) { - $data['display_name'] = $data['name_zh'] ?? ($data['name_en'] ?? ''); + $data['display_name'] = $data['name_zh'] ?? ''; } if (empty($data['display_name'])) { - Response::error('企业名称(中文名称或英文名称)为必填项', 400); + Response::error('企业名称(中文名称)为必填项', 400); } $pdo = DB::getInstance()->getPdo(); diff --git a/api/company/export.php b/api/company/export.php index 6260b13..8c18382 100644 --- a/api/company/export.php +++ b/api/company/export.php @@ -29,7 +29,7 @@ if (!$idList) { $pdo = DB::getInstance()->getPdo(); $in = implode(',', array_fill(0, count($idList), '?')); $stmt = $pdo->prepare( - "SELECT id, name_zh, name_en, business_role, country, registration_number, + "SELECT id, name_zh, business_role, country, registration_number, address, legal_representative, industry, industry_subdivision, website, registered_capital, established_date, latest_employee_count, latest_annual_revenue, is_listed, stock_code, source_channel, source_detail, created_at @@ -44,10 +44,10 @@ header('Content-Type: text/csv; charset=utf-8'); header('Content-Disposition: attachment; filename="companies_' . date('Ymd_His') . '.csv"'); echo "\xEF\xBB\xBF"; // UTF-8 BOM,便于 Excel 直接打开 $out = fopen('php://output', 'w'); -fputcsv($out, ['ID', '公司名称', '英文名称', '业务角色', '国家/地区', '注册号', '地址', '法人', '行业', '行业细分', '官网', '注册资本', '成立日期', '员工数', '年营收', '是否上市', '股票代码', '来源渠道', '来源详情', '创建时间']); +fputcsv($out, ['ID', '公司名称', '业务角色', '国家/地区', '注册号', '地址', '法人', '行业', '行业细分', '官网', '注册资本', '成立日期', '员工数', '年营收', '是否上市', '股票代码', '来源渠道', '来源详情', '创建时间']); foreach ($list as $r) { fputcsv($out, [ - $r['id'], $r['name_zh'], $r['name_en'], $r['business_role'], + $r['id'], $r['name_zh'], $r['business_role'], $r['country'], $r['registration_number'], $r['address'], $r['legal_representative'], $r['industry'], $r['industry_subdivision'], $r['website'], $r['registered_capital'], $r['established_date'], $r['latest_employee_count'], $r['latest_annual_revenue'], diff --git a/api/company/import.php b/api/company/import.php index acb4f0c..40b5fb5 100644 --- a/api/company/import.php +++ b/api/company/import.php @@ -1,7 +1,7 @@ 'name_zh', 'name_en' => 'name_en', 'display_name' => 'display_name', + 'name_zh' => 'name_zh', 'display_name' => 'display_name', 'business_role' => 'business_role', 'country' => 'country', 'registration_number' => 'registration_number', 'address' => 'address', 'legal_form' => 'legal_form', 'legal_representative' => 'legal_representative', 'industry' => 'industry', 'industry_subdivision' => 'industry_subdivision', 'website' => 'website', @@ -46,7 +46,7 @@ $failed = 0; $stmt = $pdo->prepare( "INSERT INTO companies - (name_zh, name_en, display_name, business_role, country, registration_number, + (name_zh, display_name, business_role, country, registration_number, address, legal_form, legal_representative, industry, industry_subdivision, website, registered_capital, established_date, is_listed, stock_code, source_channel, source_detail) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)" @@ -68,7 +68,7 @@ while (($row = fgetcsv($handle)) !== false) { $rec['established_date'] = ($rec['established_date'] ?? '') !== '' ? date('Y-m-d', strtotime($rec['established_date'])) : null; try { $stmt->execute([ - $rec['name_zh'] ?? null, $rec['name_en'] ?? null, $rec['display_name'], + $rec['name_zh'] ?? null, $rec['display_name'], $rec['business_role'] ?? null, $rec['country'] ?? null, $rec['registration_number'] ?? null, $rec['address'] ?? null, $rec['legal_form'] ?? null, $rec['legal_representative'] ?? null, $rec['industry'] ?? null, $rec['industry_subdivision'] ?? null, $rec['website'] ?? null, diff --git a/api/company/list.php b/api/company/list.php index ba26a63..f803932 100644 --- a/api/company/list.php +++ b/api/company/list.php @@ -23,7 +23,7 @@ $active = isset($_REQUEST['is_active']) && $_REQUEST['is_active'] !== '' ? (int // 可指定筛选的字段白名单(下拉选项来自前端「筛选」) $searchableFields = [ - 'name_zh', 'name_en', 'registration_number', 'legal_representative', + 'name_zh', 'registration_number', 'legal_representative', 'address', 'industry', 'industry_subdivision', 'website', 'source_channel', 'source_detail', 'business_scope', 'stock_code', ]; @@ -109,7 +109,7 @@ if ($keyword !== '') { $params[] = "%$keyword%"; } else { // 全部字段:匹配常用字段 - $where[] = '(name_zh LIKE ? OR name_en LIKE ? OR display_name LIKE ? OR registration_number LIKE ? OR legal_representative LIKE ? OR industry LIKE ? OR industry_subdivision LIKE ? OR website LIKE ? OR source_detail LIKE ? OR stock_code LIKE ?)'; + $where[] = '(name_zh LIKE ? OR display_name LIKE ? OR registration_number LIKE ? OR legal_representative LIKE ? OR industry LIKE ? OR industry_subdivision LIKE ? OR website LIKE ? OR source_detail LIKE ? OR stock_code LIKE ?)'; $like = "%$keyword%"; array_push($params, $like, $like, $like, $like, $like, $like, $like, $like, $like, $like); } @@ -132,7 +132,7 @@ $total = (int)$stmt->fetchColumn(); $offset = ($page - 1) * $limit; $stmt = $pdo->prepare( - "SELECT id, name_zh, name_en, display_name, business_role, legal_form, country, registration_number, + "SELECT id, name_zh, display_name, business_role, legal_form, country, registration_number, address, legal_representative, industry, industry_subdivision, website, latest_employee_count, latest_annual_revenue, is_listed, stock_code, source_channel, source_detail, is_active, created_at, updated_at diff --git a/api/fragment/soft_update.php b/api/fragment/soft_update.php index 0d64dbe..7e7cb42 100644 --- a/api/fragment/soft_update.php +++ b/api/fragment/soft_update.php @@ -89,7 +89,7 @@ switch ($table) { case 'companies': $collect([ - 'display_name' => 's', 'name_zh' => 's', 'name_en' => 's', 'business_role' => 's', + 'display_name' => 's', 'name_zh' => 's', 'business_role' => 's', 'country' => 's', 'registration_number' => 's', 'address' => 's', 'legal_form' => 's', 'legal_representative' => 's', 'business_scope' => 's', 'established_date' => 'd', 'registered_capital' => 's', 'industry' => 's', 'industry_subdivision' => 's', diff --git a/api/person/companies.php b/api/person/companies.php index 3a47f81..b52c5dc 100644 --- a/api/person/companies.php +++ b/api/person/companies.php @@ -45,7 +45,7 @@ $offset = ($page - 1) * $limit; $stmt = $pdo->prepare( "SELECT pwe.id AS work_id, pwe.company_id, CASE WHEN c.name_zh IS NOT NULL AND c.name_zh <> '' THEN c.name_zh - ELSE COALESCE(c.name_en, c.display_name) END AS company_name, + ELSE c.display_name END AS company_name, c.industry, pwe.department, pwe.position, pwe.job_level, pwe.start_date, pwe.end_date, pwe.is_current FROM person_work_experiences pwe diff --git a/api/person/company_options.php b/api/person/company_options.php index 7ddf956..033848f 100644 --- a/api/person/company_options.php +++ b/api/person/company_options.php @@ -18,13 +18,13 @@ $pdo = DB::getInstance()->getPdo(); $where = 'is_active = 1'; $params = []; if ($keyword !== '') { - $where .= ' AND (name_zh LIKE ? OR name_en LIKE ? OR display_name LIKE ?)'; + $where .= ' AND (name_zh LIKE ? OR display_name LIKE ?)'; $like = "%$keyword%"; array_push($params, $like, $like, $like); } $stmt = $pdo->prepare( - "SELECT id, COALESCE(NULLIF(display_name,''), name_zh, name_en) AS name + "SELECT id, COALESCE(NULLIF(display_name,''), name_zh) AS name FROM companies WHERE $where ORDER BY id ASC LIMIT $limit" ); $stmt->execute($params); diff --git a/api/person/products.php b/api/person/products.php index c8e84e7..70423e9 100644 --- a/api/person/products.php +++ b/api/person/products.php @@ -38,7 +38,7 @@ $offset = ($page - 1) * $limit; $stmt = $pdo->prepare( "SELECT DISTINCT cp.id, cp.category_name, cp.category_description, cp.is_core, cp.is_active, CASE WHEN c.name_zh IS NOT NULL AND c.name_zh <> '' THEN c.name_zh - ELSE COALESCE(c.name_en, c.display_name) END AS company_name + ELSE c.display_name END AS company_name $join ORDER BY company_name, cp.id DESC LIMIT $limit OFFSET $offset" diff --git a/sql/migration_v1.0.30.sql b/sql/migration_v1.0.30.sql new file mode 100644 index 0000000..2f83e1e --- /dev/null +++ b/sql/migration_v1.0.30.sql @@ -0,0 +1,8 @@ +-- ============================================================ +-- SuperLink Web - v1.0.30 数据库结构变更 +-- companies 表删除 name_en(英文名称)字段 +-- ============================================================ +SET NAMES utf8mb4; + +ALTER TABLE `companies` + DROP COLUMN `name_en`; diff --git a/static/js/company.js b/static/js/company.js index 41f6bc0..3370dca 100644 --- a/static/js/company.js +++ b/static/js/company.js @@ -31,7 +31,7 @@ $(function () { ' ' + '