WH01243 6 сар өмнө
parent
commit
e873f64f27

+ 1 - 0
clueSync/config.go

@@ -31,6 +31,7 @@ type (
 		ActiveTime              string  `json:"activeTime"`
 		RebindTime              string  `json:"rebindTime"`
 		InviteTime              string  `json:"inviteTime"`
+		ActivityTime            string  `json:"activityTime"`
 	}
 	DB struct {
 		CornExp1      int64  `json:"cornexp1"`

+ 7 - 6
clueSync/config.json

@@ -1,14 +1,14 @@
 {
-  "lastOrderId": 258784,
-  "lastOrderClueId": "2024-05-25 02:23:21",
+  "lastOrderId": 260273,
+  "lastOrderClueId": "2024-09-19 11:51:37",
   "lastUserId": "2024-05-20 15:40:02",
   "lastXcxUserId": "2024-07-09 14:59:37",
   "lastId": "66cd4d3ae83797f8bf5e7ca2",
   "lastOrderTime": "2023-04-25 00:00:00",
   "lastUserTime": "2024-07-09 11:54:02",
-  "lastSubscribeId": "64547124b487f52aade52c80",
-  "lastMessageTime": "2024-06-20 17:54:18",
-  "lastkcTime": "",
+  "lastSubscribeId": "6459d89a8edef707156e9cc6",
+  "lastMessageTime": "2024-07-16 14:26:26",
+  "lastkcTime": "2025-01-08 11:18:00",
   "lastEverythingTime": "",
   "lastEventRegTime": "",
   "lastReadClueTime": "",
@@ -21,5 +21,6 @@
   "allocationRatio": 2,
   "activeTime": "2024-07-01 14:59:37",
   "rebindTime": "2024-08-27 16:10:27",
-  "inviteTime": "2024-11-10 10:47:16"
+  "inviteTime": "2024-11-20 14:42:11",
+  "activityTime": "2025-01-15 14:29:30"
 }

+ 16 - 1
clueSync/job.go

@@ -237,9 +237,24 @@ func FormatData(data map[string]interface{}, item string) (bool, bool, bool) {
 		cluename = common.ObjToString((*userInfo)["company_name"])
 		phone = common.ObjToString((*userInfo)["phone"])
 		sourceCode = common.ObjToString(data["sourceCode"])
+	} else if item == "activity" {
+		query["userid"] = userId
+		userInfo := TiDb.FindOne("dwd_f_userbase_baseinfo", query, "", "")
+		if userInfo != nil && len(*userInfo) > 0 {
+			uId = common.ObjToString((*userInfo)["uid"])
+			source = common.ObjToString((*userInfo)["source"])       //用户来源
+			belong_to = common.ObjToString((*userInfo)["belong_to"]) //用户归属
+		} else {
+			log.Println("邀请用户,用户归集没数据", data)
+			return true, true, true
+		}
+		cluename = common.ObjToString((*userInfo)["company_name"])
+		phone = common.ObjToString((*userInfo)["phone"])
+		sourceCode = gconv.String(data["sourceCode"])
+		log.Println(sourceCode)
 	}
 	log.Println(222, cluename)
-	if cluename == "" && item != "message" && item != "orders" && item != "readClue" && item != "rebind" && item != "allocation" {
+	if cluename == "" && item != "message" && item != "orders" && item != "readClue" && item != "rebind" && item != "allocation" && item != "activity" {
 		cluename = phone //没有线索名,手机号代替
 	}
 	log.Println(333, cluename)

+ 12 - 20
clueSync/jobutil.go

@@ -1906,7 +1906,7 @@ func inviteUser() {
 }
 
 // 开年活动
-func nextYearActivit() {
+func nextYearActivity() {
 	log.Println("开年活动处理开始")
 	//判断节假日
 	runOk := getRunOk()
@@ -1914,33 +1914,25 @@ func nextYearActivit() {
 		log.Println("不是工作日,任务暂停")
 		return
 	}
-	rebindTimeEnd := cfg.InviteTime
-	sql := fmt.Sprintf(`select * from user_statistics where createTime > "%s" order by  createTime asc`, rebindTimeEnd)
-	data := BiService.SelectBySql(sql)
+	activityTimeEnd := cfg.ActivityTime
+	sql := fmt.Sprintf(`select * from jyactivities.lottery_user_account where create_time > "%s" order by  create_time asc`, activityTimeEnd)
+	data := Mysql.SelectBySql(sql)
 	if data != nil && *data != nil && len(*data) > 0 {
 		for _, v := range *data {
-			rebindTimeEnd = common.ObjToString(v["createTime"])
-			event := gconv.Int64(v["event"])
-			switch event {
-			case 1:
-				v["sourceCode"] = "736"
-			case 2:
-				v["sourceCode"] = "737"
-			case 3:
-				v["sourceCode"] = "738"
-			}
-			v["user_id"] = gconv.String(v["userId"])
-			ok1, ok2, _ := FormatData(v, "invite")
+			activityTimeEnd = common.ObjToString(v["create_time"])
+			v["sourceCode"] = gconv.Int64(v["active_id"])
+			v["user_id"] = gconv.String(v["mgo_user_id"])
+			ok1, ok2, _ := FormatData(v, "activity")
 			if !ok1 {
-				log.Println("线索卡点", "invite", v, rebindTimeEnd)
+				log.Println("线索卡点", "activity", v, activityTimeEnd)
 			} else {
 				if !ok2 {
-					log.Println("用户分配已达上限", "invite", v, rebindTimeEnd)
+					log.Println("开年活动分配已达上限", "activity", v, activityTimeEnd)
 				}
 			}
 		}
-		cfg.InviteTime = rebindTimeEnd
+		cfg.ActivityTime = activityTimeEnd
 		common.WriteSysConfig(&cfg)
 	}
-	log.Println("邀请用户处理结束")
+	log.Println("开年活动处理结束")
 }