activity_type.go 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/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. OnlineIco string `description:"线上线下Ico图标"`
  13. }
  14. type ActivityTypeListResp struct {
  15. List []*ActivityType
  16. }
  17. // 列表
  18. func GetActivityTypeList() (items []*ActivityType, err error) {
  19. o := orm.NewOrm()
  20. sql := `SELECT * FROM cygx_activity_type ORDER BY sort DESC`
  21. _, err = o.Raw(sql).QueryRows(&items)
  22. return
  23. }
  24. func GetActivityTypeDetailById(activityTypeId int) (item *ActivityType, err error) {
  25. o := orm.NewOrm()
  26. sql := `SELECT * FROM cygx_activity_type WHERE activity_type_id = ? `
  27. err = o.Raw(sql, activityTypeId).QueryRow(&item)
  28. return
  29. }
  30. type ActivityTypeListHomeResp struct {
  31. List []*ActivityTypeHome
  32. }
  33. type ActivityTypeListHomeRespPc struct {
  34. List []*ActivityTypeHomePc
  35. }
  36. type ActivityTypeHome struct {
  37. ActivityTypeId int `description:"活动类型id"`
  38. ActivityTypeName string `description:"活动名称"`
  39. ImgUrl string `description:"图片"`
  40. ImgUrlBg string `description:"背景图片"`
  41. ImgUrlBgs string `description:"背景图片"`
  42. Position int `description:"位置 ,1:左 ,2:右边"`
  43. Resource int `description:"位置 ,1:活动 ,2:专项产业调研"`
  44. List []*CygxActivityLabelList
  45. }
  46. type ActivityTypeHomePc struct {
  47. ActivityTypeId int `description:"活动类型id"`
  48. Resource int `description:"位置 ,1:活动 ,2:专项产业调研"`
  49. ActivityTypeName string `description:"活动名称"`
  50. OnlineIco string `description:"线上线下Ico图标"`
  51. ImgUrlBgPc string `description:"Pc端背景图片"`
  52. List []*CygxActivityLabelList
  53. }
  54. // 列表
  55. func GetActivityTypeHomeList(condition string, pars []interface{}) (items []*ActivityTypeHome, err error) {
  56. o := orm.NewOrm()
  57. sql := `SELECT * FROM cygx_activity_type WHERE 1= 1 `
  58. if condition != "" {
  59. sql += condition
  60. }
  61. _, err = o.Raw(sql, pars).QueryRows(&items)
  62. return
  63. }
  64. // 列表
  65. func GetActivityTypeHomeListPc() (items []*ActivityTypeHomePc, err error) {
  66. o := orm.NewOrm()
  67. sql := `SELECT * FROM cygx_activity_type WHERE activity_type_id != 7 ORDER BY sort DESC`
  68. _, err = o.Raw(sql).QueryRows(&items)
  69. return
  70. }