|
@@ -41,15 +41,15 @@ func WarningPerl() {
|
|
sendFlag2 := common.IntAll(m["flag_2"]) //上限邮件发送
|
|
sendFlag2 := common.IntAll(m["flag_2"]) //上限邮件发送
|
|
posid := common.Int64All(m["position_id"])
|
|
posid := common.Int64All(m["position_id"])
|
|
count := TiDb.CountBySql(sql, posid)
|
|
count := TiDb.CountBySql(sql, posid)
|
|
- if count >= cfg.AllocationCap && sendFlag2 == 0 {
|
|
|
|
|
|
+ if count >= db.AllocationCap && sendFlag2 == 0 {
|
|
ExceedLimitByPp(posid) // 发上限邮件
|
|
ExceedLimitByPp(posid) // 发上限邮件
|
|
_, _ = TiDb.ExecBySql(fmt.Sprintf(sql1, "send_mail | (1 << 1)"), posid)
|
|
_, _ = TiDb.ExecBySql(fmt.Sprintf(sql1, "send_mail | (1 << 1)"), posid)
|
|
- } else if count >= cfg.WarningValue && sendFlag1 == 0 && sendFlag2 == 0 {
|
|
|
|
|
|
+ } else if count >= db.WarningValue && sendFlag1 == 0 && sendFlag2 == 0 {
|
|
WillWarningByPp(posid) // 发预警邮件
|
|
WillWarningByPp(posid) // 发预警邮件
|
|
_, _ = TiDb.ExecBySql(fmt.Sprintf(sql1, "send_mail | (1 << 0)"), posid)
|
|
_, _ = TiDb.ExecBySql(fmt.Sprintf(sql1, "send_mail | (1 << 0)"), posid)
|
|
- } else if sendFlag1 == 1 && count < cfg.WarningValue { // 已发邮件
|
|
|
|
|
|
+ } else if sendFlag1 == 1 && count < db.WarningValue { // 已发邮件
|
|
_, _ = TiDb.ExecBySql(fmt.Sprintf(sql1, "send_mail & ~(1 << 0)"), posid)
|
|
_, _ = TiDb.ExecBySql(fmt.Sprintf(sql1, "send_mail & ~(1 << 0)"), posid)
|
|
- } else if sendFlag2 == 1 && count < cfg.AllocationCap { // 已发邮件
|
|
|
|
|
|
+ } else if sendFlag2 == 1 && count < db.AllocationCap { // 已发邮件
|
|
_, _ = TiDb.ExecBySql(fmt.Sprintf(sql1, "send_mail & ~(1 << 1)"), posid)
|
|
_, _ = TiDb.ExecBySql(fmt.Sprintf(sql1, "send_mail & ~(1 << 1)"), posid)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -66,12 +66,12 @@ func WarningDm() {
|
|
for _, m := range *dm {
|
|
for _, m := range *dm {
|
|
d1 := common.ObjToString(m["dept_name"])
|
|
d1 := common.ObjToString(m["dept_name"])
|
|
send1, send2 := true, true // 预警,上限 发送标记
|
|
send1, send2 := true, true // 预警,上限 发送标记
|
|
- info := TiDb.SelectBySql(dmInfoCount, d1, cfg.WarningValue)
|
|
|
|
|
|
+ info := TiDb.SelectBySql(dmInfoCount, d1, db.WarningValue)
|
|
if info != nil && len(*info) > 0 {
|
|
if info != nil && len(*info) > 0 {
|
|
send = false
|
|
send = false
|
|
send1 = false
|
|
send1 = false
|
|
}
|
|
}
|
|
- info1 := TiDb.SelectBySql(dmInfoCount, d1, cfg.AllocationCap)
|
|
|
|
|
|
+ info1 := TiDb.SelectBySql(dmInfoCount, d1, db.AllocationCap)
|
|
if info1 != nil && len(*info1) > 0 {
|
|
if info1 != nil && len(*info1) > 0 {
|
|
send2 = false
|
|
send2 = false
|
|
}
|
|
}
|
|
@@ -164,7 +164,7 @@ func WillWarningByPp(posid int64) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
toCc = getCc(posid)
|
|
toCc = getCc(posid)
|
|
- content = fmt.Sprintf(content, cfg.WarningValue, cfg.AllocationCap)
|
|
|
|
|
|
+ content = fmt.Sprintf(content, db.WarningValue, db.AllocationCap)
|
|
sendInfo(toMail, toCc, title, content)
|
|
sendInfo(toMail, toCc, title, content)
|
|
}
|
|
}
|
|
|
|
|
|
@@ -207,7 +207,7 @@ func WillWarningByDm(dname, to string, toCc []string) {
|
|
title := "“%s”私海线索即将达到上限通知"
|
|
title := "“%s”私海线索即将达到上限通知"
|
|
content := "“%s”的所有参与线索分配的电销人员,私海线索都已达到%d条(不包含成交客户),即将达到私海线索上限%d条(不包含成交客户),请及时通知电销人员将无需跟进的线索退回公海,以避免无法接收新线索。"
|
|
content := "“%s”的所有参与线索分配的电销人员,私海线索都已达到%d条(不包含成交客户),即将达到私海线索上限%d条(不包含成交客户),请及时通知电销人员将无需跟进的线索退回公海,以避免无法接收新线索。"
|
|
title = fmt.Sprintf(title, dname)
|
|
title = fmt.Sprintf(title, dname)
|
|
- content = fmt.Sprintf(content, dname, cfg.WarningValue, cfg.AllocationCap)
|
|
|
|
|
|
+ content = fmt.Sprintf(content, dname, db.WarningValue, db.AllocationCap)
|
|
sendInfo(to, strings.Join(toCc, ","), title, content)
|
|
sendInfo(to, strings.Join(toCc, ","), title, content)
|
|
}
|
|
}
|
|
|
|
|
|
@@ -223,7 +223,7 @@ func WillWarningByAll() {
|
|
to = append(to, m3)
|
|
to = append(to, m3)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- content = fmt.Sprintf(content, cfg.WarningValue)
|
|
|
|
|
|
+ content = fmt.Sprintf(content, db.WarningValue)
|
|
sendInfo(strings.Join(to, ","), "", title, content)
|
|
sendInfo(strings.Join(to, ","), "", title, content)
|
|
}
|
|
}
|
|
|
|
|
|
@@ -236,7 +236,7 @@ func ExceedLimitByPp(posid int64) {
|
|
|
|
|
|
toMail := ""
|
|
toMail := ""
|
|
toCc := ""
|
|
toCc := ""
|
|
- content = fmt.Sprintf(content, cfg.AllocationCap)
|
|
|
|
|
|
+ content = fmt.Sprintf(content, db.AllocationCap)
|
|
info := TiDb.SelectBySql(selfMail, posid)
|
|
info := TiDb.SelectBySql(selfMail, posid)
|
|
if info != nil && len(*info) > 0 {
|
|
if info != nil && len(*info) > 0 {
|
|
toMail = getMailAds(common.ObjToString((*info)[0]["mail"]), common.ObjToString((*info)[0]["name"]))
|
|
toMail = getMailAds(common.ObjToString((*info)[0]["mail"]), common.ObjToString((*info)[0]["name"]))
|
|
@@ -256,7 +256,7 @@ func ExceedLimitByDm(dname, to string, toCc []string) {
|
|
title := "“%s”私海线索已达到上限通知"
|
|
title := "“%s”私海线索已达到上限通知"
|
|
content := "“%s”的所有参与线索分配的电销人员,私海线索都已达到私海线索上限%d条(不包含成交客户),当前无法接收新线索,请及时通知电销人员将无需跟进的线索退回公海"
|
|
content := "“%s”的所有参与线索分配的电销人员,私海线索都已达到私海线索上限%d条(不包含成交客户),当前无法接收新线索,请及时通知电销人员将无需跟进的线索退回公海"
|
|
title = fmt.Sprintf(title, dname)
|
|
title = fmt.Sprintf(title, dname)
|
|
- content = fmt.Sprintf(content, dname, cfg.AllocationCap)
|
|
|
|
|
|
+ content = fmt.Sprintf(content, dname, db.AllocationCap)
|
|
sendInfo(to, strings.Join(toCc, ","), title, content)
|
|
sendInfo(to, strings.Join(toCc, ","), title, content)
|
|
}
|
|
}
|
|
|
|
|
|
@@ -285,7 +285,7 @@ func AutoReleaseNots() {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
toCc = append(toCc, getMailAds("shenbingyi@topnet.net.cn", "沈炳毅"))
|
|
toCc = append(toCc, getMailAds("shenbingyi@topnet.net.cn", "沈炳毅"))
|
|
- sendInfo(strings.Join(to, ","), strings.Join(toCc, ","), title, fmt.Sprintf(content, cfg.AllocationCap))
|
|
|
|
|
|
+ sendInfo(strings.Join(to, ","), strings.Join(toCc, ","), title, fmt.Sprintf(content, db.AllocationCap))
|
|
}
|
|
}
|
|
|
|
|
|
// @Author jianghan
|
|
// @Author jianghan
|
|
@@ -313,7 +313,7 @@ func CantBeAssignedNots() {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
toCc = append(toCc, getMailAds("shenbingyi@topnet.net.cn", "沈炳毅"))
|
|
toCc = append(toCc, getMailAds("shenbingyi@topnet.net.cn", "沈炳毅"))
|
|
- sendInfo(strings.Join(to, ","), strings.Join(toCc, ","), title, fmt.Sprintf(content, cfg.AllocationCap))
|
|
|
|
|
|
+ sendInfo(strings.Join(to, ","), strings.Join(toCc, ","), title, fmt.Sprintf(content, db.AllocationCap))
|
|
}
|
|
}
|
|
|
|
|
|
// @Author jianghan
|
|
// @Author jianghan
|
|
@@ -326,7 +326,7 @@ func HandOverFail(posid int64, ent string) {
|
|
toMail := ""
|
|
toMail := ""
|
|
toCc := ""
|
|
toCc := ""
|
|
info := TiDb.SelectBySql(selfMail, posid)
|
|
info := TiDb.SelectBySql(selfMail, posid)
|
|
- content = fmt.Sprintf(content, cfg.AllocationCap, cfg.AllocationCap, ent, cfg.ThawDay)
|
|
|
|
|
|
+ content = fmt.Sprintf(content, db.AllocationCap, db.AllocationCap, ent, db.ThawDay)
|
|
if info != nil && len(*info) > 0 {
|
|
if info != nil && len(*info) > 0 {
|
|
toMail = getMailAds(common.ObjToString((*info)[0]["mail"]), common.ObjToString((*info)[0]["name"]))
|
|
toMail = getMailAds(common.ObjToString((*info)[0]["mail"]), common.ObjToString((*info)[0]["name"]))
|
|
}
|
|
}
|
|
@@ -347,7 +347,7 @@ func OrderCreateFail(posid int64, bname string) {
|
|
|
|
|
|
toMail := ""
|
|
toMail := ""
|
|
toCc := ""
|
|
toCc := ""
|
|
- content = fmt.Sprintf(content, cfg.AllocationCap, cfg.AllocationCap, bname, cfg.ThawDay)
|
|
|
|
|
|
+ content = fmt.Sprintf(content, db.AllocationCap, db.AllocationCap, bname, db.ThawDay)
|
|
info := TiDb.SelectBySql(selfMail, posid)
|
|
info := TiDb.SelectBySql(selfMail, posid)
|
|
if info != nil && len(*info) > 0 {
|
|
if info != nil && len(*info) > 0 {
|
|
toMail = getMailAds(common.ObjToString((*info)[0]["mail"]), common.ObjToString((*info)[0]["name"]))
|
|
toMail = getMailAds(common.ObjToString((*info)[0]["mail"]), common.ObjToString((*info)[0]["name"]))
|
|
@@ -369,7 +369,7 @@ func AssFail(posid int64, ent, iname string) {
|
|
|
|
|
|
toMail := ""
|
|
toMail := ""
|
|
toCc := ""
|
|
toCc := ""
|
|
- content = fmt.Sprintf(content, cfg.AllocationCap, ent, iname)
|
|
|
|
|
|
+ content = fmt.Sprintf(content, db.AllocationCap, ent, iname)
|
|
info := TiDb.SelectBySql(selfMail, posid)
|
|
info := TiDb.SelectBySql(selfMail, posid)
|
|
if info != nil && len(*info) > 0 {
|
|
if info != nil && len(*info) > 0 {
|
|
toMail = getMailAds(common.ObjToString((*info)[0]["mail"]), common.ObjToString((*info)[0]["name"]))
|
|
toMail = getMailAds(common.ObjToString((*info)[0]["mail"]), common.ObjToString((*info)[0]["name"]))
|
|
@@ -445,8 +445,8 @@ func getCc(posid int64) (to string) {
|
|
// @Date 2024/5/13
|
|
// @Date 2024/5/13
|
|
func getMailAds(mail, name string) string {
|
|
func getMailAds(mail, name string) string {
|
|
log.Println("getMailAds", name, mail)
|
|
log.Println("getMailAds", name, mail)
|
|
- if cfg.NameToMail != nil && len(cfg.NameToMail) > 0 {
|
|
|
|
- return cfg.NameToMail[name]
|
|
|
|
|
|
+ if db.NameToMail != nil && len(db.NameToMail) > 0 {
|
|
|
|
+ return db.NameToMail[name]
|
|
} else {
|
|
} else {
|
|
return mail
|
|
return mail
|
|
}
|
|
}
|