feat: show trial plan with used/disabled state on subscribe page
- Add GET /api/v1/subscription/plans public endpoint for pricing - Subscription API now returns trial_used field - Subscribe-plans page shows trial card, greyed out with "已使用" tag when trial has been used - Trial activation calls dedicated trial API, not purchase - Prices fetched from server settings, fallback to defaults
这个提交包含在:
@@ -27,13 +27,15 @@ router.get('/subscription/plans', wrap(async (req, res) => {
|
||||
|
||||
router.get('/subscription', requireUser, wrap(async (req, res) => {
|
||||
const sub = await subscriptionDao.findActive(req.user.user_id)
|
||||
if (!sub) return res.json(ok({ status: 'inactive', plan: 'none', remaining_days: 0 }))
|
||||
const trialUsed = await subscriptionDao.findTrial(req.user.user_id)
|
||||
if (!sub) return res.json(ok({ status: 'inactive', plan: 'none', remaining_days: 0, trial_used: !!trialUsed }))
|
||||
res.json(ok({
|
||||
status: sub.remaining_days > 0 ? 'active' : 'expired',
|
||||
plan: sub.plan,
|
||||
start_time: sub.start_time,
|
||||
expire_time: sub.expire_time,
|
||||
remaining_days: sub.remaining_days
|
||||
remaining_days: sub.remaining_days,
|
||||
trial_used: !!trialUsed
|
||||
}))
|
||||
}))
|
||||
|
||||
|
||||
在新工单中引用
屏蔽一个用户