|
@@ -0,0 +1,48 @@
|
|
|
+package models
|
|
|
+
|
|
|
+import (
|
|
|
+ "fmt"
|
|
|
+ "github.com/beego/beego/v2/client/orm"
|
|
|
+ "hongze/hongze_cygx/utils"
|
|
|
+ "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:"所属销售"`
|
|
|
+}
|
|
|
+
|
|
|
+//获取当天已结束的活动
|
|
|
+func GetActivitySattusToComplete() (items []*CygxActivity, err error) {
|
|
|
+ defer func() {
|
|
|
+ if err != nil {
|
|
|
+ go utils.SendAlarmMsg("修改活动状态至已结束"+err.Error(), 2)
|
|
|
+ }
|
|
|
+ }()
|
|
|
+ o := orm.NewOrm()
|
|
|
+ resultTime_30 := time.Now().Add(-time.Minute * 30).Format(utils.FormatDateTime)
|
|
|
+ resultTime_60 := time.Now().Add(-time.Minute * 60).Format(utils.FormatDateTime)
|
|
|
+ startTime := time.Now().Format(utils.FormatDate)
|
|
|
+ var condition string
|
|
|
+ condition += ` AND (activity_type_id IN ( 1, 2, 3, 7 ) AND activity_time < '` + resultTime_30 + `' AND activity_time > '` + startTime + `')`
|
|
|
+ condition += ` OR(activity_type_id IN ( 4, 5, 6 ) AND activity_time < '` + resultTime_60 + `' AND activity_time > '` + startTime + `')`
|
|
|
+
|
|
|
+ fmt.Println(condition)
|
|
|
+ //return err
|
|
|
+ sql := " SELECT * FROM cygx_activity WHERE 1 = 1 " + condition
|
|
|
+ _, err = o.Raw(sql).QueryRows(&items)
|
|
|
+ return
|
|
|
+}
|