From 35b865724c3447759d22db87204b0119493f16c9 Mon Sep 17 00:00:00 2001 From: Michael Li Date: Mon, 18 Sep 2023 19:07:06 +0800 Subject: [PATCH] fixed get user tweets error when use cache --- internal/servants/web/loose.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/servants/web/loose.go b/internal/servants/web/loose.go index 2ef89d10..f171bec5 100644 --- a/internal/servants/web/loose.go +++ b/internal/servants/web/loose.go @@ -175,10 +175,10 @@ func (s *looseSrv) GetUserTweets(req *web.GetUserTweetsReq) (res *web.GetUserTwe func (s *looseSrv) userTweetsFromCache(req *web.GetUserTweetsReq, user *cs.VistUser) (res *web.GetUserTweetsResp, key string, ok bool) { switch req.Style { case web.UserPostsStylePost, web.UserPostsStyleHighlight, web.UserPostsStyleMedia: - key = fmt.Sprintf("%s%d:%s:%s:%d:%d", s.prefixUserTweets, req.User.ID, req.Style, user.RelTyp, req.Page, req.PageSize) + key = fmt.Sprintf("%s%d:%s:%s:%d:%d", s.prefixUserTweets, user.UserId, req.Style, user.RelTyp, req.Page, req.PageSize) default: - visitUserName := lets.If(user.RelTyp != cs.RelationGuest, user.Username, "_") - key = fmt.Sprintf("%s%d:%s:%s:%d:%d", s.prefixUserTweets, req.User.ID, req.Style, visitUserName, req.Page, req.PageSize) + meName := lets.If(user.RelTyp != cs.RelationGuest, req.User.Username, "_") + key = fmt.Sprintf("%s%d:%s:%s:%d:%d", s.prefixUserTweets, user.UserId, req.Style, meName, req.Page, req.PageSize) } if data, err := s.ac.Get(key); err == nil { ok, res = true, &web.GetUserTweetsResp{