package models import ( "github.com/beego/beego/v2/client/orm" "github.com/rdlucklib/rdluck_tools/paging" "strings" "time" ) // 活动详情 type CygxActivity struct { ActivityId int `orm:"column(activity_id);pk";description:"活动ID 等于0新增活动,大于0修改活动"` ActivityTypeId int `description:"活动类型id"` ActivityTypeName string `description:"活动类型名称"` ChartPermissionId int `description:"行业id"` ChartPermissionName string `description:"行业名称"` ChartPermissionNames string `description:"行业名称辅助字段,区分研选子分类"` Body string `description:"内容"` CreateTime time.Time `description:"创建时间"` PublishDate time.Time `description:"发布时间"` IsLimitPeople int `description:"是否限制人数 1是,0否"` LimitPeopleNum int `description:"限制的人数数量"` CustomerTypeIds string `description:"活动可见的客户类型,多个ID用 , 隔开"` PublishStatus int `description:"发布状态 1已发布,0未发布"` LastUpdatedTime time.Time `description:"更新时间"` ActivityTime string `description:"活动时间"` ActivityTimeText string `description:"活动时间带文字"` DistinguishedGuest string `description:"嘉宾"` Host string `description:"主持人"` MainlandTell string `description:"大陆拨入号"` HongKongTell string `description:"香港拨入号"` TaiwanTell string `description:"台湾拨入号"` AmericaTell string `description:"美国拨入号"` ParticipationCode string `description:"参会密码"` Theme string `description:"主题"` Expert string `description:"专家"` ActivityName string `description:"活动名称"` ActivityNameTask string `description:"活动名称定时任务同步的时候使用"` OnlineParticipation string `description:"网络参会"` ReportLink string `description:"报告链接"` City string `description:"城市"` Address string `description:"活动地址"` Highlights string `description:"活动亮点"` Remarks string `description:"备注"` Speaker string `description:"主讲人"` ArticleId int `description:"关联报告id"` Label string `description:"标签"` LinkParticipants string `description:"链接参会"` AppAttendance string `description:"App参会"` ConferencePassword string `description:"会议密码"` TemporaryLabel string `description:"临时标签"` IsMakerShow int `description:"是否仅决策人可见 0,否 、1,是"` VisibleRange int `description:"可见范围 1,仅本组可见 、2,全部客户可见"` Scale string `description:"管理规模,空不填,1::50亿以下,2:50~100亿,3:100亿以上。多个用, 隔开"` IsShowSubjectName int `description:"小程序内是否展示标的名称 1是 ,0 否 默认0 "` IsHideAppointment int `description:"是否隐藏预约纪要按钮 1是 ,0 否 默认0 "` AdminId int `description:"销售/管理员ID"` AdminName string `description:"销售/管理员姓名"` IsCanAppointmentMinutes int `description:"是否可预约纪要 1是 ,0 否 默认0 "` YidongActivityId string `description:"易董活动ID"` IsExternalLabel int `description:"是否为外部资源 1是,0否"` IsResearchPoints int `description:"是否为研选扣点"` } // 活动详情 type ActivityDetail struct { ActivityId int `orm:"column(activity_id);pk";description:"活动ID "` ActivityTypeId int `description:"活动类型id"` ActivityTypeName string `description:"活动类型名称"` ChartPermissionId int `description:"行业id"` ChartPermissionName string `description:"行业名称"` ChartPermissionNames string `description:"行业名称辅助字段,区分研选子分类"` Body string `description:"内容"` CreateTime string `description:"创建时间"` IsLimitPeople int `description:"是否限制人数 1是,0否"` LimitPeopleNum int `description:"限制的人数数量"` LastUpdatedTime string `description:"更新时间"` ActivityTime string `description:"活动时间"` ActivityTimeText string `description:"活动时间带文字"` DistinguishedGuest string `description:"嘉宾"` Host string `description:"主持人"` Speaker string `description:"主讲人"` MainlandTell string `description:"大陆拨入号"` HongKongTell string `description:"香港拨入号"` TaiwanTell string `description:"台湾拨入号"` AmericaTell string `description:"美国拨入号"` ParticipationCode string `description:"参会密码"` Theme string `description:"主题"` Expert string `description:"专家"` ActivityName string `description:"活动名称"` OnlineParticipation string `description:"网络参会"` ReportLink string `description:"报告链接"` City string `description:"城市"` Address string `description:"活动地址"` Highlights string `description:"活动亮点"` Remarks string `description:"备注"` ShowType string `description:"人数限制类型,1不展示限制,2可选限制,3强制限制"` IsSignup int `description:"是否已报名 1是 ,0 否"` IsAppointment int `description:"是否已预约纪要 1是 ,0 否"` SignupNum int `description:"已报名人数"` SignupType int `description:"报名方式,1预约外呼,2自主拨入,3我要报名"` ActiveState string `description:"活动进行状态 未开始:1、进行中2、已结束3"` IsCancelMeetingReminder int `description:"是否取消会议提醒 1展示取消会议提醒 ,0展示会议提醒"` ArticleId int `description:"报告id(报告链接跳转使用)"` CustomerTypeIds string `description:"活动可见的客户类型,多个ID用 , 隔开"` IsShowSustainable bool `description:"是否展示限免标签"` Description string `description:"研选内容说明"` IsResearch bool `description:"是否属于研选"` LinkParticipants string `description:"链接参会"` AppAttendance string `description:"App参会"` ConferencePassword string `description:"会议密码"` Scale string `description:"管理规模,空不填,1::50亿以下,2:50~100亿,3:100亿以上。多个用, 隔开"` IsShowAppointment bool `description:"是否展示预约纪要"` IsHideAppointment int `description:"是否隐藏预约纪要按钮 1是,0 否"` IsCClassMeeting bool `description:"是否是c类电话会"` ArticleList []*ActivityArticleResp // 下面是列表添加的部分结构体 IsBrackets int `description:"是否有方括号 1是 ,0 否"` Label string `description:"主题标签"` ImgUrl string `description:"图片链接"` ImgUrlText string `description:"图片链接文字"` ActivityType int `description:"活动线上线下类型 1线上,0 线下"` JmcjRoadshowTitle string `description:"进门财经手动匹配的活动名称"` Listndustrial []*IndustrialManagementRep `description:"活动关联的产业信息"` IsShowOutboundCall bool `description:"是否展示预约外呼"` IsShowMeetingReminder bool `description:"是否展示会议提醒"` IsShowHelpSsk bool `description:"是否展示帮我带问"` IsShowSignup bool `description:"是否展示我要报名"` IsShowDetails bool `description:"是否展示查看详情按钮"` TemporaryLabel string `description:"临时标签"` IsCanAppointmentMinutes int `description:"是否可预约纪要 1是 ,0 否 默认0 "` YidongActivityId string `description:"易董活动ID"` IsYidongActivity bool `description:"是否属于易董同步过来的活动"` YidongActivityUrl string `description:"易董活动跳转地址"` AudioLink bool `description:"是否展示回放按钮"` VoiceList *CygxActivityVoiceReq `description:"音频数据"` AdminId int `description:"管理员、销售ID "` IsMakerShow int `description:"是否仅决策人可见 0,否 、1,是"` VisibleRange int `description:"可见范围 1,仅本组可见 、2,全部客户可见"` VideoDetail *CygxActivityVideoListResp `description:"视频数据"` FileType int `description:"类型: 1-音频; 2-视频"` SourceType int `description:"活动来源。 1:活动 、2:专项产业调研"` TripImgLink string `description:"专项产业调研行程链接"` ActivityTimeEnd string `description:"专项产业调研活动预期结束时间"` AuthInfo *UserPermissionAuthInfo `description:"用户查看视频的权限"` Days int `description:"调研天数"` Title string `description:"标题"` IsYidongConduct bool `description:"是否属于易董办会 1:是 、0:否"` IsCanOutboundCall int `description:"是否提供外呼 1:是 、0:否"` TencentConferenceNumber string `description:"腾讯会议号"` IsResearchSpecial bool `description:"是否属于特殊的研选"` IsNeedEmail int `description:"是否需要提供邮箱 1是,0否"` SiginupDeadline string `description:"报名截止时间"` IsExternalLabel bool `description:"是否为外部资源"` IsResearchPoints bool `description:"是否为研选扣点"` CancelDeadline string `description:"取消报名截止时间"` ChartPermissionNameDeputy string `description:"副行业名称"` TopTime int `description:"置顶时间"` } // 活动详情 type ActivityListResp struct { ActivityId int `description:"活动ID "` ActivityTypeId int `description:"活动类型id"` ActivityTypeName string `description:"活动类型名称"` ChartPermissionId int `description:"行业id"` ChartPermissionName string `description:"行业名称"` IsLimitPeople int `description:"是否限制人数 1是,0否"` LimitPeopleNum int `description:"限制的人数数量"` LastUpdatedTime string `description:"更新时间"` ActivityTime string `description:"活动时间"` ActivityTimeText string `description:"活动时间带文字"` DistinguishedGuest string `description:"嘉宾"` Host string `description:"主持人"` Speaker string `description:"主讲人"` MainlandTell string `description:"大陆拨入号"` HongKongTell string `description:"香港拨入号"` TaiwanTell string `description:"台湾拨入号"` AmericaTell string `description:"美国拨入号"` ParticipationCode string `description:"参会密码"` Theme string `description:"主题"` Expert string `description:"专家"` ActivityName string `description:"活动名称"` OnlineParticipation string `description:"网络参会"` ReportLink string `description:"报告链接"` LinkParticipants string `description:"链接参会"` AppAttendance string `description:"App参会"` ConferencePassword string `description:"会议密码"` City string `description:"城市"` Address string `description:"活动地址"` Highlights string `description:"活动亮点"` Remarks string `description:"备注"` IsSignup int `description:"是否已报名 1是 ,0 否"` SignupNum int `description:"已报名人数"` IsAppointment int `description:"是否已预约纪要 1是 ,0 否"` IsCancelMeetingReminder int `description:"是否添加了消息消息提醒 1是 ,0 否"` ActiveState string `description:"活动进行状态 未开始:1、进行中2、已结束3"` IsShowSustainable bool `description:"是否展示限免标签"` Description string `description:"研选内容说明"` IsResearch bool `description:"是否属于研选"` IsHideAppointment int `description:"是否隐藏预约纪要按钮 1是,0 否"` IsCClassMeeting bool `description:"是否是c类电话会"` Label string `description:"主题标签"` ImgUrl string `description:"行业图片链接"` ImgUrlText string `description:"活动类型图片链接"` ActivityType int `description:"活动线上线下类型 1线上,0 线下"` IsShowOutboundCall bool `description:"是否展示预约外呼"` IsShowMeetingReminder bool `description:"是否展示会议提醒"` IsShowHelpSsk bool `description:"是否展示帮我带问"` IsShowSignup bool `description:"是否展示我要报名"` IsShowAppointment bool `description:"是否展示预约纪要"` IsShowDetails bool `description:"是否展示查看详情按钮"` AudioLink bool `description:"是否展示回放按钮"` VoiceDetail *CygxActivityVoiceReq `description:"音频数据"` VideoDetail *CygxActivityVideoListResp `description:"视频数据"` FileType int `description:"类型: 1-音频; 2-视频"` SourceType int `description:"活动来源。 1:活动 、2:专项产业调研"` YidongActivityUrl string `description:"易董活动跳转地址"` ArticleList []*ActivityArticleResp Listndustrial []*IndustrialManagementRep `description:"活动关联的产业信息"` AuthInfo *UserPermissionAuthInfo `description:"用户查看视频的权限"` Explain string `description:"活动右上角提示"` TripImgLink string `description:"专项产业调研行程链接"` IsTrip int `description:"是否报名 1是 ,0 否"` TripStatus int `description:"行程进行状态 1:预报名,2:确定行程"` Days int `description:"调研天数"` SignupType int `description:"报名方式,1预约外呼,2自主拨入,3我要报名"` IsYidongConduct bool `description:"是否属于易董办会 1:是 、0:否"` IsCanOutboundCall int `description:"是否提供外呼 1:是 、0:否"` TencentConferenceNumber string `description:"腾讯会议号"` IsResearchSpecial bool `description:"是否属于特殊的研选"` IsExternalLabel bool `description:"是否为外部资源"` IsResearchPoints bool `description:"是否为研选扣点"` SiginupDeadline string `description:"报名截止时间"` CancelDeadline string `description:"取消报名截止时间"` IsYidongActivity bool `description:"是否属于易董同步过来的活动"` TopTime int `description:"置顶时间"` ShareImg string `description:"分享图片"` } type ActivityCheck struct { CheckPermission bool `description:"权限是否通过校验"` HasPermission int `description:"操作方式,1:有该行业权限,正常展示,2:无该行业权限,3:潜在客户,未提交过申请,4:潜在客户,已提交过申请"` PopupMsg string `description:"权限弹窗信息"` CancelPopupMsg string `description:"取消报名时间弹窗信息"` SellerMobile string `description:"销售电话"` SellerName string `description:"销售姓名"` Mobile string `description:"手机号"` IsResearch bool `description:"是否属于研选"` IsResearchSpecial bool `description:"是否属于特殊的研选"` CheckTime bool `description:"时间是否通过校验"` CheckEmail bool `description:"邮箱是否通过校验"` CheckPoints bool `description:"扣点是否通过校验"` CompanyPoints string `description:"公司剩余点数"` ActivityPoints string `description:"本场活动要扣除的点数"` } type ActivityArticleResp struct { ReportLink string `description:"报告链接"` Title string `description:"报告标题"` ArticleId int `description:"报告id(报告链接跳转使用)"` } type CygxActivityResp struct { HasPermission int `description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下(ficc),3:无该品类权限,已提交过申请,4:无该品类权限,未提交过申请,5:潜在客户,未提交过申请,6:潜在客户,已提交过申请"` PopupMsg string `description:"权限弹窗信息"` SellerMobile string `description:"销售电话"` SellerName string `description:"销售姓名"` IsResearch bool `description:"是否属于研选"` IsResearchSpecial bool `description:"是否属于特殊的研选"` Detail *ActivityListResp } type CygxYidongActivityUrlResp struct { HasPermission int `description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下(ficc),3:无该品类权限,已提交过申请,4:无该品类权限,未提交过申请,5:潜在客户,未提交过申请,6:潜在客户,已提交过申请"` PopupMsg string `description:"权限弹窗信息"` SellerMobile string `description:"销售电话"` SellerName string `description:"销售姓名"` IsResearch bool `description:"是否属于研选"` IsResearchSpecial bool `description:"是否属于特殊的研选"` YidongActivityUrl string `description:"易董活动跳转地址"` } // 列表 func GetCygxActivityList(condition string, pars []interface{}, sortTime string, startSize, pageSize int) (items []*CygxActivity, err error) { o := orm.NewOrm() 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 FROM cygx_activity as art WHERE 1= 1 ` if condition != "" { sql += condition } sql += ` GROUP BY art.activity_id ORDER BY ` + sortTime + ` ,art.activity_id DESC LIMIT ?,? ` _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items) return } // 通过纪要ID获取活动详情 func GetAddActivityInfoById(ActivityId int) (item *ActivityDetail, err error) { o := orm.NewOrm() sql := `SELECT * FROM cygx_activity WHERE activity_id=? AND publish_status = 1 ` err = o.Raw(sql, ActivityId).QueryRow(&item) return } // 获取数量 func GetActivityCount(condition string, playBack int, pars []interface{}, filter int) (count int, err error) { var sqlJiontable string if playBack == 1 { //sqlJiontable = ` INNER JOIN cygx_activity_voice AS ac ON ac.activity_id = art.activity_id ` } if filter == 1 { sqlJiontable = ` INNER JOIN cygx_activity_video AS av ON av.activity_id = art.activity_id ` } else if filter == 2 { sqlJiontable = ` INNER JOIN cygx_activity_voice AS ac ON ac.activity_id = art.activity_id ` } sqlCount := ` SELECT COUNT(1) AS count FROM cygx_activity as art ` + sqlJiontable + ` WHERE 1= 1 ` if condition != "" { sqlCount += condition } o := orm.NewOrm() err = o.Raw(sqlCount, pars).QueryRow(&count) return } func GetActivityListNew(condition string, pars []interface{}, uid, startSize, pageSize, playBack, filter int, typeName string) (items []*ActivityDetail, err error) { var sqlJiontable string if playBack == 1 { //sqlJiontable = ` INNER JOIN cygx_activity_voice AS ac ON ac.activity_id = art.activity_id ` } if filter == 1 { sqlJiontable = ` INNER JOIN cygx_activity_video AS av ON av.activity_id = art.activity_id ` } else if filter == 2 { sqlJiontable = ` INNER JOIN cygx_activity_voice AS ac ON ac.activity_id = art.activity_id ` } o := orm.NewOrm() sql := `SELECT art.* ,t.activity_type,t.img_url_text,1 AS source_type, ( 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, ( 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, ( 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, ( SELECT COUNT( 1 ) FROM cygx_activity_appointment AS ap WHERE ap.activity_id = art.activity_id AND ap.user_id = ? ) AS is_appointment FROM cygx_activity as art INNER JOIN cygx_activity_type as t ON t.activity_type_id = art.activity_type_id ` + sqlJiontable + ` WHERE 1= 1 ` if condition != "" { sql += condition } sql += ` LIMIT ?,?` if typeName != "" { typeSlice := strings.Split(typeName, ",") tempCondition := "" for _, s := range typeSlice { if s == "1" { tempCondition += "'专家电话会'," } else if s == "2" { tempCondition += "'分析师电话会'," } else if s == "1,2" { tempCondition += "'专家电话会','分析师电话会'," } } tempCondition = strings.TrimRight(tempCondition, ",") sql = `SELECT * FROM(` + sql + `) AS t WHERE t.activity_type_name IN (` + tempCondition + `)` } _, err = o.Raw(sql, uid, uid, uid, pars, startSize, pageSize).QueryRows(&items) return } // 列表 func GetActivityListHomeNew(condition string, startSize, pageSize int) (items []*ActivityDetail, err error) { o := orm.NewOrm() sql := `SELECT activity_id FROM cygx_activity as art INNER JOIN cygx_activity_type as t ON t.activity_type_id = art.activity_type_id WHERE 1= 1 ` if condition != "" { sql += condition } sql += ` LIMIT ?,?` _, err = o.Raw(sql, startSize, pageSize).QueryRows(&items) return } type GetCygxActivityListRep struct { Paging *paging.PagingItem `description:"分页数据"` List []*ActivityListResp Label string `description:"主题"` ImgUrl string `description:"图片路径"` IsResearch bool `description:"是否属于研选"` IsJump bool `description:"是否跳转"` IndustrialManagementId int `description:"产业ID"` IndustryNewLabel bool `description:"产业是否新标签"` ChartPermissionId int `description:"权限id"` IsShowResearchPoints bool `description:"是否展示研选扣点搜索"` } type GetCygxActivityListSearchResp struct { Paging *paging.PagingItem `description:"分页数据"` List []*ActivityDetail Label string `description:"主题"` ImgUrl string `description:"图片路径"` IsResearch bool `description:"是否属于研选"` IsJump bool `description:"是否跳转"` IndustrialManagementId int `description:"产业ID"` IndustryNewLabel bool `description:"产业是否新标签"` ChartPermissionId int `description:"权限id"` } // 通过纪要ID获取活动详情 func GetAddActivityInfoByIdShow(uid, ActivityId int) (item *ActivityDetail, err error) { o := orm.NewOrm() 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, ( 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, ( 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, ( SELECT COUNT( 1 ) FROM cygx_activity_appointment AS ap WHERE ap.activity_id = a.activity_id AND ap.user_id = ? ) AS is_appointment FROM cygx_activity AS a WHERE activity_id=? AND publish_status = 1 ` err = o.Raw(sql, uid, uid, uid, ActivityId).QueryRow(&item) return } // GetActivitySpecialSearcheList 活动与专项调研的搜索 func GetActivitySpecialSearcheList(condition string, pars []interface{}, conditionSpecil string, parsSpecil []interface{}, startSize, pageSize int) (items []*ActivityDetail, total int, err error) { o := orm.NewOrm() sql := `SELECT art.activity_id, art.activity_time_text, art.activity_name, art.chart_permission_id, art.active_state, t.activity_type, art.chart_permission_name, art.distinguished_guest, art.expert, art.speaker, "" AS trip_img_link, "" AS activity_time_end, art.yidong_activity_id, art.is_can_appointment_minutes, art.activity_type_id, art.limit_people_num, art.is_limit_people, 1 AS source_type, t.img_url_text, art.is_yidong_conduct, art.is_can_outbound_call, art.city, art.is_research_points, art.siginup_deadline, art.cancel_deadline, art.activity_time FROM cygx_activity AS art INNER JOIN cygx_activity_type AS t ON t.activity_type_id = art.activity_type_id WHERE 1 = 1 ` if condition != `` { sql += condition } sql += ` UNION ALL SELECT art.activity_id, art.activity_time_text_by_day AS activity_time_text, art.research_theme AS activity_name, art.chart_permission_id, "", art.special_type AS activity_type, art.chart_permission_name, "", "", "", art.trip_img_link_fix AS trip_img_link, art.activity_time_end, "", "", "", "", "", 2 AS source_type, "", "", "", "", "", "", "", art.activity_time FROM cygx_activity_special AS art WHERE 1 = 1 ` if conditionSpecil != "" { sql += conditionSpecil } totalSql := `SELECT COUNT(1) total FROM (` + sql + `) z ` err = o.Raw(totalSql, pars, parsSpecil).QueryRow(&total) if err != nil { return } sql += ` ORDER BY activity_time DESC LIMIT ?,?` _, err = o.Raw(sql, pars, parsSpecil, startSize, pageSize).QueryRows(&items) return } // 获取我的日程数量 func GetScheduleCount(condition string, uid int) (count int, err error) { o := orm.NewOrm() sqlCount := `SELECT COUNT( 1 ) AS count FROM cygx_my_schedule AS m INNER JOIN cygx_activity AS art ON art.activity_id = m.activity_id WHERE user_id = ?` if condition != "" { sqlCount += condition } err = o.Raw(sqlCount, uid).QueryRow(&count) return } // 获取我的日程数量 func GetSpecialScheduleCount(uid int) (count int, err error) { o := orm.NewOrm() sqlCount := ` SELECT COUNT( 1 ) AS count FROM cygx_activity_special AS art INNER JOIN cygx_activity_special_trip AS my ON my.activity_id = art.activity_id WHERE 1 = 1 AND my.user_id = ? AND my.is_cancel = 0` err = o.Raw(sqlCount, uid).QueryRow(&count) return } // 我的日程列表 func GetScheduleList(condition string, pars []interface{}, uid, startSize, pageSize int) (items []*ActivityDetail, err error) { o := orm.NewOrm() sql := `SELECT art.*,t.activity_type,t.img_url_text, ( 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, ( 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 , ( SELECT COUNT( 1 ) FROM cygx_activity_appointment AS ap WHERE ap.activity_id = art.activity_id AND ap.user_id = ? ) AS is_appointment, ( 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, 1 AS source_type FROM cygx_activity AS art INNER JOIN cygx_my_schedule as my ON my.activity_id = art.activity_id INNER JOIN cygx_activity_type as t ON t.activity_type_id = art.activity_type_id WHERE 1=1 AND my.user_id = ? ` if condition != "" { sql += condition } sql += ` ORDER BY art.active_state ASC,art.activity_time ASC LIMIT ?,?` _, err = o.Raw(sql, pars, uid, uid, uid, uid, startSize, pageSize).QueryRows(&items) return } // 我的日程列表 活动以及专项调研一起 func GetScheduleAndSpecilList(condition string, pars []interface{}, conditionSpecil string, parsSpecil []interface{}, startSize, pageSize int) (items []*ActivityDetail, err error) { o := orm.NewOrm() sql := `SELECT art.activity_id, art.activity_time_text, art.activity_name, art.chart_permission_id, art.active_state, t.activity_type, art.chart_permission_name, art.distinguished_guest, art.expert, art.speaker, "" AS trip_img_link, "" AS activity_time_end, art.yidong_activity_id, art.is_can_appointment_minutes, art.activity_type_id, art.limit_people_num, art.is_limit_people, 1 AS source_type, art.activity_time, 0 AS days, art.city AS city, art.is_external_label, art.is_yidong_conduct, art.is_can_outbound_call, art.is_research_points, art.cancel_deadline, art.host FROM cygx_activity AS art INNER JOIN cygx_my_schedule AS my ON my.activity_id = art.activity_id INNER JOIN cygx_activity_type AS t ON t.activity_type_id = art.activity_type_id WHERE 1 = 1 ` if condition != `` { sql += condition } sql += ` UNION ALL SELECT art.activity_id, art.activity_time_text_by_day AS activity_time_text, art.research_theme AS activity_name, art.chart_permission_id, "", art.special_type AS activity_type, art.chart_permission_name, "", "", "", art.trip_img_link_fix AS trip_img_link, art.activity_time_end, "", "", "", "", "", 2 AS source_type, art.activity_time, art.days, art.city, "", "", "", "", "", art.host FROM cygx_activity_special AS art INNER JOIN cygx_activity_special_trip AS my ON my.activity_id = art.activity_id WHERE 1 = 1` if conditionSpecil != "" { sql += conditionSpecil } sql += ` ORDER BY activity_time DESC LIMIT ?,?` _, err = o.Raw(sql, pars, parsSpecil, startSize, pageSize).QueryRows(&items) return } // 列表 func GetActivityListByCondition(condition string, pars []interface{}) (items []*CygxActivity, err error) { o := orm.NewOrm() sql := `SELECT * FROM cygx_activity WHERE 1 =1 ` if condition != "" { sql += condition } _, err = o.Raw(sql, pars).QueryRows(&items) return }