activity.go 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "github.com/rdlucklib/rdluck_tools/paging"
  5. "strings"
  6. "time"
  7. )
  8. // 活动详情
  9. type CygxActivity struct {
  10. ActivityId int `orm:"column(activity_id);pk";description:"活动ID 等于0新增活动,大于0修改活动"`
  11. ActivityTypeId int `description:"活动类型id"`
  12. ActivityTypeName string `description:"活动类型名称"`
  13. ChartPermissionId int `description:"行业id"`
  14. ChartPermissionName string `description:"行业名称"`
  15. ChartPermissionNames string `description:"行业名称辅助字段,区分研选子分类"`
  16. Body string `description:"内容"`
  17. CreateTime time.Time `description:"创建时间"`
  18. PublishDate time.Time `description:"发布时间"`
  19. IsLimitPeople int `description:"是否限制人数 1是,0否"`
  20. LimitPeopleNum int `description:"限制的人数数量"`
  21. CustomerTypeIds string `description:"活动可见的客户类型,多个ID用 , 隔开"`
  22. PublishStatus int `description:"发布状态 1已发布,0未发布"`
  23. LastUpdatedTime time.Time `description:"更新时间"`
  24. ActivityTime string `description:"活动时间"`
  25. ActivityTimeText string `description:"活动时间带文字"`
  26. DistinguishedGuest string `description:"嘉宾"`
  27. Host string `description:"主持人"`
  28. MainlandTell string `description:"大陆拨入号"`
  29. HongKongTell string `description:"香港拨入号"`
  30. TaiwanTell string `description:"台湾拨入号"`
  31. AmericaTell string `description:"美国拨入号"`
  32. ParticipationCode string `description:"参会密码"`
  33. Theme string `description:"主题"`
  34. Expert string `description:"专家"`
  35. ActivityName string `description:"活动名称"`
  36. ActivityNameTask string `description:"活动名称定时任务同步的时候使用"`
  37. OnlineParticipation string `description:"网络参会"`
  38. ReportLink string `description:"报告链接"`
  39. City string `description:"城市"`
  40. Address string `description:"活动地址"`
  41. Highlights string `description:"活动亮点"`
  42. Remarks string `description:"备注"`
  43. Speaker string `description:"主讲人"`
  44. ArticleId int `description:"关联报告id"`
  45. Label string `description:"标签"`
  46. LinkParticipants string `description:"链接参会"`
  47. AppAttendance string `description:"App参会"`
  48. ConferencePassword string `description:"会议密码"`
  49. TemporaryLabel string `description:"临时标签"`
  50. IsMakerShow int `description:"是否仅决策人可见 0,否 、1,是"`
  51. VisibleRange int `description:"可见范围 1,仅本组可见 、2,全部客户可见"`
  52. Scale string `description:"管理规模,空不填,1::50亿以下,2:50~100亿,3:100亿以上。多个用, 隔开"`
  53. IsShowSubjectName int `description:"小程序内是否展示标的名称 1是 ,0 否 默认0 "`
  54. IsHideAppointment int `description:"是否隐藏预约纪要按钮 1是 ,0 否 默认0 "`
  55. AdminId int `description:"销售/管理员ID"`
  56. AdminName string `description:"销售/管理员姓名"`
  57. IsCanAppointmentMinutes int `description:"是否可预约纪要 1是 ,0 否 默认0 "`
  58. YidongActivityId string `description:"易董活动ID"`
  59. IsExternalLabel int `description:"是否为外部资源 1是,0否"`
  60. IsResearchPoints int `description:"是否为研选扣点"`
  61. }
  62. // 活动详情
  63. type ActivityDetail struct {
  64. ActivityId int `orm:"column(activity_id);pk";description:"活动ID "`
  65. ActivityTypeId int `description:"活动类型id"`
  66. ActivityTypeName string `description:"活动类型名称"`
  67. ChartPermissionId int `description:"行业id"`
  68. ChartPermissionName string `description:"行业名称"`
  69. ChartPermissionNames string `description:"行业名称辅助字段,区分研选子分类"`
  70. Body string `description:"内容"`
  71. CreateTime string `description:"创建时间"`
  72. IsLimitPeople int `description:"是否限制人数 1是,0否"`
  73. LimitPeopleNum int `description:"限制的人数数量"`
  74. LastUpdatedTime string `description:"更新时间"`
  75. ActivityTime string `description:"活动时间"`
  76. ActivityTimeText string `description:"活动时间带文字"`
  77. DistinguishedGuest string `description:"嘉宾"`
  78. Host string `description:"主持人"`
  79. Speaker string `description:"主讲人"`
  80. MainlandTell string `description:"大陆拨入号"`
  81. HongKongTell string `description:"香港拨入号"`
  82. TaiwanTell string `description:"台湾拨入号"`
  83. AmericaTell string `description:"美国拨入号"`
  84. ParticipationCode string `description:"参会密码"`
  85. Theme string `description:"主题"`
  86. Expert string `description:"专家"`
  87. ActivityName string `description:"活动名称"`
  88. OnlineParticipation string `description:"网络参会"`
  89. ReportLink string `description:"报告链接"`
  90. City string `description:"城市"`
  91. Address string `description:"活动地址"`
  92. Highlights string `description:"活动亮点"`
  93. Remarks string `description:"备注"`
  94. ShowType string `description:"人数限制类型,1不展示限制,2可选限制,3强制限制"`
  95. IsSignup int `description:"是否已报名 1是 ,0 否"`
  96. IsAppointment int `description:"是否已预约纪要 1是 ,0 否"`
  97. SignupNum int `description:"已报名人数"`
  98. SignupType int `description:"报名方式,1预约外呼,2自主拨入,3我要报名"`
  99. ActiveState string `description:"活动进行状态 未开始:1、进行中2、已结束3"`
  100. IsCancelMeetingReminder int `description:"是否取消会议提醒 1展示取消会议提醒 ,0展示会议提醒"`
  101. ArticleId int `description:"报告id(报告链接跳转使用)"`
  102. CustomerTypeIds string `description:"活动可见的客户类型,多个ID用 , 隔开"`
  103. IsShowSustainable bool `description:"是否展示限免标签"`
  104. Description string `description:"研选内容说明"`
  105. IsResearch bool `description:"是否属于研选"`
  106. LinkParticipants string `description:"链接参会"`
  107. AppAttendance string `description:"App参会"`
  108. ConferencePassword string `description:"会议密码"`
  109. Scale string `description:"管理规模,空不填,1::50亿以下,2:50~100亿,3:100亿以上。多个用, 隔开"`
  110. IsShowAppointment bool `description:"是否展示预约纪要"`
  111. IsHideAppointment int `description:"是否隐藏预约纪要按钮 1是,0 否"`
  112. IsCClassMeeting bool `description:"是否是c类电话会"`
  113. ArticleList []*ActivityArticleResp // 下面是列表添加的部分结构体
  114. IsBrackets int `description:"是否有方括号 1是 ,0 否"`
  115. Label string `description:"主题标签"`
  116. ImgUrl string `description:"图片链接"`
  117. ImgUrlText string `description:"图片链接文字"`
  118. ActivityType int `description:"活动线上线下类型 1线上,0 线下"`
  119. JmcjRoadshowTitle string `description:"进门财经手动匹配的活动名称"`
  120. Listndustrial []*IndustrialManagementRep `description:"活动关联的产业信息"`
  121. IsShowOutboundCall bool `description:"是否展示预约外呼"`
  122. IsShowMeetingReminder bool `description:"是否展示会议提醒"`
  123. IsShowHelpSsk bool `description:"是否展示帮我带问"`
  124. IsShowSignup bool `description:"是否展示我要报名"`
  125. IsShowDetails bool `description:"是否展示查看详情按钮"`
  126. TemporaryLabel string `description:"临时标签"`
  127. IsCanAppointmentMinutes int `description:"是否可预约纪要 1是 ,0 否 默认0 "`
  128. YidongActivityId string `description:"易董活动ID"`
  129. IsYidongActivity bool `description:"是否属于易董同步过来的活动"`
  130. YidongActivityUrl string `description:"易董活动跳转地址"`
  131. AudioLink bool `description:"是否展示回放按钮"`
  132. VoiceList *CygxActivityVoiceReq `description:"音频数据"`
  133. AdminId int `description:"管理员、销售ID "`
  134. IsMakerShow int `description:"是否仅决策人可见 0,否 、1,是"`
  135. VisibleRange int `description:"可见范围 1,仅本组可见 、2,全部客户可见"`
  136. VideoDetail *CygxActivityVideoListResp `description:"视频数据"`
  137. FileType int `description:"类型: 1-音频; 2-视频"`
  138. SourceType int `description:"活动来源。 1:活动 、2:专项产业调研"`
  139. TripImgLink string `description:"专项产业调研行程链接"`
  140. ActivityTimeEnd string `description:"专项产业调研活动预期结束时间"`
  141. AuthInfo *UserPermissionAuthInfo `description:"用户查看视频的权限"`
  142. Days int `description:"调研天数"`
  143. Title string `description:"标题"`
  144. IsYidongConduct bool `description:"是否属于易董办会 1:是 、0:否"`
  145. IsCanOutboundCall int `description:"是否提供外呼 1:是 、0:否"`
  146. TencentConferenceNumber string `description:"腾讯会议号"`
  147. IsResearchSpecial bool `description:"是否属于特殊的研选"`
  148. IsNeedEmail int `description:"是否需要提供邮箱 1是,0否"`
  149. SiginupDeadline string `description:"报名截止时间"`
  150. IsExternalLabel bool `description:"是否为外部资源"`
  151. IsResearchPoints bool `description:"是否为研选扣点"`
  152. CancelDeadline string `description:"取消报名截止时间"`
  153. ChartPermissionNameDeputy string `description:"副行业名称"`
  154. TopTime int `description:"置顶时间"`
  155. IsZoom int `description:"是否是Zoom模版 1是,0否"`
  156. MeetingId string `description:"会议ID"`
  157. }
  158. // 活动详情
  159. type ActivityListResp struct {
  160. ActivityId int `description:"活动ID "`
  161. ActivityTypeId int `description:"活动类型id"`
  162. ActivityTypeName string `description:"活动类型名称"`
  163. ChartPermissionId int `description:"行业id"`
  164. ChartPermissionName string `description:"行业名称"`
  165. IsLimitPeople int `description:"是否限制人数 1是,0否"`
  166. LimitPeopleNum int `description:"限制的人数数量"`
  167. LastUpdatedTime string `description:"更新时间"`
  168. ActivityTime string `description:"活动时间"`
  169. ActivityTimeText string `description:"活动时间带文字"`
  170. DistinguishedGuest string `description:"嘉宾"`
  171. Host string `description:"主持人"`
  172. Speaker string `description:"主讲人"`
  173. MainlandTell string `description:"大陆拨入号"`
  174. HongKongTell string `description:"香港拨入号"`
  175. TaiwanTell string `description:"台湾拨入号"`
  176. AmericaTell string `description:"美国拨入号"`
  177. ParticipationCode string `description:"参会密码"`
  178. Theme string `description:"主题"`
  179. Expert string `description:"专家"`
  180. ActivityName string `description:"活动名称"`
  181. OnlineParticipation string `description:"网络参会"`
  182. ReportLink string `description:"报告链接"`
  183. LinkParticipants string `description:"链接参会"`
  184. AppAttendance string `description:"App参会"`
  185. ConferencePassword string `description:"会议密码"`
  186. City string `description:"城市"`
  187. Address string `description:"活动地址"`
  188. Highlights string `description:"活动亮点"`
  189. Remarks string `description:"备注"`
  190. IsSignup int `description:"是否已报名 1是 ,0 否"`
  191. SignupNum int `description:"已报名人数"`
  192. IsAppointment int `description:"是否已预约纪要 1是 ,0 否"`
  193. IsCancelMeetingReminder int `description:"是否添加了消息消息提醒 1是 ,0 否"`
  194. ActiveState string `description:"活动进行状态 未开始:1、进行中2、已结束3"`
  195. IsShowSustainable bool `description:"是否展示限免标签"`
  196. Description string `description:"研选内容说明"`
  197. IsResearch bool `description:"是否属于研选"`
  198. IsHideAppointment int `description:"是否隐藏预约纪要按钮 1是,0 否"`
  199. IsCClassMeeting bool `description:"是否是c类电话会"`
  200. Label string `description:"主题标签"`
  201. ImgUrl string `description:"行业图片链接"`
  202. ImgUrlText string `description:"活动类型图片链接"`
  203. ActivityType int `description:"活动线上线下类型 1线上,0 线下"`
  204. IsShowOutboundCall bool `description:"是否展示预约外呼"`
  205. IsShowMeetingReminder bool `description:"是否展示会议提醒"`
  206. IsShowHelpSsk bool `description:"是否展示帮我带问"`
  207. IsShowSignup bool `description:"是否展示我要报名"`
  208. IsShowAppointment bool `description:"是否展示预约纪要"`
  209. IsShowDetails bool `description:"是否展示查看详情按钮"`
  210. AudioLink bool `description:"是否展示回放按钮"`
  211. VoiceDetail *CygxActivityVoiceReq `description:"音频数据"`
  212. VideoDetail *CygxActivityVideoListResp `description:"视频数据"`
  213. FileType int `description:"类型: 1-音频; 2-视频"`
  214. SourceType int `description:"活动来源。 1:活动 、2:专项产业调研"`
  215. YidongActivityUrl string `description:"易董活动跳转地址"`
  216. ArticleList []*ActivityArticleResp
  217. Listndustrial []*IndustrialManagementRep `description:"活动关联的产业信息"`
  218. AuthInfo *UserPermissionAuthInfo `description:"用户查看视频的权限"`
  219. Explain string `description:"活动右上角提示"`
  220. TripImgLink string `description:"专项产业调研行程链接"`
  221. IsTrip int `description:"是否报名 1是 ,0 否"`
  222. TripStatus int `description:"行程进行状态 1:预报名,2:确定行程"`
  223. Days int `description:"调研天数"`
  224. SignupType int `description:"报名方式,1预约外呼,2自主拨入,3我要报名"`
  225. IsYidongConduct bool `description:"是否属于易董办会 1:是 、0:否"`
  226. IsCanOutboundCall int `description:"是否提供外呼 1:是 、0:否"`
  227. TencentConferenceNumber string `description:"腾讯会议号"`
  228. IsResearchSpecial bool `description:"是否属于特殊的研选"`
  229. IsExternalLabel bool `description:"是否为外部资源"`
  230. IsResearchPoints bool `description:"是否为研选扣点"`
  231. SiginupDeadline string `description:"报名截止时间"`
  232. CancelDeadline string `description:"取消报名截止时间"`
  233. IsYidongActivity bool `description:"是否属于易董同步过来的活动"`
  234. TopTime int `description:"置顶时间"`
  235. ShareImg string `description:"分享图片"`
  236. IsZoom int `description:"是否是Zoom模版 1是,0否"`
  237. MeetingId string `description:"会议ID"`
  238. }
  239. type ActivityCheck struct {
  240. CheckPermission bool `description:"权限是否通过校验"`
  241. HasPermission int `description:"操作方式,1:有该行业权限,正常展示,2:无该行业权限,3:潜在客户,未提交过申请,4:潜在客户,已提交过申请"`
  242. PopupMsg string `description:"权限弹窗信息"`
  243. CancelPopupMsg string `description:"取消报名时间弹窗信息"`
  244. SellerMobile string `description:"销售电话"`
  245. SellerName string `description:"销售姓名"`
  246. Mobile string `description:"手机号"`
  247. IsResearch bool `description:"是否属于研选"`
  248. IsResearchSpecial bool `description:"是否属于特殊的研选"`
  249. CheckTime bool `description:"时间是否通过校验"`
  250. CheckEmail bool `description:"邮箱是否通过校验"`
  251. CheckPoints bool `description:"扣点是否通过校验"`
  252. CompanyPoints string `description:"公司剩余点数"`
  253. ActivityPoints string `description:"本场活动要扣除的点数"`
  254. }
  255. type ActivityArticleResp struct {
  256. ReportLink string `description:"报告链接"`
  257. Title string `description:"报告标题"`
  258. ArticleId int `description:"报告id(报告链接跳转使用)"`
  259. }
  260. type CygxActivityResp struct {
  261. HasPermission int `description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下(ficc),3:无该品类权限,已提交过申请,4:无该品类权限,未提交过申请,5:潜在客户,未提交过申请,6:潜在客户,已提交过申请"`
  262. PopupMsg string `description:"权限弹窗信息"`
  263. SellerMobile string `description:"销售电话"`
  264. SellerName string `description:"销售姓名"`
  265. IsResearch bool `description:"是否属于研选"`
  266. IsResearchSpecial bool `description:"是否属于特殊的研选"`
  267. Detail *ActivityListResp
  268. }
  269. type CygxYidongActivityUrlResp struct {
  270. HasPermission int `description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下(ficc),3:无该品类权限,已提交过申请,4:无该品类权限,未提交过申请,5:潜在客户,未提交过申请,6:潜在客户,已提交过申请"`
  271. PopupMsg string `description:"权限弹窗信息"`
  272. SellerMobile string `description:"销售电话"`
  273. SellerName string `description:"销售姓名"`
  274. IsResearch bool `description:"是否属于研选"`
  275. IsResearchSpecial bool `description:"是否属于特殊的研选"`
  276. YidongActivityUrl string `description:"易董活动跳转地址"`
  277. }
  278. // 列表
  279. func GetCygxActivityList(condition string, pars []interface{}, sortTime string, startSize, pageSize int) (items []*CygxActivity, err error) {
  280. o := orm.NewOrm()
  281. sql := `SELECT activity_id,chart_permission_id, city, label,temporary_label,is_show_subject_name, MAX( art.activity_time ) AS timesort, MIn( art.activity_time ) AS mintimesort , yidong_activity_id , activity_type_id,is_external_label,is_research_points
  282. FROM cygx_activity as art WHERE 1= 1 `
  283. if condition != "" {
  284. sql += condition
  285. }
  286. sql += ` GROUP BY art.activity_id ORDER BY ` + sortTime + ` ,art.activity_id DESC LIMIT ?,? `
  287. _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
  288. return
  289. }
  290. // 通过纪要ID获取活动详情
  291. func GetAddActivityInfoById(ActivityId int) (item *ActivityDetail, err error) {
  292. o := orm.NewOrm()
  293. sql := `SELECT * FROM cygx_activity WHERE activity_id=? AND publish_status = 1 `
  294. err = o.Raw(sql, ActivityId).QueryRow(&item)
  295. return
  296. }
  297. // 获取数量
  298. func GetActivityCount(condition string, playBack int, pars []interface{}, filter int) (count int, err error) {
  299. var sqlJiontable string
  300. if playBack == 1 {
  301. //sqlJiontable = ` INNER JOIN cygx_activity_voice AS ac ON ac.activity_id = art.activity_id `
  302. }
  303. if filter == 1 {
  304. sqlJiontable = ` INNER JOIN cygx_activity_video AS av ON av.activity_id = art.activity_id `
  305. } else if filter == 2 {
  306. sqlJiontable = ` INNER JOIN cygx_activity_voice AS ac ON ac.activity_id = art.activity_id `
  307. }
  308. sqlCount := ` SELECT COUNT(1) AS count FROM cygx_activity as art ` + sqlJiontable + ` WHERE 1= 1 `
  309. if condition != "" {
  310. sqlCount += condition
  311. }
  312. o := orm.NewOrm()
  313. err = o.Raw(sqlCount, pars).QueryRow(&count)
  314. return
  315. }
  316. func GetActivityListNew(condition string, pars []interface{}, uid, startSize, pageSize, playBack, filter int, typeName string) (items []*ActivityDetail, err error) {
  317. var sqlJiontable string
  318. if playBack == 1 {
  319. //sqlJiontable = ` INNER JOIN cygx_activity_voice AS ac ON ac.activity_id = art.activity_id `
  320. }
  321. if filter == 1 {
  322. sqlJiontable = ` INNER JOIN cygx_activity_video AS av ON av.activity_id = art.activity_id `
  323. } else if filter == 2 {
  324. sqlJiontable = ` INNER JOIN cygx_activity_voice AS ac ON ac.activity_id = art.activity_id `
  325. }
  326. o := orm.NewOrm()
  327. sql := `SELECT art.* ,t.activity_type,t.img_url_text,1 AS source_type,
  328. ( SELECT COUNT( 1 ) FROM cygx_activity_signup AS s WHERE s.activity_id = art.activity_id AND s.user_id = ? AND s.is_cancel = 0 AND s.do_fail_type = 0) AS is_signup,
  329. ( SELECT COUNT( DISTINCT user_id ) FROM cygx_activity_signup AS s WHERE s.activity_id = art.activity_id AND s.is_cancel = 0 AND s.do_fail_type = 0) AS signup_num,
  330. ( SELECT COUNT( 1 ) FROM cygx_activity_meeting_reminder AS m WHERE m.activity_id = art.activity_id AND m.user_id = ? AND m.is_cancel = 0 ) AS is_cancel_meeting_reminder,
  331. ( SELECT COUNT( 1 ) FROM cygx_activity_appointment AS ap WHERE ap.activity_id = art.activity_id AND ap.user_id = ? ) AS is_appointment
  332. FROM cygx_activity as art
  333. INNER JOIN cygx_activity_type as t ON t.activity_type_id = art.activity_type_id ` + sqlJiontable + ` WHERE 1= 1 `
  334. if condition != "" {
  335. sql += condition
  336. }
  337. sql += ` LIMIT ?,?`
  338. if typeName != "" {
  339. typeSlice := strings.Split(typeName, ",")
  340. tempCondition := ""
  341. for _, s := range typeSlice {
  342. if s == "1" {
  343. tempCondition += "'专家电话会',"
  344. } else if s == "2" {
  345. tempCondition += "'分析师电话会',"
  346. } else if s == "1,2" {
  347. tempCondition += "'专家电话会','分析师电话会',"
  348. }
  349. }
  350. tempCondition = strings.TrimRight(tempCondition, ",")
  351. sql = `SELECT * FROM(` + sql + `) AS t WHERE t.activity_type_name IN (` + tempCondition + `)`
  352. }
  353. _, err = o.Raw(sql, uid, uid, uid, pars, startSize, pageSize).QueryRows(&items)
  354. return
  355. }
  356. // 列表
  357. func GetActivityListHomeNew(condition string, startSize, pageSize int) (items []*ActivityDetail, err error) {
  358. o := orm.NewOrm()
  359. sql := `SELECT activity_id
  360. FROM cygx_activity as art
  361. INNER JOIN cygx_activity_type as t ON t.activity_type_id = art.activity_type_id WHERE 1= 1 `
  362. if condition != "" {
  363. sql += condition
  364. }
  365. sql += ` LIMIT ?,?`
  366. _, err = o.Raw(sql, startSize, pageSize).QueryRows(&items)
  367. return
  368. }
  369. type GetCygxActivityListRep struct {
  370. Paging *paging.PagingItem `description:"分页数据"`
  371. List []*ActivityListResp
  372. Label string `description:"主题"`
  373. ImgUrl string `description:"图片路径"`
  374. IsResearch bool `description:"是否属于研选"`
  375. IsJump bool `description:"是否跳转"`
  376. IndustrialManagementId int `description:"产业ID"`
  377. IndustryNewLabel bool `description:"产业是否新标签"`
  378. ChartPermissionId int `description:"权限id"`
  379. IsShowResearchPoints bool `description:"是否展示研选扣点搜索"`
  380. }
  381. type GetCygxActivityListSearchResp struct {
  382. Paging *paging.PagingItem `description:"分页数据"`
  383. List []*ActivityDetail
  384. Label string `description:"主题"`
  385. ImgUrl string `description:"图片路径"`
  386. IsResearch bool `description:"是否属于研选"`
  387. IsJump bool `description:"是否跳转"`
  388. IndustrialManagementId int `description:"产业ID"`
  389. IndustryNewLabel bool `description:"产业是否新标签"`
  390. ChartPermissionId int `description:"权限id"`
  391. }
  392. // 通过纪要ID获取活动详情
  393. func GetAddActivityInfoByIdShow(uid, ActivityId int) (item *ActivityDetail, err error) {
  394. o := orm.NewOrm()
  395. sql := `SELECT *,( SELECT COUNT( 1 ) FROM cygx_activity_signup AS s WHERE s.activity_id = a.activity_id AND s.user_id = ? AND s.is_cancel = 0 AND s.do_fail_type = 0) AS is_signup,
  396. ( SELECT COUNT( DISTINCT user_id ) FROM cygx_activity_signup AS s WHERE s.activity_id = a.activity_id AND s.is_cancel = 0 AND s.do_fail_type = 0) AS signup_num,
  397. ( SELECT COUNT( 1 ) FROM cygx_activity_meeting_reminder AS m WHERE m.activity_id = a.activity_id AND m.user_id = ? AND m.is_cancel = 0 ) AS is_cancel_meeting_reminder,
  398. ( SELECT COUNT( 1 ) FROM cygx_activity_appointment AS ap WHERE ap.activity_id = a.activity_id AND ap.user_id = ? ) AS is_appointment
  399. FROM cygx_activity AS a WHERE activity_id=? AND publish_status = 1 `
  400. err = o.Raw(sql, uid, uid, uid, ActivityId).QueryRow(&item)
  401. return
  402. }
  403. // GetActivitySpecialSearcheList 活动与专项调研的搜索
  404. func GetActivitySpecialSearcheList(condition string, pars []interface{}, conditionSpecil string, parsSpecil []interface{}, startSize, pageSize int) (items []*ActivityDetail, total int, err error) {
  405. o := orm.NewOrm()
  406. sql := `SELECT
  407. art.activity_id,
  408. art.activity_time_text,
  409. art.activity_name,
  410. art.chart_permission_id,
  411. art.active_state,
  412. t.activity_type,
  413. art.chart_permission_name,
  414. art.distinguished_guest,
  415. art.expert,
  416. art.speaker,
  417. "" AS trip_img_link,
  418. "" AS activity_time_end,
  419. art.yidong_activity_id,
  420. art.is_can_appointment_minutes,
  421. art.activity_type_id,
  422. art.limit_people_num,
  423. art.is_limit_people,
  424. 1 AS source_type,
  425. t.img_url_text,
  426. art.is_yidong_conduct,
  427. art.is_can_outbound_call,
  428. art.city,
  429. art.is_research_points,
  430. art.siginup_deadline,
  431. art.cancel_deadline,
  432. art.activity_time
  433. FROM
  434. cygx_activity AS art
  435. INNER JOIN cygx_activity_type AS t ON t.activity_type_id = art.activity_type_id
  436. WHERE
  437. 1 = 1 `
  438. if condition != `` {
  439. sql += condition
  440. }
  441. sql += ` UNION ALL
  442. SELECT
  443. art.activity_id,
  444. art.activity_time_text_by_day AS activity_time_text,
  445. art.research_theme AS activity_name,
  446. art.chart_permission_id,
  447. "",
  448. art.special_type AS activity_type,
  449. art.chart_permission_name,
  450. "",
  451. "",
  452. "",
  453. art.trip_img_link_fix AS trip_img_link,
  454. art.activity_time_end,
  455. "",
  456. "",
  457. "",
  458. "",
  459. "",
  460. 2 AS source_type,
  461. "",
  462. "",
  463. "",
  464. "",
  465. "",
  466. "",
  467. "",
  468. art.activity_time
  469. FROM
  470. cygx_activity_special AS art
  471. WHERE
  472. 1 = 1 `
  473. if conditionSpecil != "" {
  474. sql += conditionSpecil
  475. }
  476. totalSql := `SELECT COUNT(1) total FROM (` + sql + `) z `
  477. err = o.Raw(totalSql, pars, parsSpecil).QueryRow(&total)
  478. if err != nil {
  479. return
  480. }
  481. sql += ` ORDER BY activity_time DESC LIMIT ?,?`
  482. _, err = o.Raw(sql, pars, parsSpecil, startSize, pageSize).QueryRows(&items)
  483. return
  484. }
  485. // 获取我的日程数量
  486. func GetScheduleCount(condition string, uid int) (count int, err error) {
  487. o := orm.NewOrm()
  488. sqlCount := `SELECT COUNT( 1 ) AS count
  489. FROM cygx_my_schedule AS m
  490. INNER JOIN cygx_activity AS art ON art.activity_id = m.activity_id
  491. WHERE
  492. user_id = ?`
  493. if condition != "" {
  494. sqlCount += condition
  495. }
  496. err = o.Raw(sqlCount, uid).QueryRow(&count)
  497. return
  498. }
  499. // 获取我的日程数量
  500. func GetSpecialScheduleCount(uid int) (count int, err error) {
  501. o := orm.NewOrm()
  502. sqlCount := `
  503. SELECT COUNT( 1 ) AS count FROM
  504. cygx_activity_special AS art
  505. INNER JOIN cygx_activity_special_trip AS my ON my.activity_id = art.activity_id
  506. WHERE
  507. 1 = 1 AND my.user_id = ? AND my.is_cancel = 0`
  508. err = o.Raw(sqlCount, uid).QueryRow(&count)
  509. return
  510. }
  511. // 我的日程列表
  512. func GetScheduleList(condition string, pars []interface{}, uid, startSize, pageSize int) (items []*ActivityDetail, err error) {
  513. o := orm.NewOrm()
  514. sql := `SELECT art.*,t.activity_type,t.img_url_text,
  515. ( SELECT COUNT( 1 ) FROM cygx_activity_signup AS s WHERE s.activity_id = art.activity_id AND s.user_id = ? AND s.is_cancel = 0 AND s.do_fail_type = 0) AS is_signup,
  516. ( SELECT COUNT( DISTINCT user_id ) FROM cygx_activity_signup AS s WHERE s.activity_id = art.activity_id AND s.is_cancel = 0 AND s.do_fail_type = 0) AS signup_num ,
  517. ( SELECT COUNT( 1 ) FROM cygx_activity_appointment AS ap WHERE ap.activity_id = art.activity_id AND ap.user_id = ? ) AS is_appointment,
  518. ( SELECT COUNT( 1 ) FROM cygx_activity_meeting_reminder AS m WHERE m.activity_id = art.activity_id AND m.is_cancel = 0 AND m.user_id = ? ) AS is_cancel_meeting_reminder,
  519. 1 AS source_type
  520. FROM cygx_activity AS art
  521. INNER JOIN cygx_my_schedule as my ON my.activity_id = art.activity_id
  522. INNER JOIN cygx_activity_type as t ON t.activity_type_id = art.activity_type_id
  523. WHERE 1=1 AND my.user_id = ? `
  524. if condition != "" {
  525. sql += condition
  526. }
  527. sql += ` ORDER BY art.active_state ASC,art.activity_time ASC LIMIT ?,?`
  528. _, err = o.Raw(sql, pars, uid, uid, uid, uid, startSize, pageSize).QueryRows(&items)
  529. return
  530. }
  531. // 我的日程列表 活动以及专项调研一起
  532. func GetScheduleAndSpecilList(condition string, pars []interface{}, conditionSpecil string, parsSpecil []interface{}, startSize, pageSize int) (items []*ActivityDetail, err error) {
  533. o := orm.NewOrm()
  534. sql := `SELECT
  535. art.activity_id,
  536. art.activity_time_text,
  537. art.activity_name,
  538. art.chart_permission_id,
  539. art.active_state,
  540. t.activity_type,
  541. art.chart_permission_name,
  542. art.distinguished_guest,
  543. art.expert,
  544. art.speaker,
  545. "" AS trip_img_link,
  546. "" AS activity_time_end,
  547. art.yidong_activity_id,
  548. art.is_can_appointment_minutes,
  549. art.activity_type_id,
  550. art.limit_people_num,
  551. art.is_limit_people,
  552. 1 AS source_type,
  553. art.activity_time,
  554. 0 AS days,
  555. art.city AS city,
  556. art.is_external_label,
  557. art.is_yidong_conduct,
  558. art.is_can_outbound_call,
  559. art.is_research_points,
  560. art.cancel_deadline,
  561. art.is_zoom,
  562. art.host
  563. FROM
  564. cygx_activity AS art
  565. INNER JOIN cygx_my_schedule AS my ON my.activity_id = art.activity_id
  566. INNER JOIN cygx_activity_type AS t ON t.activity_type_id = art.activity_type_id
  567. WHERE
  568. 1 = 1 `
  569. if condition != `` {
  570. sql += condition
  571. }
  572. sql += ` UNION ALL
  573. SELECT
  574. art.activity_id,
  575. art.activity_time_text_by_day AS activity_time_text,
  576. art.research_theme AS activity_name,
  577. art.chart_permission_id,
  578. "",
  579. art.special_type AS activity_type,
  580. art.chart_permission_name,
  581. "",
  582. "",
  583. "",
  584. art.trip_img_link_fix AS trip_img_link,
  585. art.activity_time_end,
  586. "",
  587. "",
  588. "",
  589. "",
  590. "",
  591. 2 AS source_type,
  592. art.activity_time,
  593. art.days,
  594. art.city,
  595. "",
  596. "",
  597. "",
  598. "",
  599. "",
  600. "",
  601. art.host
  602. FROM
  603. cygx_activity_special AS art
  604. INNER JOIN cygx_activity_special_trip AS my ON my.activity_id = art.activity_id
  605. WHERE
  606. 1 = 1`
  607. if conditionSpecil != "" {
  608. sql += conditionSpecil
  609. }
  610. sql += ` ORDER BY activity_time DESC LIMIT ?,?`
  611. _, err = o.Raw(sql, pars, parsSpecil, startSize, pageSize).QueryRows(&items)
  612. return
  613. }
  614. // 列表
  615. func GetActivityListByCondition(condition string, pars []interface{}) (items []*CygxActivity, err error) {
  616. o := orm.NewOrm()
  617. sql := `SELECT * FROM cygx_activity WHERE 1 =1 `
  618. if condition != "" {
  619. sql += condition
  620. }
  621. _, err = o.Raw(sql, pars).QueryRows(&items)
  622. return
  623. }