activity_type.go 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package models
  2. import (
  3. "rdluck_tools/orm"
  4. )
  5. type ActivityType struct {
  6. ActivityTypeId int `description:"活动类型id"`
  7. ActivityTypeName string `description:"活动名称"`
  8. //TemplateP string `description:"活动模板,带P标签"`
  9. //Template string `description:"活动模板"`
  10. ShowType string `description:"人数限制类型,1不展示限制,2可选限制,3强制限制"`
  11. IsChoose bool `description:"是否选择"`
  12. }
  13. type ActivityTypeListResp struct {
  14. List []*ActivityType
  15. }
  16. //列表
  17. func GetActivityTypeList() (items []*ActivityType, err error) {
  18. o := orm.NewOrm()
  19. sql := `SELECT * FROM cygx_activity_type ORDER BY sort DESC`
  20. _, err = o.Raw(sql).QueryRows(&items)
  21. return
  22. }
  23. func GetActivityTypeDetailById(activityTypeId int) (item *ActivityType, err error) {
  24. o := orm.NewOrm()
  25. sql := `SELECT * FROM cygx_activity_type WHERE activity_type_id = ? `
  26. err = o.Raw(sql, activityTypeId).QueryRow(&item)
  27. return
  28. }
  29. type ActivityTypeListHomeResp struct {
  30. List []*ActivityTypeHome
  31. }
  32. type ActivityTypeHome struct {
  33. ActivityTypeId int `description:"活动类型id"`
  34. ActivityTypeName string `description:"活动名称"`
  35. ImgUrl string `description:"图片"`
  36. ImgUrlBg string `description:"背景图片"`
  37. ImgUrlBgs string `description:"背景图片"`
  38. List []*CygxActivityLabelList
  39. }
  40. //列表
  41. func GetActivityTypeHomeList() (items []*ActivityTypeHome, err error) {
  42. o := orm.NewOrm()
  43. sql := `SELECT * FROM cygx_activity_type ORDER BY sort DESC`
  44. _, err = o.Raw(sql).QueryRows(&items)
  45. return
  46. }