zwxi 11 bulan lalu
induk
melakukan
79bbd19306
1 mengubah file dengan 36 tambahan dan 0 penghapusan
  1. 36 0
      models/activity.go

+ 36 - 0
models/activity.go

@@ -624,3 +624,39 @@ func GetCygxActivityIdList(condition string, pars []interface{}) (items []*CygxA
 	_, err = o.Raw(sql, pars).QueryRows(&items)
 	return
 }
+
+// 获取研选系列专家电话会,会前1小时,满足推送的活动ID数量
+func GetCountActivityResearchToSendFile(condition, endDate string) (count int, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+	COUNT(1) count
+FROM
+	cygx_activity AS a
+	INNER JOIN cygx_activity_help_ask AS k ON k.activity_id = a.activity_id 
+WHERE
+	1 = 1 ` + condition + `
+	AND a.is_send_ask_msg = 0 
+	AND a.activity_time <= ? 
+	AND a.activity_time >= NOW()`
+	err = o.Raw(sql, endDate).QueryRow(&count)
+	return
+}
+
+// 获取研选系列专家电话会,会前1小时,满足推送的活动ID
+func GetActivityResearchToSendFile(condition, endDate string) (items []*ActivityIdRep, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+	* 
+FROM
+	cygx_activity AS a
+	INNER JOIN cygx_activity_help_ask AS k ON k.activity_id = a.activity_id 
+WHERE
+	1 = 1 ` + condition + `
+	AND a.is_send_ask_msg = 0 
+	AND a.activity_time <= ? 
+	AND a.activity_time >= NOW() 
+GROUP BY
+	a.activity_id `
+	_, err = o.Raw(sql, endDate).QueryRows(&items)
+	return
+}