activity_type.go 2.7 KB

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