Browse Source

Merge branch 'dev_v1.5.2.2_wh' of jianyu/datatools into hotfix/v1.5.2.2

王浩 1 year ago
parent
commit
e0f448ab98
1 changed files with 9 additions and 9 deletions
  1. 9 9
      clueSync/kc.go

+ 9 - 9
clueSync/kc.go

@@ -19,7 +19,7 @@ import (
 
 
 func kcSync() {
 func kcSync() {
 	log.Println("客户成功系统移交定时任务开始")
 	log.Println("客户成功系统移交定时任务开始")
-	sql := `select * from dwd_f_userbase_order_info where pay_money > 0 and vip_endtime > "` + time.Now().Format(date.Date_Full_Layout) + `" and autoUpdate > "` + cfg.LastkcTime + `" order by autoUpdate asc`
+	sql := `select * from dwd_f_userbase_order_info where payable_money > 0 and vip_endtime > "` + time.Now().Format(date.Date_Full_Layout) + `" and autoUpdate > "` + cfg.LastkcTime + `" order by autoUpdate asc`
 	data := TiDb.SelectBySql(sql)
 	data := TiDb.SelectBySql(sql)
 	if data != nil && *data != nil && len(*data) > 0 {
 	if data != nil && *data != nil && len(*data) > 0 {
 		for _, v := range *data {
 		for _, v := range *data {
@@ -54,7 +54,7 @@ func kcJob(data map[string]interface{}) int {
 		product_type := common.ObjToString(data["product_type"])
 		product_type := common.ObjToString(data["product_type"])
 		data_spec := common.ObjToString(data["data_spec"])
 		data_spec := common.ObjToString(data["data_spec"])
 		userName := common.ObjToString((*clueData)["name"])
 		userName := common.ObjToString((*clueData)["name"])
-		phone := common.ObjToString((*clueData)["phone"])
+		//phone := common.ObjToString((*clueData)["phone"])
 		product, company_name := 0, common.ObjToString(data["company_name"])
 		product, company_name := 0, common.ObjToString(data["company_name"])
 		productMap := map[string]int{
 		productMap := map[string]int{
 			"dhy6":   1,
 			"dhy6":   1,
@@ -70,12 +70,12 @@ func kcJob(data map[string]interface{}) int {
 		}
 		}
 		if product_type == "企业商机管理" {
 		if product_type == "企业商机管理" {
 			product = productMap[product_type]
 			product = productMap[product_type]
-			powerData := TiDb.FindOne("dwd_f_data_equity_info", map[string]interface{}{"phone": phone, "product_type": "商机管理"}, "", "comeintime desc")
+			powerData := TiDb.FindOne("dwd_f_data_equity_info", map[string]interface{}{"uid": uId, "product_type": "商机管理"}, "", "comeintime desc")
 			if powerData != nil {
 			if powerData != nil {
 				starttime = common.ObjToString((*powerData)["starttime"])
 				starttime = common.ObjToString((*powerData)["starttime"])
 				endtime = common.ObjToString((*powerData)["endtime"])
 				endtime = common.ObjToString((*powerData)["endtime"])
 			} else {
 			} else {
-				log.Println("客成移交权限未查到--", phone)
+				log.Println("客成移交权限未查到--", uId)
 				return 0
 				return 0
 			}
 			}
 		} else {
 		} else {
@@ -96,7 +96,7 @@ func kcJob(data map[string]interface{}) int {
 		}
 		}
 		//同一公司名称(以客户详情-组织机构-公司名称)下的线索需分配给同1人
 		//同一公司名称(以客户详情-组织机构-公司名称)下的线索需分配给同1人
 		//合力亿捷线索同步
 		//合力亿捷线索同步
-		customerData := TiDbData.FindOne("customer", map[string]interface{}{"phone": phone}, "", "")
+		/*customerData := TiDbData.FindOne("customer", map[string]interface{}{"phone": phone}, "", "")
 		if customerData != nil {
 		if customerData != nil {
 			log.Println("移交客成查询到合力亿捷")
 			log.Println("移交客成查询到合力亿捷")
 			status999 := common.ObjToString((*customerData)["status999"])               //线索状态
 			status999 := common.ObjToString((*customerData)["status999"])               //线索状态
@@ -165,7 +165,7 @@ func kcJob(data map[string]interface{}) int {
 				"industry":            belongToIndustry,
 				"industry":            belongToIndustry,
 				"follow_project_area": areaCode,
 				"follow_project_area": areaCode,
 			})
 			})
-		}
+		}*/
 		//
 		//
 		entIds := common.IntAll(data["ent_id"])
 		entIds := common.IntAll(data["ent_id"])
 		positionId, name = cAutoDraw(entIds)
 		positionId, name = cAutoDraw(entIds)
@@ -650,7 +650,7 @@ func refundAuto() {
 			}
 			}
 			isFull := FindUpperLimit(gconv.String(saleId), "", false)
 			isFull := FindUpperLimit(gconv.String(saleId), "", false)
 			isAllRefund := false
 			isAllRefund := false
-			myOrders := TiDb.SelectBySql(`select refund_status from dwd_f_userbase_order_info where uid=? and (product_type = "企业商机管理" or product_type = "大会员") and order_status = 1 and pay_money > 0 and vip_endtime < ?`, uid, nowTime)
+			myOrders := TiDb.SelectBySql(`select refund_status from dwd_f_userbase_order_info where uid=? and (product_type = "企业商机管理" or product_type = "大会员") and order_status = 1  and vip_endtime < ?`, uid, nowTime)
 			if myOrders != nil {
 			if myOrders != nil {
 				refundCount := 0
 				refundCount := 0
 				for _, v := range *myOrders {
 				for _, v := range *myOrders {
@@ -707,10 +707,10 @@ func refundAuto() {
 				})
 				})
 				TiDb.UpdateOrDeleteBySql(`UPDATE dwd_f_csm_customer_info SET is_transfer=1 WHERE clue_id = ?`, clueId)
 				TiDb.UpdateOrDeleteBySql(`UPDATE dwd_f_csm_customer_info SET is_transfer=1 WHERE clue_id = ?`, clueId)
 			} else {
 			} else {
-				order1 := TiDb.SelectBySql(`select id from dwd_f_userbase_order_info where uid=? and (product_type = "企业商机管理" or product_type = "大会员") and vip_endtime > ? and order_status = 1 and pay_money > 0`, uid, nowTime)
+				order1 := TiDb.SelectBySql(`select id from dwd_f_userbase_order_info where uid=? and (product_type = "企业商机管理" or product_type = "大会员") and vip_endtime > ? and order_status = 1 `, uid, nowTime)
 				if order1 == nil || len(*order1) == 0 {
 				if order1 == nil || len(*order1) == 0 {
 					isOk := false
 					isOk := false
-					order3 := TiDb.SelectBySql(`select vip_endtime from dwd_f_userbase_order_info where uid=? and (product_type = "企业商机管理" or product_type = "大会员") and vip_endtime < ? and order_status = 1 and pay_money > 0`, uid, nowTime)
+					order3 := TiDb.SelectBySql(`select vip_endtime from dwd_f_userbase_order_info where uid=? and (product_type = "企业商机管理" or product_type = "大会员") and vip_endtime < ? and order_status = 1 `, uid, nowTime)
 					if order3 != nil && len(*order3) > 0 {
 					if order3 != nil && len(*order3) > 0 {
 						for _, vv := range *order3 {
 						for _, vv := range *order3 {
 							if isRenewalProtection == 1 {
 							if isRenewalProtection == 1 {