Commit ff00cfca by 宋鹏博

添加@逻辑

parent 74be03fe
import ast
import json import json
import requests import requests
from common.DButils import DButils 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): ...@@ -20,12 +34,20 @@ def error_message(text, url=wechaturl, mobile_list=16638842134):
# 发送mkdown格式微信消息 # 发送mkdown格式微信消息
def mk_error_message(error_editor, error_answer, message_id, url=wechaturl): def mk_error_message(error_editor, error_answer, message_id, url=wechaturl):
data = { if error_editor == "AI审校团队" or error_editor == "AI预审编辑":
"msgtype": "markdown", data = {
"markdown": { "msgtype": "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> " "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) requests.post(url, json=data)
...@@ -43,3 +65,13 @@ def ws_error(minute, error_answer_list=error_answer): ...@@ -43,3 +65,13 @@ def ws_error(minute, error_answer_list=error_answer):
f" id= {data[i][0]} ); ") f" id= {data[i][0]} ); ")
mk_error_message(editor[0][0], n, data[i][2]) mk_error_message(editor[0][0], n, data[i][2])
print("结束") 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"))
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 to comment