123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- package cygx
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- type CygxActivitySignupDetail 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:"所属销售"`
- FirstMeetingTime string `description:"首次入会时间"`
- LastMeetingTime string `description:"最后退出时间"`
- Duration string `description:"参会时长"`
- MeetingTypeStr string `description:"参会方式"`
- MeetingAuthentication string `description:"参会权鉴"`
- MeetingStatusStr string `description:"参会状态"`
- Position string `description:"职位"`
- IsMeeting int `description:"是否到会,1到会,0未到会"`
- UseridEntity int `description:"参会者身份. 1:主讲人, 2:主持人, 3:嘉宾, 4:普通参会者, 5:联席主讲人, 6:会议助理"`
- ActivityTime string `description:"活动时间"`
- CrmCompanyMapStatusId int `description:"转换后的对应状态信息:1=正式客户, 2=曾使用客户, 3=其他"`
- }
- // 获取今天报名的用户信息,存入到参会记录表中
- func GetSignupDetailBySignup(condition string, pars []interface{}) (list []*CygxActivitySignupDetail, err error) {
- o := orm.NewOrmUsingDB("hz_cygx")
- sql := `SELECT * FROM cygx_activity_signup WHERE 1= 1 `
- if condition != "" {
- sql += condition
- }
- _, err = o.Raw(sql, pars).QueryRows(&list)
- return
- }
- // 获取参会记录表列表
- func GetSignupDetailList(condition string, pars []interface{}) (list []*CygxActivitySignupDetail, err error) {
- o := orm.NewOrmUsingDB("hz_cygx")
- sql := `SELECT * FROM cygx_activity_signup_detail WHERE 1= 1 `
- if condition != "" {
- sql += condition
- }
- _, err = o.Raw(sql, pars).QueryRows(&list)
- return
- }
- // 添加
- func AddCygxActivitySignupDetail(items []*CygxActivitySignupDetail) (err error) {
- o, err := orm.NewOrmUsingDB("hz_cygx").Begin()
- if err != nil {
- return
- }
- defer func() {
- if err == nil {
- o.Commit()
- } else {
- o.Rollback()
- }
- }()
- if len(items) > 0 {
- //批量添加
- _, err = o.InsertMulti(len(items), items)
- if err != nil {
- return err
- }
- }
- return
- }
- // UpdateActivitySignupDetailMulti 批量修改用户报名信息且报名的人
- func UpdateActivitySignupDetailMulti(items []*CygxActivitySignupDetail) (err error) {
- o := orm.NewOrmUsingDB("hz_cygx")
- p, err := o.Raw(` UPDATE cygx_activity_signup_detail SET
- first_meeting_time = ?,
- last_meeting_time = ?,
- duration = ?,
- meeting_type_str = ?,
- meeting_authentication = ?,
- meeting_status_str = ?,
- position = ?,
- is_meeting = ?,
- userid_entity = ?,
- activity_time = ?,
- crm_company_map_status_id = ?
- WHERE mobile = ? AND activity_id = ? `).Prepare()
- if err != nil {
- return
- }
- defer func() {
- _ = p.Close() // 别忘记关闭 statement
- }()
- for _, v := range items {
- _, err = p.Exec(
- v.FirstMeetingTime,
- v.LastMeetingTime,
- v.Duration,
- v.MeetingTypeStr,
- v.MeetingAuthentication,
- v.MeetingStatusStr,
- v.Position,
- v.IsMeeting,
- v.UseridEntity,
- v.ActivityTime,
- v.CrmCompanyMapStatusId,
- v.Mobile, v.ActivityId)
- if err != nil {
- return
- }
- }
- return
- }
- // UpdateActivitySignupDetailMultiByYiDong 易董批量修改用户报名信息且报名的人
- func UpdateActivitySignupDetailMultiByYiDong(items []*CygxActivitySignupDetail) (err error) {
- o := orm.NewOrmUsingDB("hz_cygx")
- p, err := o.Raw(` UPDATE cygx_activity_signup_detail SET
- first_meeting_time = ?,
- last_meeting_time = ?,
- meeting_status_str = ?,
- position = ?,
- real_name = ?,
- duration = ?,
- is_meeting = ?
- WHERE mobile = ? AND activity_id = ? `).Prepare()
- if err != nil {
- return
- }
- defer func() {
- _ = p.Close() // 别忘记关闭 statement
- }()
- for _, v := range items {
- _, err = p.Exec(
- v.FirstMeetingTime,
- v.LastMeetingTime,
- v.MeetingStatusStr,
- v.Position,
- v.RealName,
- v.Duration,
- v.IsMeeting,
- v.Mobile, v.ActivityId)
- if err != nil {
- return
- }
- }
- return
- }
|