Jianghan 1 년 전
부모
커밋
6e9f0dbca9
1개의 변경된 파일4개의 추가작업 그리고 4개의 파일을 삭제
  1. 4 4
      clueSync/sendMail.go

+ 4 - 4
clueSync/sendMail.go

@@ -17,7 +17,7 @@ var (
                     WHERE a.dept_name = '销售三部' AND a.resign = 0 AND c.role_id = 3`
 	dmInfo = `SELECT b.dept_name FROM dwd_d_crm_department_level_succbi b WHERE b.position_id IN (SELECT a.position_id FROM dwd_f_crm_personnel_management a
 		WHERE assign_type = 1) GROUP BY b.dept_name`
-	dmInfoCount = `SELECT a.position_id, COUNT(IF(a.trailstatus <> '08', 1, NULL)) as num FROM dwd_f_crm_clue_info a LEFT JOIN dwd_d_crm_department_level_succbi b ON a.position_id = b.position_id LEFT JOIN dwd_f_crm_personnel_management c ON b.position_id = c.position_id WHERE b.dept_name = ? AND c.resign = 0 AND c.assign_type = 1 GROUP BY a.position_id HAVING COUNT(a.position_id) < ?`
+	dmInfoCount = `SELECT b.position_id, COUNT(IF(a.trailstatus <> '08', 1, NULL)) as num FROM Jianyu_subjectdb_test.dwd_f_crm_clue_info a RIGHT JOIN Jianyu_subjectdb_test.dwd_d_crm_department_level_succbi b ON a.position_id = b.position_id LEFT JOIN Jianyu_subjectdb_test.dwd_f_crm_personnel_management c ON b.position_id = c.position_id WHERE b.dept_name = ? AND c.resign = 0 AND c.assign_type = 1 GROUP BY a.position_id HAVING COUNT(a.position_id) < ?`
 	dmInfoMail  = `SELECT a.name, a.position_id, (b.send_mail >> 2) & 1 AS flag_1, (b.send_mail >> 3) & 1 AS flag_2, c.mail FROM dwd_d_crm_department_level_succbi a INNER JOIN dwd_f_crm_personnel_management b ON a.position_id = b.position_id LEFT JOIN jianyu.entniche_user c ON a.ent_user_id = c.id WHERE a.dept_name = ? AND a.resign = 0 AND b.role_id = 3`
 	xgMail      = `SELECT a.name, c.mail FROM dwd_d_crm_department_level_succbi a INNER JOIN dwd_f_crm_personnel_management b ON a.position_id = b.position_id LEFT JOIN jianyu.entniche_user c ON a.ent_user_id = c.id WHERE b.role_id = 5 AND b.resign = 0`
 	// 所有参与线索分配人员的邮箱
@@ -264,13 +264,14 @@ func CantBeAssignedNots() {
 // @Author jianghan
 // @Description  客成移交线索失败提醒
 // @Date 2024/4/10
-func HandOverFail(posid int64) {
+func HandOverFail(posid int64, ent string) {
 	title := "客成线索移交失败通知"
-	content := "您的私海线索已超过**条(不包含成交客户),已达到私海线索上限**条(不包含成交客户),导致“XXX线索名称(XXX手机号)”无法从客成到期自动移交至私海,请及时将无需跟进的线索退回公海,超过3个工作日(根据配置获取)不处理,该线索将自动退回至公海"
+	content := "您的私海线索已超过%d条(不包含成交客户),已达到私海线索上限%d条(不包含成交客户),导致“%s”无法从客成到期自动移交至私海,请及时将无需跟进的线索退回公海,超过3个工作日(根据配置获取)不处理,该线索将自动退回至公海"
 
 	toMail := ""
 	toCc := ""
 	info := TiDb.SelectBySql(selfMail, posid)
+	content = fmt.Sprintf(content, cfg.AllocationCap, cfg.AllocationCap, ent)
 	if info != nil && len(*info) > 0 {
 		toMail = getMailAds(common.ObjToString((*info)[0]["mail"]), common.ObjToString((*info)[0]["name"]))
 	}
@@ -301,7 +302,6 @@ func OrderCreateFail(posid int64, bname string) {
 		return
 	}
 	toCc = getCc(posid)
-	toCc = strings.Join(append(strings.Split(toCc, ","), getMailAds("shenbingyi@topnet.net.cn", "沈炳毅")), ",")
 	sendInfo(toMail, toCc, title, content)
 }