WH01243 1 долоо хоног өмнө
parent
commit
ea3a5dee92

+ 14 - 11
clueSync/jobutil.go

@@ -592,10 +592,9 @@ func users() {
 	log.Println("新注册用户定时任务开始", cfg.LastUserId)
 	selectTimeEnd := cfg.LastUserId
 	sql := fmt.Sprintf(`select * from dwd_f_userbase_baseinfo   where createtime > "%s" and (s_platform != 'xcx' or    s_sourceid='jyzbw'    or  s_platform is  NULL)  and source = "0101" and status != 2  order by  createtime asc`, selectTimeEnd)
-	//sql := fmt.Sprintf(`select * from dwd_f_userbase_baseinfo   where id= 12617743`)
 	data := TiDb.SelectBySql(sql)
 	if data != nil && *data != nil && len(*data) > 0 {
-		for k, v := range *data {
+		for _, v := range *data {
 			//判断用户是否有小程序切使用过剑鱼其他产品
 			createtime := common.ObjToString(v["createtime"])
 			changeCode := GetUserChannel(gconv.String(v["userid"]))
@@ -606,6 +605,14 @@ func users() {
 					"belong_to": changeCode,
 				})
 			}
+			//判断一下用户是否进线索
+			uid := gconv.String(v["uid"])
+			if TiDb.Count("dwd_f_crm_clue_info", map[string]interface{}{
+				"uid": uid,
+			}) > 0 {
+				cfg.LastUserId = createtime
+				continue
+			}
 			ok1, ok2, _ := FormatData(v, "users")
 			if !ok1 {
 				log.Println("线索卡点", "users", v, selectTimeEnd)
@@ -614,9 +621,7 @@ func users() {
 					log.Println("用户分配已达上限", "users", v, selectTimeEnd)
 				}
 			}
-			if k == len(*data)-1 {
-				cfg.LastUserId = createtime
-			}
+			cfg.LastUserId = createtime
 		}
 	}
 	common.WriteSysConfig(&cfg)
@@ -661,7 +666,7 @@ WHERE
 	log.Println("11122", selectXcxTimeEnd, xcxData)
 	if xcxData != nil && *xcxData != nil && len(*xcxData) > 0 {
 		afList := []map[string]interface{}{}
-		for k, v := range *xcxData {
+		for _, v := range *xcxData {
 			//判断用户是否有小程序切使用过剑鱼其他产品
 			//判断uid
 			uId := ""
@@ -709,9 +714,7 @@ WHERE
 				}
 			}
 
-			if k == len(*xcxData)-1 {
-				cfg.LastXcxUserId = updatetime
-			}
+			cfg.LastXcxUserId = updatetime
 		}
 		if len(afList) > 0 {
 			//发邮件给张文福
@@ -1114,7 +1117,7 @@ func autoDraw(userId, mode, cluename, phone string, isGroup, isCommerce int) (po
 		//查一下之前有没有设置的人
 		data := TiDb.FindOne("temporary_assignment", map[string]interface{}{
 			"userId": userId,
-			"status": 1,
+			"status": 0,
 		}, "", "")
 		if data != nil && len(*data) > 0 {
 			positionId, seatNumber, saleName, isOk = gconv.Int64((*data)["positionId"]), gconv.String((*data)["seatNumber"]), gconv.String((*data)["saleName"]), true
@@ -1123,7 +1126,7 @@ func autoDraw(userId, mode, cluename, phone string, isGroup, isCommerce int) (po
 			TiDb.Update("temporary_assignment", map[string]interface{}{
 				"id": id,
 			}, map[string]interface{}{
-				"status": 0,
+				"status": 1,
 			})
 			return
 		}

+ 2 - 0
clueSync/manualOperation.go

@@ -66,6 +66,8 @@ func clueBefore(c *gin.Context) {
 			positionId = gconv.Int64((*clueData)["position_id"])
 		}
 
+	} else {
+		belong_to = GetUserChannel(userId)
 	}
 	if source == "0104" || strings.HasPrefix(belong_to, "02") || source == "0102" || source == "0103" || phone == "" || strings.HasPrefix(belong_to, "03") {
 		c.JSON(http.StatusOK, returnData)