fixed follow topics number more by give number error

pull/274/head v0.3.0-alpha.6
Michael Li 2 years ago
parent 32b5b6886a
commit 96ac9d7fcd
No known key found for this signature in database

@ -75,7 +75,12 @@ func (s *topicServant) GetFollowTags(userId int64, limit int, offset int) ([]*co
return nil, nil
}
userTopics := []*topicInfo{}
err := s.db.Model(&dbr.TopicUser{}).Where("user_id=?", userId).Order("is_top DESC").Find(&userTopics).Error
err := s.db.Model(&dbr.TopicUser{}).
Where("user_id=?", userId).
Order("is_top DESC").
Limit(limit).
Offset(offset).
Find(&userTopics).Error
if err != nil {
return nil, err
}

@ -164,12 +164,12 @@ func (s *looseSrv) TopicList(req *web.TopicListReq) (*web.TopicListResp, mir.Err
tags, err = s.Ds.GetFollowTags(req.Uid, num, 0)
case web.TagTypeHotExtral:
extralNum := req.ExtralNum
if extralNum == 0 {
if extralNum <= 0 {
extralNum = num
}
tags, err = s.Ds.GetHotTags(req.Uid, num, 0)
if err == nil {
extralTags, err = s.Ds.GetFollowTags(req.Uid, num, 0)
extralTags, err = s.Ds.GetFollowTags(req.Uid, extralNum, 0)
}
default:
// TODO: return good error

Loading…
Cancel
Save