|
@@ -417,7 +417,7 @@ func autoDraw(mode, cluename, phone string, isGroup, isCommerce int) (positionId
|
|
|
for _, v := range *data {
|
|
|
isOk := false //判断是否有新员工
|
|
|
for _, vv := range *countData {
|
|
|
- if common.ObjToString(v["seat_number"]) == common.ObjToString(vv["seatNumber"]) {
|
|
|
+ if common.Int64All(v["position_id"]) == common.Int64All(vv["position_id"]) {
|
|
|
if common.IntAll(v["resign"]) == 0 {
|
|
|
vv["status"] = 1
|
|
|
} else {
|
|
@@ -427,29 +427,29 @@ func autoDraw(mode, cluename, phone string, isGroup, isCommerce int) (positionId
|
|
|
}
|
|
|
}
|
|
|
if !isOk { //有新员工直接分给新员工
|
|
|
- seatNumber = common.ObjToString(v["seat_number"])
|
|
|
+ positionId = common.Int64All(v["position_id"])
|
|
|
saleName = common.ObjToString(v["name"])
|
|
|
rData := TiDb.FindOne("dwd_f_crm_clue_autodraw_record", map[string]interface{}{"clue_level": mode}, "", "count desc")
|
|
|
TiDb.Insert("dwd_f_crm_clue_autodraw_record", map[string]interface{}{
|
|
|
- "seatNumber": seatNumber,
|
|
|
- "clue_level": mode,
|
|
|
- "count": common.Int64All((*rData)["count"]),
|
|
|
+ "position_id": positionId,
|
|
|
+ "clue_level": mode,
|
|
|
+ "count": common.Int64All((*rData)["count"]),
|
|
|
})
|
|
|
break
|
|
|
}
|
|
|
}
|
|
|
- if seatNumber == "" {
|
|
|
+ if positionId > 0 {
|
|
|
res := int64(0)
|
|
|
countres := 0
|
|
|
for _, v := range *countData {
|
|
|
if common.IntAll(v["status"]) == 1 {
|
|
|
if countres == 0 {
|
|
|
res = common.Int64All(v["count"])
|
|
|
- seatNumber = common.ObjToString(v["seatNumber"])
|
|
|
+ positionId = common.Int64All(v["position_id"])
|
|
|
} else {
|
|
|
if common.Int64All(v["count"]) <= res {
|
|
|
res = common.Int64All(v["count"])
|
|
|
- seatNumber = common.ObjToString(v["seatNumber"])
|
|
|
+ positionId = common.Int64All(v["position_id"])
|
|
|
}
|
|
|
}
|
|
|
countres++
|
|
@@ -457,26 +457,26 @@ func autoDraw(mode, cluename, phone string, isGroup, isCommerce int) (positionId
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- seatNumber = common.ObjToString((*data)[0]["seat_number"])
|
|
|
+ positionId = common.Int64All((*data)[0]["position_id"])
|
|
|
saleName = common.ObjToString((*data)[0]["name"])
|
|
|
rData := TiDb.FindOne("dwd_f_crm_clue_autodraw_record", map[string]interface{}{"clue_level": mode}, "", "count desc")
|
|
|
if rData != nil && len(*rData) > 0 {
|
|
|
TiDb.Insert("dwd_f_crm_clue_autodraw_record", map[string]interface{}{
|
|
|
- "seatNumber": seatNumber,
|
|
|
- "clue_level": mode,
|
|
|
- "count": common.Int64All((*rData)["count"]),
|
|
|
+ "position_id": positionId,
|
|
|
+ "clue_level": mode,
|
|
|
+ "count": common.Int64All((*rData)["count"]),
|
|
|
})
|
|
|
} else {
|
|
|
TiDb.Insert("dwd_f_crm_clue_autodraw_record", map[string]interface{}{
|
|
|
- "seatNumber": seatNumber,
|
|
|
- "clue_level": mode,
|
|
|
- "count": 0,
|
|
|
+ "position_id": positionId,
|
|
|
+ "clue_level": mode,
|
|
|
+ "count": 0,
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
for _, v := range *data {
|
|
|
- if seatNumber == common.ObjToString(v["seat_number"]) {
|
|
|
- positionId = common.Int64All(v["position_id"])
|
|
|
+ if positionId == common.Int64All(v["position_id"]) {
|
|
|
+ seatNumber = common.ObjToString(v["seat_number"])
|
|
|
saleName = common.ObjToString(v["name"])
|
|
|
}
|
|
|
}
|