|
@@ -233,7 +233,7 @@ func FormatData(data map[string]interface{}, item string) (bool, bool) {
|
|
|
log.Println("线索分配失败,线索过滤top_cluetype!!", item, uId, phone, userId)
|
|
|
return true, true
|
|
|
}
|
|
|
- position_id, seatNumber, saleName, saleData, pIsOk, isFreeze := autoDraw(level, cluename, phone, isGroup, isCommerce) //查询当前分配次数最少的,如果当前线索有销售,此次找出的不会+1
|
|
|
+ position_id, seatNumber, saleName, saleData, pIsOk, isFreeze, noticePositionId := autoDraw(level, cluename, phone, isGroup, isCommerce) //查询当前分配次数最少的,如果当前线索有销售,此次找出的不会+1
|
|
|
log.Println("data -------", position_id, seatNumber, saleName)
|
|
|
if position_id > 0 && seatNumber != "" {
|
|
|
uCount, oks := TiDb.FindOne("dwd_f_crm_clue_info", map[string]interface{}{"uid": uId}, "", ""), true //查当前线索是否已存在
|
|
@@ -257,9 +257,31 @@ func FormatData(data map[string]interface{}, item string) (bool, bool) {
|
|
|
if isFreeze {
|
|
|
//达上限放公海处理
|
|
|
uCount, oks := TiDb.FindOne("dwd_f_crm_clue_info", map[string]interface{}{"uid": uId}, "", ""), true //查当前线索是否已存在
|
|
|
- if uCount == nil || len(*uCount) == 0 { //已存在,走更新
|
|
|
+ if uCount == nil || len(*uCount) == 0 {
|
|
|
oks = SaveClue0(item, userId, uId, top_cluetype, sub_cluetype, topname, subname, cluename, name, saleName, phone, position, department, departments, industry, follow_project_area, role, seatNumber, position_id, source, sourceCode, remark, keyword, belong_to, isGroup, isCommerce, isFreeze)
|
|
|
log.Println(oks)
|
|
|
+ AssFail(noticePositionId, cluename, phone)
|
|
|
+ } else {
|
|
|
+ //留资线索更新
|
|
|
+ if item != "orders" && item != "users" { //新用户和订单之外的替换一下新的留资信息
|
|
|
+ clueUpdateData := map[string]interface{}{}
|
|
|
+ if name != "" {
|
|
|
+ clueUpdateData["name"] = name
|
|
|
+ }
|
|
|
+ if position != "" {
|
|
|
+ clueUpdateData["position"] = position
|
|
|
+ }
|
|
|
+ if department != "" {
|
|
|
+ clueUpdateData["department"] = department
|
|
|
+ }
|
|
|
+ if follow_project_area != "" {
|
|
|
+ clueUpdateData["follow_project_area"] = follow_project_area
|
|
|
+ }
|
|
|
+ if role != "" {
|
|
|
+ clueUpdateData["role"] = role
|
|
|
+ }
|
|
|
+ TiDb.Update("dwd_f_crm_clue_info", map[string]interface{}{"uid": uId}, clueUpdateData)
|
|
|
+ }
|
|
|
}
|
|
|
return true, true
|
|
|
}
|