- 包含4个产业方向的前端项目:智能开发、智能制造、大健康、财经商贸 - 已清理node_modules、.yoyo等大文件,项目大小从2.6GB优化至631MB - 配置完善的.gitignore文件 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
36 lines
1.2 KiB
JavaScript
36 lines
1.2 KiB
JavaScript
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
// 读取图片数据
|
|
const imagesDataPath = path.join(__dirname, '网页未导入数据/智能开发产业/智能开发_内推岗位企业图片.json');
|
|
const imagesData = JSON.parse(fs.readFileSync(imagesDataPath, 'utf-8'));
|
|
|
|
// 读取岗位数据
|
|
const jobsDataPath = path.join(__dirname, 'src/mocks/companyJobsData.json');
|
|
const jobsData = JSON.parse(fs.readFileSync(jobsDataPath, 'utf-8'));
|
|
|
|
// 创建图片映射
|
|
const imageMap = {};
|
|
imagesData.forEach(item => {
|
|
const position = item['内推岗位名称'];
|
|
const imageLinks = item['BOSS照片链接'];
|
|
if (imageLinks) {
|
|
// 将逗号分隔的链接转为数组
|
|
imageMap[position] = imageLinks.split(',').map(url => url.trim());
|
|
}
|
|
});
|
|
|
|
// 为岗位数据添加图片
|
|
jobsData.forEach(job => {
|
|
const position = job['内推岗位名称'];
|
|
if (imageMap[position]) {
|
|
job['公司图片'] = imageMap[position];
|
|
}
|
|
});
|
|
|
|
// 写回文件
|
|
fs.writeFileSync(jobsDataPath, JSON.stringify(jobsData, null, 2), 'utf-8');
|
|
|
|
console.log('成功添加公司图片数据!');
|
|
console.log(`共处理 ${jobsData.length} 个岗位,其中 ${Object.keys(imageMap).length} 个岗位有图片数据`);
|