feat: fetch subscription prices from server settings
- Add GET /api/v1/subscription/plans public endpoint (no auth needed) that reads prices from system_settings table - Subscribe-plans page now loads prices from server on show - Falls back to hardcoded defaults if API fails - Add api.getPlans() to miniprogram API module
这个提交包含在:
@@ -13,6 +13,18 @@ const PLANS = {
|
||||
yearly: { amount: 899, days: 365 }
|
||||
}
|
||||
|
||||
router.get('/subscription/plans', wrap(async (req, res) => {
|
||||
const settingsDao = require('../dao/settings.dao')
|
||||
const settings = await settingsDao.getAll()
|
||||
res.json(ok({
|
||||
plans: [
|
||||
{ key: 'monthly', name: '月卡', price: Number(settings.monthly_price) || PLANS.monthly.amount, days: 30 },
|
||||
{ key: 'yearly', name: '年卡', price: Number(settings.yearly_price) || PLANS.yearly.amount, days: 365 },
|
||||
{ key: 'trial', name: '试用', price: 0, days: Number(settings.trial_days) || 7 }
|
||||
]
|
||||
}))
|
||||
}))
|
||||
|
||||
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 }))
|
||||
|
||||
在新工单中引用
屏蔽一个用户