- 添加日历课程详情弹窗的点击跳转功能 - 公共课直播间和课程直播间支持URL参数自动选中课程 - 优化岗位详情页面样式,复用简洁卡片样式 - 为岗位详情标题添加图标 - 调整不同类型课程的跳转逻辑 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
101 lines
3.4 KiB
Python
101 lines
3.4 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
|
|
import json
|
|
from datetime import datetime
|
|
|
|
# 读取岗位等级数据
|
|
def load_job_levels():
|
|
with open('网页未导入数据/文旅产业/岗位等级.json', 'r', encoding='utf-8') as f:
|
|
data = json.load(f)
|
|
|
|
# 创建岗位名称到等级的映射
|
|
job_levels_map = {}
|
|
for item in data:
|
|
job_name = item['❌岗位名称']
|
|
level = item['前端查询名称']
|
|
job_levels_map[job_name] = level
|
|
|
|
return job_levels_map
|
|
|
|
# 读取当前的joblevel.json
|
|
def load_current_joblevel():
|
|
with open('src/data/joblevel.json', 'r', encoding='utf-8') as f:
|
|
return json.load(f)
|
|
|
|
# 重新整理joblevel.json
|
|
def reorganize_joblevel():
|
|
# 备份原文件
|
|
backup_path = f'src/data/joblevel.json.backup_{datetime.now().strftime("%Y%m%d_%H%M%S")}'
|
|
with open('src/data/joblevel.json', 'r', encoding='utf-8') as f:
|
|
original_data = json.load(f)
|
|
with open(backup_path, 'w', encoding='utf-8') as f:
|
|
json.dump(original_data, f, ensure_ascii=False, indent=4)
|
|
print(f"已备份: {backup_path}")
|
|
|
|
# 加载岗位等级映射
|
|
job_levels_map = load_job_levels()
|
|
|
|
# 收集所有岗位信息
|
|
all_positions = []
|
|
for level_key, level_data in original_data['data'].items():
|
|
for position in level_data['list']:
|
|
all_positions.append(position)
|
|
|
|
# 按新的等级重新分组
|
|
new_data = {
|
|
"code": 200,
|
|
"message": "操作成功",
|
|
"data": {
|
|
"high": {
|
|
"name": "储备干部岗",
|
|
"list": []
|
|
},
|
|
"middle": {
|
|
"name": "技术骨干岗",
|
|
"list": []
|
|
},
|
|
"ordinary": {
|
|
"name": "普通岗",
|
|
"list": []
|
|
}
|
|
}
|
|
}
|
|
|
|
# 分配岗位到正确的等级
|
|
unmatched_positions = []
|
|
for position in all_positions:
|
|
position_name = position['position_name']
|
|
if position_name in job_levels_map:
|
|
level = job_levels_map[position_name]
|
|
if level == "储备干部岗":
|
|
new_data['data']['high']['list'].append(position)
|
|
elif level == "技术骨干岗":
|
|
new_data['data']['middle']['list'].append(position)
|
|
elif level == "普通岗":
|
|
new_data['data']['ordinary']['list'].append(position)
|
|
print(f"分配: {position_name} -> {level}")
|
|
else:
|
|
# 对于未匹配的岗位,保持原有等级或默认为普通岗
|
|
unmatched_positions.append(position)
|
|
print(f"未找到匹配: {position_name}")
|
|
|
|
# 将未匹配的岗位添加到普通岗
|
|
for position in unmatched_positions:
|
|
new_data['data']['ordinary']['list'].append(position)
|
|
print(f"默认分配到普通岗: {position['position_name']}")
|
|
|
|
# 写回文件
|
|
with open('src/data/joblevel.json', 'w', encoding='utf-8') as f:
|
|
json.dump(new_data, f, ensure_ascii=False, indent=4)
|
|
|
|
# 统计结果
|
|
print("\n" + "=" * 50)
|
|
print("重新整理完成!")
|
|
print(f"储备干部岗: {len(new_data['data']['high']['list'])} 个岗位")
|
|
print(f"技术骨干岗: {len(new_data['data']['middle']['list'])} 个岗位")
|
|
print(f"普通岗: {len(new_data['data']['ordinary']['list'])} 个岗位")
|
|
print("=" * 50)
|
|
|
|
if __name__ == "__main__":
|
|
reorganize_joblevel() |