Commit bdea6c5f by 朱继来

调整监听脚本

parent 3f984ccc
Showing with 9 additions and 8 deletions
......@@ -40,7 +40,7 @@ func main() {
initArgs()
logConfig := make(map[string]string)
logConfig["log_path"] = LogDir + "/task/taskMonitor"
logConfig["log_path"] = LogDir + "/task/task_monitor"
logConfig["log_chan_size"] = "100"
logger.InitLogger("file", logConfig)
logger.Init()
......@@ -85,7 +85,7 @@ func updateOverTime() {
if err != nil {
logger.Info("获取任务配置详情失败,任务Id:%d,错误原因:%v", task_info.TaskId, err.Error())
service.DingAlert(configs.Ding_crm_task_token, "任务告警:任务脚本获取任务配置详情失败,CRM用户ID:"+strconv.Itoa(task_info.UserId)+",任务ID:"+strconv.Itoa(task_info.TaskId)+",原因:"+err.Error(), "")
service.DingAlert(configs.Ding_crm_task_token, "任务告警:监听任务脚本获取任务配置详情失败,CRM用户ID:"+strconv.Itoa(task_info.UserId)+",任务ID:"+strconv.Itoa(task_info.TaskId)+",原因:"+err.Error(), "")
continue
}
......@@ -97,12 +97,14 @@ func updateOverTime() {
}
// TaskResult: 1-释放客户至公共池,2-重新分配客服
var msg_txt string
if task_setup_details.TaskResult == 1 {
dao.GetDb().Exec("update lie_user set is_free = ?, free_time = ?, is_churn = ? where user_id = ?", 1, current_time, 0, task_info.UserId)
dao.GetDb().Exec("delete from lie_salesman where user_id = ?", task_info.UserId)
dao.GetDb().Exec("insert into lie_action_log (user_id, type, event, remark, create_time) values (?, ?, ?, ?, ?)", task_info.UserId, 2, "释放用户", "", current_time)
service.DingAlert(configs.Ding_crm_task_token, "任务告警:任务脚本释放用户成功,CRM用户ID:"+strconv.Itoa(task_info.UserId), "")
msg_txt = "任务告警:监听任务脚本释放用户成功,CRM用户ID:"+strconv.Itoa(task_info.UserId)
} else {
// 获取adtag、ptag
var user model.Users
......@@ -114,24 +116,23 @@ func updateOverTime() {
dao.GetDb().Get(&sale_tag, "select sale_id from lie_sale_tag where adtag = ? or ptag = ?", user.Adtag, user.Ptag)
var sale_id int
var msg_txt string
if sale_tag.SaleId != 0 { // 自动分配
sale_id = sale_tag.SaleId
msg_txt = "任务脚本自动分配客服"
msg_txt = "任务告警:监听任务脚本自动分配客服成功,CRM用户ID:"+strconv.Itoa(task_info.UserId)+",指定客服ID:"+strconv.Itoa(sale_id)
} else { // 随机取一个客服
user_info := RandomSelctSales()
sale_id = user_info.UserId
msg_txt = "任务脚本随机分配客服"
msg_txt = "任务告警:监听任务脚本随机分配客服成功,CRM用户ID:"+strconv.Itoa(task_info.UserId)+",指定客服ID:"+strconv.Itoa(sale_id)
}
dao.GetDb().Exec("update lie_salesman set sale_id = ?, create_time = ?, update_time = ? where user_id = ?", sale_id, current_time, current_time, task_info.UserId)
service.DingAlert(configs.Ding_crm_task_token, "任务告警:"+msg_txt+"成功,CRM用户ID:"+strconv.Itoa(task_info.UserId)+",指定客服ID:"+strconv.Itoa(sale_id), "")
}
}
// 标记已超时状态
dao.GetDb().Exec("update lie_task_info set status = ?, update_time = ? where id = ?", -1, task_info.Id, current_time)
dao.GetDb().Exec("update lie_task_info set status = ?, update_time = ? where id = ?", -1, current_time, task_info.Id)
service.DingAlert(configs.Ding_crm_task_token, msg_txt, "")
}
return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment