feat: 品牌更新 + 每日一题公开随机 + 面试计时器修复 + 反馈功能 + 营销文案
- 品牌名统一:职引 → 宇之然AI磁场,SEO 双名策略保留搜索关键词 - 每日一题:放开未登录访问,后端改用 \ 随机取题,灌入 23 题覆盖 8 个岗位 - 面试计时器:timerSeconds 改为 ref 修复 UI 不更新,完成自动停止,增加轮次提示 - 反馈功能:FeedbackModule 前后端完整实现 + admin 面板 + Playwright 测试 - 管理后台:所有列表分页改为 limit=10 + 加载更多按钮 - 录音 UX:修复异步竞态 + 点击开始/停止 + 空语音友好提示 + 发送按钮录音中禁用 - 营销文案:三端平台(公众号/知乎/小红书)推广方案 + 可复制 HTML 文件
This commit is contained in:
@@ -1,40 +1,37 @@
|
||||
import { Controller, Get, Param, Query, UseGuards } from '@nestjs/common'
|
||||
import { Controller, Get, Param, Query } from '@nestjs/common'
|
||||
import { InjectModel } from '@nestjs/mongoose'
|
||||
import { Model } from 'mongoose'
|
||||
import { JwtAuthGuard } from '../../common/guards/jwt-auth.guard'
|
||||
import { Public } from '../../common/decorators/public.decorator'
|
||||
import { DailyQuestion, DailyQuestionDocument } from '../schemas/daily-question.schema'
|
||||
|
||||
@Controller('daily-question')
|
||||
@UseGuards(JwtAuthGuard)
|
||||
export class DailyQuestionController {
|
||||
constructor(
|
||||
@InjectModel(DailyQuestion.name) private dailyQuestionModel: Model<DailyQuestionDocument>,
|
||||
) {}
|
||||
|
||||
@Get()
|
||||
async getToday(@Query('position') position?: string) {
|
||||
const filter: any = {}
|
||||
if (position) filter.position = position
|
||||
@Public()
|
||||
async getRandom(@Query('position') position?: string) {
|
||||
const pipeline: any[] = []
|
||||
if (position) pipeline.push({ $match: { position } })
|
||||
pipeline.push({ $sample: { size: 1 } })
|
||||
|
||||
const question = await this.dailyQuestionModel
|
||||
.findOne(filter)
|
||||
.sort({ date: -1 })
|
||||
.exec()
|
||||
const results = await this.dailyQuestionModel.aggregate(pipeline).exec()
|
||||
if (results.length > 0) return results[0]
|
||||
|
||||
if (!question) {
|
||||
// Return a default question if no specific one found
|
||||
const defaultQ = await this.dailyQuestionModel.findOne().sort({ date: -1 }).exec()
|
||||
if (defaultQ) return defaultQ
|
||||
|
||||
return {
|
||||
position: '通用',
|
||||
question: '请做一个简单的自我介绍,突出你的核心优势和职业目标。',
|
||||
referenceAnswer: '建议结构:1) 基本信息 2) 教育背景与专业 3) 实习/项目经历中的亮点 4) 为什么选择这个岗位 5) 职业目标。控制在1-2分钟内。',
|
||||
category: 'behavioral',
|
||||
}
|
||||
// Fallback: try without position filter
|
||||
if (position) {
|
||||
const fallback = await this.dailyQuestionModel.aggregate([{ $sample: { size: 1 } }]).exec()
|
||||
if (fallback.length > 0) return fallback[0]
|
||||
}
|
||||
|
||||
return question
|
||||
return {
|
||||
position: '通用',
|
||||
question: '请做一个简单的自我介绍,突出你的核心优势和职业目标。',
|
||||
referenceAnswer: '建议结构:1) 基本信息 2) 教育背景与专业 3) 实习/项目经历中的亮点 4) 为什么选择这个岗位 5) 职业目标。控制在1-2分钟内。',
|
||||
category: 'behavioral',
|
||||
}
|
||||
}
|
||||
|
||||
@Get('position/:position')
|
||||
|
||||
Reference in New Issue
Block a user