浏览代码

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

王浩 1 月之前
父节点
当前提交
b989537c25
共有 1 个文件被更改,包括 8 次插入5 次删除
  1. 8 5
      clueSync/kc.go

+ 8 - 5
clueSync/kc.go

@@ -1068,7 +1068,7 @@ func refundAuto() {
 		}
 		return true
 	}, `select ent_id,clue_id,position_id,name,is_renewal_protection,company_name from dwd_f_csm_customer_info where is_transfer = 0`)
-	//}, `select ent_id,clue_id,position_id,name,is_renewal_protection,company_name from dwd_f_csm_customer_info where clue_id =1892234`)
+	//}, `select ent_id,clue_id,position_id,name,is_renewal_protection,company_name from dwd_f_csm_customer_info where clue_id =527993`)
 
 	//移交电销提醒
 	for i, v := range mailData {
@@ -2048,14 +2048,18 @@ func getOrderData(sql string) (map[string]map[string]interface{}, string) {
 		if productInt64 == 0 {
 			continue
 		}
+		t1, _ := time.Parse(time.DateTime, lastEndTime)
+		t2, _ := time.Parse(time.DateTime, vip_endtime)
+		//判断服务周期
+		if t2.Unix() > t1.Unix() {
+			lastEndTime = vip_endtime
+		}
 		if _, exists := orderMap[orderCode]; exists {
-			//判断服务周期
 			data := orderMap[orderCode]
 			//商品类型获取
 			oldDifference := gconv.Int(data["difference"])
-			if oldDifference >= difference {
+			if difference >= oldDifference {
 				//需要更换
-				lastEndTime = vip_endtime
 				v["difference"] = difference
 				v["product"] = productInt64
 				v["service_endtime"] = vip_endtime
@@ -2064,7 +2068,6 @@ func getOrderData(sql string) (map[string]map[string]interface{}, string) {
 				orderMap[orderCode] = v
 			}
 		} else {
-			lastEndTime = vip_endtime
 			v["difference"] = difference
 			v["product"] = productInt64
 			v["product_type"] = product_type