activity.go 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "github.com/rdlucklib/rdluck_tools/paging"
  5. "hongze/hongze_mfyx/models/order"
  6. "strings"
  7. "time"
  8. )
  9. // 活动详情
  10. type CygxActivity struct {
  11. ActivityId int `orm:"column(activity_id);pk";description:"活动ID 等于0新增活动,大于0修改活动"`
  12. ActivityTypeId int `description:"活动类型id"`
  13. ActivityTypeName string `description:"活动类型名称"`
  14. ChartPermissionId int `description:"行业id"`
  15. ChartPermissionName string `description:"行业名称"`
  16. ChartPermissionNames string `description:"行业名称辅助字段,区分研选子分类"`
  17. IsShowHz int `description:"是否同时在弘则展示 1是,0否"`
  18. ChartPermissionIdDeputy int `description:"行业id"`
  19. ChartPermissionNameDeputy string `description:"副行业名称"`
  20. Body string `description:"内容"`
  21. CreateTime time.Time `description:"创建时间"`
  22. IsLimitPeople int `description:"是否限制人数 1是,0否"`
  23. LimitPeopleNum int `description:"限制的人数数量"`
  24. CustomerTypeIds string `description:"活动可见的客户类型,多个ID用 , 隔开"`
  25. PublishStatus int `description:"发布状态 1已发布,0未发布"`
  26. LastUpdatedTime time.Time `description:"更新时间"`
  27. ActivityTime string `description:"活动时间"`
  28. ActivityTimeText string `description:"活动时间带文字"`
  29. DistinguishedGuest string `description:"嘉宾"`
  30. Host string `description:"主持人"`
  31. MainlandTell string `description:"大陆拨入号"`
  32. HongKongTell string `description:"香港拨入号"`
  33. TaiwanTell string `description:"台湾拨入号"`
  34. AmericaTell string `description:"美国拨入号"`
  35. ParticipationCode string `description:"参会密码"`
  36. Theme string `description:"主题"`
  37. Expert string `description:"专家"`
  38. ActivityName string `description:"活动名称"`
  39. ActivityNameTask string `description:"活动名称定时任务同步的时候使用"`
  40. OnlineParticipation string `description:"网络参会"`
  41. ReportLink string `description:"报告链接"`
  42. City string `description:"城市"`
  43. Address string `description:"活动地址"`
  44. Highlights string `description:"活动亮点"`
  45. Remarks string `description:"备注"`
  46. Speaker string `description:"主讲人"`
  47. ArticleId int `description:"关联报告id"`
  48. Label string `description:"标签"`
  49. LinkParticipants string `description:"链接参会"`
  50. AppAttendance string `description:"App参会"`
  51. ConferencePassword string `description:"会议密码"`
  52. TemporaryLabel string `description:"临时标签"`
  53. IsMakerShow int `description:"是否仅决策人可见 0,否 、1,是"`
  54. VisibleRange int `description:"可见范围 1,仅本组可见 、2,全部客户可见"`
  55. Scale string `description:"管理规模,空不填,1::50亿以下,2:50~100亿,3:100亿以上。多个用, 隔开"`
  56. IsShowSubjectName int `description:"小程序内是否展示标的名称 1是 ,0 否 默认0 "`
  57. IsHideAppointment int `description:"是否隐藏预约纪要按钮 1是 ,0 否 默认0 "`
  58. AdminId int `description:"销售/管理员ID"`
  59. AdminName string `description:"销售/管理员姓名"`
  60. IsCanAppointmentMinutes int `description:"是否可预约纪要 1是 ,0 否 默认0 "`
  61. YidongActivityId string `description:"易董活动ID"`
  62. YidongActivityUrl string `description:"易董活动跳转地址"`
  63. YidongActivityEndTime string `description:"易董活动截止时间"`
  64. ActivityJoinType string `description:"活动入会类型01报名审核后可入会 02预约即可入会 03仅定向邀请人员可入会"`
  65. YidongSignUpEnd string `description:"易董活动截止时间"` // 报名结束时间,适应于报名审核后可入会,为空表示不限制报名时间
  66. YidongSignUpStart string `description:"易董活动截止时间"` // 报名开始时间,适应于报名审核后可入会,为空表示不限制报名时间
  67. IsExternalLabel int `description:"是否为外部资源 1是,0否"`
  68. YidongActivityIdByCygx string `description:"通过查研观向建会易董返回的活动ID"`
  69. JmcjRoadshowTitle string `description:"进门财经的活动标题"`
  70. JmcjActivityId string `description:"进门财经的活动ID"`
  71. }
  72. type ActivityCheck struct {
  73. CheckPermission bool `description:"权限是否通过校验"`
  74. HasPermission int `description:"操作方式,1:有该行业权限,正常展示,2:无该行业权限,3:潜在客户,未提交过申请,4:潜在客户,已提交过申请"`
  75. PopupMsg string `description:"权限弹窗信息"`
  76. CancelPopupMsg string `description:"取消报名时间弹窗信息"`
  77. SellerMobile string `description:"销售电话"`
  78. SellerName string `description:"销售姓名"`
  79. Mobile string `description:"手机号"`
  80. IsResearch bool `description:"是否属于研选"`
  81. IsResearchSpecial bool `description:"是否属于特殊的研选"`
  82. CheckTime bool `description:"时间是否通过校验"`
  83. CheckEmail bool `description:"邮箱是否通过校验"`
  84. CheckPoints bool `description:"扣点是否通过校验"`
  85. CheckSiginUpNum bool `description:"报名人数是否通过校验"`
  86. CompanyPoints string `description:"公司剩余点数"`
  87. ActivityPoints string `description:"本场活动要扣除的点数"`
  88. PopupPriceMsg string `description:"价格弹窗信息"`
  89. IsShowWxPay bool `description:"是否展示微信支付"`
  90. IsCompanyApply bool `description:"机构是否申请过试用"`
  91. IsNeedBusinessCard bool `description:"是否需要上传名片"`
  92. GoodsList []*order.CygxGoodsResp `description:"商品信息"`
  93. IsPayActivity bool `description:"是否是花钱购买的单场活动"`
  94. }
  95. type ActivityIdRep struct {
  96. ActivityId int `description:"活动id"`
  97. PlaySeconds int `description:"播放时长"`
  98. }
  99. type ActivitySingnupRep struct {
  100. ActivityId int `description:"活动id"`
  101. SignupType int `description:"报名方式,1预约外呼,2自主拨入,3我要报名"`
  102. }
  103. type ActivityCcustomerType struct {
  104. CustomerTypeId int `description:"活动类型id"`
  105. CustomerName string `description:"活动名称"`
  106. PermissionValue string `description:"用户权限对应的值"`
  107. }
  108. type ActivityCcustomerTypeList struct {
  109. List []*ActivityCcustomerType
  110. }
  111. // 列表
  112. func GetActivityCcustomerTypeList() (items []*ActivityCcustomerType, err error) {
  113. o := orm.NewOrm()
  114. sql := `SELECT * FROM cygx_customer_type ORDER BY sort DESC`
  115. _, err = o.Raw(sql).QueryRows(&items)
  116. return
  117. }
  118. // 活动添加、修改入参
  119. type ActivityRep struct {
  120. ActivityTypeId int `description:"活动类型id"`
  121. ChartPermissionId int `description:"行业id"`
  122. Body string `description:"内容"`
  123. LimitPeopleNum int `description:"限制的人数数量"`
  124. CustomerTypeIds string `description:"活动可见的客户类型,多个ID用 , 隔开"`
  125. ActivityId int `description:"活动ID 等于0新增活动,大于0修改活动"`
  126. DoType int `description:"操作类型 0,保存 、1,发布"`
  127. }
  128. type ActivityArticleResp struct {
  129. ReportLink string `description:"报告链接"`
  130. ArticleId int `description:"报告id(报告链接跳转使用)"`
  131. Title string `description:"报告id(报告链接跳转使用)"`
  132. }
  133. // 活动详情
  134. type ActivityDetail struct {
  135. ActivityId int `orm:"column(activity_id);pk";description:"活动ID "`
  136. ActivityTypeId int `description:"活动类型id"`
  137. PublishStatus int `description:"发布状态,0未发布,1已发布"`
  138. ActivityTypeName string `description:"活动类型名称"`
  139. ChartPermissionId int `description:"行业id"`
  140. ChartPermissionName string `description:"行业名称"`
  141. ChartPermissionNames string `description:"行业名称辅助字段,区分研选子分类"`
  142. Body string `description:"内容"`
  143. CreateTime string `description:"创建时间"`
  144. IsLimitPeople int `description:"是否限制人数 1是,0否"`
  145. LimitPeopleNum int `description:"限制的人数数量"`
  146. LastUpdatedTime string `description:"更新时间"`
  147. ActivityTime string `description:"活动时间"`
  148. ActivityTimeText string `description:"活动时间带文字"`
  149. DistinguishedGuest string `description:"嘉宾"`
  150. Host string `description:"主持人"`
  151. Speaker string `description:"主讲人"`
  152. MainlandTell string `description:"大陆拨入号"`
  153. HongKongTell string `description:"香港拨入号"`
  154. TaiwanTell string `description:"台湾拨入号"`
  155. AmericaTell string `description:"美国拨入号"`
  156. ParticipationCode string `description:"参会密码"`
  157. Theme string `description:"主题"`
  158. Expert string `description:"专家"`
  159. ActivityName string `description:"活动名称"`
  160. OnlineParticipation string `description:"网络参会"`
  161. ReportLink string `description:"报告链接"`
  162. City string `description:"城市"`
  163. Address string `description:"活动地址"`
  164. Highlights string `description:"活动亮点"`
  165. Remarks string `description:"备注"`
  166. ShowType string `description:"人数限制类型,1不展示限制,2可选限制,3强制限制"`
  167. IsSignup int `description:"是否已报名 1是 ,0 否"`
  168. IsAppointment int `description:"是否已预约纪要 1是 ,0 否"`
  169. SignupNum int `description:"已报名人数"`
  170. SignupType int `description:"报名方式,1预约外呼,2自主拨入,3我要报名"`
  171. ActiveState string `description:"活动进行状态 未开始:1、进行中2、已结束3"`
  172. IsCancelMeetingReminder int `description:"是否取消会议提醒 1展示取消会议提醒 ,0展示会议提醒"`
  173. ArticleId int `description:"报告id(报告链接跳转使用)"`
  174. CustomerTypeIds string `description:"活动可见的客户类型,多个ID用 , 隔开"`
  175. IsShowSustainable bool `description:"是否展示限免标签"`
  176. Description string `description:"研选内容说明"`
  177. IsResearch bool `description:"是否属于研选"`
  178. IsResearchSpecial bool `description:"是否属于特殊的研选"`
  179. LinkParticipants string `description:"链接参会"`
  180. AppAttendance string `description:"App参会"`
  181. ConferencePassword string `description:"会议密码"`
  182. Scale string `description:"管理规模,空不填,1::50亿以下,2:50~100亿,3:100亿以上。多个用, 隔开"`
  183. IsShowAppointment bool `description:"是否展示预约纪要"`
  184. IsHideAppointment int `description:"是否隐藏预约纪要按钮 1是,0 否"`
  185. IsCClassMeeting bool `description:"是否是c类电话会"`
  186. ArticleList []*ActivityArticleResp // 下面是列表添加的部分结构体
  187. IsBrackets int `description:"是否有方括号 1是 ,0 否"`
  188. Label string `description:"主题标签"`
  189. ImgUrl string `description:"图片链接"`
  190. ImgUrlText string `description:"图片链接文字"`
  191. ActivityType int `description:"活动线上线下类型 1线上,0 线下"`
  192. JmcjRoadshowTitle string `description:"进门财经手动匹配的活动名称"`
  193. Listndustrial []*IndustrialManagementRep `description:"活动关联的产业信息"`
  194. IsShowOutboundCall bool `description:"是否展示预约外呼"`
  195. IsShowMeetingReminder bool `description:"是否展示会议提醒"`
  196. IsShowHelpSsk bool `description:"是否展示帮我带问"`
  197. IsShowSignup bool `description:"是否展示我要报名"`
  198. IsShowDetails bool `description:"是否展示查看详情按钮"`
  199. TemporaryLabel string `description:"临时标签"`
  200. IsCanAppointmentMinutes int `description:"是否可预约纪要 1是 ,0 否 默认0 "`
  201. YidongActivityId string `description:"易董活动ID"`
  202. YidongActivityUrl string `description:"易董活动跳转地址"`
  203. AudioLink bool `description:"是否展示回放按钮"`
  204. VoiceList *CygxActivityVoiceReq `description:"音频数据"`
  205. AdminId int `description:"管理员、销售ID "`
  206. IsMakerShow int `description:"是否仅决策人可见 0,否 、1,是"`
  207. VisibleRange int `description:"可见范围 1,仅本组可见 、2,全部客户可见"`
  208. VideoDetail *CygxActivityVideoListResp `description:"视频数据"`
  209. FileType int `description:"类型: 1-音频; 2-视频"`
  210. SourceType int `description:"活动来源。 1:活动 、2:专项产业调研"`
  211. TripImgLink string `description:"专项产业调研行程链接"`
  212. ActivityTimeEnd string `description:"专项产业调研活动预期结束时间"`
  213. IsCollect bool `description:"是否收藏"`
  214. IsShowFollowButton bool `description:"是否展示关注取关按钮"`
  215. IsFollowButton bool `description:"是否关注"`
  216. IsYidongConduct bool `description:"是否属于易董办会 1:是 、0:否"`
  217. IsCanOutboundCall int `description:"是否提供外呼 1:是 、0:否"`
  218. TencentConferenceNumber string `description:"腾讯会议号"`
  219. YidongActivityIdByCygx string `description:"通过查研观向建会易董返回的活动ID"`
  220. IsShowSigninButton bool `description:"是否展示签到码按钮"`
  221. IsShowSignUpDetail bool `description:"是否展示报名详情按钮"`
  222. SigninImg string `description:"签到码图片"`
  223. IsNeedEmail int `description:"是否需要提供邮箱 1是,0否"`
  224. SiginupDeadline string `description:"报名截止时间"`
  225. IsExternalLabel bool `description:"是否为外部资源"`
  226. IsResearchPoints bool `description:"是否为研选扣点"`
  227. IsResearchPointsByUser bool `description:"是否为扣用户点数的研选扣点"`
  228. CancelDeadline string `description:"取消报名截止时间"`
  229. ImgUrlBgYx string `description:"研选背景图片"`
  230. ChartPermissionNameDeputy string `description:"副行业名称"`
  231. TopTime int `description:"置顶时间"`
  232. LabelKeyword string `description:"标签关键词"`
  233. LabelKeywordImgLink string `description:"标签关键词ico"`
  234. MomentsImg string `description:"分享到朋友圈的封面图片"`
  235. ActivityPrice float64 `description:"单场活动价格"`
  236. ActivityOriginalPrice float64 `description:"单场活动原价格"`
  237. }
  238. type ListArticleActivity struct {
  239. Title string `description:"文章标题"`
  240. ArtleId int `description:"产业id"`
  241. }
  242. type CygxActivityResp struct {
  243. HaqveJurisdiction bool `description:"是否有权限"`
  244. OperationMode string `description:"操作方式 Apply:立即申请、Call:拨号 为空则为有权限"`
  245. HasPermission int `description:"操作方式,1:有该行业权限,正常展示,2:无该行业权限,3:潜在客户,未提交过申请,4:潜在客户,已提交过申请,5:有IFCC、无权益"`
  246. PopupMsg string `description:"权限弹窗信息"`
  247. MsgType string `description:"Type : 类型 , Industry : 行业"`
  248. SellerMobile string `description:"销售电话"`
  249. SellerName string `description:"销售姓名"`
  250. IsResearch bool `description:"是否属于研选"`
  251. IsResearchSpecial bool `description:"是否属于特殊的研选"`
  252. Detail *ActivityDetail
  253. PopupPriceMsg string `description:"价格弹窗信息"`
  254. IsShowWxPay bool `description:"是否展示微信支付"`
  255. IsCompanyApply bool `description:"机构是否申请过试用"`
  256. IsNeedBusinessCard bool `description:"是否需要上传名片"`
  257. PayTimeCountdown int `description:"支付时间倒计时"`
  258. OrderCode string `comment:"订单编号"`
  259. GoodsList []*order.CygxGoodsResp `description:"商品信息"`
  260. VivoPoints VivoPointsResp `description:"音视频设置"`
  261. }
  262. type VivoPointsResp struct {
  263. HavePoint bool `description:"是否被扣过点"`
  264. PointPermission int `description:"1:点数充足、2点数不足需付费、3:只能付费"`
  265. CompanyPoints string `description:"公司剩余点数"`
  266. ActivityPoints string `description:"本场活动要扣除的点数"`
  267. //Title string `description:"标题"`
  268. //ResourceUrl string `description:"链接"`
  269. //Type int `description:"类型: 1-活动音频; 2-活动视频;"`
  270. //PlaySeconds string `description:"音视频时长"`
  271. }
  272. // 通过纪要ID获取活动详情
  273. func GetAddActivityInfoById(ActivityId int) (item *ActivityDetail, err error) {
  274. o := orm.NewOrm()
  275. sql := `SELECT * FROM cygx_activity WHERE activity_id=? AND publish_status = 1 `
  276. err = o.Raw(sql, ActivityId).QueryRow(&item)
  277. return
  278. }
  279. // 通过纪要ID获取活动详情
  280. func GetAddActivityInfoByActivityId(ActivityId int) (item *ActivityDetail, err error) {
  281. o := orm.NewOrm()
  282. sql := `SELECT * FROM cygx_activity WHERE activity_id=? `
  283. err = o.Raw(sql, ActivityId).QueryRow(&item)
  284. return
  285. }
  286. // 通过纪要ID获取活动详情
  287. func GetAddActivityInfoByIdShow(uid, ActivityId int) (item *ActivityDetail, err error) {
  288. o := orm.NewOrm()
  289. 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,
  290. ( 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,
  291. ( 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,
  292. ( SELECT COUNT( 1 ) FROM cygx_activity_appointment AS ap WHERE ap.activity_id = a.activity_id AND ap.user_id = ? ) AS is_appointment
  293. FROM cygx_activity AS a WHERE activity_id=? AND publish_status = 1 `
  294. err = o.Raw(sql, uid, uid, uid, ActivityId).QueryRow(&item)
  295. return
  296. }
  297. // 活动列表
  298. type CygxActivityList struct {
  299. ActivityId int `orm:"column(activity_id);pk";description:"活动ID 等于0新增活动,大于0修改活动"`
  300. ActivityTypeId int `description:"活动类型id"`
  301. ActivityName string `description:"活动名称"`
  302. ActivityTypeName string `description:"活动类型名称"`
  303. Speaker string `description:"主讲人"`
  304. SignupType int `description:"报名方式,1预约外呼,2我要报名"`
  305. ChartPermissionId int `description:"行业id"`
  306. ChartPermissionName string `description:"行业名称"`
  307. IsLimitPeople int `description:"是否限制人数 1是,0否"`
  308. LimitPeopleNum int `description:"限制的人数数量"`
  309. ActivityTime string `description:"活动时间"`
  310. ActivityTimeText string `description:"活动时间带文字"`
  311. City string `description:"城市"`
  312. Address string `description:"活动地址"`
  313. DistinguishedGuest string `description:"嘉宾"`
  314. Expert string `description:"专家"`
  315. IsSignup int `description:"是否已报名 1是 ,0 否"`
  316. IsAppointment int `description:"是否已预约纪要 1是 ,0 否"`
  317. IsShowAppointment bool `description:"是否展示预约纪要"`
  318. SignupNum int `description:"已报名人数"`
  319. ActiveState string `description:"活动进行状态 未开始:1、进行中2、已结束3"`
  320. IsCancelMeetingReminder int `description:"是否取消会议提醒 1展示取消会议提醒 ,0展示会议提醒"`
  321. IsBrackets int `description:"是否有方括号 1是 ,0 否"`
  322. Label string `description:"主题标签"`
  323. IsShowSustainable bool `description:"是否展示限免标签"`
  324. ImgUrl string `description:"图片链接"`
  325. ImgUrlText string `description:"图片链接文字"`
  326. ActivityType int `description:"活动线上线下类型 1线上,0 线下"`
  327. IsHideAppointment int `description:"是否隐藏预约纪要按钮 1是,0 否"`
  328. JmcjRoadshowTitle string `description:"进门财经手动匹配的活动名称"`
  329. IsCClassMeeting bool `description:"是否是c类电话会"`
  330. }
  331. type GetCygxActivityListRep struct {
  332. Paging *paging.PagingItem `description:"分页数据"`
  333. List []*ActivityDetail
  334. Label string `description:"主题"`
  335. ImgUrl string `description:"图片路径"`
  336. IsResearch bool `description:"是否属于研选"`
  337. IsJump bool `description:"是否跳转"`
  338. IndustrialManagementId int `description:"产业ID"`
  339. IndustryNewLabel bool `description:"产业是否新标签"`
  340. IsShowResearchPoints bool `description:"是否展示研选扣点搜索"`
  341. }
  342. // 获取我的日程数量
  343. func GetScheduleCount(condition string, uid int) (count int, err error) {
  344. o := orm.NewOrm()
  345. sqlCount := `SELECT COUNT( 1 ) AS count
  346. FROM cygx_my_schedule AS m
  347. INNER JOIN cygx_activity AS art ON art.activity_id = m.activity_id
  348. WHERE
  349. user_id = ?`
  350. if condition != "" {
  351. sqlCount += condition
  352. }
  353. err = o.Raw(sqlCount, uid).QueryRow(&count)
  354. return
  355. }
  356. // 我的日程列表
  357. func GetScheduleList(condition string, pars []interface{}, uid, startSize, pageSize int) (items []*ActivityDetail, err error) {
  358. o := orm.NewOrm()
  359. sql := `SELECT art.*,t.activity_type,t.img_url_text,
  360. ( 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,
  361. ( 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 ,
  362. ( SELECT COUNT( 1 ) FROM cygx_activity_appointment AS ap WHERE ap.activity_id = art.activity_id AND ap.user_id = ? ) AS is_appointment,
  363. ( 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
  364. FROM cygx_activity AS art
  365. INNER JOIN cygx_my_schedule as my ON my.activity_id = art.activity_id
  366. INNER JOIN cygx_activity_type as t ON t.activity_type_id = art.activity_type_id
  367. WHERE 1=1 AND my.user_id = ? `
  368. if condition != "" {
  369. sql += condition
  370. }
  371. sql += ` ORDER BY art.active_state ASC,art.activity_time ASC LIMIT ?,?`
  372. _, err = o.Raw(sql, pars, uid, uid, uid, uid, startSize, pageSize).QueryRows(&items)
  373. return
  374. }
  375. // 我的日程列表 活动以及专项调研一起
  376. func GetScheduleAndSpecilList(condition string, pars []interface{}, conditionSpecil string, parsSpecil []interface{}, startSize, pageSize int) (items []*ActivityDetail, err error) {
  377. o := orm.NewOrm()
  378. sql := `SELECT
  379. art.activity_id,
  380. art.activity_time_text,
  381. art.activity_name,
  382. art.chart_permission_id,
  383. art.active_state,
  384. t.activity_type,
  385. t.img_url_text,
  386. art.chart_permission_name,
  387. art.distinguished_guest,
  388. art.expert,
  389. art.speaker,
  390. "" AS trip_img_link,
  391. "" AS activity_time_end,
  392. art.yidong_activity_id,
  393. art.is_can_appointment_minutes,
  394. art.activity_type_id,
  395. art.limit_people_num,
  396. art.is_limit_people,
  397. 1 AS source_type,
  398. art.activity_time,
  399. art.city,
  400. art.is_external_label,
  401. art.siginup_deadline,
  402. art.is_research_points,
  403. art.cancel_deadline
  404. FROM
  405. cygx_activity AS art
  406. INNER JOIN cygx_my_schedule AS my ON my.activity_id = art.activity_id
  407. INNER JOIN cygx_activity_type AS t ON t.activity_type_id = art.activity_type_id
  408. WHERE
  409. 1 = 1 `
  410. if condition != `` {
  411. sql += condition
  412. }
  413. sql += ` ORDER BY activity_time DESC LIMIT ?,?`
  414. _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
  415. return
  416. }
  417. type SignupExportRep struct {
  418. Mobile string `description:"手机号"`
  419. CompanyName string `description:"公司名称"`
  420. CompanyId int `description:"公司Id"`
  421. RealName string `description:"姓名"`
  422. CountryCode string `description:"区号"`
  423. OutboundMobile string `description:"外呼手机号"`
  424. SellerName string `description:"销售姓名"`
  425. }
  426. type ActivityMsgExportRep struct {
  427. AskId int `description:"活动带问ID"`
  428. UserId int `description:"用户ID"`
  429. RealName string `description:"姓名"`
  430. CompanyName string `description:"公司名称"`
  431. CompanyId int `description:"公司ID"`
  432. Content string `description:"内容"`
  433. CreateTime string `description:"提交时间"`
  434. }
  435. // 活动详情
  436. type CygxActivityLabelList struct {
  437. KeyWord string `orm:"column(label)";description:"主题"`
  438. Timesort string `description:"最大时间"`
  439. Mintimesort string `description:"最小时间"`
  440. ImgUrlBg string `description:"背景图片"`
  441. ActivityId int `description:"活动ID "`
  442. IsShowSubjectName int `description:"小程序内是否展示标的名称 1是 ,0否 默认0 "`
  443. Resource int `description:"位置 ,1:活动 ,2:专项产业调研"`
  444. TemporaryLabel string `description:"临时标签"`
  445. IsNew bool `description:"是否为新:活动存在关联的的产业所关联的报告均在3个月内/无报告则标记新"`
  446. YidongActivityId string `description:"易董活动ID"`
  447. IsExternalLabel bool `description:"是否为外部资源"`
  448. IsResearchPoints bool `description:"是否为研选扣点"`
  449. TripStatus int `description:"行程进行状态 1:预报名,2:确定行程"`
  450. City string `description:"城市"`
  451. Days int `description:"天数"`
  452. ActivityTypeId int `description:"活动类型id"`
  453. IsResearch bool `description:"是否属于研选"`
  454. ChartPermissionId int `description:"行业id"`
  455. }
  456. type GetCygxActivityLabelListRep struct {
  457. Label string `description:"主题"`
  458. ImgUrl string `description:"图片路径"`
  459. List []*CygxActivityLabelList
  460. }
  461. type AskEmailRep struct {
  462. Name string `description:"姓名"`
  463. Email string `description:"邮箱"`
  464. Mobile string `description:"手机号"`
  465. }
  466. func GetAskEmail() (item []*AskEmailRep, err error) {
  467. o := orm.NewOrm()
  468. sql := `SELECT * FROM cygx_activity_ask_email`
  469. _, err = o.Raw(sql).QueryRows(&item)
  470. return
  471. }
  472. type GetCygxActivitySpecialDetailListResp struct {
  473. IsFollow bool `description:"是否关注新调研通知"`
  474. IsBindingMobile bool `description:"是否绑定了手机号"`
  475. Paging *paging.PagingItem `description:"分页数据"`
  476. List []*CygxActivitySpecialDetail
  477. }
  478. type CygxActivitySpecialResp struct {
  479. HaqveJurisdiction bool `description:"是否有权限"`
  480. OperationMode string `description:"操作方式 Apply:立即申请、Call:拨号 为空则为有权限"`
  481. HasPermission int `description:"操作方式,1:有该行业权限,正常展示,2:无该行业权限,3:潜在客户,未提交过申请,4:潜在客户,已提交过申请,5:有IFCC、无权益"`
  482. PopupMsg string `description:"权限弹窗信息"`
  483. MsgType string `description:"Type : 类型 , Industry : 行业"`
  484. SellerMobile string `description:"销售电话"`
  485. SellerName string `description:"销售姓名"`
  486. IsFollow bool `description:"是否关注新调研通知"`
  487. Detail *CygxActivitySpecialDetail
  488. }
  489. // 获取专项调研活动列表
  490. func GetCygxActivitySpecialDetailList(condition string, pars []interface{}, uid, startSize, pageSize int) (items []*CygxActivitySpecialDetail, err error) {
  491. o := orm.NewOrm()
  492. sql := ` SELECT
  493. art.*,
  494. (
  495. SELECT
  496. COUNT( 1 )
  497. FROM
  498. cygx_activity_special_signup AS s
  499. WHERE
  500. s.activity_id = art.activity_id
  501. AND s.user_id = ?
  502. ) AS is_signup
  503. FROM
  504. cygx_activity_special AS art
  505. WHERE
  506. 1 = 1 `
  507. if condition != "" {
  508. sql += condition
  509. }
  510. sql += ` LIMIT ?,? `
  511. _, err = o.Raw(sql, uid, pars, startSize, pageSize).QueryRows(&items)
  512. return
  513. }
  514. // 列表
  515. func GetIndustrialActivityGroupManagementList(activityId int) (items []*IndustrialManagementRep, err error) {
  516. o := orm.NewOrm()
  517. sql := `SELECT
  518. m.chart_permission_id,
  519. m.industrial_management_id,
  520. m.industry_name
  521. FROM
  522. cygx_industrial_activity_group_management AS am
  523. INNER JOIN cygx_industrial_management AS m ON m.industrial_management_id = am.industrial_management_id
  524. WHERE
  525. am.activity_id = ? AND am.source = 1`
  526. _, err = o.Raw(sql, activityId).QueryRows(&items)
  527. return
  528. }
  529. // 列表
  530. func GetActivityListByCondition(condition string, pars []interface{}) (items []*CygxActivity, err error) {
  531. o := orm.NewOrm()
  532. sql := `SELECT * FROM cygx_activity WHERE 1 =1 `
  533. if condition != "" {
  534. sql += condition
  535. }
  536. _, err = o.Raw(sql, pars).QueryRows(&items)
  537. return
  538. }
  539. // UpdateCygxActivitySubmitMeetingByActivityId ,修改活动提交到会状态
  540. func UpdateCygxActivitySubmitMeetingByActivityId(activityId int) (err error) {
  541. o := orm.NewOrm()
  542. sql := `UPDATE cygx_activity SET is_submit_meeting = 1 WHERE activity_id = ? `
  543. _, err = o.Raw(sql, activityId).Exec()
  544. return
  545. }
  546. // 列表
  547. func GetActivityListNew(condition string, pars []interface{}, uid, startSize, pageSize, playBack, filter int, typeName string) (items []*ActivityDetail, err error) {
  548. var sqlJiontable string
  549. if playBack == 1 {
  550. //sqlJiontable = ` INNER JOIN cygx_activity_voice AS ac ON ac.activity_id = art.activity_id `
  551. }
  552. if filter == 1 {
  553. sqlJiontable = ` INNER JOIN cygx_activity_video AS av ON av.activity_id = art.activity_id `
  554. } else if filter == 2 {
  555. sqlJiontable = ` INNER JOIN cygx_activity_voice AS ac ON ac.activity_id = art.activity_id `
  556. }
  557. o := orm.NewOrm()
  558. sql := `SELECT art.* ,t.activity_type,t.img_url_text,t.img_url_bg_yx,
  559. ( 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,
  560. ( 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,
  561. ( 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,
  562. ( SELECT COUNT( 1 ) FROM cygx_activity_appointment AS ap WHERE ap.activity_id = art.activity_id AND ap.user_id = ? ) AS is_appointment
  563. FROM cygx_activity as art
  564. INNER JOIN cygx_activity_type as t ON t.activity_type_id = art.activity_type_id ` + sqlJiontable + ` WHERE 1= 1 `
  565. if condition != "" {
  566. sql += condition
  567. }
  568. sql += ` LIMIT ?,?`
  569. if typeName != "" {
  570. typeSlice := strings.Split(typeName, ",")
  571. tempCondition := ""
  572. for _, s := range typeSlice {
  573. if s == "1" {
  574. tempCondition += "'专家电话会',"
  575. } else if s == "2" {
  576. tempCondition += "'分析师电话会',"
  577. } else if s == "1,2" {
  578. tempCondition += "'专家电话会','分析师电话会',"
  579. }
  580. }
  581. tempCondition = strings.TrimRight(tempCondition, ",")
  582. sql = `SELECT * FROM(` + sql + `) AS t WHERE t.activity_type_name IN (` + tempCondition + `)`
  583. }
  584. _, err = o.Raw(sql, uid, uid, uid, pars, startSize, pageSize).QueryRows(&items)
  585. return
  586. }
  587. // 列表
  588. func GetCygxActivityList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxActivity, err error) {
  589. o := orm.NewOrm()
  590. sql := `SELECT * FROM cygx_activity as art WHERE 1= 1 `
  591. if condition != "" {
  592. sql += condition
  593. }
  594. sql += ` LIMIT ?,? `
  595. _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
  596. return
  597. }
  598. // 列表
  599. func GetCygxActivityIdList(condition string, pars []interface{}) (items []*CygxActivity, err error) {
  600. o := orm.NewOrm()
  601. sql := `SELECT * FROM cygx_activity as art WHERE 1= 1 `
  602. if condition != "" {
  603. sql += condition
  604. }
  605. _, err = o.Raw(sql, pars).QueryRows(&items)
  606. return
  607. }
  608. // 活动详情
  609. type WxMsgCygxActivityList struct {
  610. Id int `description:"报名ID"`
  611. UserId int `description:"用户ID"`
  612. ActivityId int `description:"活动ID 等于0新增活动,大于0修改活动"`
  613. ActivityTypeId int `description:"活动类型id"`
  614. ActivityName string `description:"活动名称"`
  615. ActivityTypeName string `description:"活动类型名称"`
  616. Speaker string `description:"主讲人"`
  617. SignupType int `description:"报名方式,1预约外呼,2我要报名"`
  618. ChartPermissionId int `description:"行业id"`
  619. ChartPermissionName string `description:"行业名称"`
  620. IsLimitPeople int `description:"是否限制人数 1是,0否"`
  621. LimitPeopleNum int `description:"限制的人数数量"`
  622. ActivityTime string `description:"活动时间"`
  623. ActivityTimeText string `description:"活动时间带文字"`
  624. City string `description:"城市"`
  625. Address string `description:"活动地址"`
  626. DistinguishedGuest string `description:"嘉宾"`
  627. Expert string `description:"专家"`
  628. IsSignup int `description:"是否已报名 1是 ,0 否"`
  629. SignupNum int `description:"已报名人数"`
  630. ActiveState string `description:"活动进行状态 未开始:1、进行中2、已结束3"`
  631. IsCancelMeetingReminder int `description:"是否取消会议提醒 1展示取消会议提醒 ,0展示会议提醒"`
  632. IsBrackets int `description:"是否有方括号 1是 ,0 否"`
  633. OpenId string `description:"OenId"`
  634. FailType int `description:"失败原因,0,未失败,1总人数已满,2单机构超限制,3,爽约次数超限"`
  635. }
  636. func GetYxActivitySendMsgListAll(endDate string) (items []*WxMsgCygxActivityList, err error) {
  637. o := orm.NewOrm()
  638. sql := `SELECT
  639. s.id,
  640. s.user_id,
  641. s.fail_type,
  642. cr.open_id,
  643. a.*
  644. FROM
  645. cygx_activity AS a
  646. INNER JOIN cygx_activity_signup AS s ON s.activity_id = a.activity_id
  647. INNER JOIN cygx_user_record AS cr ON cr.cygx_bind_account = s.mobile
  648. WHERE
  649. 1 = 1
  650. AND s.is_send_wx_msg = 0
  651. AND s.do_fail_type = 0
  652. AND a.publish_status = 1
  653. AND a.chart_permission_id = 31
  654. AND a.activity_time <= ? AND a.activity_time >= NOW()
  655. AND s.is_cancel = 0
  656. GROUP BY s.id`
  657. _, err = o.Raw(sql, endDate).QueryRows(&items)
  658. return
  659. }
  660. // 修改是否推送消息状态
  661. func UPdateSendedMsgStatus(signupIds string) (err error) {
  662. sql := ` UPDATE cygx_activity_signup SET is_send_wx_msg= 1 WHERE id IN(` + signupIds + `)`
  663. o := orm.NewOrm()
  664. _, err = o.Raw(sql).Exec()
  665. return
  666. }