activity_special.go 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. package models
  2. import (
  3. //"fmt"
  4. "github.com/beego/beego/v2/client/orm"
  5. "github.com/rdlucklib/rdluck_tools/paging"
  6. )
  7. // 专项调研活动列表
  8. type CygxActivitySpecialDetail struct {
  9. ActivityId int `description:"活动ID "`
  10. ActivityTypeName string `description:"活动名称"`
  11. SpecialType int `description:"调研形式、 1 线上 , 2 线下"`
  12. City string `description:"调研城市"`
  13. ChartPermissionName string `description:"行业名称"`
  14. ChartPermissionId int `description:"行业Id"`
  15. ResearchTheme string `description:"调研主题"`
  16. ActivityTimeText string `description:"活动预期时间带文字"`
  17. TripImgLink string `description:"行程图片链接"`
  18. IsSignup int `description:"是否感兴趣 1是 ,0 否"`
  19. Label string `description:"主题标签"`
  20. ImgUrl string `description:"图片链接"`
  21. ImgUrlText string `description:"图片链接文字"`
  22. IndustrialName string `description:"产业名称"`
  23. IndustrialSubjectName string `description:"标的名称(相关公司)"`
  24. Scale string `description:"管理规模,空不填,1::50亿以下,2:50~100亿,3:100亿以上。多个用, 隔开"`
  25. CustomerTypeIds string `description:"活动可见的客户类型,多个ID用 , 隔开"`
  26. IsTrip int `description:"是否报名 1是 ,0 否"`
  27. TripNum int `description:"已报名人数"`
  28. Days int `description:"调研天数"`
  29. Host string `description:"主持人"`
  30. PersonInCharge string `description:"纪要负责人"`
  31. LimitPeopleNum int `description:"限制人数数量"`
  32. TripImgLinkFix string `description:"确定行程之后的图片链接"`
  33. ActivityTimeTextByDay string `description:"活动预期时间带周日"`
  34. ActivityTime string `description:"活动预期时间"`
  35. ActivityTimeEnd string `description:"活动预期结束时间"`
  36. ActiveState string `description:"活动进行状态 未开始:1、进行中2、已结束3"`
  37. TripStatus int `description:"行程进行状态 1:预报名,2:确定行程"`
  38. Explain string `description:"说明"`
  39. AdminId int `description:"管理员ID"`
  40. }
  41. // 获取数量
  42. func GetActivitySpecialCount(condition string, pars []interface{}) (count int, err error) {
  43. sqlCount := ` SELECT COUNT(1) AS count FROM cygx_activity_special as art WHERE 1= 1 `
  44. if condition != "" {
  45. sqlCount += condition
  46. }
  47. o := orm.NewOrm()
  48. err = o.Raw(sqlCount, pars).QueryRow(&count)
  49. return
  50. }
  51. // 主题列表
  52. func GetActivitySpecialListAll(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxActivitySpecialDetail, err error) {
  53. o := orm.NewOrm()
  54. sql := `SELECT *
  55. FROM cygx_activity_special as art WHERE 1= 1 `
  56. if condition != "" {
  57. sql += condition
  58. }
  59. sql += ` ORDER BY art.last_updated_time DESC LIMIT ?,? `
  60. _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
  61. return
  62. }
  63. // 修改发布状态
  64. func UpdateActivitySpecialPublishStatus(publishStatus, activityId int) (err error) {
  65. sql := ` UPDATE cygx_activity_special SET publish_status= ? WHERE activity_id = ?`
  66. o := orm.NewOrm()
  67. _, err = o.Raw(sql, publishStatus, activityId).Exec()
  68. return
  69. }
  70. // 主题列表
  71. func GetActivityLabelSpecialListAll(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxActivityLabelList, err error) {
  72. o := orm.NewOrm()
  73. sql := `SELECT label,activity_id,is_show_subject_name,days
  74. FROM cygx_activity_special as art WHERE 1= 1 `
  75. if condition != "" {
  76. sql += condition
  77. }
  78. sql += ` LIMIT ?,? `
  79. _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
  80. return
  81. }
  82. // 获取专项调研活动列表
  83. func GetCygxActivitySpecialDetailList(condition string, pars []interface{}, uid, startSize, pageSize int) (items []*CygxActivitySpecialDetail, err error) {
  84. o := orm.NewOrm()
  85. sql := ` SELECT
  86. art.*,
  87. (
  88. SELECT
  89. COUNT( 1 )
  90. FROM
  91. cygx_activity_special_signup AS s
  92. WHERE
  93. s.activity_id = art.activity_id
  94. AND s.user_id = ?
  95. ) AS is_signup
  96. FROM
  97. cygx_activity_special AS art
  98. WHERE
  99. 1 = 1 `
  100. if condition != "" {
  101. sql += condition
  102. }
  103. sql += ` LIMIT ?,? `
  104. _, err = o.Raw(sql, uid, pars, startSize, pageSize).QueryRows(&items)
  105. return
  106. }
  107. type GetCygxActivitySpecialDetailListResp struct {
  108. IsFollow bool `description:"是否关注新调研通知"`
  109. IsBindingMobile bool `description:"是否绑定了手机号"`
  110. Paging *paging.PagingItem `description:"分页数据"`
  111. List []*CygxActivitySpecialDetail
  112. }
  113. type CygxActivitySpecialResp struct {
  114. HasPermission int `description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下(ficc),3:无该品类权限,已提交过申请,4:无该品类权限,未提交过申请,5:潜在客户,未提交过申请,6:潜在客户,已提交过申请"`
  115. PopupMsg string `description:"权限弹窗信息"`
  116. SellerMobile string `description:"销售电话"`
  117. SellerName string `description:"销售姓名"`
  118. IsFollow bool `description:"是否关注新调研通知"`
  119. Detail *CygxActivitySpecialDetail
  120. }
  121. // 通过活动ID获取活动详情
  122. func GetCygxActivitySpecialDetailById(uid, ActivityId int) (item *CygxActivitySpecialDetail, err error) {
  123. o := orm.NewOrm()
  124. sql := `SELECT *,( SELECT COUNT( 1 ) FROM cygx_activity_special_signup AS s WHERE s.activity_id = a.activity_id AND s.user_id = ? ) AS is_signup
  125. FROM
  126. cygx_activity_special AS a
  127. WHERE
  128. activity_id = ?
  129. AND publish_status = 1 AND is_offline = 0 `
  130. err = o.Raw(sql, uid, ActivityId).QueryRow(&item)
  131. return
  132. }
  133. type ActivityIdRep struct {
  134. ActivityId int `description:"活动id"`
  135. PlaySeconds int `description:"播放时长"`
  136. }
  137. // 通过活动ID获取活动详情
  138. func GetCygxActivitySpecialDetail(ActivityId int) (item *CygxActivitySpecialDetail, err error) {
  139. o := orm.NewOrm()
  140. sql := `SELECT * FROM cygx_activity_special WHERE activity_id=? AND publish_status = 1 `
  141. err = o.Raw(sql, ActivityId).QueryRow(&item)
  142. return
  143. }