From 26c77e33356a519b3caaed44fd9d7f8722f41918 Mon Sep 17 00:00:00 2001 From: SayaAndy Date: Wed, 27 Aug 2025 19:11:16 +0700 Subject: feat: add and show like count feat: localize like button --- internal/router/client-cache.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'internal/router/client-cache.go') diff --git a/internal/router/client-cache.go b/internal/router/client-cache.go index 3104a66..7d276b1 100644 --- a/internal/router/client-cache.go +++ b/internal/router/client-cache.go @@ -58,6 +58,13 @@ func (c *ClientCache) GetLikeStatus(id string, page string) bool { return ok } +func (c *ClientCache) GetLikeCount(page string) int { + if userSet, ok := c.likePageMap[page]; ok { + return len(userSet) + } + return 0 +} + func (c *ClientCache) LikeOn(id string, page string) (alreadyLiked bool) { if _, ok := c.mutexLikeMap[id]; !ok { c.mutexLikeMap[id] = &sync.Mutex{} -- cgit v1.3.1+13