0806
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* 媒体数据 CSV 导入接口 POST /api/media/import.php (multipart/form-data, 字段名 file)
|
||||
* CSV 表头:owner_type,owner_id,platform,account_id,profile_url,remark,is_primary,
|
||||
* CSV 表头:owner_type,owner_id,platform,account_id,profile_url,remark,is_primary,is_defult,
|
||||
* account_level,content_categories,follower_count,avg_read_count,certification_type
|
||||
* owner_type 为 person/company 时 owner_id 也可填对应名称(display_name/full_name),自动解析为ID。
|
||||
*/
|
||||
@@ -26,8 +26,8 @@ $header = str_getcsv(trim($first));
|
||||
|
||||
$pdo = DB::getInstance()->getPdo();
|
||||
$insAccount = $pdo->prepare(
|
||||
"INSERT INTO social_accounts (owner_type, owner_id, platform, account_id, profile_url, remark, is_primary, is_active)
|
||||
VALUES (?,?,?,?,?,?,?,1)"
|
||||
"INSERT INTO social_accounts (owner_type, owner_id, platform, account_id, profile_url, remark, is_primary, is_defult, is_active)
|
||||
VALUES (?,?,?,?,?,?,?,?,1)"
|
||||
);
|
||||
$insAttr = $pdo->prepare(
|
||||
"INSERT INTO media_commercial_attributes
|
||||
@@ -75,6 +75,7 @@ while (($row = fgetcsv($handle)) !== false) {
|
||||
$insAccount->execute([
|
||||
$ownerType, $ownerId, $rec['platform'], $rec['account_id'],
|
||||
$rec['profile_url'] ?? null, $rec['remark'] ?? null, !empty($rec['is_primary']) ? 1 : 0,
|
||||
!empty($rec['is_defult']) ? 1 : 0,
|
||||
]);
|
||||
$newId = (int)$pdo->lastInsertId();
|
||||
if (!empty($rec['account_level']) || !empty($rec['certification_type'])) {
|
||||
|
||||
Reference in New Issue
Block a user