v4.2 冲刺版+每日推送+支付修复+全量代码评审
## 新增功能 - 冲刺版 ¥49.9/月:完整支付→激活→权益扣减链路 - 每日一题定时推送(@nestjs/schedule,早8点微信订阅消息) - miniprogram-ci 编译上传脚本(scripts/upload-mp.js) ## Bug修复 - 套餐值统一:vip→growth/sprint(interview轮次限制、analyze次数检查) - member/pay 移除开发绕过:改为订单校验后激活 - progress→report 参数名不匹配:id→interviewId - result.vue resume.create() 参数传错(对象→独立参数) - resume.vue analyze请求缺少Authorization header - bank.vue contribution请求缺少Authorization header - member.vue startPay() 缺少try/catch导致网络错误崩溃 - login.vue 调试面板 v-if="true" 生产泄漏 ## 配置 - 微信支付生产证书就位(商户号1113760598) - .env 清理冗余文件(删除.example/.production) - WX_NOTIFY_URL 更新为 zhiyinwx.yzrcloud.cn ## 文档 - PROJECT-STATUS.md v4.1→v4.2,状态全面更新 - DEPLOYMENT.md 新增小程序编译上传章节、清理检查清单
This commit is contained in:
@@ -25,6 +25,15 @@ export class Interview {
|
||||
|
||||
@Prop({ default: '' })
|
||||
summary: string
|
||||
|
||||
@Prop({ type: [{ word: String, count: Number }], default: [] })
|
||||
fillerWords: { word: string; count: number }[]
|
||||
|
||||
@Prop({ default: 0 })
|
||||
fillerScore: number
|
||||
|
||||
@Prop({ default: 0 })
|
||||
fillerDensity: number
|
||||
}
|
||||
|
||||
export const InterviewSchema = SchemaFactory.createForClass(Interview)
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { Injectable, HttpException, HttpStatus, forwardRef, Inject } from '@nestjs/common'
|
||||
import { Injectable, HttpException, HttpStatus } from '@nestjs/common'
|
||||
import { InjectModel } from '@nestjs/mongoose'
|
||||
import { Model } from 'mongoose'
|
||||
import { Interview, InterviewDocument } from './interview.schema'
|
||||
import { Progress, ProgressDocument } from '../schemas/progress.schema'
|
||||
import { AiService } from '../ai/ai.service'
|
||||
import { UserService } from '../user/user.service'
|
||||
import { analyzeSpeech } from '../../common/utils/filler-words'
|
||||
|
||||
@Injectable()
|
||||
export class InterviewService {
|
||||
@@ -47,10 +48,10 @@ export class InterviewService {
|
||||
|
||||
// 检查轮次限制
|
||||
const user = await this.userService.getModel().findById(userId).exec()
|
||||
const maxRounds = user?.plan === 'vip' ? 10 : 5
|
||||
const maxRounds = user?.plan !== 'free' ? 10 : 5
|
||||
if (interview.questionCount >= maxRounds) {
|
||||
throw new HttpException(
|
||||
user?.plan === 'vip' ? '已达到每场面试最大轮次(10轮)' : '免费版每场最多5轮,升级会员可享10轮',
|
||||
user?.plan !== 'free' ? '已达到每场面试最大轮次(10轮)' : '免费版每场最多5轮,升级会员可享10轮',
|
||||
HttpStatus.FORBIDDEN
|
||||
)
|
||||
}
|
||||
@@ -59,6 +60,12 @@ export class InterviewService {
|
||||
interview.messages.push({ role: 'user', content: answer })
|
||||
interview.questionCount += 1
|
||||
|
||||
// Analyze filler words in user's answer
|
||||
const speechAnalysis = analyzeSpeech(answer)
|
||||
interview.fillerWords = speechAnalysis.fillerWords.map(f => ({ word: f.word, count: f.count }))
|
||||
interview.fillerScore = speechAnalysis.fillerScore
|
||||
interview.fillerDensity = speechAnalysis.fillerDensity
|
||||
|
||||
// AI evaluates answer and generates next question
|
||||
const conversationHistory = interview.messages
|
||||
.slice(-6)
|
||||
@@ -230,7 +237,21 @@ ${fullConversation}
|
||||
async getDetail(interviewId: string, userId: string) {
|
||||
const interview = await this.interviewModel.findOne({ _id: interviewId, userId }).exec()
|
||||
if (!interview) throw new HttpException('面试不存在', HttpStatus.NOT_FOUND)
|
||||
return interview
|
||||
|
||||
// Compute aggregate speech analysis from user messages
|
||||
const userAnswers = interview.messages
|
||||
.filter(m => m.role === 'user')
|
||||
.map(m => m.content)
|
||||
.join('\n')
|
||||
const speechAnalysis = userAnswers ? analyzeSpeech(userAnswers) : null
|
||||
|
||||
return {
|
||||
...interview.toObject(),
|
||||
fillerWords: speechAnalysis?.fillerWords || interview.fillerWords,
|
||||
fillerScore: speechAnalysis?.fillerScore || interview.fillerScore,
|
||||
fillerDensity: speechAnalysis?.fillerDensity || interview.fillerDensity,
|
||||
speechAnalysis,
|
||||
}
|
||||
}
|
||||
|
||||
async getList(userId: string) {
|
||||
|
||||
Reference in New Issue
Block a user