feat: unified gravity system - VIP members consume gravity instead of unlimited; add monthly gravity top-up cron
This commit is contained in:
@@ -54,6 +54,12 @@ export class MemberController {
|
||||
|
||||
return {
|
||||
interview: { dailyFreeLimit: FREE_DAILY_LIMIT, maxRoundsFree: 5, maxRoundsVip: 10 },
|
||||
gravityRates: pricing.gravityRates,
|
||||
products: {
|
||||
interview: { price: pricing.interview.pricePerSession, title: 'AI 模拟面试单次', gravity: pricing.gravityRates.interviewPerUse },
|
||||
optimize: { price: pricing.resumeOptimize.pricePerOptimize, title: '简历优化单次', gravity: pricing.gravityRates.optimizePerUse },
|
||||
download: { price: pricing.resumeDownload.pricePerDownload, title: '简历下载', gravity: pricing.gravityRates.downloadPerUse },
|
||||
},
|
||||
plans,
|
||||
}
|
||||
}
|
||||
@@ -66,6 +72,7 @@ export class MemberController {
|
||||
plan: user.plan,
|
||||
planName: user.plan === 'growth' ? '成长版' : user.plan === 'sprint' ? '冲刺版' : '免费版',
|
||||
remaining: user.remaining,
|
||||
gravity: user.gravity ?? 0,
|
||||
dailyLimit: user.plan !== 'free' ? 999 : FREE_DAILY_LIMIT,
|
||||
vipExpireAt: user.vipExpireAt,
|
||||
sprintExpireAt: user.sprintExpireAt,
|
||||
@@ -101,7 +108,7 @@ export class MemberController {
|
||||
user.plan = 'growth'
|
||||
user.vipExpireAt = expireAt
|
||||
}
|
||||
await this.quotaService.setPlanQuota(userId, order.plan, planCfg.credits)
|
||||
await this.quotaService.setPlanQuota(userId, planCfg.gravityPerMonth)
|
||||
return { success: true, plan: user.plan, planName: user.plan === 'growth' ? '成长版' : '冲刺版', expireAt }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user