package models import ( "github.com/beego/beego/v2/client/orm" "time" ) type Banner struct { Id int `orm:"column(id);pk"` ClassifyId int `description:"分类id"` ImageUrl string `description:"图片路径"` BannerType int `description:"类型 1:轮播图,2:头部海报"` CreateTime time.Time `description:"创建时间"` ModifyTime time.Time `description:"修改时间"` ClassifyName string `description:"分类名称"` JumpUrl string `description:"跳转地址"` Abstract string `description:"栏目简介"` Descript string `description:"分享描述"` ReportAuthor string `description:"栏目作者"` AuthorDescript string `description:"作者简介"` ColumnImgUrl string `description:"栏目配图"` HeadImgUrl string `description:"头部banner"` AvatarImgUrl string `description:"头像"` ReportImgUrl string `description:"报告配图"` } //获取轮播图列表 func GetHomeBannerList(platform string) (items []*Banner, err error) { sql := ` SELECT * FROM banner WHERE banner_type=1 ORDER BY modify_time DESC ` if platform == "pc" { sql += ` LIMIT 1` } o := orm.NewOrmUsingDB("rddp") _, err = o.Raw(sql).QueryRows(&items) return }