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
7ee1a0fd
authored
Jul 12, 2021
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
调整监听任务
parent
8561ccae
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
11 deletions
cmd/task/task_monitor/main.go
cmd/task/task_monitor/main.go
View file @
7ee1a0fd
...
...
@@ -89,13 +89,18 @@ func updateOverTime() {
db
.
Exec
(
"update lie_user set last_sale_id = ? where user_id = ?"
,
salesman
.
Sale_Id
,
task_info
.
UserId
)
}
// 获取当前用户信息
var
user_info
model
.
Users
db
.
Get
(
&
user_info
,
"select user_id,outter_uid,is_free,free_time,is_churn from lie_user where user_id = ?"
,
task_info
.
UserId
)
// TaskResult: 1-释放客户至公共池,2-重新分配客服
var
msg_txt
string
if
task_setup_details
.
TaskResult
==
1
{
db
.
Exec
(
"update lie_user set is_free = ?, free_time = ?, is_churn = ? where user_id = ?"
,
1
,
current_time
,
0
,
task_info
.
UserId
)
db
.
Exec
(
"delete from lie_salesman where user_id = ?"
,
task_info
.
UserId
)
db
.
Exec
(
"insert into lie_action_log (user_id, type, event, remark, create_time) values (?, ?, ?, ?, ?)"
,
task_info
.
UserId
,
2
,
"释放用户"
,
""
,
current_time
)
// 清理新的关联表
db
.
Exec
(
"update `lie_invoice_com_user` set sale_id= ?, update_time = ? where user_id = ?"
,
0
,
current_time
,
user_info
.
Outter_uid
)
msg_txt
=
"任务告警:监听任务脚本释放用户成功,CRM用户ID:"
+
strconv
.
Itoa
(
task_info
.
UserId
)
}
else
{
...
...
@@ -103,26 +108,28 @@ func updateOverTime() {
var
user
model
.
Users
db
.
Get
(
&
user
,
"select user_id,outter_uid,adtag,ptag from lie_user where user_id = ?"
,
task_info
.
UserId
)
if
user
.
Adtag
!=
""
||
user
.
Ptag
!=
""
{
// 获取自动分配表指定的客服
var
sale_id
int
if
user
.
Adtag
!=
""
||
user
.
Ptag
!=
""
{
// 获取自动分配表指定的客服
var
sale_tag
model
.
SaleTag
db
.
Get
(
&
sale_tag
,
"select sale_id from lie_sale_tag where adtag = ? or ptag = ?"
,
user
.
Adtag
,
user
.
Ptag
)
var
sale_id
int
if
sale_tag
.
SaleId
!=
0
{
// 自动分配
sale_id
=
sale_tag
.
SaleId
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
=
"任务告警:监听任务脚本随机分配客服成功,CRM用户ID:"
+
strconv
.
Itoa
(
task_info
.
UserId
)
+
",指定客服ID:"
+
strconv
.
Itoa
(
sale_id
)
}
db
.
Exec
(
"update lie_salesman set sale_id = ?, create_time = ?, update_time = ? where user_id = ?"
,
sale_id
,
current_time
,
current_time
,
task_info
.
UserId
)
}
else
{
// 随机取一个客服
cms_user_info
:=
RandomSelctSales
()
sale_id
=
cms_user_info
.
UserId
msg_txt
=
"任务告警:监听任务脚本随机分配客服成功,CRM用户ID:"
+
strconv
.
Itoa
(
task_info
.
UserId
)
+
",指定客服ID:"
+
strconv
.
Itoa
(
sale_id
)
}
db
.
Exec
(
"update lie_salesman set sale_id = ?, create_time = ?, update_time = ? where user_id = ?"
,
sale_id
,
current_time
,
current_time
,
task_info
.
UserId
)
db
.
Exec
(
"update `lie_invoice_com_user` set sale_id= ?, update_time = ? where user_id = ?"
,
sale_id
,
current_time
,
user_info
.
Outter_uid
)
}
db
.
Exec
(
"insert into lie_action_log (user_id, type, event, remark, create_time) values (?, ?, ?, ?, ?)"
,
task_info
.
UserId
,
2
,
"监听任务脚本"
,
msg_txt
,
current_time
)
// 标记已超时状态
db
.
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
,
""
)
...
...
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