26 lines
1.1 KiB
JavaScript
26 lines
1.1 KiB
JavaScript
|
|
import fs from 'fs';
|
||
|
|
|
||
|
|
// 读取环保课程日历数据
|
||
|
|
const dataPath = './网页未导入数据/环保产业/环保课程日历.json';
|
||
|
|
const data = JSON.parse(fs.readFileSync(dataPath, 'utf8'));
|
||
|
|
|
||
|
|
let updateCount = 0;
|
||
|
|
|
||
|
|
// 遍历所有记录,更新模拟面试的导师
|
||
|
|
data.forEach((item, index) => {
|
||
|
|
// 如果是模拟面试实战练习
|
||
|
|
if (item['模拟面试实战练习阶段'] && item['模拟面试实战练习阶段'].trim() !== '') {
|
||
|
|
item['导师姓名查询'] = '线下站点指导';
|
||
|
|
updateCount++;
|
||
|
|
console.log(`更新第 ${index + 1} 条记录: ${item['日期']} - ${item['模拟面试实战练习阶段']}`);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
// 写回文件
|
||
|
|
fs.writeFileSync(dataPath, JSON.stringify(data, null, 2), 'utf8');
|
||
|
|
console.log(`\n完成!共更新了 ${updateCount} 条模拟面试记录的导师名称为"线下站点指导老师"`);
|
||
|
|
|
||
|
|
// 同时更新到src/data目录
|
||
|
|
const srcDataPath = './src/data/intelligentManufacturingCalendar.json';
|
||
|
|
fs.writeFileSync(srcDataPath, JSON.stringify(data, null, 2), 'utf8');
|
||
|
|
console.log('已同步更新到 src/data/intelligentManufacturingCalendar.json');
|