activity_special.go 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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. ShareImg string `description:"分享图片"`
  41. }
  42. // 获取数量
  43. func GetActivitySpecialCount(condition string, pars []interface{}) (count int, err error) {
  44. sqlCount := ` SELECT COUNT(1) AS count FROM cygx_activity_special as art WHERE 1= 1 `
  45. if condition != "" {
  46. sqlCount += condition
  47. }
  48. o := orm.NewOrm()
  49. err = o.Raw(sqlCount, pars).QueryRow(&count)
  50. return
  51. }
  52. // 主题列表
  53. func GetActivitySpecialListAll(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxActivitySpecialDetail, err error) {
  54. o := orm.NewOrm()
  55. sql := `SELECT *
  56. FROM cygx_activity_special as art WHERE 1= 1 `
  57. if condition != "" {
  58. sql += condition
  59. }
  60. sql += ` ORDER BY art.last_updated_time DESC LIMIT ?,? `
  61. _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
  62. return
  63. }
  64. // 修改发布状态
  65. func UpdateActivitySpecialPublishStatus(publishStatus, activityId int) (err error) {
  66. sql := ` UPDATE cygx_activity_special SET publish_status= ? WHERE activity_id = ?`
  67. o := orm.NewOrm()
  68. _, err = o.Raw(sql, publishStatus, activityId).Exec()
  69. return
  70. }
  71. // 主题列表
  72. func GetActivityLabelSpecialListAll(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxActivityLabelList, err error) {
  73. o := orm.NewOrm()
  74. sql := `SELECT label,activity_id,is_show_subject_name,days
  75. FROM cygx_activity_special as art WHERE 1= 1 `
  76. if condition != "" {
  77. sql += condition
  78. }
  79. sql += ` LIMIT ?,? `
  80. _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
  81. return
  82. }
  83. // 获取专项调研活动列表
  84. func GetCygxActivitySpecialDetailList(condition string, pars []interface{}, uid, startSize, pageSize int) (items []*CygxActivitySpecialDetail, err error) {
  85. o := orm.NewOrm()
  86. sql := ` SELECT
  87. art.*,
  88. (
  89. SELECT
  90. COUNT( 1 )
  91. FROM
  92. cygx_activity_special_signup AS s
  93. WHERE
  94. s.activity_id = art.activity_id
  95. AND s.user_id = ?
  96. ) AS is_signup
  97. FROM
  98. cygx_activity_special AS art
  99. WHERE
  100. 1 = 1 `
  101. if condition != "" {
  102. sql += condition
  103. }
  104. sql += ` LIMIT ?,? `
  105. _, err = o.Raw(sql, uid, pars, startSize, pageSize).QueryRows(&items)
  106. return
  107. }
  108. type GetCygxActivitySpecialDetailListResp struct {
  109. IsFollow bool `description:"是否关注新调研通知"`
  110. IsBindingMobile bool `description:"是否绑定了手机号"`
  111. Paging *paging.PagingItem `description:"分页数据"`
  112. List []*CygxActivitySpecialDetail
  113. }
  114. type CygxActivitySpecialResp struct {
  115. HasPermission int `description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下(ficc),3:无该品类权限,已提交过申请,4:无该品类权限,未提交过申请,5:潜在客户,未提交过申请,6:潜在客户,已提交过申请"`
  116. PopupMsg string `description:"权限弹窗信息"`
  117. SellerMobile string `description:"销售电话"`
  118. SellerName string `description:"销售姓名"`
  119. IsFollow bool `description:"是否关注新调研通知"`
  120. Detail *CygxActivitySpecialDetail
  121. }
  122. // 通过活动ID获取活动详情
  123. func GetCygxActivitySpecialDetailById(uid, ActivityId int) (item *CygxActivitySpecialDetail, err error) {
  124. o := orm.NewOrm()
  125. 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
  126. FROM
  127. cygx_activity_special AS a
  128. WHERE
  129. activity_id = ?
  130. AND publish_status = 1 AND is_offline = 0 `
  131. err = o.Raw(sql, uid, ActivityId).QueryRow(&item)
  132. return
  133. }
  134. type ActivityIdRep struct {
  135. ActivityId int `description:"活动id"`
  136. PlaySeconds int `description:"播放时长"`
  137. }
  138. // 通过活动ID获取活动详情
  139. func GetCygxActivitySpecialDetail(ActivityId int) (item *CygxActivitySpecialDetail, err error) {
  140. o := orm.NewOrm()
  141. sql := `SELECT * FROM cygx_activity_special WHERE activity_id=? AND publish_status = 1 `
  142. err = o.Raw(sql, ActivityId).QueryRow(&item)
  143. return
  144. }