banner.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package feed
  2. import (
  3. "context"
  4. resource "go-common/app/service/main/resource/model"
  5. "strconv"
  6. "go-common/app/interface/main/app-card/model/card/banner"
  7. "go-common/app/interface/main/app-feed/model"
  8. )
  9. var (
  10. _banners = map[int8]int{
  11. model.PlatIPhoneB: 467,
  12. model.PlatIPhone: 467,
  13. model.PlatAndroid: 631,
  14. model.PlatIPad: 771,
  15. model.PlatIPhoneI: 947,
  16. model.PlatAndroidG: 1285,
  17. model.PlatAndroidI: 1707,
  18. model.PlatIPadI: 1117,
  19. }
  20. )
  21. // banners get banners by plat, build channel, ip.
  22. func (s *Service) banners(c context.Context, plat int8, build int, mid int64, buvid, network, mobiApp, device, openEvent, adExtra, hash string) (bs []*banner.Banner, version string, err error) {
  23. plat = model.PlatAPPBuleChange(plat)
  24. var (
  25. rscID = _banners[plat]
  26. bm map[int][]*resource.Banner
  27. )
  28. if bm, version, err = s.rsc.Banner(c, plat, build, mid, strconv.Itoa(rscID), "", buvid, network, mobiApp, device, true, openEvent, adExtra, hash); err != nil {
  29. return
  30. }
  31. for _, rb := range bm[rscID] {
  32. b := &banner.Banner{}
  33. b.Change(rb)
  34. bs = append(bs, b)
  35. }
  36. return
  37. }