Browse Source

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

王浩 5 months ago
parent
commit
2fa54b7823
1 changed files with 23 additions and 22 deletions
  1. 23 22
      clueSync/kc.go

+ 23 - 22
clueSync/kc.go

@@ -1231,6 +1231,7 @@ func CustomerChange() {
 		}
 		return true
 	}, `select operator_id, clue_id,position_id,old_value,new_value,createtime from   dwd_f_crm_clue_change_record  where    createtime>?  and change_type="客户成功经理"   order by  createtime`, startTime)
+	//}, `select operator_id, clue_id,position_id,old_value,new_value,createtime from   dwd_f_crm_clue_change_record  where   id=?   order by  createtime`, 21921661)
 	if len(customMap1) > 0 {
 		ChangeSendKc(customMap1, 1)
 	}
@@ -1353,28 +1354,28 @@ func CustomerChangeHandle(data map[string]interface{}) map[string]interface{} {
 	}
 }
 func FindPositionIdClueId(clueId int64) (int64, string) {
-	querySql := fmt.Sprintf(`
-SELECT
-	b.salesperson,c.position_id
-FROM
-	dwd_f_crm_clue_info a
-	INNER JOIN dwd_f_userbase_order_info b ON a.id = %d 
-	AND a.uid = b.uid 
-	AND (
-		b.payable_money > 0 
-		OR (
-			b.payable_money = 0 
-		AND ( b.filter LIKE "%分期付款补充权益%" OR b.filter LIKE "%原订单不支持开通多项权益%" OR b.filter LIKE "%权益码兑换%" ))) 
-	AND b.data_spec != "dhy4" 
-	AND b.order_status = 1 
-	AND ( b.refund_status != 1 OR b.refund_status IS NULL ) 
-	AND b.vip_starttime < "2099-01-01" 
-	AND b.product_type IN ( "大会员", "企业商机管理" ) 
-	AND ( b.order_change = 0 OR ( b.order_change = 0 AND DATEDIFF( b.vip_endtime, b.vip_starttime )> 90 ) ) 
-	INNER JOIN   dwd_f_crm_personnel_management c   on c.ent_id =%d and    b.salesperson=c.name 
-ORDER BY
-	b.create_time,b.payable_money DESC limit  1`, clueId, db.EntId)
-	clueData := TiDb.SelectBySql(querySql)
+	querySql := `
+	SELECT
+		b.salesperson,c.position_id
+	FROM
+		dwd_f_crm_clue_info a
+		INNER JOIN dwd_f_userbase_order_info b ON a.id = ?
+		AND a.uid = b.uid 
+		AND (
+			b.payable_money > 0 
+			OR (
+				b.payable_money = 0 
+			AND ( b.filter LIKE "%分期付款补充权益%" OR b.filter LIKE "%原订单不支持开通多项权益%" OR b.filter LIKE "%权益码兑换%" ))) 
+		AND b.data_spec != "dhy4" 
+		AND b.order_status = 1 
+		AND ( b.refund_status != 1 OR b.refund_status IS NULL ) 
+		AND b.vip_starttime < "2099-01-01" 
+		AND b.product_type IN ( "大会员", "企业商机管理" ) 
+		AND ( b.order_change = 0 OR ( b.order_change = 0 AND DATEDIFF( b.vip_endtime, b.vip_starttime )> 90 ) ) 
+		INNER JOIN   dwd_f_crm_personnel_management c   on c.ent_id =?  and    b.salesperson=c.name 
+	ORDER BY
+		b.create_time,b.payable_money DESC limit  1`
+	clueData := TiDb.SelectBySql(querySql, clueId, db.EntId)
 	if clueData == nil || len(*clueData) == 0 {
 		return 0, ""
 	}