Преглед изворни кода

Merge branch 'dev_v1.5.14_wh' of jianyu/datatools into feature/v1.5.14

王浩 пре 11 месеци
родитељ
комит
03ef1127ac

+ 1 - 1
clueSync/everything.go

@@ -658,7 +658,7 @@ func AdvisoryCommittee() {
 						continue
 					}
 				}
-				key := fmt.Sprintf("%s_%s", source, phone)
+				key := fmt.Sprintf("%s_%s_%s", source, phone, interest)
 				if _, ok := data[key]; ok {
 					continue
 				}

+ 3 - 1
telemarketingEtl/config.yaml

@@ -119,4 +119,6 @@ businessLeads: 2
 #回收站A.5个自然日内被销售人员手动退回公海的客户;
 handReturn: 5
 #回收站B.3个自然日内有过“已接听”的通话记录且仍处于“商机线索”状态下的客户。
-recycleB: 3
+recycleB: 3
+#3.30个自然日内自动退回公海的“拒绝沟通客户”;;
+refuseHandReturn: 30

+ 40 - 15
telemarketingEtl/entity/dwd_f_crm_open_sea.go

@@ -36,7 +36,7 @@ A.最近30天内活跃天数≥15天的客户;
 B.10天≤最近30天内活跃天数<15天的客户;
 C.5天≤最近30天内活跃天数<10天的客户;
 D.1天≤最近30天内活跃天数<5天的客户;
-备注:判断当日是否活跃的标准为当日是否点击查看了标讯内容。
+备注:判断当日是否活跃的标准为当日是否点击查看了标讯内容。私海无意向客户退回
 (3)三级公海:
 最近30天内活跃天数=0天的客户。
 (4)回收站:
@@ -65,47 +65,47 @@ func GetOpenSea() {
 			"$lt":  end,
 		},
 		"$or": []map[string]interface{}{
-			map[string]interface{}{
+			{
 				"url": map[string]interface{}{
 					"$regex": `/front/vipsubscribe/introducePage`,
 				},
 			},
-			map[string]interface{}{
+			{
 				"url": map[string]interface{}{
 					"$regex": `/big/wx/page/landingPage`,
 				},
 			},
-			map[string]interface{}{
+			{
 				"url": map[string]interface{}{
 					"$regex": `/product/index`,
 				},
 			},
-			map[string]interface{}{
+			{
 				"url": map[string]interface{}{
 					"$regex": `/front/dataExport/toSieve`,
 				},
 			},
-			map[string]interface{}{
+			{
 				"url": map[string]interface{}{
 					"$regex": `/front/dataExport/toCreateOrderPage`,
 				},
 			},
-			map[string]interface{}{
+			{
 				"url": map[string]interface{}{
 					"$regex": `/front/dataPack/createOrder`,
 				},
 			},
-			map[string]interface{}{
+			{
 				"url": map[string]interface{}{
 					"$regex": `/swordfish/page_big_pc/free/svip/buy`,
 				},
 			},
-			map[string]interface{}{
+			{
 				"url": map[string]interface{}{
 					"$regex": `/big/pc/page/buy_commit`,
 				},
 			},
-			map[string]interface{}{
+			{
 				"url": map[string]interface{}{
 					"$regex": `/front/wx_dataExport/toSieve`,
 				},
@@ -152,17 +152,17 @@ func GetOpenSea() {
 			"$lt":  end,
 		},
 		"$or": []map[string]interface{}{
-			map[string]interface{}{
+			{
 				"url": map[string]interface{}{
 					"$regex": `/jyapp/vipsubscribe/introducePage`,
 				},
 			},
-			map[string]interface{}{
+			{
 				"url": map[string]interface{}{
 					"$regex": `jyapp/big/page/landingPage`,
 				},
 			},
-			map[string]interface{}{
+			{
 				"url": map[string]interface{}{
 					"$regex": `/jyapp/front/dataExport/toSieve`,
 				},
@@ -244,6 +244,7 @@ func GetOpenSea() {
 	// AddOpenSea(three, 3, "D")
 	//
 	Recycle()
+	RefuseRecycle()
 	log.Println("end")
 }
 
@@ -255,7 +256,6 @@ func GetOpenSea() {
 	D.1天≤最近30天内活跃天数<5天的客户;
 */
 func TwoOpenSea(oneClassA, oneClassB, oneClassC map[string]bool) (aMap, bMap, cMap, dMap map[string]bool) {
-
 	clubIdMap := func() map[string]string {
 		c := 0
 		mp := map[string]string{}
@@ -422,7 +422,7 @@ func GetClueIdByUserId(userid string) (uuid string) {
 func AddOpenSea(m map[string]bool, level int, clue_level string) {
 	// createtime := time.Now().Format(date.Date_Full_Layout)
 	if len(m) > 0 {
-		for k, _ := range m {
+		for k := range m {
 			config.JianyuSubjectdb.Update("dwd_f_crm_clue_info", map[string]interface{}{"id": k}, map[string]interface{}{
 				"clue_level": clue_level,
 				"level_open": level,
@@ -739,6 +739,31 @@ func Recycle() {
 	log.Println("回收站结束")
 
 }
+func RefuseRecycle() {
+	log.Println("拒绝客户回收站开始")
+	ctx := gctx.New()
+	t := time.Now()
+	t = time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, time.Local)
+	refuseHandReturn := g.Cfg().MustGet(ctx, "refuseHandReturn").Int()
+	tA := t.AddDate(0, 0, -refuseHandReturn)
+	sql := fmt.Sprintf(`select id from dwd_f_crm_clue_info where comeinsource_open=11 and is_assign = 0 and comeintime_open > "%s" ;`, tA.Format(date.Date_Full_Layout))
+
+	config.JianyuSubjectdb.SelectByBath(500, func(l *[]map[string]interface{}) bool {
+		ids := []interface{}{}
+		for _, v := range *l {
+			id := v["id"]
+			ids = append(ids, id)
+		}
+		whs := []string{}
+		for i := 0; i < len(ids); i++ {
+			whs = append(whs, "?")
+		}
+		wh := strings.Join(whs, ",")
+		config.JianyuSubjectdb.UpdateOrDeleteBySql(`UPDATE dwd_f_crm_clue_info SET level_open = 4 WHERE id in (`+wh+`)`, ids...)
+		return true
+	}, sql)
+	log.Println("回收站结束")
+}
 
 /*
 dwd_f_crm_clue_info.uid    trailstatus==01

+ 0 - 1
telemarketingEtl/entity/old.go

@@ -16,7 +16,6 @@ import (
 
 // 查看事件
 func VisitInfoAddOld(start, end int64) {
-
 	// 获取时间戳 1 和时间戳 2 所在的日期
 	t1 := time.Unix(start, 0)
 	t2 := time.Unix(end, 0)

BIN
telemarketingEtl/telemarketingEtl