feat(notif): 点赞通知延迟落库,短时取消不打扰作者
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
||||
"strconv"
|
||||
|
||||
"github.com/freefire/jiang13-bbs/middleware"
|
||||
"github.com/freefire/jiang13-bbs/model"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
@@ -22,11 +21,6 @@ func (h *Handlers) ToggleLike(c *gin.Context) {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
// 仅点赞时通知帖子作者(取消点赞不通知)
|
||||
if liked {
|
||||
if authorID, e := h.Post.GetAuthorID(uint(id)); e == nil {
|
||||
h.Notification.Create(authorID, claims.ID, model.NotificationTypeLike, uint(id), 0, "")
|
||||
}
|
||||
}
|
||||
// 点赞通知由后台延迟落库:误点后很快取消则不打扰作者
|
||||
c.JSON(http.StatusOK, gin.H{"liked": liked, "like_count": count})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user