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
+8 -5
View File
@@ -519,18 +519,21 @@ router.get('/me', async (req, res) => {
const decoded = jwt.verify(token, process.env.JWT_SECRET)
const user = await User.findById(decoded.userId)
if (!user) {
return ApiResponse.notFound(res, '用户不存在')
}
return ApiResponse.success(res, user)
} catch (error) {
if (error.name === 'JsonWebTokenError' || error.name === 'TokenExpiredError') {
return ApiResponse.unauthorized(res, '认证令牌无效或已过期')
}
logger.error('获取用户信息失败:', error)
return ApiResponse.serverError(res, error.message)
}
})
})
/**
* WebView Token 交换接口
@@ -568,7 +571,7 @@ router.post('/webview-token', async (req, res) => {
await recordLoginLog(
user._id,
openid,
'webview_auto_login',
'auto_login',
'wechat_webview',
'webview_h5',
req,