Przeglądaj źródła

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

王浩 6 miesięcy temu
rodzic
commit
fecd7e32db
1 zmienionych plików z 19 dodań i 3 usunięć
  1. 19 3
      clueSync/kc.go

+ 19 - 3
clueSync/kc.go

@@ -636,7 +636,9 @@ func refundAuto() {
 				if orderData != nil && len(*orderData) > 0 {
 					endDate := time.Now().AddDate(0, 0, -db.ExpirationPeriod+1).Unix()
 					startDate := time.Now().AddDate(0, 0, -db.ExpirationPeriod).Unix()
-					vipEndDate, _ := time.Parse(time.DateTime, gconv.String((*orderData)[0]["vip_endtime"]))
+					vipEndDate, _ := time.ParseInLocation(time.DateTime, gconv.String((*orderData)[0]["vip_endtime"]), time.Local)
+					log.Println(vipEndDate.Unix() > startDate, vipEndDate.Unix() < endDate)
+					log.Println(vipEndDate.Unix(), startDate, endDate)
 					if vipEndDate.Unix() > startDate && vipEndDate.Unix() < endDate {
 						//即将到期
 						mailData[name] = append(mailData[name], map[string]interface{}{
@@ -924,7 +926,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 =1471384`)
+	//}, `select ent_id,clue_id,position_id,name,is_renewal_protection,company_name from dwd_f_csm_customer_info where clue_id =1651388`)
 
 	//移交电销提醒
 	for i, v := range mailData {
@@ -1127,6 +1129,9 @@ func ExitKcSaleSend(positionId int64, infoList []map[string]interface{}) {
 		}
 	}
 	if to != "" {
+		if to == cc {
+			cc = ""
+		}
 		status := mail.GSendMail_q("剑鱼标讯", to, cc, "", "成交客户续费失败移交销售通知", startStr, "", "", gmail)
 		if status {
 			log.Println("客成发邮件 send mail success", startStr, to, cc)
@@ -1213,7 +1218,7 @@ func ChangeSendKc(data map[string][]map[string]interface{}, personType int64) {
 		endStr := `</tbody></table><p></body></html>`
 		startStr += endStr
 		if to != "" {
-			status := mail.GSendMail_q("剑鱼标讯", to, "", "", gconv.String(common.If(personType == 1, "您有新的客户,请及时跟进处理", "您的客户已转至其他客户成功经理负责")), startStr, "", "", &Gmail)
+			status := mail.GSendMail_q("剑鱼标讯", to, "", "", gconv.String(common.If(personType == 2, "您有新的客户,请及时跟进处理", "您的客户已转至其他客户成功经理负责")), startStr, "", "", &Gmail)
 			if status {
 				log.Println("客成发邮件 send mail success", startStr, to, "")
 			}
@@ -1285,6 +1290,9 @@ func ChangeSendSale(data map[int64][]map[string]interface{}, personType int64) {
 		endStr := `</tbody></table><p></body></html>`
 		startStr += endStr
 		if to != "" {
+			if to == cc {
+				cc = ""
+			}
 			status := mail.GSendMail_q("剑鱼标讯", to, cc, "", "成交客户负责客户成功经理变更", startStr, "", "", &Gmail)
 			if status {
 				log.Println("客成发邮件 send mail success", startStr, to, "")
@@ -1563,6 +1571,9 @@ func KcSend(orderCode, personName string) {
 		if deptData != nil && len(*deptData) > 0 {
 			mailStr := gconv.String((*deptData)[0]["mail"])
 			if mailStr != "" || adminMailStr != "" {
+				if mailStr == adminMailStr {
+					adminMailStr = ""
+				}
 				gmail := &mail.GmailAuth{
 					SmtpHost: db.Mail.SmtpHost,
 					SmtpPort: db.Mail.SmtpPort,
@@ -1620,6 +1631,9 @@ func ExitKcSend(personName string, infoList []map[string]interface{}) {
 			adminMailStr = gconv.String((*adminData)[0]["mail"])
 		}
 		if mailStr != "" || adminMailStr != "" {
+			if mailStr == adminMailStr {
+				adminMailStr = ""
+			}
 			gmail := &mail.GmailAuth{
 				SmtpHost: db.Mail.SmtpHost,
 				SmtpPort: db.Mail.SmtpPort,
@@ -1645,6 +1659,8 @@ func ExitKcSend(personName string, infoList []map[string]interface{}) {
 		}
 	}
 }
+
+// 客成邮件   订单信息初始化
 func KcOrderFormat(orderCode string, bigmemberService, combo map[int64]string) *OrderInfo {
 	orderData := Mysql.SelectBySql(`SELECT a.id,a.order_code,a.pay_money,a.user_phone,a.vip_starttime,a.vip_endtime,a.product_type,a.filter,a.user_id,a.ent_id,a.company_name,a.create_person,SUM(b.return_money) AS return_money 
 		FROM jianyu.dataexport_order a