Files
jiaowu-test/final_update_resumes.py
KQL 1b964b3886 chore: 更新数据文件和组件优化
主要更新内容:
- 优化UI组件(视频播放器、HR访问模态框、岗位信息展示等)
- 更新数据文件(简历、岗位、项目案例等)
- 添加新的图片资源(面试状态图标等)
- 新增AgentPage等页面组件
- 清理旧的备份文件,提升代码库整洁度
- 优化岗位等级和面试状态的数据结构

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-15 15:55:25 +08:00

128 lines
5.5 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
import re
# 读取清理后的数据
with open('resume_updates_cleaned.json', 'r', encoding='utf-8') as f:
updates = json.load(f)
# 读取resumeInterviewMock.js
with open('src/mocks/resumeInterviewMock.js', 'r', encoding='utf-8') as f:
content = f.read()
print("开始批量更新简历数据...")
# 1. 首先添加露营地运营行业(如果不存在)
if '"露营地运营":' not in content:
print("\n1. 添加露营地运营行业...")
# 在宠物店经营后面添加
insert_pattern = r'("宠物店经营":\s*\[[^\]]*\])'
replacement = r'\1,\n "露营地运营": []'
content = re.sub(insert_pattern, replacement, content)
print(" ✓ 露营地运营行业已添加")
# 2. 为露营地运营专员添加完整数据
print("\n2. 添加露营地运营专员数据...")
luyingdi_data = next((u for u in updates if u['position'] == '露营地运营专员'), None)
if luyingdi_data:
# 构建完整的岗位数据
luyingdi_entry = f''' {{
position: "露营地运营专员",
level: "普通岗",
content: {{
original: "露营地运营专员简历内容",
modified: "露营地运营专员简历内容"
}},
studentInfo: {{
project_experience: {{
project_name: "{luyingdi_data['studentInfo']['project_experience']['project_name']}",
position: "{luyingdi_data['studentInfo']['project_experience']['position']}",
time_period: "{luyingdi_data['studentInfo']['project_experience']['time_period']}",
company: "{luyingdi_data['studentInfo']['project_experience']['company']}",
description: `{luyingdi_data['studentInfo']['project_experience']['description']}`
}},
core_skills: {json.dumps(luyingdi_data['studentInfo']['core_skills'], ensure_ascii=False, indent=10)},
compound_skills: {json.dumps(luyingdi_data['studentInfo']['compound_skills'], ensure_ascii=False, indent=10)},
personal_summary: "{luyingdi_data['studentInfo']['personal_summary']}"
}}
}}'''
# 在露营地运营数组中添加数据
pattern = r'("露营地运营":\s*\[)(\s*\])'
replacement = rf'\1\n{luyingdi_entry}\n \2'
content = re.sub(pattern, replacement, content)
print(" ✓ 露营地运营专员数据已添加")
# 3. 更新其他岗位的studentInfo
positions_to_update = [
('文创产品设计师', '文旅产品设计'),
('文创产品策划师', '文旅产品设计'),
('文创产品设计师助理', '文旅产品设计'),
('品牌策划运营专员', '品牌运营'),
('品牌公关', '品牌运营'),
('品牌推广专员', '品牌运营'),
('ip运营', '品牌运营'),
('ip运营总监助理', '品牌运营'),
('品牌公关管培生', '品牌运营')
]
print("\n3. 更新其他岗位的studentInfo...")
for position, industry in positions_to_update:
update_data = next((u for u in updates if u['position'] == position), None)
if not update_data:
print(f" ⚠ 未找到{position}的更新数据")
continue
# 构建studentInfo
student_info = f'''{{
project_experience: {{
project_name: "{update_data['studentInfo']['project_experience']['project_name']}",
position: "{update_data['studentInfo']['project_experience']['position']}",
time_period: "{update_data['studentInfo']['project_experience']['time_period']}",
company: "{update_data['studentInfo']['project_experience']['company']}",
description: `{update_data['studentInfo']['project_experience']['description']}`
}},
core_skills: {json.dumps(update_data['studentInfo']['core_skills'], ensure_ascii=False, indent=10)},
compound_skills: {json.dumps(update_data['studentInfo']['compound_skills'], ensure_ascii=False, indent=10)},
personal_summary: "{update_data['studentInfo']['personal_summary']}"
}}'''
# 查找并替换studentInfo: null或缺失的studentInfo
# 查找该岗位的位置
position_pattern = f'position: "{position}"'
pos = content.find(position_pattern)
if pos != -1:
# 找到该岗位结束的位置(下一个岗位或数组结束)
next_pos = content.find('position:', pos + len(position_pattern))
if next_pos == -1:
# 可能是最后一个岗位,找数组结束
next_pos = content.find(']', pos)
# 获取这段内容
section = content[pos:next_pos]
# 检查是否有studentInfo: null
if 'studentInfo: null' in section:
# 替换studentInfo: null
pattern = rf'(position: "{position}".*?studentInfo:\s*)null'
replacement = rf'\1{student_info}'
content = re.sub(pattern, replacement, content, flags=re.DOTALL)
print(f"{position} studentInfo已更新")
elif 'studentInfo:' not in section:
# 没有studentInfo需要添加
# 在content后面添加
pattern = rf'(position: "{position}".*?content:\s*{{[^}}]*}})(\s*}})'
replacement = rf'\1,\n studentInfo: {student_info}\2'
content = re.sub(pattern, replacement, content, flags=re.DOTALL)
print(f"{position} studentInfo已添加")
else:
print(f" {position} 已有studentInfo")
# 保存更新后的文件
with open('src/mocks/resumeInterviewMock.js', 'w', encoding='utf-8') as f:
f.write(content)
print("\n✓ 所有更新已完成!")