package models import ( "github.com/beego/beego/v2/client/orm" ) type ActivityType struct { ActivityTypeId int `description:"活动类型id"` ActivityTypeName string `description:"活动类型名称"` //TemplateP string `description:"活动模板,带P标签"` //Template string `description:"活动模板"` ShowType string `description:"人数限制类型,1不展示限制,2可选限制,3强制限制"` IsChoose bool `description:"是否选择"` OnlineIco string `description:"线上线下Ico图标"` ActivityType int `description:"活动线上线下类型 1线上,0 线下"` } type ActivityTypeListResp struct { List []*ActivityType } // 列表 func GetActivityTypeList(condition string) (items []*ActivityType, err error) { o := orm.NewOrm() sql := `SELECT * FROM cygx_activity_type WHERE 1= 1 ` + condition + ` ORDER BY sort DESC` _, err = o.Raw(sql).QueryRows(&items) return } func GetActivityTypeDetailById(activityTypeId int) (item *ActivityType, err error) { o := orm.NewOrm() sql := `SELECT * FROM cygx_activity_type WHERE activity_type_id = ? ` err = o.Raw(sql, activityTypeId).QueryRow(&item) return } type ActivityTypeListHomeResp struct { List []*ActivityTypeHome } type ActivityTypeListHomeRespPc struct { List []*ActivityTypeHomePc } type ActivityTypeHome struct { ActivityTypeId int `description:"活动类型id"` ActivityTypeName string `description:"活动名称"` ImgUrl string `description:"图片"` ImgUrlBg string `description:"背景图片"` ImgUrlBgs string `description:"背景图片"` Position int `description:"位置 ,1:左 ,2:右边"` Resource int `description:"位置 ,1:活动 ,2:专项产业调研"` List []*CygxActivityLabelList } type ActivityTypeHomePc struct { ActivityTypeId int `description:"活动类型id"` Resource int `description:"位置 ,1:活动 ,2:专项产业调研"` ActivityTypeName string `description:"活动名称"` OnlineIco string `description:"线上线下Ico图标"` ImgUrlBgPc string `description:"Pc端背景图片"` List []*CygxActivityLabelList } // 列表 func GetActivityTypeHomeList(condition string, pars []interface{}) (items []*ActivityTypeHome, err error) { o := orm.NewOrm() sql := `SELECT * FROM cygx_activity_type WHERE 1= 1 ` if condition != "" { sql += condition } _, err = o.Raw(sql, pars).QueryRows(&items) return } // 列表 func GetActivityTypeHomeListPc() (items []*ActivityTypeHomePc, err error) { o := orm.NewOrm() sql := `SELECT * FROM cygx_activity_type WHERE activity_type_id != 7 ORDER BY sort DESC` _, err = o.Raw(sql).QueryRows(&items) return }