瀏覽代碼

Merge branch 'master' into feature/v1.5.20

yuelujie 9 月之前
父節點
當前提交
00ba05e7c7
共有 4 個文件被更改,包括 20 次插入15 次删除
  1. 0 5
      clueSync/everything.go
  2. 12 6
      clueSync/job.go
  3. 7 3
      clueSync/jobutil.go
  4. 1 1
      clueSync/kc.go

+ 0 - 5
clueSync/everything.go

@@ -371,7 +371,6 @@ func bigCustomer() {
 	saleleadsData, ok := Mgo.Find("saleLeads", map[string]interface{}{"createtime": map[string]interface{}{"$gte": bigSaleTime}}, `{"phone":1,"createtime":1}`, nil, false, -1, -1)
 	if ok && saleleadsData != nil && len(*saleleadsData) > 0 {
 		for _, v := range *saleleadsData {
-			log.Println("444", v)
 			sources := common.ObjToString(v["source"])
 			userid := common.ObjToString(v["userid"])
 			uid := ""
@@ -407,7 +406,6 @@ func bigCustomer() {
 				data_requirement := common.ObjToString(v["data_requirement"])
 				belongTo, usernickname := "大客户", ""
 				userData := TiDb.FindOne("dwd_f_userbase_baseinfo", map[string]interface{}{"uid": uid}, "", "")
-				log.Println("555", uid, userData)
 				if userData != nil {
 					usernickname = common.ObjToString((*userData)["nickname"])
 					bt := common.ObjToString((*userData)["belong_to"])
@@ -415,10 +413,8 @@ func bigCustomer() {
 						continue
 					}
 				}
-				log.Println("333", userData)
 				s_sourceid := common.ObjToString((*userData)["s_sourceid"])
 				if s_sourceid == db.Sourceid {
-					log.Println("abhList", data, 2222)
 					//安博会数据
 					abhList = append(abhList, map[string]interface{}{
 						"createTime":       nowTime,
@@ -562,7 +558,6 @@ func bigCustomer() {
 		}
 		cfg.BigOrderTime = bigOrderTime
 	}
-	log.Println("abhList", abhList, 11111)
 	if len(abhList) > 0 {
 		ABHEmail("big", abhList)
 	}

+ 12 - 6
clueSync/job.go

@@ -75,25 +75,26 @@ func FormatData(data map[string]interface{}, item string) (bool, bool, bool) {
 			} else {
 				query["userid"] = userId
 			}
-			createtimeStr := ""
+			//createtimeStr := ""
 			userInfo := TiDb.FindOne("dwd_f_userbase_baseinfo", query, "", "")
 			if userInfo != nil && len(*userInfo) > 0 {
 				uId = common.ObjToString((*userInfo)["uid"])
 				source = common.ObjToString((*userInfo)["source"])
 				belong_to = common.ObjToString((*userInfo)["belong_to"])
 				s_sourceid = common.ObjToString((*userInfo)["s_sourceid"])
-				createtimeStr = common.ObjToString((*userInfo)["l_registedate"])
+				//createtimeStr = common.ObjToString((*userInfo)["l_registedate"])
 			}
 			if item == "xcxusers" {
 				sourceCode = common.ObjToString(data["industry"])
-				t, _ := time.Parse("2006-01-02 15:04:05", createtimeStr)
+				//t, _ := time.Parse("2006-01-02 15:04:05", createtimeStr)
 				if sourceCode == "" {
 					log.Println("留资没有source", phone)
 					return true, true, true
 				}
-				if t.Unix() > db.NewRegistration && sourceCode == "安防" {
-					return true, true, false
-				}
+				/*	安防代码
+					if t.Unix() > db.NewRegistration && sourceCode == "安防" {
+							return true, true, false
+						}*/
 				//线索名称查询处理
 				clueData, _ := TiDb.FindOne("dwd_f_crm_clue_info", map[string]interface{}{"uid": uId}, "", ""), true //查当前线索是否已存在
 				if clueData != nil && len(*clueData) > 0 {
@@ -116,6 +117,8 @@ func FormatData(data map[string]interface{}, item string) (bool, bool, bool) {
 			belong_to = common.ObjToString((*userInfo)["belong_to"])
 		}
 	} else if item == "saleLeads" { //留资
+		//线索名称打印
+		log.Println(1111, common.ObjToString(data["company"]))
 		userId = common.ObjToString(data["userid"])
 		if !mongodb.IsObjectIdHex(userId) {
 			positionId = userId
@@ -216,9 +219,11 @@ func FormatData(data map[string]interface{}, item string) (bool, bool, bool) {
 		phone = common.ObjToString(data["phone"])
 		sourceId = common.Int64All(data["sourceId"])
 	}
+	log.Println(222, cluename)
 	if cluename == "" && item != "message" && item != "orders" && item != "readClue" && item != "rebind" && item != "allocation" {
 		cluename = phone //没有线索名,手机号代替
 	}
+	log.Println(333, cluename)
 	cluename = strings.ReplaceAll(cluename, " ", "")
 	isGroup, isCommerce := GetCompanyType(cluename)                                                                    //判断是否集团公司、工商库
 	if source == "0104" || strings.HasPrefix(belong_to, "02") || source == "0102" || source == "0103" || phone == "" { //参照用户来源代码表
@@ -279,6 +284,7 @@ func FormatData(data map[string]interface{}, item string) (bool, bool, bool) {
 		log.Println("线索分配失败,线索过滤top_cluetype!!", item, uId, phone, userId)
 		return true, true, true
 	}
+	log.Println("人员选择", level, cluename, phone, isGroup, isCommerce)
 	position_id, seatNumber, saleName, saleData, pIsOk, isFreeze, noticePositionId := autoDraw(level, cluename, phone, isGroup, isCommerce) //查询当前分配次数最少的,如果当前线索有销售,此次找出的不会+1
 	log.Println("data -------", position_id, seatNumber, saleName, pIsOk, isFreeze, noticePositionId)
 	if position_id > 0 && seatNumber != "" {

+ 7 - 3
clueSync/jobutil.go

@@ -655,13 +655,13 @@ WHERE
 				cfg.LastXcxUserId = updatetime
 				continue
 			}
-			ok1, ok2, ok3 := FormatData(v, "xcxusers")
-			if !ok3 {
+			ok1, ok2, _ := FormatData(v, "xcxusers")
+			/*if !ok3 {
 				//首次使用"安防"小程序新注册用户
 				afList = append(afList, v)
 				cfg.LastXcxUserId = updatetime
 				continue
-			}
+			}*/
 			if !ok1 {
 				common.WriteSysConfig(&cfg)
 				log.Println("小程序用户分配线索卡点", "xcxusers", v, selectXcxTimeEnd)
@@ -1052,6 +1052,10 @@ func getClueType(item string, data map[string]interface{}, sourceCode string, so
 			pcode = "532"
 			code = "694"
 			subname = `首次使用“车辆”小程序`
+		case "安防":
+			pcode = "532"
+			code = "701"
+			subname = `首次使用“安防”小程序`
 		}
 	} else if item == "allocation" {
 		pcode = "532"

+ 1 - 1
clueSync/kc.go

@@ -422,7 +422,7 @@ func ordersClue() {
 			userId, uId, cluename, seatNumber, positionId, trailstatus, clueId := common.ObjToString(v["user_id"]), "", "", "", int64(0), "", int64(0)
 			product_type_str2 := `"大会员","企业商机管理","VIP订阅"`
 			product_type := common.ObjToString(v["product_type"])
-			if order_status == 1 && is_backstage_order == 1 && salesperson != "" && !strings.HasPrefix(user_phone, "9") && strings.Contains(product_type_str2, product_type) {
+			if order_status == 1 && is_backstage_order == 1 && saleDep != "" && !strings.HasPrefix(user_phone, "9") && strings.Contains(product_type_str2, product_type) {
 				//销售部
 				query := map[string]interface{}{}
 				source := ""