v1.0.12: 企业/人员/媒体去删除入口;企业/人员加产品入口;企业详情去产品品类/关联联系人;编辑企业改Tab卡(工商信息/财务信息/资质认证)

This commit is contained in:
nanguaboss
2026-08-03 23:22:33 +08:00
parent 71c6e8d9c1
commit 96cba121a8
14 changed files with 644 additions and 83 deletions
+12 -4
View File
@@ -25,12 +25,20 @@ if ((int)$chk->fetchColumn() === 0) {
Response::error('人员不存在');
}
$where = ['pwe.person_id = ?', 'pwe.is_active = 1'];
$params = [$personId];
if (isset($_REQUEST['is_current']) && $_REQUEST['is_current'] !== '') {
$where[] = 'pwe.is_current = ?';
$params[] = (int)$_REQUEST['is_current'] ? 1 : 0;
}
$whereSql = implode(' AND ', $where);
$stmt = $pdo->prepare(
"SELECT COUNT(*) FROM person_work_experiences pwe
INNER JOIN companies c ON c.id = pwe.company_id
WHERE pwe.person_id = ? AND pwe.is_active = 1"
WHERE $whereSql"
);
$stmt->execute([$personId]);
$stmt->execute($params);
$total = (int)$stmt->fetchColumn();
$offset = ($page - 1) * $limit;
@@ -42,11 +50,11 @@ $stmt = $pdo->prepare(
pwe.start_date, pwe.end_date, pwe.is_current
FROM person_work_experiences pwe
INNER JOIN companies c ON c.id = pwe.company_id
WHERE pwe.person_id = ? AND pwe.is_active = 1
WHERE $whereSql
ORDER BY pwe.is_current DESC, pwe.start_date DESC
LIMIT $limit OFFSET $offset"
);
$stmt->execute([$personId]);
$stmt->execute($params);
$list = $stmt->fetchAll();
Response::success(['list' => $list, 'total' => $total, 'page' => $page, 'limit' => $limit]);
+48
View File
@@ -0,0 +1,48 @@
<?php
/**
* 人员相关产品品类列表接口 GET /api/person/products.php
* 入参:person_id(必填)/ page / limit
* 数据源:该人员任职公司的产品品类(去重)
*/
require_once __DIR__ . '/../common/db.php';
require_once __DIR__ . '/../common/response.php';
require_once __DIR__ . '/../common/auth.php';
checkPermission('person');
$personId = (int)($_REQUEST['person_id'] ?? 0);
if ($personId <= 0) {
Response::error('参数错误', 400);
}
[$page, $limit] = pageParams(5);
$pdo = DB::getInstance()->getPdo();
$chk = $pdo->prepare("SELECT COUNT(*) FROM persons WHERE id = ?");
$chk->execute([$personId]);
if ((int)$chk->fetchColumn() === 0) {
Response::error('人员不存在');
}
$join = "FROM person_work_experiences pwe
INNER JOIN company_products cp ON cp.company_id = pwe.company_id AND cp.is_active = 1
INNER JOIN companies c ON c.id = pwe.company_id
WHERE pwe.person_id = ? AND pwe.is_active = 1";
$stmt = $pdo->prepare("SELECT COUNT(DISTINCT cp.id) $join");
$stmt->execute([$personId]);
$total = (int)$stmt->fetchColumn();
$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
$join
ORDER BY company_name, cp.id DESC
LIMIT $limit OFFSET $offset"
);
$stmt->execute([$personId]);
Response::success(['list' => $stmt->fetchAll(), 'total' => $total, 'page' => $page, 'limit' => $limit]);