|
@@ -12,52 +12,51 @@ func autoTask() {
|
|
log.Println("超时未跟进定时任务开始")
|
|
log.Println("超时未跟进定时任务开始")
|
|
t := time.Now()
|
|
t := time.Now()
|
|
nowTime := time.Now().Format(date.Date_Full_Layout)
|
|
nowTime := time.Now().Format(date.Date_Full_Layout)
|
|
- // statusMap := map[string]int{
|
|
|
|
- // "07": 5, //待签署客户
|
|
|
|
- // "06": 3, //高意向客户
|
|
|
|
- // "05": 5, //意向客户
|
|
|
|
- // "04": 7, //潜在客户
|
|
|
|
- // }
|
|
|
|
- // statusMaps := map[string]int{}
|
|
|
|
|
|
+ statusMap := map[string]int{
|
|
|
|
+ "07": 2, //待签署客户
|
|
|
|
+ "06": 2, //高意向客户
|
|
|
|
+ "05": 3, //意向客户
|
|
|
|
+ "04": 7, //潜在客户
|
|
|
|
+ }
|
|
//判断节假日
|
|
//判断节假日
|
|
- // for status, statusInt := range statusMap {
|
|
|
|
- // count, counts := 0, 0
|
|
|
|
- // for {
|
|
|
|
- // count++
|
|
|
|
- // currentTime := t.AddDate(0, 0, -count)
|
|
|
|
- // if currentTime.Weekday() == time.Sunday || currentTime.Weekday() == time.Saturday {
|
|
|
|
- // isok := false
|
|
|
|
- // for k, v := range DateMap {
|
|
|
|
- // if currentTime.Format(date.Date_Short_Layout) == k && v == 2 {
|
|
|
|
- // isok = true
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- // if isok {
|
|
|
|
- // counts++
|
|
|
|
- // }
|
|
|
|
- // } else {
|
|
|
|
- // isok := true
|
|
|
|
- // for k, v := range DateMap {
|
|
|
|
- // if currentTime.Format(date.Date_Short_Layout) == k && v == 1 {
|
|
|
|
- // isok = false
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- // if isok {
|
|
|
|
- // counts++
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- // if counts >= statusInt {
|
|
|
|
- // break
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- // statusMap[status] = count
|
|
|
|
- // }
|
|
|
|
- // log.Println(statusMap)
|
|
|
|
- for trailstatus, nexttime := range map[string]interface{}{
|
|
|
|
- "07": t.AddDate(0, 0, -5), //待签署客户
|
|
|
|
- "06": t.AddDate(0, 0, -3), //高意向客户
|
|
|
|
- "05": t.AddDate(0, 0, -5), //意向客户
|
|
|
|
- "04": t.AddDate(0, 0, -7), //潜在客户
|
|
|
|
|
|
+ for status, statusInt := range statusMap {
|
|
|
|
+ count, counts := 0, 0
|
|
|
|
+ for {
|
|
|
|
+ count++
|
|
|
|
+ currentTime := t.AddDate(0, 0, -count)
|
|
|
|
+ if currentTime.Weekday() == time.Sunday || currentTime.Weekday() == time.Saturday {
|
|
|
|
+ isok := false
|
|
|
|
+ for k, v := range DateMap {
|
|
|
|
+ if currentTime.Format(date.Date_Short_Layout) == k && v == 2 {
|
|
|
|
+ isok = true
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if isok {
|
|
|
|
+ counts++
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ isok := true
|
|
|
|
+ for k, v := range DateMap {
|
|
|
|
+ if currentTime.Format(date.Date_Short_Layout) == k && v == 1 {
|
|
|
|
+ isok = false
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if isok {
|
|
|
|
+ counts++
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if counts >= statusInt {
|
|
|
|
+ break
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ statusMap[status] = count
|
|
|
|
+ }
|
|
|
|
+ log.Println(statusMap)
|
|
|
|
+ for trailstatus, _ := range map[string]string{
|
|
|
|
+ "07": "", //待签署客户
|
|
|
|
+ "06": "", //高意向客户
|
|
|
|
+ "05": "", //意向客户
|
|
|
|
+ "04": "", //潜在客户
|
|
} {
|
|
} {
|
|
sql := `SELECT a.clue_id,a.position_id,a.seatNumber,a.out_task_status FROM dwd_f_crm_private_sea a
|
|
sql := `SELECT a.clue_id,a.position_id,a.seatNumber,a.out_task_status FROM dwd_f_crm_private_sea a
|
|
LEFT JOIN dwd_f_crm_clue_info b ON a.clue_id=b.id
|
|
LEFT JOIN dwd_f_crm_clue_info b ON a.clue_id=b.id
|
|
@@ -65,8 +64,8 @@ func autoTask() {
|
|
argsSelect := []interface{}{trailstatus}
|
|
argsSelect := []interface{}{trailstatus}
|
|
intime := ""
|
|
intime := ""
|
|
sql += " AND a.comeintime <?"
|
|
sql += " AND a.comeintime <?"
|
|
- nt := nexttime.(time.Time)
|
|
|
|
- // nt := t.AddDate(0, 0, -statusMap[trailstatus])
|
|
|
|
|
|
+ // nt := nexttime.(time.Time)
|
|
|
|
+ nt := t.AddDate(0, 0, -statusMap[trailstatus])
|
|
intime = nt.Format(date.Date_Full_Layout)
|
|
intime = nt.Format(date.Date_Full_Layout)
|
|
argsSelect = append(argsSelect, intime)
|
|
argsSelect = append(argsSelect, intime)
|
|
//
|
|
//
|