Browse Source

替换为占位符

xuzhiheng 1 year ago
parent
commit
10ef251222
1 changed files with 11 additions and 7 deletions
  1. 11 7
      clueSync/kc.go

+ 11 - 7
clueSync/kc.go

@@ -96,6 +96,7 @@ func kcJob(data map[string]interface{}) int {
 		//合力亿捷线索同步
 		//合力亿捷线索同步
 		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("移交客成查询到合力亿捷")
 			status999 := common.ObjToString((*customerData)["status999"])               //线索状态
 			status999 := common.ObjToString((*customerData)["status999"])               //线索状态
 			source := common.ObjToString((*customerData)["source"])                     //销售来源
 			source := common.ObjToString((*customerData)["source"])                     //销售来源
 			customerNeeds := common.ObjToString((*customerData)["customerNeeds"])       //客户需求
 			customerNeeds := common.ObjToString((*customerData)["customerNeeds"])       //客户需求
@@ -166,6 +167,7 @@ func kcJob(data map[string]interface{}) int {
 		//
 		//
 		entIds := common.IntAll(data["ent_id"])
 		entIds := common.IntAll(data["ent_id"])
 		positionId, name = cAutoDraw(entIds)
 		positionId, name = cAutoDraw(entIds)
+		log.Println("移交客成positionId", positionId, name)
 		saveMap = map[string]interface{}{
 		saveMap = map[string]interface{}{
 			"clue_id":                   clueId,
 			"clue_id":                   clueId,
 			"transfertime":              nowTime,
 			"transfertime":              nowTime,
@@ -611,13 +613,16 @@ func refundAuto() {
 				company_verification = common.IntAll((*clueData)["company_verification"])
 				company_verification = common.IntAll((*clueData)["company_verification"])
 				uid = common.ObjToString((*clueData)["uid"])
 				uid = common.ObjToString((*clueData)["uid"])
 			}
 			}
-			query1 := `select id from dwd_f_userbase_order_info where (product_type = "企业商机管理" or product_type = "大会员") and vip_endtime > "?" and order_status = 1 and uid = "?"`
-			query2 := `select id from dwd_f_userbase_order_info where (product_type = "企业商机管理" or product_type = "大会员") and refund_status in (0,2) and order_status = 1 and uid = "?"`
-			order1 := TiDb.SelectBySql(query1, nowTime, uid)
+			query1 := fmt.Sprintf(`select id from dwd_f_userbase_order_info where (product_type = "企业商机管理" or product_type = "大会员") and vip_endtime > "%s" and order_status = 1 and uid = "%s"`, nowTime, uid)
+			query2 := fmt.Sprintf(`select id from dwd_f_userbase_order_info where (product_type = "企业商机管理" or product_type = "大会员") and refund_status in (0,2) and order_status = 1 and uid = "%s"`, uid)
+			log.Println("query1 ", query1)
+			log.Println("query2 ", query2)
+			order1 := TiDb.SelectBySql(query1)
 			if order1 == nil || len(*order1) == 0 {
 			if order1 == nil || len(*order1) == 0 {
-				log.Println("query1 ", query1)
 				isOk := false
 				isOk := false
-				order3 := TiDb.SelectBySql(`select vip_endtime from dwd_f_userbase_order_info where (product_type = "企业商机管理" or product_type = "大会员") and vip_endtime < "?" and order_status = 1 and uid = "?"`, nowTime, uid)
+				query3 := fmt.Sprintf(`select vip_endtime from dwd_f_userbase_order_info where (product_type = "企业商机管理" or product_type = "大会员") and vip_endtime < "%s" and order_status = 1 and uid = "%s"`, nowTime, uid)
+				log.Println("query3 ", query3)
+				order3 := TiDb.SelectBySql(query3)
 				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 {
@@ -715,9 +720,8 @@ 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)
 				}
 				}
 			}
 			}
-			order2 := TiDb.SelectBySql(query2, uid)
+			order2 := TiDb.SelectBySql(query2)
 			if order2 == nil || len(*order2) == 0 {
 			if order2 == nil || len(*order2) == 0 {
-				log.Println("query2 ", query2)
 				//全退款了
 				//全退款了
 				TiDb.UpdateOrDeleteBySql(`UPDATE dwd_f_crm_clue_info SET is_assign=0,trailstatus="01",position_id=null,seatNumber=null,updatetime=?,comeintime_open=?,comeinsource_open=1,level_open=3,next_trail_time=null,is_task=null,tasktime=null,taskstatus=null,comeinsource_private=null,tasksource=null,is_transfer=0 WHERE id = ?`, nowTime, nowTime, clueId)
 				TiDb.UpdateOrDeleteBySql(`UPDATE dwd_f_crm_clue_info SET is_assign=0,trailstatus="01",position_id=null,seatNumber=null,updatetime=?,comeintime_open=?,comeinsource_open=1,level_open=3,next_trail_time=null,is_task=null,tasktime=null,taskstatus=null,comeinsource_private=null,tasksource=null,is_transfer=0 WHERE id = ?`, nowTime, nowTime, clueId)
 				TiDb.Insert("dwd_f_crm_clue_change_record", map[string]interface{}{
 				TiDb.Insert("dwd_f_crm_clue_change_record", map[string]interface{}{