|
@@ -1,58 +1,61 @@
|
|
package cygx_activity
|
|
package cygx_activity
|
|
|
|
|
|
import (
|
|
import (
|
|
|
|
+ "fmt"
|
|
"github.com/beego/beego/v2/client/orm"
|
|
"github.com/beego/beego/v2/client/orm"
|
|
"time"
|
|
"time"
|
|
)
|
|
)
|
|
|
|
|
|
// 活动详情
|
|
// 活动详情
|
|
type CygxActivity struct {
|
|
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:"创建时间"`
|
|
|
|
- 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:"销售/管理员姓名"`
|
|
|
|
|
|
+ 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:"创建时间"`
|
|
|
|
+ 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:"销售/管理员姓名"`
|
|
|
|
+ TencentConferenceNumber string `description:"腾讯会议号"`
|
|
|
|
+ VmpRobotMeetingId string `description:"会议ID"`
|
|
}
|
|
}
|
|
|
|
|
|
type CygxActivitySignup struct {
|
|
type CygxActivitySignup struct {
|
|
@@ -71,6 +74,7 @@ type CygxActivitySignup struct {
|
|
RealName string `description:"用户实际名称"`
|
|
RealName string `description:"用户实际名称"`
|
|
SellerName string `description:"所属销售"`
|
|
SellerName string `description:"所属销售"`
|
|
YidongExamineStatus int `description:"易董活动报名审核状态0审核中,1:审核通过、2审核不通过"`
|
|
YidongExamineStatus int `description:"易董活动报名审核状态0审核中,1:审核通过、2审核不通过"`
|
|
|
|
+ ThreeSource int `description:"三方来源,1进门财经"`
|
|
}
|
|
}
|
|
|
|
|
|
type CygxYidongActivityExamineStatus struct {
|
|
type CygxYidongActivityExamineStatus struct {
|
|
@@ -96,6 +100,19 @@ func GetAddActivityInfoById(activityIdYiDong string) (item *CygxActivity, err er
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// 通过ID获取活动详情
|
|
|
|
+func GetAddActivityInfoByActivityId(activityId int) (item *CygxActivity, err error) {
|
|
|
|
+ o := orm.NewOrmUsingDB("hz_cygx")
|
|
|
|
+ sql := `SELECT
|
|
|
|
+ a.*
|
|
|
|
+ FROM
|
|
|
|
+ cygx_activity as a
|
|
|
|
+ WHERE
|
|
|
|
+ activity_id = ? `
|
|
|
|
+ err = o.Raw(sql, activityId).QueryRow(&item)
|
|
|
|
+ return
|
|
|
|
+}
|
|
|
|
+
|
|
type ExamineStatusReq struct {
|
|
type ExamineStatusReq struct {
|
|
ActivityId int `description:"活动ID"`
|
|
ActivityId int `description:"活动ID"`
|
|
Mobile string `description:"手机号" json:"mobile"`
|
|
Mobile string `description:"手机号" json:"mobile"`
|
|
@@ -220,6 +237,19 @@ type CygxMySchedule struct {
|
|
CompanyName string `description:"公司名称"`
|
|
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取消报名"`
|
|
|
|
+}
|
|
|
|
+
|
|
// GetCygxMyScheduleList 获取我的日程数据
|
|
// GetCygxMyScheduleList 获取我的日程数据
|
|
func GetCygxMyScheduleList(activityId int) (items []*CygxMySchedule, err error) {
|
|
func GetCygxMyScheduleList(activityId int) (items []*CygxMySchedule, err error) {
|
|
o := orm.NewOrmUsingDB("hz_cygx")
|
|
o := orm.NewOrmUsingDB("hz_cygx")
|
|
@@ -253,3 +283,73 @@ func DelCygxcActivitySignup(mobile string, activityId int) (err error) {
|
|
_, err = o.Raw(sql, activityId).Exec()
|
|
_, err = o.Raw(sql, activityId).Exec()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+// 添加报名信息
|
|
|
|
+func AddActivitySignup(item *CygxActivitySignup) (lastId int64, err error) {
|
|
|
|
+ o, err := orm.NewOrmUsingDB("hz_cygx").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 GetActivitySignupCountByUserId(uid, activityId int) (count int, err error) {
|
|
|
|
+ sqlCount := `SELECT COUNT(1) AS count FROM cygx_activity_signup WHERE user_id=? AND activity_id=? `
|
|
|
|
+ o := orm.NewOrm()
|
|
|
|
+ err = o.Raw(sqlCount, uid, activityId).QueryRow(&count)
|
|
|
|
+ return
|
|
|
|
+}
|