fixed get user's coment/like tweets error by guest

pull/391/head
Michael Li 1 year ago
parent 35b865724c
commit 8f32e827d6
No known key found for this signature in database

@ -177,7 +177,10 @@ func (s *looseSrv) userTweetsFromCache(req *web.GetUserTweetsReq, user *cs.VistU
case web.UserPostsStylePost, web.UserPostsStyleHighlight, web.UserPostsStyleMedia: case web.UserPostsStylePost, web.UserPostsStyleHighlight, web.UserPostsStyleMedia:
key = fmt.Sprintf("%s%d:%s:%s:%d:%d", s.prefixUserTweets, user.UserId, 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: default:
meName := lets.If(user.RelTyp != cs.RelationGuest, req.User.Username, "_") meName := "_"
if user.RelTyp != cs.RelationGuest {
meName = req.User.Username
}
key = fmt.Sprintf("%s%d:%s:%s:%d:%d", s.prefixUserTweets, user.UserId, req.Style, meName, req.Page, req.PageSize) 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 { if data, err := s.ac.Get(key); err == nil {

Loading…
Cancel
Save