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
ff00cfca
Commit
ff00cfca
authored
Mar 19, 2025
by
宋鹏博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加@逻辑
parent
74be03fe
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
6 deletions
+38
-6
cutils.py
common/cutils.py
+38
-6
No files found.
common/cutils.py
View file @
ff00cfca
import
ast
import
json
import
requests
from
common.DButils
import
DButils
from
config
import
wechaturl
,
error_answer
from
config
import
wechaturl
,
error_answer
,
file_path
def
read_json
(
file_name
):
path
=
file_path
+
"/data/"
+
file_name
with
open
(
path
,
"r"
,
encoding
=
"utf-8"
)
as
f
:
data
=
json
.
load
(
f
)
return
data
def
load_json
(
file_name
,
data
):
path
=
file_path
+
"/data/"
+
file_name
with
open
(
path
,
"w"
,
encoding
=
"utf-8"
)
as
f
:
json
.
dump
(
data
,
f
)
# 发送微信消息
...
...
@@ -20,12 +34,20 @@ def error_message(text, url=wechaturl, mobile_list=16638842134):
# 发送mkdown格式微信消息
def
mk_error_message
(
error_editor
,
error_answer
,
message_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> "
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> "
}
}
else
:
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> "
}
}
}
requests
.
post
(
url
,
json
=
data
)
...
...
@@ -43,3 +65,13 @@ def ws_error(minute, error_answer_list=error_answer):
f
" id= {data[i][0]} ); "
)
mk_error_message
(
editor
[
0
][
0
],
n
,
data
[
i
][
2
])
print
(
"结束"
)
if
__name__
==
'__main__'
:
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; "
)
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"
))
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