first commit

This commit is contained in:
2026-04-11 11:51:54 +08:00
commit b12a84e388
99 changed files with 19620 additions and 0 deletions

21
backend/backfill-ai.ts Normal file
View File

@@ -0,0 +1,21 @@
import * as dotenv from 'dotenv';
dotenv.config();
import pool from './src/config/database';
async function run() {
const [results] = await pool.query<any[]>('SELECT ai_id, perf_id, ai_score_json FROM ai_result');
for (const row of results) {
const items = JSON.parse(row.ai_score_json);
for (const item of items) {
await pool.query(
'UPDATE perf_item SET ai_score = ?, ai_explanation = ? WHERE perf_id = ? AND item_name = ?',
[item.aiScore, item.scoreExplanation, row.perf_id, item.itemName]
);
}
console.log(`回写 perfId=${row.perf_id},共 ${items.length}`);
}
await pool.end();
console.log('完成');
}
run().catch(console.error);