search.go 981 B

123456789101112131415161718192021222324252627282930313233
  1. package view
  2. import (
  3. "context"
  4. "strconv"
  5. "go-common/app/interface/main/app-card/model"
  6. "go-common/app/interface/main/app-card/model/card/operate"
  7. )
  8. func (s *Service) searchFollow(c context.Context, platform, mobiApp, device, buvid string, build int, mid, vmid int64) (follow *operate.Card, err error) {
  9. const _title = "关注TA的也关注了"
  10. ups, trackID, err := s.search.Follow(c, platform, mobiApp, device, buvid, build, mid, vmid)
  11. if err != nil {
  12. return
  13. }
  14. items := make([]*operate.Card, 0, len(ups))
  15. for _, up := range ups {
  16. if up.Mid != 0 {
  17. item := &operate.Card{ID: up.Mid, Goto: model.GotoMid, Param: strconv.FormatInt(up.Mid, 10), URI: strconv.FormatInt(up.Mid, 10), Desc: up.RecReason}
  18. items = append(items, item)
  19. }
  20. }
  21. if len(items) < 3 {
  22. return
  23. }
  24. id, _ := strconv.ParseInt(trackID, 10, 64)
  25. if id < 1 {
  26. return
  27. }
  28. follow = &operate.Card{ID: id, Param: trackID, Items: items, Title: _title, CardGoto: model.CardGotoSearchUpper}
  29. return
  30. }