room_ex.go 980 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package v2
  2. import (
  3. "context"
  4. "strconv"
  5. v2pb "go-common/app/interface/live/app-interface/api/http/v2"
  6. )
  7. // 首页banner
  8. func (s *IndexService) getIndexBanner(ctx context.Context, platform string, device string, build int64) (resp []*v2pb.MBanner) {
  9. bizList := map[int64]int64{
  10. 0: _bannerType,
  11. }
  12. moduleList := s.GetAllModuleInfoMapFromCache(ctx)
  13. for biz, moduleType := range bizList {
  14. for _, moduleInfo := range moduleList[moduleType] {
  15. bannerList, err := s.roomexDao.GetBanner(ctx, biz, 0, platform, device, build)
  16. if err != nil {
  17. continue
  18. }
  19. res := &v2pb.MBanner{}
  20. list := make([]*v2pb.PicItem, 0)
  21. for _, banner := range bannerList {
  22. id, _ := strconv.Atoi(banner.Id)
  23. list = append(list, &v2pb.PicItem{
  24. Id: int64(id),
  25. Link: banner.Link,
  26. Pic: banner.Pic,
  27. Title: banner.Title,
  28. Content: "",
  29. })
  30. }
  31. res.ModuleInfo = moduleInfo
  32. res.List = list
  33. resp = append(resp, res)
  34. }
  35. }
  36. return
  37. }