v1.0.12: 企业/人员/媒体去删除入口;企业/人员加产品入口;企业详情去产品品类/关联联系人;编辑企业改Tab卡(工商信息/财务信息/资质认证)
This commit is contained in:
@@ -26,5 +26,32 @@ $pdo = DB::getInstance()->getPdo();
|
||||
$pdo->prepare("INSERT INTO companies $sql")->execute($params);
|
||||
$newId = (int)$pdo->lastInsertId();
|
||||
|
||||
// 财务信息 / 资质认证(可选,整表替换)
|
||||
if (array_key_exists('financials', $_POST) || array_key_exists('certifications', $_POST)) {
|
||||
$pdo->beginTransaction();
|
||||
try {
|
||||
if (array_key_exists('financials', $_POST)) {
|
||||
$financials = json_decode($_POST['financials'], true);
|
||||
if (!is_array($financials)) {
|
||||
$pdo->rollBack();
|
||||
Response::error('财务信息格式错误', 400);
|
||||
}
|
||||
saveCompanyFinancials($pdo, $newId, $financials);
|
||||
}
|
||||
if (array_key_exists('certifications', $_POST)) {
|
||||
$certs = json_decode($_POST['certifications'], true);
|
||||
if (!is_array($certs)) {
|
||||
$pdo->rollBack();
|
||||
Response::error('资质认证格式错误', 400);
|
||||
}
|
||||
saveCompanyCertifications($pdo, $newId, $certs);
|
||||
}
|
||||
$pdo->commit();
|
||||
} catch (Exception $e) {
|
||||
$pdo->rollBack();
|
||||
Response::error('关联信息保存失败:' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
logCurrent('add', 'company', 'companies', $newId, $data);
|
||||
Response::success(['id' => $newId], '新增成功');
|
||||
|
||||
Reference in New Issue
Block a user