0806
This commit is contained in:
+4
-4
@@ -34,18 +34,18 @@ if ((int)$chk->fetchColumn() > 0) {
|
||||
$pdo->prepare("INSERT INTO persons $sql")->execute($params);
|
||||
$newId = (int)$pdo->lastInsertId();
|
||||
|
||||
// 写入联系方式
|
||||
// 写入联系方式(v1.0.16:支持 is_defult 字段,1常用/0备用)
|
||||
$contacts = json_decode($_POST['contacts'] ?? '[]', true);
|
||||
if (is_array($contacts)) {
|
||||
$ins = $pdo->prepare(
|
||||
"INSERT INTO social_accounts (owner_type, owner_id, platform, account_id, profile_url, remark, is_primary)
|
||||
VALUES ('person', ?, ?, ?, ?, ?, ?)"
|
||||
"INSERT INTO social_accounts (owner_type, owner_id, platform, account_id, profile_url, remark, is_primary, is_defult)
|
||||
VALUES ('person', ?, ?, ?, ?, ?, ?, ?)"
|
||||
);
|
||||
foreach ($contacts as $c) {
|
||||
$platform = trim($c['platform'] ?? '');
|
||||
$accountId = trim($c['account_id'] ?? '');
|
||||
if ($platform === '' || $accountId === '') continue;
|
||||
$ins->execute([$newId, $platform, $accountId, $c['profile_url'] ?? null, $c['remark'] ?? null, !empty($c['is_primary']) ? 1 : 0]);
|
||||
$ins->execute([$newId, $platform, $accountId, $c['profile_url'] ?? null, $c['remark'] ?? null, !empty($c['is_primary']) ? 1 : 0, !empty($c['is_defult']) ? 1 : 0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user