|
@@ -131,40 +131,34 @@ func GetOpenSea() {
|
|
|
log.Println("一级公海开始.")
|
|
|
//一级公海
|
|
|
for thisData := map[string]interface{}{}; iter.Next(&thisData); {
|
|
|
- oPool <- true
|
|
|
- oWait.Add(1)
|
|
|
- go func(thisData map[string]interface{}) {
|
|
|
- defer func() {
|
|
|
- <-oPool
|
|
|
- oWait.Done()
|
|
|
- }()
|
|
|
- userid := gconv.String(thisData["userid"])
|
|
|
- if userid == "" {
|
|
|
- return
|
|
|
- }
|
|
|
- if !mongodb.IsObjectIdHex(userid) {
|
|
|
- userid = GetUserIdByPositionId(userid)
|
|
|
- }
|
|
|
- if userid == "" {
|
|
|
- return
|
|
|
- }
|
|
|
- //根据userid获取线索id
|
|
|
- if oneClassA[userid] {
|
|
|
- return
|
|
|
- }
|
|
|
- uuid := GetClueIdByUserId(userid)
|
|
|
- if uuid == "" {
|
|
|
- return
|
|
|
- }
|
|
|
- oneClassA[uuid] = true
|
|
|
- }(thisData)
|
|
|
+
|
|
|
+ userid := gconv.String(thisData["userid"])
|
|
|
+ if userid == "" {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if !mongodb.IsObjectIdHex(userid) {
|
|
|
+ userid = GetUserIdByPositionId(userid)
|
|
|
+ }
|
|
|
+ if userid == "" {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ //根据userid获取线索id
|
|
|
+ if oneClassA[userid] {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ uuid := GetClueIdByUserId(userid)
|
|
|
+ if uuid == "" {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ oneClassA[uuid] = true
|
|
|
+
|
|
|
count++
|
|
|
if count%10 == 0 {
|
|
|
log.Printf("已完成%d条数据\n", count)
|
|
|
}
|
|
|
thisData = map[string]interface{}{}
|
|
|
}
|
|
|
- oWait.Wait()
|
|
|
+
|
|
|
log.Println("一级公海 pc 结束")
|
|
|
queryOneClassApp := map[string]interface{}{
|
|
|
"date": map[string]interface{}{
|
|
@@ -193,40 +187,33 @@ func GetOpenSea() {
|
|
|
count = 0
|
|
|
//一级公海
|
|
|
for thisData := map[string]interface{}{}; iter2.Next(&thisData); {
|
|
|
- oPool <- true
|
|
|
- oWait.Add(1)
|
|
|
- go func(thisData map[string]interface{}) {
|
|
|
- defer func() {
|
|
|
- <-oPool
|
|
|
- oWait.Done()
|
|
|
- }()
|
|
|
- userid := gconv.String(thisData["userid"])
|
|
|
- if userid == "" {
|
|
|
- return
|
|
|
- }
|
|
|
- if !mongodb.IsObjectIdHex(userid) {
|
|
|
- userid = GetUserIdByPositionId(userid)
|
|
|
- }
|
|
|
- if userid == "" {
|
|
|
- return
|
|
|
- }
|
|
|
- //根据userid获取线索id
|
|
|
- if oneClassA[userid] {
|
|
|
- return
|
|
|
- }
|
|
|
- uuid := GetClueIdByUserId(userid)
|
|
|
- if uuid == "" {
|
|
|
- return
|
|
|
- }
|
|
|
- oneClassA[uuid] = true
|
|
|
- }(thisData)
|
|
|
+
|
|
|
+ userid := gconv.String(thisData["userid"])
|
|
|
+ if userid == "" {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if !mongodb.IsObjectIdHex(userid) {
|
|
|
+ userid = GetUserIdByPositionId(userid)
|
|
|
+ }
|
|
|
+ if userid == "" {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ //根据userid获取线索id
|
|
|
+ if oneClassA[userid] {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ uuid := GetClueIdByUserId(userid)
|
|
|
+ if uuid == "" {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ oneClassA[uuid] = true
|
|
|
+
|
|
|
count++
|
|
|
if count%10 == 0 {
|
|
|
log.Printf("已完成%d条数据\n", count)
|
|
|
}
|
|
|
thisData = map[string]interface{}{}
|
|
|
}
|
|
|
- oWait.Wait()
|
|
|
//更新公海
|
|
|
AddOpenSea(oneClassA, 1, "A")
|
|
|
log.Println("一级公海 更新结束。")
|
|
@@ -341,7 +328,7 @@ func ThreeOpenSea() {
|
|
|
day := g.Cfg().MustGet(ctx, "classThreeHighSeaslastDay").Int()
|
|
|
t.AddDate(0, 0, day)
|
|
|
start := util.GetObjectId(t.Unix())
|
|
|
- createtime := time.Now().Format(date.Date_Full_Layout)
|
|
|
+ // createtime := time.Now().Format(date.Date_Full_Layout)
|
|
|
|
|
|
config.JianyuSubjectdb.SelectByBath(500, func(l *[]map[string]interface{}) bool {
|
|
|
for _, v := range *l {
|
|
@@ -355,9 +342,11 @@ func ThreeOpenSea() {
|
|
|
// uuid := gconv.String(v["uid"])
|
|
|
id := gconv.Int64(v["id"])
|
|
|
if r, ok := config.MgoLog.Find("subscribepay_logs", query, nil, `{"_id":1}`, false, 0, 1); ok && r != nil && len(*r) == 0 {
|
|
|
- config.JianyuSubjectdb.ExecBySql(`INSERT INTO dwd_f_crm_open_sea (comeintime,comeinsource,LEVEL,clue_level,clue_id)
|
|
|
- VALUES(?,?,?,?,?)
|
|
|
- ON DUPLICATE KEY UPDATE comeintime=?,comeinsource=?,LEVEL=?,clue_level=?`, createtime, 1, 3, "D", id, createtime, 1, 3, "D")
|
|
|
+ config.JianyuSubjectdb.Update("dwd_f_crm_open_sea", map[string]interface{}{"clue_id": id}, map[string]interface{}{
|
|
|
+ // "comeintime": createtime,
|
|
|
+ "LEVEL": 3,
|
|
|
+ "clue_level": "D",
|
|
|
+ })
|
|
|
|
|
|
}
|
|
|
}
|
|
@@ -381,12 +370,13 @@ func GetClueIdByUserId(userid string) (uuid string) {
|
|
|
// level 公海级别
|
|
|
// clue_level线索级别
|
|
|
func AddOpenSea(m map[string]bool, level int, clue_level string) {
|
|
|
- createtime := time.Now().Format(date.Date_Full_Layout)
|
|
|
+ // createtime := time.Now().Format(date.Date_Full_Layout)
|
|
|
if len(m) > 0 {
|
|
|
for _, v := range m {
|
|
|
- config.JianyuSubjectdb.ExecBySql(`INSERT INTO dwd_f_crm_open_sea (comeintime,comeinsource,LEVEL,clue_level,clue_id)
|
|
|
- VALUES(?,?,?,?,?)
|
|
|
- ON DUPLICATE KEY UPDATE comeintime=?,comeinsource=?,LEVEL=?,clue_level=?`, createtime, 1, level, clue_level, v, createtime, 1, level, clue_level)
|
|
|
+ config.JianyuSubjectdb.Update("dwd_f_crm_open_sea", map[string]interface{}{"clue_id": v}, map[string]interface{}{
|
|
|
+ "clue_level": clue_level,
|
|
|
+ "LEVEL": level,
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -410,7 +400,7 @@ func DeleteOpenSea() {
|
|
|
return true
|
|
|
}
|
|
|
return true
|
|
|
- }, `select id from dwd_f_crm_clue_info where trailstatus = ?`, "00")
|
|
|
+ }, `select id from dwd_f_crm_clue_info where trailstatus = ?`, "02")
|
|
|
}
|
|
|
|
|
|
//自动退回公海
|
|
@@ -441,12 +431,12 @@ func ReturnOpenSea() {
|
|
|
noIdeaCustomer := g.Cfg().MustGet(ctx, "noIdeaCustomer").Int()
|
|
|
//2.“高意向客户”超过30天未更新跟进记录自动退回公海;
|
|
|
for trailstatus, nexttime := range map[string]interface{}{
|
|
|
- "04": t.AddDate(0, 0, -highIntentionCustomer),
|
|
|
+ "06": t.AddDate(0, 0, -highIntentionCustomer),
|
|
|
"05": t.AddDate(0, 0, -intentionCustomer),
|
|
|
- "06": t.AddDate(0, 0, -latentCustomer),
|
|
|
- "07": t.AddDate(0, 0, -sleepCustomer),
|
|
|
+ "04": t.AddDate(0, 0, -latentCustomer),
|
|
|
+ "03": t.AddDate(0, 0, -sleepCustomer),
|
|
|
"01": t.AddDate(0, 0, -businessLeads),
|
|
|
- "08": t.AddDate(0, 0, -noIdeaCustomer),
|
|
|
+ "00": t.AddDate(0, 0, -noIdeaCustomer),
|
|
|
} {
|
|
|
config.JianyuSubjectdb.SelectByBath(500, func(l *[]map[string]interface{}) bool {
|
|
|
//1新增 2私海手动退回 3私海高意向客户自动退回 4私海意向客户退回 5私海潜在客户退回 6私海沉睡客户退回 7私海商机线索退回 8私海无意向客户退回
|
|
@@ -481,11 +471,15 @@ func ReturnOpenSea() {
|
|
|
log.Println("return sea end")
|
|
|
}
|
|
|
|
|
|
+//2私海手动退回 3私海高意向客户自动退回 4私海意向客户退回 5私海潜在客户退回 6私海沉睡客户退回 7私海商机线索退回 8私海无意向客户退回
|
|
|
func GetComeSource() map[string]int {
|
|
|
return map[string]int{
|
|
|
- "04": 2,
|
|
|
- "05": 4,
|
|
|
"06": 3,
|
|
|
+ "05": 4,
|
|
|
+ "04": 5,
|
|
|
+ "03": 6,
|
|
|
+ "01": 7,
|
|
|
+ "00": 8,
|
|
|
}
|
|
|
}
|
|
|
|