实现@提及功能,允许用户在阅读页中高亮并点击提及的用户,触发添加好友流程。更新内容解析逻辑以支持提及格式,调整页面展示以适应新功能,并优化样式以提升用户体验。

This commit is contained in:
Alex-larget
2026-03-07 18:57:22 +08:00
parent 9aaffd8024
commit 6852004303
7 changed files with 246 additions and 47 deletions

View File

@@ -166,6 +166,11 @@ func UserCheckPurchased(c *gin.Context) {
c.JSON(http.StatusNotFound, gin.H{"success": false, "error": "用户不存在"})
return
}
// 超级VIP管理端开通is_vip=1 且 vip_expire_date>NOW 时,所有文章阅读免费,无需再查订单
if user.IsVip != nil && *user.IsVip && user.VipExpireDate != nil && user.VipExpireDate.After(time.Now()) {
c.JSON(http.StatusOK, gin.H{"success": true, "data": gin.H{"isPurchased": true, "reason": "has_vip"}})
return
}
hasFullBook := user.HasFullBook != nil && *user.HasFullBook
if hasFullBook {
c.JSON(http.StatusOK, gin.H{"success": true, "data": gin.H{"isPurchased": true, "reason": "has_full_book"}})
@@ -377,8 +382,13 @@ func UserPurchaseStatus(c *gin.Context) {
if user.PendingEarnings != nil {
pendingEarnings = *user.PendingEarnings
}
// 超级VIP管理端开通与 check-purchased 一致,视为全章可读
hasFullBook := user.HasFullBook != nil && *user.HasFullBook
if !hasFullBook && user.IsVip != nil && *user.IsVip && user.VipExpireDate != nil && user.VipExpireDate.After(time.Now()) {
hasFullBook = true
}
c.JSON(http.StatusOK, gin.H{"success": true, "data": gin.H{
"hasFullBook": user.HasFullBook != nil && *user.HasFullBook,
"hasFullBook": hasFullBook,
"purchasedSections": purchasedSections,
"sectionMidMap": sectionMidMap,
"purchasedCount": len(purchasedSections),