banner.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type Banner struct {
  7. Id int `orm:"column(id);pk"`
  8. ClassifyId int `description:"分类id"`
  9. ImageUrl string `description:"图片路径"`
  10. BannerType int `description:"类型 1:轮播图,2:头部海报"`
  11. CreateTime time.Time `description:"创建时间"`
  12. ModifyTime time.Time `description:"修改时间"`
  13. ClassifyName string `description:"分类名称"`
  14. JumpUrl string `description:"跳转地址"`
  15. Abstract string `description:"栏目简介"`
  16. Descript string `description:"分享描述"`
  17. ReportAuthor string `description:"栏目作者"`
  18. AuthorDescript string `description:"作者简介"`
  19. ColumnImgUrl string `description:"栏目配图"`
  20. HeadImgUrl string `description:"头部banner"`
  21. AvatarImgUrl string `description:"头像"`
  22. ReportImgUrl string `description:"报告配图"`
  23. }
  24. //获取轮播图列表
  25. func GetHomeBannerList(platform string) (items []*Banner, err error) {
  26. sql := ` SELECT * FROM banner WHERE banner_type=1 ORDER BY modify_time DESC `
  27. if platform == "pc" {
  28. sql += ` LIMIT 1`
  29. }
  30. o := orm.NewOrmUsingDB("rddp")
  31. _, err = o.Raw(sql).QueryRows(&items)
  32. return
  33. }