Explorar o código

Merge branch 'dev_v1.5.2_wh' of jianyu/datatools into feature/v1.5.2

王浩 hai 1 ano
pai
achega
08b20a86f6
Modificáronse 5 ficheiros con 37 adicións e 14 borrados
  1. 0 3
      clueSync/autoTask.go
  2. 3 1
      clueSync/everything.go
  3. 2 2
      clueSync/job.go
  4. 30 7
      clueSync/jobutil.go
  5. 2 1
      clueSync/tag.go

+ 0 - 3
clueSync/autoTask.go

@@ -385,7 +385,6 @@ func Thaw() {
 			continue
 		}
 		k--
-		fmt.Println(nowTime.Format("20060102"))
 	}
 	nameMap := map[int64]string{}
 	nameList := TiDb.SelectBySql("select  name,position_id from  dwd_f_crm_personnel_management")
@@ -395,7 +394,6 @@ func Thaw() {
 		}
 	}
 	//查询
-	fmt.Println()
 	layout := "2006-01-02 15:04:05"
 	//三天以后退公海处理
 	TiDb.SelectByBath(100, func(l *[]map[string]interface{}) bool {
@@ -438,7 +436,6 @@ func Thaw() {
 					"operator_id":  -1,
 				})
 			} else {
-				fmt.Println(FindUpperLimit(gconv.String(positionId), "", false))
 				if !FindUpperLimit(gconv.String(positionId), "", false) {
 					if TiDb.Update("dwd_f_crm_clue_info", map[string]interface{}{"id": clueId}, map[string]interface{}{
 						"is_assign": 1,

+ 3 - 1
clueSync/everything.go

@@ -546,10 +546,12 @@ func eventReg() {
 			ok1, ok2 := FormatData(v, "eventReg")
 			if !ok1 {
 				common.WriteSysConfig(&cfg)
+				log.Println("线索卡点", "eventReg", v, lastEventRegTime)
 				break
 			} else {
 				if !ok2 {
-					log.Println("用户分配已达上限")
+					log.Println("用户分配已达上限", "eventReg", v, lastEventRegTime)
+
 					common.WriteSysConfig(&cfg)
 					break
 				}

+ 2 - 2
clueSync/job.go

@@ -282,7 +282,7 @@ func FormatData(data map[string]interface{}, item string) (bool, bool) {
 					clueUpdateData := map[string]interface{}{}
 					if old_name != name && name != "" {
 						clueUpdateData["name"] = name
-						fmt.Println("1234", TiDb.Insert("dwd_f_crm_clue_change_record", map[string]interface{}{
+						TiDb.Insert("dwd_f_crm_clue_change_record", map[string]interface{}{
 							"clue_id":      clueId,
 							"change_field": "name",
 							"position_id":  0,
@@ -291,7 +291,7 @@ func FormatData(data map[string]interface{}, item string) (bool, bool) {
 							"new_value":    common.If(name != "", name, "/"),
 							"createtime":   nowTime,
 							"BCPCID":       BCPCID,
-							"operator_id":  -1}))
+							"operator_id":  -1})
 					}
 					if old_position != position && position != "" {
 						clueUpdateData["position"] = position

+ 30 - 7
clueSync/jobutil.go

@@ -32,10 +32,11 @@ func orders() {
 				ok1, ok2 := FormatData(v, "orders")
 				if !ok1 {
 					common.WriteSysConfig(&cfg)
+					log.Println("线索卡点", "orders", v, selectTimeEnd, selectTimeStart)
 					break
 				} else {
 					if !ok2 {
-						log.Println("用户分配已达上限")
+						log.Println("用户分配已达上限", "orders", v, selectTimeEnd, selectTimeStart)
 						common.WriteSysConfig(&cfg)
 						break
 					}
@@ -58,10 +59,11 @@ func readClue() {
 			ok1, ok2 := FormatData(v, "readClue")
 			if !ok1 {
 				common.WriteSysConfig(&cfg)
+				log.Println("用户分配已达上限", "readClue", v, lastReadClueTime)
 				break
 			} else {
 				if !ok2 {
-					log.Println("用户分配已达上限")
+					log.Println("用户分配已达上限", "readClue", v, lastReadClueTime)
 					common.WriteSysConfig(&cfg)
 					break
 				}
@@ -89,7 +91,18 @@ func users() {
 	if data != nil && *data != nil && len(*data) > 0 {
 		for k, v := range *data {
 			createtime := common.ObjToString(v["createtime"])
-			FormatData(v, "users")
+			ok1, ok2 := FormatData(v, "users")
+			if !ok1 {
+				common.WriteSysConfig(&cfg)
+				log.Println("线索卡点", "users", v, selectTimeEnd)
+				break
+			} else {
+				if !ok2 {
+					log.Println("用户分配已达上限", "users", v, selectTimeEnd)
+					common.WriteSysConfig(&cfg)
+					break
+				}
+			}
 			if k == len(*data)-1 {
 				cfg.LastUserId = createtime
 			}
@@ -129,10 +142,11 @@ func saleLeads() {
 		ok1, ok2 := FormatData(thisData, "saleLeads")
 		if !ok1 {
 			common.WriteSysConfig(&cfg)
+			log.Println("线索卡点", "saleLeads", thisData, lastId)
 			break
 		} else {
 			if !ok2 {
-				log.Println("用户分配已达上限")
+				log.Println("用户分配已达上限", "saleLeads", thisData, lastId)
 				common.WriteSysConfig(&cfg)
 				break
 			}
@@ -235,7 +249,18 @@ func userbase() {
 							}
 						} else {
 							if count == 0 {
-								FormatData(v, "users")
+								ok1, ok2 := FormatData(v, "users")
+								if !ok1 {
+									common.WriteSysConfig(&cfg)
+									log.Println("线索卡点", "userbase uid", v, uId)
+									break
+								} else {
+									if !ok2 {
+										log.Println("用户分配已达上限", "userbase uid", v, uId)
+										common.WriteSysConfig(&cfg)
+										break
+									}
+								}
 							} else {
 								TiDb.Insert("dwd_f_userbase_contacts", map[string]interface{}{
 									"status":      1,
@@ -569,9 +594,7 @@ func FindUpperLimit(positionId string, level string, isAdd bool) bool {
 		return false
 	}
 	isFull := false
-	fmt.Println("111", positionId, TiDb.CountBySql(`select count(1) from dwd_f_crm_clue_info where position_id=? and is_assign=1  and trailstatus != '08'    `, positionId))
 	isFull = TiDb.CountBySql(`select count(1) from dwd_f_crm_clue_info where position_id=? and is_assign=1   and trailstatus != '08'  `, positionId) >= cfg.AllocationCap
-	fmt.Println("2222", TiDb.CountBySql(`select count(1) from dwd_f_crm_clue_info where position_id=? and is_assign=1   and trailstatus != '08'  `, positionId), TiDb.CountBySql(`select count(1) from dwd_f_crm_clue_info where position_id=? and is_assign=1   and trailstatus != '08'  `, positionId) >= cfg.AllocationCap)
 	if isFull && isAdd && level != "" {
 		TiDb.UpdateOrDeleteBySql(`update dwd_f_crm_clue_autodraw_record set count = count + 1 where position_id = ? and clue_level = ?`, positionId, level)
 	}

+ 2 - 1
clueSync/tag.go

@@ -307,10 +307,11 @@ func messageSync() {
 					if own_id > 0 {
 						ok1, ok2 := FormatData(*mData, "message")
 						if !ok1 {
+							log.Println("线索卡点", "message", mData, messag_id)
 							break
 						} else {
 							if !ok2 {
-								log.Println("用户分配已达上限")
+								log.Println("用户分配已达上限", "message", mData, messag_id)
 								break
 							}
 						}