Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wsmonitor_sql
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
宋鹏博
wsmonitor_sql
Commits
2be2b126
Commit
2be2b126
authored
Mar 19, 2025
by
宋鹏博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加@逻辑
parent
ff00cfca
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
19 deletions
+50
-19
cutils.py
common/cutils.py
+28
-7
config.py
config.py
+19
-11
data.json
data/data.json
+2
-0
start.py
start.py
+1
-1
No files found.
common/cutils.py
View file @
2be2b126
...
...
@@ -34,18 +34,21 @@ def error_message(text, url=wechaturl, mobile_list=16638842134):
# 发送mkdown格式微信消息
def
mk_error_message
(
error_editor
,
error_answer
,
message_id
,
url
=
wechaturl
):
if
error_editor
==
"AI审校团队"
or
error_editor
==
"AI预审编辑"
:
data
=
{
"msgtype"
:
"markdown"
,
"markdown"
:
{
"content"
:
f
"ws推送<font color=
\"
warning
\"
>异常</font>,请相关同事注意。
\n
>问题编辑:<font color=
\"
comment
\"
>{error_editor}@宋鹏博
</font>
\n
>消息id:<font color=
\"
comment
\"
>{message_id}</font>
\n
>返回消息:<font color=
\"
comment
\"
>{error_answer}</font> "
"content"
:
f
"ws推送<font color=
\"
warning
\"
>异常</font>,请相关同事注意。
\n
>问题编辑:<font color=
\"
comment
\"
>{error_editor}
</font>
\n
>消息id:<font color=
\"
comment
\"
>{message_id}</font>
\n
>返回消息:<font color=
\"
comment
\"
>{error_answer}</font> "
}
}
else
:
requests
.
post
(
url
,
json
=
data
)
def
mk_error_aireview_message
(
error_editor
,
error_answer
,
message_id
,
biz_id
,
url
=
wechaturl
):
data
=
{
"msgtype"
:
"markdown"
,
"markdown"
:
{
"content"
:
f
"ws推送<font color=
\"
warning
\"
>异常</font>,请相关同事注意。
\n
>问题编辑:<font color=
\"
comment
\"
>{error_editor}</font>
\n
>消息id:<font color=
\"
comment
\"
>{message_id}</font>
\n
>返回消息:<font color=
\"
comment
\"
>{error_answer}</font> "
"content"
:
f
"ws推送<font color=
\"
warning
\"
>异常</font>,请相关同事注意。
\n
>问题编辑:<font color=
\"
comment
\"
>{error_editor}</font>
\n
>消息id:<font color=
\"
comment
\"
>{message_id}</font>
\n
>返回消息:<font color=
\"
comment
\"
>{error_answer}</font>
\n
>biz_id:<font color=
\"
comment
\"
>{biz_id}</font> "
,
"mentioned_mobile_list"
:
[
"16638842134"
,
"@宋鹏博"
]
}
}
requests
.
post
(
url
,
json
=
data
)
...
...
@@ -63,15 +66,33 @@ def ws_error(minute, error_answer_list=error_answer):
editor
=
DButils
()
.
select_sql
(
f
"select name from aicaptain.job where id= (SELECT job_id FROM aicaptain.employee WHERE "
f
" id= {data[i][0]} ); "
)
if
editor
[
0
][
0
]
in
[
"AI审校团队"
,
"AI预审编辑"
]:
if
"true"
or
"false"
in
data
[
0
][
1
]:
dirt
=
data
[
0
][
1
]
.
replace
(
"true"
,
"True"
)
.
replace
(
"false"
,
"False"
)
d
=
ast
.
literal_eval
(
dirt
)
biz_id
=
d
.
get
(
"msgContentList"
)[
1
]
.
get
(
"data"
)
.
get
(
"reviewReportRecordId"
)
mk_error_aireview_message
(
editor
[
0
][
0
],
n
,
data
[
i
][
2
],
biz_id
)
else
:
mk_error_message
(
editor
[
0
][
0
],
n
,
data
[
i
][
2
])
print
(
"结束"
)
if
__name__
==
'__main__'
:
error_answer_list
=
[
"无法回答此类问题,请换个话题吧"
,
"二维码创建失败"
,
"意图下发失败"
,
"文件处理失败"
,
"生成失败"
,
"润色任务失败"
,
"网络异常"
,
"获取书评助理结果失败"
,
"审校失败"
,
"图书生成报告失败"
,
"对不起,我暂时无法回答这个问题"
]
data
=
DButils
()
.
select_sql
(
f
"select emp_id,content,id from aicaptain.message_record mr WHERE create_time > NOW() - INTERVAL 100 minute "
f
"and id=1895017692240617472 limit 1; "
)
f
"select emp_id,content,id from aicaptain.message_record mr WHERE id=1900420961792245760 "
f
"and msg_type != 1 ; "
)
print
(
data
)
for
i
in
range
(
len
(
data
)):
for
n
in
error_answer_list
:
if
n
in
data
[
i
][
1
]:
editor
=
DButils
()
.
select_sql
(
f
"select name from aicaptain.job where id= (SELECT job_id FROM aicaptain.employee WHERE "
f
" id= {data[i][0]} ); "
)
if
editor
[
0
][
0
]
==
"AI审校团队"
or
editor
[
0
][
0
]
==
"AI预审编辑"
:
if
"true"
or
"false"
in
data
[
0
][
1
]:
dirt
=
data
[
0
][
1
]
.
replace
(
"true"
,
"True"
)
.
replace
(
"false"
,
"False"
)
d
=
ast
.
literal_eval
(
dirt
)
print
(
d
.
get
(
"msgContentList"
)[
1
]
.
get
(
"data"
)
.
get
(
"reviewReportRecordId"
)
)
biz_id
=
d
.
get
(
"msgContentList"
)[
1
]
.
get
(
"data"
)
.
get
(
"reviewReportRecordId"
)
config.py
View file @
2be2b126
import
os
# 测试环境数据库
#
host = "122.112.227.235"
#
user = "userop"
#
database_pwd = "0#ztXqUzECGen8E"
#
database = "aireview"
#
port = 3306
host
=
"122.112.227.235"
user
=
"userop"
database_pwd
=
"0#ztXqUzECGen8E"
database
=
"aireview"
port
=
3306
# 生产环境aireview数据库
# host = "192.168.8.234"
# user = "aireview110"
...
...
@@ -11,15 +13,21 @@
# database = "aireview"
# port = 3306
# 生产环境aicaption数据库
host
=
"192.168.8.234"
user
=
"aicaptain110"
database_pwd
=
"ABs4B79c"
database
=
"aicaptain"
port
=
3306
#
host = "192.168.8.234"
#
user = "aicaptain110"
#
database_pwd = "ABs4B79c"
#
database = "aicaptain"
#
port = 3306
# 微信机器人url
wechaturl
=
"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=5a4fa3ba-9974-44d3-9c1e-2428f77f8087"
# 问题词
error_answer
=
[
"无法回答此类问题,请换个话题吧"
,
"二维码创建失败"
,
"意图下发失败"
,
"文件处理失败"
,
"生成失败"
,
"润色任务失败"
,
"网络异常"
,
"获取书评助理结果失败"
,
"审校失败"
,
"图书生成报告失败"
,
"对不起,我暂时无法回答这个问题"
]
error_answer
=
[
"无法回答此类问题,请换个话题吧"
,
"二维码创建失败"
,
"意图下发失败"
,
"文件处理失败"
,
"生成失败"
,
"润色任务失败"
,
"网络异常"
,
"获取书评助理结果失败"
,
"审校失败"
,
"图书生成报告失败"
,
"对不起,我暂时无法回答这个问题"
]
# 文件路径设置
file_path
=
os
.
path
.
dirname
(
__file__
)
data/data.json
0 → 100644
View file @
2be2b126
"{
\"
empId
\"
:16583,
\"
isChat
\"
:0,
\"
messageMetaId
\"
:4635342746807116,
\"
hasSend
\"
:true,
\"
inquiryMsgMetaId
\"
:4635342746807116,
\"
msgRemoteId
\"
:
\"
4635342746807115
\"
,
\"
msgContentList
\"
:[{
\"
content
\"
:
\"\u
4e2d
\u
6587
\u
811a
\u
672c.docx
\u
9884
\u
5ba1
\u
5df2
\u
5b8c
\u
6210
\"
,
\"
notShow
\"
:true,
\"
contentType
\"
:
\"
Text
\"
,
\"
classType
\"
:
\"
TextMsgTypeDTO
\"
},{
\"
data
\"
:{
\"
reportContent
\"
:
\"\u
4e2d
\u
6587
\u
811a
\u
672c.docx
\u
751f
\u
6210
\u
5931
\u
8d25
\\
n
\u
9884
\u
5ba1
\u
5931
\u
8d25
\"
,
\"
title
\"
:
\"\u
4e2d
\u
6587
\u
811a
\u
672c
\"
,
\"
reviewReportRecordId
\"
:
\"
11727
\"
,
\"
assistantCodes
\"
:
\"
preliminarytrial
\"
,
\"
status
\"
:
\"
-2
\"
},
\"
dataCode
\"
:
\"
YUSHEN
\"
,
\"
contentType
\"
:
\"
Data
\"
,
\"
classType
\"
:
\"
DataMsgTypeDTO
\"
}],
\"
messageRecordId
\"
:1895017692240617472,
\"
hasPolish
\"
:0,
\"
hasTask
\"
:1,
\"
createTime
\"
:1740642400215,
\"
costTime
\"
:17306215,
\"
adviserId
\"
:1002164,
\"
hasRegenerate
\"
:0,
\"
abilityId
\"
:105,
\"
contentType
\"
:
\"
Json
\"
}"
\ No newline at end of file
start.py
View file @
2be2b126
from
common.cutils
import
ws_error
ws_error
(
1
0
)
ws_error
(
1
5
)
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