feat: 微信分享钩子全页面接入 + 订阅信息结构化映射 + JWT 错误处理加强

- client: 全部页面接入 onShareAppMessage/onShareTimeline 分享钩子
- client: login 页增强、profile 订阅展示优化
- client/stores: 订阅字段扁平结构映射为 subInfo(plan/expiresAt/startDate)
- server: auth 路由 JWT 无效/过期统一返回 401 未授权响应
- server: models/tests 同步更新
This commit is contained in:
Yuzhiran Dev
2026-09-04 11:47:29 +08:00
parent de8ca9c420
commit 66de1dc396
37 changed files with 2138 additions and 1830 deletions
+18 -10
View File
@@ -76,22 +76,30 @@ app.use((err, req, res, next) => {
})
})
// 启动服务器
// 启动服务器(仅在直接运行时启动,被测试 import 时不启动)
const PORT = process.env.PORT || 3000
const server = app.listen(PORT, () => {
logger.info(`🚀 服务器启动成功`)
logger.info(`📍 端口: ${PORT}`)
logger.info(`🌐 环境: ${process.env.NODE_ENV || 'development'}`)
logger.info(`📊 健康检查: http://localhost:${PORT}/health`)
})
let server = null
if (require.main === module) {
server = app.listen(PORT, () => {
logger.info(`🚀 服务器启动成功`)
logger.info(`📍 端口: ${PORT}`)
logger.info(`🌐 环境: ${process.env.NODE_ENV || 'development'}`)
logger.info(`📊 健康检查: http://localhost:${PORT}/health`)
})
}
// 优雅关闭
process.on('SIGTERM', () => {
logger.info('📴 接收到 SIGTERM 信号,正在关闭服务器...')
server.close(() => {
logger.info('✅ 服务器已关闭')
if (server) {
server.close(() => {
logger.info('✅ 服务器已关闭')
process.exit(0)
})
} else {
process.exit(0)
})
}
})
module.exports = app