Merge branch 'dev' into alpha

pull/398/head v0.5.0-alpha.2
Michael Li 1 year ago
commit bb7b16ad93
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) { func (s *looseSrv) userTweetsFromCache(req *web.GetUserTweetsReq, user *cs.VistUser) (res *web.GetUserTweetsResp, key string, ok bool) {
switch req.Style { switch req.Style {
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, 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: default:
visitUserName := lets.If(user.RelTyp != cs.RelationGuest, user.Username, "_") meName := lets.If(user.RelTyp != cs.RelationGuest, req.User.Username, "_")
key = fmt.Sprintf("%s%d:%s:%s:%d:%d", s.prefixUserTweets, req.User.ID, req.Style, visitUserName, 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 {
ok, res = true, &web.GetUserTweetsResp{ ok, res = true, &web.GetUserTweetsResp{

Loading…
Cancel
Save