275 lines
10 KiB
JavaScript
275 lines
10 KiB
JavaScript
|
|
const mysql = require('mysql2/promise');
|
|||
|
|
|
|||
|
|
const dbConfig = {
|
|||
|
|
host: 'gz-cynosdbmysql-grp-d26pzce5.sql.tencentcdb.com',
|
|||
|
|
port: 24936,
|
|||
|
|
user: 'root',
|
|||
|
|
password: '!Rjb12191',
|
|||
|
|
database: 'pronode_db',
|
|||
|
|
charset: 'utf8mb4'
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
// Android高级工程师面试题大纲生成模板
|
|||
|
|
const androidInterviewTemplate = {
|
|||
|
|
id: `template_${Date.now()}_android_interview`,
|
|||
|
|
title: 'Android高级工程师面试题大纲生成器',
|
|||
|
|
description: '专业的Android高级工程师面试题大纲生成模板,涵盖技术深度、架构设计、性能优化等核心领域,帮助面试官制定全面的技术面试方案',
|
|||
|
|
category: 'programming',
|
|||
|
|
role: '你是一位资深的Android技术专家和面试官,拥有丰富的Android开发经验和面试经验,熟悉Android生态系统的各个技术栈和最佳实践',
|
|||
|
|
task: '根据候选人的背景和职位要求,生成全面的Android高级工程师面试题大纲,包括技术深度、架构设计、性能优化、团队协作等多个维度的考察内容',
|
|||
|
|
context: '需要为Android高级工程师职位制定技术面试方案,确保能够全面评估候选人的技术能力、架构思维、问题解决能力和团队协作能力',
|
|||
|
|
constraints: JSON.stringify([
|
|||
|
|
'题目必须具有技术深度和挑战性',
|
|||
|
|
'涵盖Android核心技术栈',
|
|||
|
|
'包含架构设计和性能优化',
|
|||
|
|
'考虑实际工作场景',
|
|||
|
|
'题目难度递进,从基础到高级',
|
|||
|
|
'包含代码实现和理论分析',
|
|||
|
|
'考察候选人的思维过程和解决问题的方法'
|
|||
|
|
]),
|
|||
|
|
variables: JSON.stringify([
|
|||
|
|
{
|
|||
|
|
name: 'candidateLevel',
|
|||
|
|
type: 'string',
|
|||
|
|
description: '候选人级别(高级/资深/专家)',
|
|||
|
|
options: ['高级工程师', '资深工程师', '技术专家', '架构师']
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
name: 'experience',
|
|||
|
|
type: 'string',
|
|||
|
|
description: '候选人工作年限',
|
|||
|
|
options: ['3-5年', '5-8年', '8年以上']
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
name: 'focusAreas',
|
|||
|
|
type: 'array',
|
|||
|
|
description: '重点考察领域',
|
|||
|
|
options: ['架构设计', '性能优化', '内存管理', '多线程', '网络编程', 'UI/UX', '安全', '测试']
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
name: 'companyType',
|
|||
|
|
type: 'string',
|
|||
|
|
description: '公司类型',
|
|||
|
|
options: ['互联网大厂', '创业公司', '传统企业', '金融科技', '游戏公司']
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
name: 'teamSize',
|
|||
|
|
type: 'string',
|
|||
|
|
description: '团队规模',
|
|||
|
|
options: ['小团队(5-10人)', '中型团队(10-30人)', '大团队(30人以上)']
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
name: 'interviewDuration',
|
|||
|
|
type: 'string',
|
|||
|
|
description: '面试时长',
|
|||
|
|
options: ['60分钟', '90分钟', '120分钟']
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
name: 'technicalStack',
|
|||
|
|
type: 'array',
|
|||
|
|
description: '技术栈重点',
|
|||
|
|
options: ['Kotlin', 'Java', 'Jetpack Compose', 'MVVM', 'MVP', 'Clean Architecture', 'RxJava', 'Coroutines', 'Dagger/Hilt', 'Retrofit', 'Room']
|
|||
|
|
}
|
|||
|
|
]),
|
|||
|
|
outputFormat: 'Markdown格式的完整面试题大纲,包含技术基础、架构设计、性能优化、高级技术和问题解决能力五个模块,每个模块包含具体的面试题目和评分标准',
|
|||
|
|
examples: JSON.stringify([
|
|||
|
|
{
|
|||
|
|
title: 'Android高级工程师面试题大纲示例',
|
|||
|
|
description: '基于候选人背景生成的完整面试题大纲',
|
|||
|
|
input: {
|
|||
|
|
candidateLevel: '高级工程师',
|
|||
|
|
experience: '5-8年',
|
|||
|
|
focusAreas: ['架构设计', '性能优化', '内存管理'],
|
|||
|
|
companyType: '互联网大厂',
|
|||
|
|
teamSize: '中型团队(10-30人)',
|
|||
|
|
interviewDuration: '90分钟',
|
|||
|
|
technicalStack: ['Kotlin', 'MVVM', 'Jetpack Compose', 'Coroutines']
|
|||
|
|
},
|
|||
|
|
output: `# Android高级工程师面试题大纲
|
|||
|
|
|
|||
|
|
## 候选人信息
|
|||
|
|
- **级别**: 高级工程师
|
|||
|
|
- **经验**: 5-8年
|
|||
|
|
- **重点领域**: 架构设计、性能优化、内存管理
|
|||
|
|
- **公司类型**: 互联网大厂
|
|||
|
|
|
|||
|
|
## 面试结构 (90分钟)
|
|||
|
|
|
|||
|
|
### 1. 技术基础考察 (20分钟)
|
|||
|
|
#### 1.1 Android核心概念
|
|||
|
|
- [ ] 题目1: Android四大组件生命周期深度解析
|
|||
|
|
- [ ] 题目2: Activity启动模式及应用场景
|
|||
|
|
- [ ] 题目3: Fragment生命周期与Activity的交互
|
|||
|
|
|
|||
|
|
#### 1.2 内存管理
|
|||
|
|
- [ ] 题目4: Android内存管理机制
|
|||
|
|
- [ ] 题目5: 内存泄漏检测与优化
|
|||
|
|
- [ ] 题目6: OOM问题分析与解决
|
|||
|
|
|
|||
|
|
### 2. 架构设计能力 (30分钟)
|
|||
|
|
#### 2.1 架构模式
|
|||
|
|
- [ ] 题目7: MVVM vs MVP vs MVC对比分析
|
|||
|
|
- [ ] 题目8: Clean Architecture在Android中的应用
|
|||
|
|
- [ ] 题目9: 组件化架构设计与实现
|
|||
|
|
|
|||
|
|
#### 2.2 设计模式
|
|||
|
|
- [ ] 题目10: 常用设计模式在Android中的应用
|
|||
|
|
- [ ] 题目11: 依赖注入框架选择与使用
|
|||
|
|
- [ ] 题目12: 观察者模式的实现与应用
|
|||
|
|
|
|||
|
|
### 3. 性能优化 (25分钟)
|
|||
|
|
#### 3.1 启动优化
|
|||
|
|
- [ ] 题目13: App启动流程分析与优化
|
|||
|
|
- [ ] 题目14: 冷启动、温启动、热启动优化策略
|
|||
|
|
- [ ] 题目15: 启动时间监控与测量
|
|||
|
|
|
|||
|
|
#### 3.2 运行时优化
|
|||
|
|
- [ ] 题目16: UI渲染性能优化
|
|||
|
|
- [ ] 题目17: 网络请求优化策略
|
|||
|
|
- [ ] 题目18: 电池优化与后台任务管理
|
|||
|
|
|
|||
|
|
### 4. 高级技术 (20分钟)
|
|||
|
|
#### 4.1 多线程与异步
|
|||
|
|
- [ ] 题目19: Handler机制深度解析
|
|||
|
|
- [ ] 题目20: RxJava vs Coroutines对比
|
|||
|
|
- [ ] 题目21: 线程池设计与使用
|
|||
|
|
|
|||
|
|
#### 4.2 新技术应用
|
|||
|
|
- [ ] 题目22: Jetpack Compose使用经验
|
|||
|
|
- [ ] 题目23: Kotlin协程高级应用
|
|||
|
|
- [ ] 题目24: Android新特性应用
|
|||
|
|
|
|||
|
|
### 5. 问题解决能力 (15分钟)
|
|||
|
|
#### 5.1 实际场景
|
|||
|
|
- [ ] 题目25: 复杂业务逻辑架构设计
|
|||
|
|
- [ ] 题目26: 性能问题排查与解决
|
|||
|
|
- [ ] 题目27: 团队技术选型决策
|
|||
|
|
|
|||
|
|
## 评分标准
|
|||
|
|
- **技术深度** (30%): 对Android技术的理解深度
|
|||
|
|
- **架构思维** (25%): 系统设计和架构能力
|
|||
|
|
- **问题解决** (20%): 分析和解决复杂问题的能力
|
|||
|
|
- **代码质量** (15%): 代码规范和最佳实践
|
|||
|
|
- **学习能力** (10%): 对新技术的接受和学习能力
|
|||
|
|
|
|||
|
|
## 面试建议
|
|||
|
|
1. 根据候选人回答深度调整后续问题难度
|
|||
|
|
2. 关注候选人的思维过程和解决问题的方法
|
|||
|
|
3. 结合实际项目经验进行深入讨论
|
|||
|
|
4. 评估候选人的技术视野和学习能力
|
|||
|
|
|
|||
|
|
## 后续评估
|
|||
|
|
- [ ] 技术能力评估
|
|||
|
|
- [ ] 团队协作能力
|
|||
|
|
- [ ] 学习成长潜力
|
|||
|
|
- [ ] 文化匹配度`
|
|||
|
|
}
|
|||
|
|
]),
|
|||
|
|
user_id: 'user_001',
|
|||
|
|
is_public: true,
|
|||
|
|
likes: 0,
|
|||
|
|
downloads: 0,
|
|||
|
|
created_at: new Date().toISOString().slice(0, 19).replace('T', ' '),
|
|||
|
|
updated_at: new Date().toISOString().slice(0, 19).replace('T', ' ')
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
async function createAndroidInterviewTemplate() {
|
|||
|
|
let connection;
|
|||
|
|
|
|||
|
|
try {
|
|||
|
|
console.log('🔗 连接到数据库...');
|
|||
|
|
connection = await mysql.createConnection(dbConfig);
|
|||
|
|
|
|||
|
|
console.log('✅ 数据库连接成功');
|
|||
|
|
|
|||
|
|
// 检查表是否存在
|
|||
|
|
const [tables] = await connection.execute('SHOW TABLES LIKE "promptforge_templates"');
|
|||
|
|
if (tables.length === 0) {
|
|||
|
|
console.log('❌ promptforge_templates 表不存在,请先创建表');
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
console.log('📝 开始插入Android面试题模板...');
|
|||
|
|
|
|||
|
|
try {
|
|||
|
|
await connection.execute(
|
|||
|
|
`INSERT INTO promptforge_templates (
|
|||
|
|
id, title, description, category, role, task, context,
|
|||
|
|
constraints, variables, outputFormat, examples, authorId, isPublic,
|
|||
|
|
usageCount, rating, createdAt, updatedAt
|
|||
|
|
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|||
|
|
[
|
|||
|
|
androidInterviewTemplate.id,
|
|||
|
|
androidInterviewTemplate.title,
|
|||
|
|
androidInterviewTemplate.description,
|
|||
|
|
androidInterviewTemplate.category,
|
|||
|
|
androidInterviewTemplate.role,
|
|||
|
|
androidInterviewTemplate.task,
|
|||
|
|
androidInterviewTemplate.context,
|
|||
|
|
androidInterviewTemplate.constraints,
|
|||
|
|
androidInterviewTemplate.variables,
|
|||
|
|
androidInterviewTemplate.outputFormat,
|
|||
|
|
androidInterviewTemplate.examples,
|
|||
|
|
androidInterviewTemplate.user_id,
|
|||
|
|
androidInterviewTemplate.is_public,
|
|||
|
|
androidInterviewTemplate.downloads,
|
|||
|
|
androidInterviewTemplate.likes > 0 ? (androidInterviewTemplate.likes / 100).toFixed(2) : 0,
|
|||
|
|
androidInterviewTemplate.created_at,
|
|||
|
|
androidInterviewTemplate.updated_at
|
|||
|
|
]
|
|||
|
|
);
|
|||
|
|
console.log(`✅ 成功插入Android面试题模板: ${androidInterviewTemplate.title}`);
|
|||
|
|
console.log(`📋 模板ID: ${androidInterviewTemplate.id}`);
|
|||
|
|
} catch (error) {
|
|||
|
|
if (error.code === 'ER_DUP_ENTRY') {
|
|||
|
|
console.log(`⚠️ 模板已存在: ${androidInterviewTemplate.title}`);
|
|||
|
|
} else {
|
|||
|
|
console.error(`❌ 插入模板失败: ${androidInterviewTemplate.title}`, error.message);
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
console.log('🎉 Android面试题模板创建完成!');
|
|||
|
|
|
|||
|
|
// 验证插入的数据
|
|||
|
|
const [rows] = await connection.execute('SELECT COUNT(*) as count FROM promptforge_templates WHERE category = "programming"');
|
|||
|
|
console.log(`📊 数据库中编程类模板共有 ${rows[0].count} 个`);
|
|||
|
|
|
|||
|
|
// 显示新创建的模板信息
|
|||
|
|
const [templateInfo] = await connection.execute('SELECT id, title, category, createdAt FROM promptforge_templates WHERE id = ?', [androidInterviewTemplate.id]);
|
|||
|
|
if (templateInfo.length > 0) {
|
|||
|
|
console.log('📋 新模板信息:');
|
|||
|
|
console.log(` ID: ${templateInfo[0].id}`);
|
|||
|
|
console.log(` 标题: ${templateInfo[0].title}`);
|
|||
|
|
console.log(` 分类: ${templateInfo[0].category}`);
|
|||
|
|
console.log(` 创建时间: ${templateInfo[0].createdAt}`);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
|
|||
|
|
} catch (error) {
|
|||
|
|
console.error('❌ 操作失败:', error.message);
|
|||
|
|
return false;
|
|||
|
|
} finally {
|
|||
|
|
if (connection) {
|
|||
|
|
await connection.end();
|
|||
|
|
console.log('🔌 数据库连接已关闭');
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 运行脚本
|
|||
|
|
createAndroidInterviewTemplate().then(success => {
|
|||
|
|
if (success) {
|
|||
|
|
console.log('🎯 Android面试题模板创建成功!');
|
|||
|
|
console.log('💡 模板功能:');
|
|||
|
|
console.log(' - 生成全面的Android高级工程师面试题大纲');
|
|||
|
|
console.log(' - 涵盖技术基础、架构设计、性能优化等核心领域');
|
|||
|
|
console.log(' - 支持自定义候选人级别、经验、重点考察领域等参数');
|
|||
|
|
console.log(' - 提供详细的评分标准和面试建议');
|
|||
|
|
} else {
|
|||
|
|
console.log('💥 Android面试题模板创建失败!');
|
|||
|
|
}
|
|||
|
|
process.exit(success ? 0 : 1);
|
|||
|
|
});
|