|
@@ -184,8 +184,7 @@ func monitor(ctx context.Context) {
|
|
|
// 双十二活动 查询活动期间的第多少名
|
|
|
func monitorMode2(ctx context.Context) {
|
|
|
logger.Info("开始本轮订单查询")
|
|
|
- _, inTime, _ := activity.MembershipDay.InActivity()
|
|
|
- if !inTime {
|
|
|
+ if time.Now().Before(activity.MembershipDay.T2) { // 活动未开始
|
|
|
logger.Info("当前时间不在活动时间范围内")
|
|
|
return
|
|
|
}
|
|
@@ -201,7 +200,7 @@ func monitorMode2(ctx context.Context) {
|
|
|
if _, ok := ruleWinNumFlag[i][num]; !ok { // 不在待查询的map中
|
|
|
continue
|
|
|
}
|
|
|
- rs := selectOrder2(num, rules.Products, rules.PriceLimit, rules.PriceStart, rules.PriceEnd, date.FormatDate(&activity.MembershipDay.T2, date.Date_Short_Layout), date.FormatDate(&activity.MembershipDay.Ed, date.Date_Short_Layout))
|
|
|
+ rs := selectOrder2(num, rules.Products, rules.PriceLimit, rules.PriceStart, rules.PriceEnd, date.FormatDate(&activity.MembershipDay.T2, date.Date_Full_Layout), date.FormatDate(&activity.MembershipDay.Ed, date.Date_Full_Layout))
|
|
|
if len(rs) == 0 {
|
|
|
logger.Info("未查到", num)
|
|
|
break // 如果没有查询到 等待下一轮任务再查询
|
|
@@ -234,6 +233,10 @@ func monitorMode2(ctx context.Context) {
|
|
|
needSelect = true // 存在未查询到的 定时任务不用关闭
|
|
|
}
|
|
|
}
|
|
|
+ if time.Now().After(activity.MembershipDay.Ed) { // 活动已结束
|
|
|
+ logger.Info("活动已结束")
|
|
|
+ needSelect = false
|
|
|
+ }
|
|
|
if !needSelect { // 不用再找了 结束任务
|
|
|
gcron.Remove("selectJob")
|
|
|
gcron.Remove("openCronJob")
|
|
@@ -272,6 +275,7 @@ LIMIT ?,1
|
|
|
|
|
|
// 查询活动期间指定支付顺序的订单
|
|
|
func selectOrder2(num int, productType []string, priceLimit bool, priceStart, priceEnd int, startTime, endTime string) map[string]interface{} {
|
|
|
+ logger.Info(startTime, endTime, "==================")
|
|
|
var products []string
|
|
|
var values []interface{}
|
|
|
productTypeStr := "" // 产品类型
|