1 parent
ac27310dfd
commit
d8ade5ba43
1 file changed
+28
-1
+28
-1
@@ -184,11 +184,25 @@ def feishu_notify(text):
|
|||||||
data = res.read()
|
data = res.read()
|
||||||
|
|
||||||
|
|
||||||
|
def feishu_notify_to_xbot_content_group(text):
|
||||||
|
|
||||||
|
webhook_url = "/open-apis/bot/v2/hook/b2db78ac-799a-4251-8341-18d49091fa62"
|
||||||
|
Keys = "T8phm8fcfZ04bvOHaI0kzd"
|
||||||
|
|
||||||
|
conn = http.client.HTTPSConnection("open.feishu.cn")
|
||||||
|
payload = json.dumps({"msg_type": "text", "content": {"text": text}})
|
||||||
|
headers = {"Content-Type": "application/json"}
|
||||||
|
conn.request("POST", webhook_url, payload, headers)
|
||||||
|
res = conn.getresponse()
|
||||||
|
data = res.read()
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
"""
|
"""
|
||||||
主程序入口
|
主程序入口
|
||||||
"""
|
"""
|
||||||
messages = []
|
messages = []
|
||||||
|
message_without_phone = []
|
||||||
try:
|
try:
|
||||||
# 获取所有工单
|
# 获取所有工单
|
||||||
work_orders = get_all_work_orders()
|
work_orders = get_all_work_orders()
|
||||||
@@ -217,13 +231,21 @@ def main():
|
|||||||
# 通知提交者
|
# 通知提交者
|
||||||
|
|
||||||
messages.append(
|
messages.append(
|
||||||
f"工单ID: {processed_order['uuid']}\n"
|
# f"工单ID: {processed_order['uuid']}\n"
|
||||||
f"提交者: {processed_order['submitter']}\n"
|
f"提交者: {processed_order['submitter']}\n"
|
||||||
|
f"标题: {processed_order['title']}\n"
|
||||||
f"电话: {processed_order['phone']}\n"
|
f"电话: {processed_order['phone']}\n"
|
||||||
f"企业: {processed_order['enterprise'] or '未找到'}\n"
|
f"企业: {processed_order['enterprise'] or '未找到'}\n"
|
||||||
f"邀约: 我是影刀的小伙伴, 想跟你沟通反馈的需求: {processed_order['content']}\n\n"
|
f"邀约: 我是影刀的小伙伴, 想跟你沟通反馈的需求: {processed_order['content']}\n\n"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
message_without_phone.append(
|
||||||
|
f"工单ID: {processed_order['uuid']}\n"
|
||||||
|
f"提交者: {processed_order['submitter']}\n"
|
||||||
|
f"标题: {processed_order['title']}\n"
|
||||||
|
f"企业: {processed_order['enterprise'] or '未找到'}\n"
|
||||||
|
)
|
||||||
|
|
||||||
transfer_work_order(
|
transfer_work_order(
|
||||||
processed_order["uuid"],
|
processed_order["uuid"],
|
||||||
CONFIG.get("newDutyUuid"),
|
CONFIG.get("newDutyUuid"),
|
||||||
@@ -234,6 +256,11 @@ def main():
|
|||||||
print("发送飞书通知")
|
print("发送飞书通知")
|
||||||
feishu_notify(text=messages)
|
feishu_notify(text=messages)
|
||||||
|
|
||||||
|
if message_without_phone.strip():
|
||||||
|
message_without_phone = "\n".join(message_without_phone)
|
||||||
|
print("发送飞书通知")
|
||||||
|
feishu_notify_to_xbot_content_group(text=message_without_phone)
|
||||||
|
|
||||||
except requests.RequestException as e:
|
except requests.RequestException as e:
|
||||||
print(f"请求发生错误: {e}")
|
print(f"请求发生错误: {e}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
Reference in new issue
Block a user