1
0
forked from erp-dev/erp

feat: wecom robot markdown message support

This commit is contained in:
2026-01-23 15:47:37 +08:00
parent 7fd44c64aa
commit 88688f9481
6 changed files with 297 additions and 1 deletions

View File

@@ -76,6 +76,11 @@ TENCENTCLOUD_TIIA_ENDPOINT = env('TENCENTCLOUD_TIIA_ENDPOINT', default='tiia.ten
TENCENTCLOUD_TIIA_PIC_NAME_PREFIX = env('TENCENTCLOUD_TIIA_PIC_NAME_PREFIX', default='plate_order')
TENCENTCLOUD_TIIA_QPS = env.int('TENCENTCLOUD_TIIA_QPS', default=10) # Tencent API 限速:每秒最多 10 次
# 企业微信机器人 Webhook目前按需求直接写入 settings不走 .env
# 使用https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=xxxx
WECOM_WEBHOOK_BASE_URL = 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send'
WECOM_WEBHOOK_KEY = 'cc88bdef-a13f-4d7e-bdb6-ee51b68b8205'
# CORS 配置
CORS_ALLOW_ALL_ORIGINS = DEBUG # 开发环境允许所有源,生产环境需要配置白名单
@@ -262,6 +267,19 @@ else:
}
# PrintingJob状态推进时的企业微信通知markdown
# - 默认:测试环境关闭(避免单测出网/刷屏),非测试环境开启
PRINTING_JOB_STATE_ADVANCED_WECOM_NOTIFY_ENABLED = (not TESTING)
PRINTING_JOB_STATE_ADVANCED_WECOM_MARKDOWN_TEMPLATE = (
"### PrintingJob 状态推进\n"
"\n"
"- **PrintingOrder.id**: `{printing_order_id}`\n"
"- **PrintingJob.id**: `{printing_job_id}`\n"
"- **State**: **{state_name}**\n"
"- **AdvancedAt**: `{advanced_at}`\n"
)
# Logging configuration
# 目标:
# - 生产环境出现 500 时,能在 stdout 日志里看到完整 traceback