pref: 数据同步

This commit is contained in:
2025-07-14 14:30:59 +08:00
parent 3b737b0bd0
commit 2329b1bbe6

View File

@@ -930,7 +930,8 @@ class DataMigration extends Command
{ {
$videos = Db::connect('old') $videos = Db::connect('old')
->name('video') ->name('video')
->where('id', '>', 844) // ->where('id', '>', 844)
->where('cid', 'in', array_keys($category_map))
->where('country_code', 'in', ['ZH', 'US']) ->where('country_code', 'in', ['ZH', 'US'])
->order(['id' => 'asc']) ->order(['id' => 'asc'])
->cursor(); ->cursor();
@@ -970,7 +971,16 @@ class DataMigration extends Command
'seo_desc' => $val['seo_description'], 'seo_desc' => $val['seo_description'],
'deleted_at' => $val['stat'] == -1 ? date('Y-m-d H:i:s') : null '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']); $this->println('迁移视频ID' . $val['id']);
} }
} }