go-common/app/interface/live/app-interface/service/v2/room_ex.go

44 lines
980 B
Go
Raw Normal View History

2019-04-22 10:49:16 +00:00
package v2
import (
"context"
"strconv"
v2pb "go-common/app/interface/live/app-interface/api/http/v2"
)
// 首页banner
func (s *IndexService) getIndexBanner(ctx context.Context, platform string, device string, build int64) (resp []*v2pb.MBanner) {
bizList := map[int64]int64{
0: _bannerType,
}
moduleList := s.GetAllModuleInfoMapFromCache(ctx)
for biz, moduleType := range bizList {
for _, moduleInfo := range moduleList[moduleType] {
bannerList, err := s.roomexDao.GetBanner(ctx, biz, 0, platform, device, build)
if err != nil {
continue
}
res := &v2pb.MBanner{}
list := make([]*v2pb.PicItem, 0)
for _, banner := range bannerList {
id, _ := strconv.Atoi(banner.Id)
list = append(list, &v2pb.PicItem{
Id: int64(id),
Link: banner.Link,
Pic: banner.Pic,
Title: banner.Title,
Content: "",
})
}
res.ModuleInfo = moduleInfo
res.List = list
resp = append(resp, res)
}
}
return
}