xingzai 2 жил өмнө
parent
commit
5af5d7e48d

+ 48 - 0
models/activity_signup_detail.go

@@ -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
+}

+ 1 - 0
models/db.go

@@ -120,6 +120,7 @@ func init() {
 		new(CygxThreeApiLog),
 		new(CygxIndustrialArticleGroupManagement),
 		new(ArticleTopHistoryRecord),
+		new(CygxActivitySignupDetail),
 	)
 	// 记录ORM查询日志
 	orm.Debug = true

+ 19 - 0
services/activity.go

@@ -1571,3 +1571,22 @@ func AddActivitykeyWordSearch(keyWordSearch string, user *models.WxUserItem) {
 		}
 	}
 }
+
+func init() {
+	initss(22)
+}
+
+func initss(artcleId int) (err error) {
+	defer func() {
+		if err != nil {
+			go utils.SendAlarmMsg("周日下午四点半推送全部活动失败,DoActivityOnenIdWxTemplateMsg ErrMsg:"+err.Error(), 2)
+		}
+	}()
+	actList, err := models.GetActivitySattusToComplete()
+	if err != nil {
+		fmt.Println(err)
+		return err
+	}
+	fmt.Println(actList)
+	return err
+}