Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CnChunfeng
/
crm_server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
bdea6c5f
authored
Sep 03, 2020
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
调整监听脚本
parent
3f984ccc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
cmd/task/task_monitor/main.go
cmd/task/task_monitor/main.go
View file @
bdea6c5f
...
...
@@ -40,7 +40,7 @@ func main() {
initArgs
()
logConfig
:=
make
(
map
[
string
]
string
)
logConfig
[
"log_path"
]
=
LogDir
+
"/task/task
M
onitor"
logConfig
[
"log_path"
]
=
LogDir
+
"/task/task
_m
onitor"
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment