123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677 |
- package models
- import (
- "fmt"
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- type CygxActivitySignup struct {
- Id int `orm:"column(id);pk"`
- ActivityId int `description:"活动ID"`
- UserId int `description:"用户ID"`
- CreateTime time.Time `description:"创建时间"`
- Mobile string `description:"手机号"`
- Email string `description:"邮箱"`
- CompanyId int `description:"公司id"`
- CompanyName string `description:"公司名称"`
- FailType int `description:"失败原因,0,未失败,1总人数已满,2单机构超限制,3,爽约次数超限"`
- SignupType int `description:"报名方式,1预约外呼,2自主拨入,3我要报名"`
- DoFailType int `description:"失败原因,0,未失败,1总人数已满,2单机构超限制,3,爽约次数超限"`
- OutboundMobile string `description:"外呼手机号"`
- CountryCode string `description:"手机国家区号"`
- RealName string `description:"用户实际名称"`
- SellerName string `description:"所属销售"`
- }
- type SignupStatus struct {
- SignupStatus string `description:"返回状态:人数已满:FullStarffed、单机构超过两人:TwoPeople、爽约次数过多:BreakPromise、超时:Overtime 、成功:Success"`
- GoFollow bool `description:"是否去关注"`
- SignupType int `description:"报名方式,1预约外呼,2我要报名"`
- ActivityId int `description:"活动ID"`
- HaqveJurisdiction bool `description:"是否有权限"`
- OperationMode string `description:"操作方式 Apply:立即申请、Call:拨号 为空则为有权限"`
- HasPermission int `description:"操作方式,1:有该行业权限,正常展示,2:无该行业权限,3:潜在客户,未提交过申请,4:潜在客户,已提交过申请"`
- PopupMsg string `description:"权限弹窗信息"`
- SellerMobile string `description:"销售电话"`
- MsgType string `description:"Type : 类型 , Industry : 行业"`
- SellerName string `description:"销售姓名"`
- Mobile string `description:"外呼手机号"`
- CountryCode string `description:"外呼手机号区号"`
- GoOutboundMobile bool `description:"是否去绑定手机号"`
- GoBindEmail bool `description:"是否去绑定邮箱"`
- IsResearch bool `description:"是否属于研选"`
- IsResearchSpecial bool `description:"是否属于特殊的研选"`
- ActivityTypeName string `description:"活动类型名称"`
- ActivityTime string `description:"活动时间"`
- ActivityType int `description:"活动线上线下类型 1线上,0 线下"`
- }
- // 我的日程
- type CygxMySchedule struct {
- Id int `orm:"column(id);pk"`
- ActivityId int `description:"活动ID"`
- UserId int `description:"用户ID"`
- CreateTime time.Time `description:"创建时间"`
- Mobile string `description:"手机号"`
- Email string `description:"邮箱"`
- CompanyId int `description:"公司id"`
- CompanyName string `description:"公司名称"`
- }
- // 报名记录日志
- type CygxActivitySignupLog struct {
- Id int `orm:"column(id);pk"`
- ActivityId int `description:"活动ID"`
- UserId int `description:"用户ID"`
- CreateTime time.Time `description:"创建时间"`
- Mobile string `description:"手机号"`
- Email string `description:"邮箱"`
- CompanyId int `description:"公司id"`
- CompanyName string `description:"公司名称"`
- Type int `description:"操作方式,1报名,2取消报名"`
- }
- // 添加报名信息
- func AddActivitySignup(item *CygxActivitySignup) (lastId int64, err error) {
- o, err := orm.NewOrm().Begin()
- if err != nil {
- return
- }
- defer func() {
- fmt.Println(err)
- if err == nil {
- o.Commit()
- } else {
- o.Rollback()
- }
- }()
- var count int
- var countMySchedule int
- sql := `SELECT COUNT(1) AS count FROM cygx_my_schedule WHERE user_id=? AND activity_id=? `
- err = o.Raw(sql, item.UserId, item.ActivityId).QueryRow(&countMySchedule)
- if err != nil {
- return
- }
- if countMySchedule == 0 {
- itemMy := new(CygxMySchedule)
- itemMy.UserId = item.UserId
- itemMy.ActivityId = item.ActivityId
- itemMy.CreateTime = time.Now()
- itemMy.Mobile = item.Mobile
- itemMy.Email = item.Email
- itemMy.CompanyId = item.CompanyId
- itemMy.CompanyName = item.CompanyName
- lastId, err = o.Insert(itemMy)
- if err != nil {
- return
- }
- }
- sql = `SELECT COUNT(1) AS count FROM cygx_activity_signup WHERE user_id=? AND activity_id=? `
- err = o.Raw(sql, item.UserId, item.ActivityId).QueryRow(&count)
- if err != nil {
- return
- }
- if count > 0 {
- sql := `UPDATE cygx_activity_signup SET is_cancel = 0 ,do_fail_type = 0, signup_type=? WHERE user_id=? AND activity_id=? `
- _, err = o.Raw(sql, item.SignupType, item.UserId, item.ActivityId).Exec()
- } else {
- lastId, err = o.Insert(item)
- }
- if err != nil {
- return
- }
- itemLog := new(CygxActivitySignupLog)
- itemLog.UserId = item.UserId
- itemLog.ActivityId = item.ActivityId
- itemLog.CreateTime = time.Now()
- itemLog.Mobile = item.Mobile
- itemLog.Email = item.Email
- itemLog.CompanyId = item.CompanyId
- itemLog.CompanyName = item.CompanyName
- itemLog.Type = 1
- lastId, err = o.Insert(itemLog)
- return
- }
- // 仅绑定邮箱的用户修改报名后,添加报名信息
- func AddActivitySignupFromEmail(item *CygxActivitySignup) (lastId int64, err error) {
- o, err := orm.NewOrm().Begin()
- if err != nil {
- return
- }
- defer func() {
- fmt.Println(err)
- if err == nil {
- o.Commit()
- } else {
- o.Rollback()
- }
- }()
- var count int
- var countMySchedule int
- ow := orm.NewOrmUsingDB("weekly_report")
- sql := `UPDATE wx_user SET outbound_mobile=? ,outbound_country_code = ? ,is_msg_outbound_mobile = 1 WHERE user_id=? `
- _, err = ow.Raw(sql, item.OutboundMobile, item.CountryCode, item.UserId).Exec()
- if err != nil {
- return
- }
- sql = `SELECT COUNT(1) AS count FROM cygx_my_schedule WHERE user_id=? AND activity_id=? `
- err = o.Raw(sql, item.UserId, item.ActivityId).QueryRow(&countMySchedule)
- if err != nil {
- return
- }
- if countMySchedule == 0 {
- itemMy := new(CygxMySchedule)
- itemMy.UserId = item.UserId
- itemMy.ActivityId = item.ActivityId
- itemMy.CreateTime = time.Now()
- itemMy.Mobile = item.Mobile
- itemMy.Email = item.Email
- itemMy.CompanyId = item.CompanyId
- itemMy.CompanyName = item.CompanyName
- lastId, err = o.Insert(itemMy)
- if err != nil {
- return
- }
- }
- sql = `SELECT COUNT(1) AS count FROM cygx_activity_signup WHERE user_id=? AND activity_id=? `
- err = o.Raw(sql, item.UserId, item.ActivityId).QueryRow(&count)
- if err != nil {
- return
- }
- if count > 0 {
- sql := `UPDATE cygx_activity_signup SET is_cancel = 0 ,do_fail_type = 0, signup_type=? WHERE user_id=? AND activity_id=? `
- _, err = o.Raw(sql, item.SignupType, item.UserId, item.ActivityId).Exec()
- } else {
- lastId, err = o.Insert(item)
- }
- if err != nil {
- return
- }
- itemLog := new(CygxActivitySignupLog)
- itemLog.UserId = item.UserId
- itemLog.ActivityId = item.ActivityId
- itemLog.CreateTime = time.Now()
- itemLog.Mobile = item.Mobile
- itemLog.Email = item.Email
- itemLog.CompanyId = item.CompanyId
- itemLog.CompanyName = item.CompanyName
- itemLog.Type = 1
- lastId, err = o.Insert(itemLog)
- return
- }
- // 添加报名信息
- func AddActivitySignupNoSchedule(item *CygxActivitySignup) (lastId int64, err error) {
- o, err := orm.NewOrm().Begin()
- if err != nil {
- return
- }
- defer func() {
- fmt.Println(err)
- if err == nil {
- o.Commit()
- } else {
- o.Rollback()
- }
- }()
- lastId, err = o.Insert(item)
- if err != nil {
- return
- }
- itemLog := new(CygxActivitySignupLog)
- itemLog.UserId = item.UserId
- itemLog.ActivityId = item.ActivityId
- itemLog.CreateTime = time.Now()
- itemLog.Mobile = item.Mobile
- itemLog.Email = item.Email
- itemLog.CompanyId = item.CompanyId
- itemLog.CompanyName = item.CompanyName
- itemLog.Type = 1
- lastId, err = o.Insert(itemLog)
- return
- }
- // 获取用户报名成功数量
- func GetActivitySignupCount(uid, activityId int) (count int, err error) {
- sqlCount := `SELECT COUNT(1) AS count FROM cygx_activity_signup WHERE is_cancel=0 AND do_fail_type = 0 AND user_id=? AND activity_id=? `
- o := orm.NewOrm()
- err = o.Raw(sqlCount, uid, activityId).QueryRow(&count)
- return
- }
- // 获取用户报名数量
- func GetActivitySignupByUserCount(uid, activityId int) (count int, err error) {
- sqlCount := `SELECT COUNT(1) AS count FROM cygx_activity_signup WHERE is_cancel=0 AND user_id=? AND activity_id=? `
- o := orm.NewOrm()
- err = o.Raw(sqlCount, uid, activityId).QueryRow(&count)
- return
- }
- // 获取除弘则以外所有成功报名的用户数量
- func GetActivitySignupSuccessByUserCountNoHz(activityId int) (count int, err error) {
- sqlCount := `SELECT
- COUNT( 1 ) AS count
- FROM
- cygx_activity_signup
- WHERE
- is_cancel = 0
- AND company_id != 16
- AND do_fail_type = 0
- AND activity_id = ? `
- o := orm.NewOrm()
- err = o.Raw(sqlCount, activityId).QueryRow(&count)
- return
- }
- // 获取用户报名禁止数量
- func GetActivitySignupByUserRestrictCount(uid, activityId int) (count int, err error) {
- sqlCount := `SELECT COUNT(1) AS count FROM cygx_activity_signup WHERE do_fail_type=3 AND user_id=? AND activity_id=? `
- o := orm.NewOrm()
- err = o.Raw(sqlCount, uid, activityId).QueryRow(&count)
- return
- }
- // 获取某一活动已经报名的数量
- func GetActivitySignupSuccessCount(activityId int) (count int, err error) {
- sqlCount := `SELECT COUNT(1) AS count FROM cygx_activity_signup WHERE is_cancel=0 AND do_fail_type = 0 AND activity_id=? `
- o := orm.NewOrm()
- err = o.Raw(sqlCount, activityId).QueryRow(&count)
- return
- }
- // 获取某一活动某个机构已经报名的数量
- func GetActivitySignupCompanyCount(activityId, companyId int) (count int, err error) {
- sqlCount := `SELECT COUNT(1) AS count FROM cygx_activity_signup WHERE is_cancel=0 AND fail_type = 0 AND activity_id=? AND company_id=? `
- o := orm.NewOrm()
- err = o.Raw(sqlCount, activityId, companyId).QueryRow(&count)
- return
- }
- // 获取某一用户是否被限制报名
- func GetUserRestrictCount(mobile string) (count int, err error) {
- sqlCount := `SELECT COUNT(1) AS count FROM cygx_activity_restrict_signup WHERE is_restrict=1 AND mobile=? `
- o := orm.NewOrm()
- err = o.Raw(sqlCount, mobile).QueryRow(&count)
- return
- }
- // 获取某一用户的日程数量
- func GetUserMeetingReminderCount(uid int) (count int, err error) {
- sqlCount := `SELECT COUNT(1) AS count FROM cygx_my_schedule WHERE user_id=? `
- o := orm.NewOrm()
- err = o.Raw(sqlCount, uid).QueryRow(&count)
- return
- }
- // 获取某一用户的报名的数量
- func GetUserSignupCount(uid int) (count int, err error) {
- sqlCount := `SELECT COUNT(1) AS count FROM cygx_activity_signup_log WHERE user_id=? `
- o := orm.NewOrm()
- err = o.Raw(sqlCount, uid).QueryRow(&count)
- return
- }
- // 取消报名
- func CancelActivitySignup(item *CygxActivitySignup) (lastId int64, err error) {
- o, err := orm.NewOrm().Begin()
- if err != nil {
- return
- }
- defer func() {
- fmt.Println(err)
- if err == nil {
- o.Commit()
- } else {
- o.Rollback()
- }
- }()
- //判断是否删除我的日程
- var countReminder int
- var countAppointment int
- sql := `SELECT COUNT(1) AS count FROM cygx_activity_meeting_reminder WHERE is_cancel = 0 AND user_id=? AND activity_id=? `
- err = o.Raw(sql, item.UserId, item.ActivityId).QueryRow(&countReminder)
- sql = `SELECT COUNT(1) AS count FROM cygx_activity_appointment WHERE user_id=? AND activity_id=? `
- err = o.Raw(sql, item.UserId, item.ActivityId).QueryRow(&countAppointment)
- if err != nil {
- return
- }
- if countReminder == 0 && countAppointment == 0 {
- sql = `DELETE FROM cygx_my_schedule WHERE user_id=? AND activity_id=? `
- _, err = o.Raw(sql, item.UserId, item.ActivityId).Exec()
- if err != nil {
- return
- }
- }
- sql = `DELETE FROM cygx_activity_signup WHERE user_id=? AND activity_id=? `
- _, err = o.Raw(sql, item.UserId, item.ActivityId).Exec()
- if err != nil {
- return
- }
- itemLog := new(CygxActivitySignupLog)
- itemLog.UserId = item.UserId
- itemLog.ActivityId = item.ActivityId
- itemLog.CreateTime = time.Now()
- itemLog.Mobile = item.Mobile
- itemLog.Email = item.Email
- itemLog.CompanyId = item.CompanyId
- itemLog.CompanyName = item.CompanyName
- itemLog.Type = 2
- lastId, err = o.Insert(itemLog)
- return
- }
- // 详情
- func GetActivitySignupDetail(activityId, uid int) (item *CygxActivitySignup, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM cygx_activity_signup WHERE activity_id = ? AND user_id =? `
- err = o.Raw(sql, activityId, uid).QueryRow(&item)
- return
- }
- func GetActivitySignuListByUser(condition string, pars []interface{}) (item []*CygxActivitySignup, err error) {
- o := orm.NewOrm()
- sql := `SELECT *
- FROM
- cygx_activity_signup
- WHERE 1 = 1 ` + condition
- _, err = o.Raw(sql, pars).QueryRows(&item)
- return
- }
- // 解除报名限制之后二次报名
- func AddActivitySignupByRestrict(item *CygxActivitySignup) (lastId int64, err error) {
- o, err := orm.NewOrm().Begin()
- if err != nil {
- return
- }
- defer func() {
- fmt.Println(err)
- if err == nil {
- o.Commit()
- } else {
- o.Rollback()
- }
- }()
- itemMy := new(CygxMySchedule)
- itemMy.UserId = item.UserId
- itemMy.ActivityId = item.ActivityId
- itemMy.CreateTime = time.Now()
- itemMy.Mobile = item.Mobile
- itemMy.Email = item.Email
- itemMy.CompanyId = item.CompanyId
- itemMy.CompanyName = item.CompanyName
- lastId, err = o.Insert(itemMy)
- if err != nil {
- return
- }
- sql := `UPDATE cygx_activity_signup SET do_fail_type = 0 , fail_type=0 WHERE user_id=? AND activity_id=? `
- _, err = o.Raw(sql, item.UserId, item.ActivityId).Exec()
- itemLog := new(CygxActivitySignupLog)
- itemLog.UserId = item.UserId
- itemLog.ActivityId = item.ActivityId
- itemLog.CreateTime = time.Now()
- itemLog.Mobile = item.Mobile
- itemLog.Email = item.Email
- itemLog.CompanyId = item.CompanyId
- itemLog.CompanyName = item.CompanyName
- itemLog.Type = 1
- lastId, err = o.Insert(itemLog)
- return
- }
- // 列表
- func GetActivitySignupListAll() (items []*CygxActivitySignup, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM cygx_activity_signup `
- _, err = o.Raw(sql).QueryRows(&items)
- return
- }
- // 修改是否推送消息状态
- func UPdateSignup(item *CygxActivitySignup) (err error) {
- sql := ` UPDATE cygx_activity_signup SET outbound_mobile= ? , country_code=86 WHERE id = ?`
- o := orm.NewOrm()
- _, err = o.Raw(sql, item.Mobile, item.Id).Exec()
- return
- }
- // 获取数量
- func GetActivityCountByIdWithUid(activityId, Uid int) (count int, err error) {
- o := orm.NewOrm()
- sqlCount := `SELECT COUNT(1) AS count FROM cygx_activity_signup WHERE activity_id = ? AND user_id = ?`
- err = o.Raw(sqlCount, activityId, Uid).QueryRow(&count)
- return
- }
- // 获取用户报名数量
- func GetActivitySignupNomeetingCount(activityId int) (count int, err error) {
- sqlCount := `SELECT
- COUNT( 1 ) count
- FROM
- cygx_activity_signup AS s
- INNER JOIN cygx_activity AS a ON a.activity_id = s.activity_id
- WHERE
- 1 = 1
- AND a.is_limit_people > 0
- AND s.is_meeting = 0
- AND a.is_submit_meeting = 1
- AND a.activity_id = ?`
- o := orm.NewOrm()
- err = o.Raw(sqlCount, activityId).QueryRow(&count)
- return
- }
- func GetUserMeetingMobile(activityId int) (items []*CygxActivitySignup, err error) {
- o := orm.NewOrm()
- sql := `SELECT *
- FROM
- cygx_activity_signup AS s
- WHERE
- s.is_meeting = 1
- AND s.activity_id = ?`
- _, err = o.Raw(sql, activityId).QueryRows(&items)
- return
- }
- // 获取用户是否被限制报名
- func GetRestrictSignupCountByUid(uid int) (count int, err error) {
- sqlCount := `SELECT COUNT( 1 ) count FROM cygx_activity_restrict_signup WHERE user_id = ?`
- o := orm.NewOrm()
- err = o.Raw(sqlCount, uid).QueryRow(&count)
- return
- }
- // 获取用户爽约次数
- func GetActivitySignupNomeetingCountByUid(uid int) (count int, err error) {
- sqlCount := `SELECT
- COUNT( 1 ) count
- FROM
- cygx_activity_signup AS s
- INNER JOIN cygx_activity AS a ON a.activity_id = s.activity_id
- WHERE
- 1 = 1
- AND a.is_limit_people > 0
- AND s.is_meeting = 0
- AND a.is_submit_meeting = 1
- AND s.do_fail_type = 0
- AND s.user_id = ?`
- o := orm.NewOrm()
- err = o.Raw(sqlCount, uid).QueryRow(&count)
- return
- }
- // 删除
- func DeleteCygxActivityRestrictSignup(uid int) (err error) {
- o := orm.NewOrm()
- sql := ` DELETE FROM cygx_activity_restrict_signup WHERE user_id=?`
- _, err = o.Raw(sql, uid).Exec()
- return
- }
- type CygxActivitySignupList struct {
- Id int `orm:"column(id);pk"`
- UserId int `description:"用户id"`
- ActivityId int `description:"活动ID"`
- CompanyName string `description:"公司名称"`
- RealName string `description:"姓名"`
- CreateTime string `description:"创建时间"`
- IsMeeting int `description:"是否到会 ,1是, 0否"`
- Operation bool `description:"操作按钮,true,到会,false 未到会"`
- Channel int `description:"报名渠道,0 空降、 1小程序报名"`
- SellerName string `description:"所属销售"`
- Mobile string `description:"手机号"`
- Email string `description:"邮箱"`
- CompanyId int `description:"公司id"`
- SigninTime string `description:"签到时间"`
- }
- type CygxActivitySignupResp struct {
- CompanyName string `description:"公司名称"`
- RealName string `description:"姓名"`
- IsMeeting int `description:"是否到会 ,1是, 0否"`
- SigninTime string `description:"签到时间"`
- }
- // 获取用户报名列表
- func GetActivitySignupNomeetingCountList(activityId int) (items []*CygxActivitySignupList, err error) {
- o := orm.NewOrm()
- sql := `SELECT
- s.*
- FROM
- cygx_activity_signup AS s
- INNER JOIN cygx_activity AS a ON a.activity_id = s.activity_id
- WHERE
- 1 = 1
- AND s.is_meeting = 0
- AND a.is_submit_meeting = 1
- AND a.activity_id = ?`
- _, err = o.Raw(sql, activityId).QueryRows(&items)
- return
- }
- type UserAndCompanyName struct {
- UserId int `orm:"column(user_id);pk"`
- Mobile string
- Email string
- CompanyId int
- CompanyName string `description:"公司名称"`
- CountryCode string `description:"手机国家区号"`
- OutboundMobile string `description:"外呼手机号"`
- OutboundCountryCode string `description:"外呼手机号区号"`
- }
- func GetUserAndCompanyNameList(uid int) (item *UserAndCompanyName, err error) {
- o := orm.NewOrm()
- sql := ` SELECT u.*,c.company_name
- FROM wx_user AS u
- INNER JOIN company AS c ON c.company_id = u.company_id
- WHERE user_id =?`
- err = o.Raw(sql, uid).QueryRow(&item)
- return
- }
- type CygxActivityRestrictSignup struct {
- Id int `orm:"column(id);pk"`
- UserId int `description:"用户id,多个用,隔开"`
- CreateTime time.Time `description:"创建时间"`
- Mobile string `description:"手机号"`
- Email string `description:"邮箱号"`
- CompanyId int `description:"公司ID"`
- CompanyName string `description:"公司名称"`
- IsRestrict int `description:"是否限制报名,1是,0否"`
- }
- // 添加
- func AddCygxActivityRestrictSignup(item *CygxActivityRestrictSignup) (err error) {
- o := orm.NewOrm()
- _, err = o.Insert(item)
- return
- }
- // 获取列表信息根据手机号分组
- func GetCygxActivitySignupByMobileList(condition string) (items []*CygxActivitySignup, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM cygx_activity_signup_detail WHERE 1= 1 ` + condition + ` GROUP BY mobile `
- _, err = o.Raw(sql).QueryRows(&items)
- return
- }
- // 修改用户报名的相关信息
- func UpdateCygxActivitySignup(wxUser *WxUserItem) (err error) {
- o := orm.NewOrm()
- sql := `UPDATE cygx_activity_signup_detail SET email=?,company_id=?,company_name=?,user_id=?,real_name=? WHERE mobile=? `
- _, err = o.Raw(sql, wxUser.Email, wxUser.CompanyId, wxUser.CompanyName, wxUser.UserId, wxUser.RealName, wxUser.Mobile).Exec()
- return
- }
- // UpdateCygxActivitySignupisMeet 修改易董的活动,用户已到会
- func UpdateCygxActivitySignupisMeet(activityId int, mobile string) (err error) {
- o := orm.NewOrm()
- sql := `UPDATE cygx_activity_signup SET is_meeting=1 WHERE activity_id=? AND mobile = ? `
- _, err = o.Raw(sql, activityId, mobile).Exec()
- return
- }
- // UpdateCygxActivitySignupisMeetList 批量修改易董的活动,用户已到会
- func UpdateCygxActivitySignupisMeetList(condition string, pars []interface{}) (err error) {
- if condition == "" {
- return
- }
- o := orm.NewOrm()
- sql := `UPDATE cygx_activity_signup SET is_meeting=1 WHERE 1= 1 ` + condition
- _, err = o.Raw(sql, pars).Exec()
- return
- }
- // GetCygxCygxActivitySignupList 获取报名列表信息
- func GetActivitySignupList(condition string, pars []interface{}) (items []*CygxActivitySignup, err error) {
- sql := `SELECT
- *
- FROM
- cygx_activity_signup AS v
- WHERE
- 1 = 1 ` + condition
- o := orm.NewOrm()
- _, err = o.Raw(sql, pars).QueryRows(&items)
- return
- }
- // GetCygxCygxActivitySignupList 获取报名列表信息
- func GetActivitySignupInnerActivityList(condition string, pars []interface{}) (items []*CygxActivitySignup, err error) {
- sql := `SELECT
- *
- FROM
- cygx_activity_signup AS v
- INNER JOIN cygx_activity as a ON a.activity_id = v.activity_id
- WHERE
- 1 = 1 ` + condition
- o := orm.NewOrm()
- _, err = o.Raw(sql, pars).QueryRows(&items)
- return
- }
- // UpdateCygxActivitySignupIsMeeting 批量标记用户的到会信息
- func UpdateCygxActivitySignupIsMeeting(items []*CygxActivityAttendanceDetail) (err error) {
- o := orm.NewOrm()
- p, err := o.Raw(` UPDATE cygx_activity_signup SET
- is_meeting = 1
- WHERE outbound_mobile = ? AND activity_id = ? `).Prepare()
- if err != nil {
- return
- }
- defer func() {
- _ = p.Close() // 别忘记关闭 statement
- }()
- for _, v := range items {
- _, err = p.Exec(
- v.Mobile,
- v.ActivityId)
- if err != nil {
- return
- }
- }
- return
- }
|