fixed get user tweets error when use cache

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

@ -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{

Loading…
Cancel
Save