refactor(i18n): 全工程面向国际用户与全球现代商务重构,彻底清理出海跨境等单向视角表达并对齐自动化测试
这个提交包含在:
40
backend/database/apply-seed.js
普通文件
40
backend/database/apply-seed.js
普通文件
@@ -0,0 +1,40 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const mysql = require('mysql2/promise');
|
||||
|
||||
async function run() {
|
||||
const sqlPath = path.join(__dirname, 'seed_cards.sql');
|
||||
const sqlContent = fs.readFileSync(sqlPath, 'utf8');
|
||||
|
||||
const connection = await mysql.createConnection({
|
||||
host: '127.0.0.1',
|
||||
port: 3306,
|
||||
user: 'root',
|
||||
password: '123456',
|
||||
database: 'crmmpdata',
|
||||
multipleStatements: true,
|
||||
charset: 'utf8mb4',
|
||||
});
|
||||
|
||||
try {
|
||||
console.log('[Seed] 正在导入多媒体名片数据 (UTF-8)...');
|
||||
await connection.query(sqlContent);
|
||||
console.log('[Seed] 5 张高保真多媒体名片数据导入成功!');
|
||||
|
||||
// 打印验证统计
|
||||
const [cards] = await connection.query('SELECT id, slug, name, company FROM card_info WHERE id >= 1001');
|
||||
console.log(`[Seed] 成功验证 ${cards.length} 张名片:`);
|
||||
cards.forEach(c => console.log(` - [${c.id}] ${c.name} (${c.company}) -> /${c.slug}`));
|
||||
|
||||
const [videos] = await connection.query("SELECT id, card_id, title FROM card_bento WHERE type = 'video'");
|
||||
console.log(`[Seed] 成功验证 ${videos.length} 个视频 Bento 块:`);
|
||||
videos.forEach(v => console.log(` - [Bento #${v.id}] (名片 #${v.card_id}): ${v.title}`));
|
||||
} catch (err) {
|
||||
console.error('[Seed Error]', err);
|
||||
process.exit(1);
|
||||
} finally {
|
||||
await connection.end();
|
||||
}
|
||||
}
|
||||
|
||||
run();
|
||||
在新工单中引用
屏蔽一个用户