From 988bdde6f1716eff616b3020c9c6067410a68e18 Mon Sep 17 00:00:00 2001 From: jsasg <735273025@qq.com> Date: Mon, 14 Jul 2025 14:30:59 +0800 Subject: [PATCH] =?UTF-8?q?pref:=20=E6=95=B0=E6=8D=AE=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/command/DataMigration.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/command/DataMigration.php b/app/command/DataMigration.php index e506ef9a..06e237f0 100644 --- a/app/command/DataMigration.php +++ b/app/command/DataMigration.php @@ -930,7 +930,8 @@ class DataMigration extends Command { $videos = Db::connect('old') ->name('video') - ->where('id', '>', 844) + // ->where('id', '>', 844) + ->where('cid', 'in', array_keys($category_map)) ->where('country_code', 'in', ['ZH', 'US']) ->order(['id' => 'asc']) ->cursor(); @@ -970,7 +971,16 @@ class DataMigration extends Command 'seo_desc' => $val['seo_description'], 'deleted_at' => $val['stat'] == -1 ? date('Y-m-d H:i:s') : null ]; - Db::name('video')->insert($item); + $ret = Db::name('video') + ->where('language_id', '=', $item['language_id']) + ->where('name', '=', $item['name']) + ->find(); + if (empty($ret)) { + Db::name('video')->insert($item); + } else { + Db::name('video')->where('id', '=', $ret['id'])->update($item); + } + $this->println('迁移视频ID:' . $val['id']); } }