Browse Source

循环处理

WH01243 1 year ago
parent
commit
e0264c281f
1 changed files with 14 additions and 25 deletions
  1. 14 25
      clueSync/jobutil.go

+ 14 - 25
clueSync/jobutil.go

@@ -1297,28 +1297,21 @@ func rebind() {
 	sql := fmt.Sprintf(`select * from freeClubSign where sub_again_date > "%s" order by  sub_again_date asc`, rebindTimeEnd)
 	data := BiService.SelectBySql(sql)
 	if data != nil && *data != nil && len(*data) > 0 {
-		for k, v := range *data {
-			//
+		for _, v := range *data {
+			rebindTimeEnd = common.ObjToString(v["act_again_date"])
 			registedates, _ := time.Parse(date.Date_Full_Layout, gconv.String(v["register_time"]))
-			if time.Now().Unix()-registedates.Unix() < int64(db.RegTimes)*86400 {
-				//七天以内注册的
-				continue
-			}
-			ok1, ok2 := FormatData(v, "rebind")
-			if !ok1 {
-				log.Println("线索卡点", "allocation", v, rebindTimeEnd)
-				continue
-			} else {
-				if !ok2 {
-					log.Println("用户分配已达上限", "allocation", v, rebindTimeEnd)
-					continue
+			if time.Now().Unix()-registedates.Unix() > int64(db.RegTimes)*86400 {
+				ok1, ok2 := FormatData(v, "rebind")
+				if !ok1 {
+					log.Println("线索卡点", "allocation", v, rebindTimeEnd)
+				} else {
+					if !ok2 {
+						log.Println("用户分配已达上限", "allocation", v, rebindTimeEnd)
+					}
 				}
 			}
-			rebindTimeEnd = common.ObjToString(v["act_again_date"])
-			if k == len(*data)-1 {
-				cfg.AllocationTime = rebindTimeEnd
-			}
 		}
+		cfg.AllocationTime = rebindTimeEnd
 		common.WriteSysConfig(&cfg)
 	}
 	log.Println("重新关注用户处理结束")
@@ -1339,23 +1332,19 @@ func activeUsers() {
 	sql := fmt.Sprintf(`select * from freeClubSign where act_again_date > "%s" order by  act_again_date asc`, activeTimeEnd)
 	data := BiService.SelectBySql(sql)
 	if data != nil && *data != nil && len(*data) > 0 {
-		for k, v := range *data {
+		for _, v := range *data {
+			activeTimeEnd = common.ObjToString(v["act_again_date"])
 			ok1, ok2 := FormatData(v, "allocation")
 			log.Println(v, "allocation", ok1, ok2)
 			if !ok1 {
 				log.Println("线索卡点", "allocation", v, activeTimeEnd)
-				continue
 			} else {
 				if !ok2 {
 					log.Println("用户分配已达上限", "allocation", v, activeTimeEnd)
-					continue
 				}
 			}
-			activeTimeEnd = common.ObjToString(v["act_again_date"])
-			if k == len(*data)-1 {
-				cfg.ActiveTime = activeTimeEnd
-			}
 		}
+		cfg.ActiveTime = activeTimeEnd
 		common.WriteSysConfig(&cfg)
 	}
 	log.Println("活跃用户处理结束")