Files
shanxia2.0/backend/app/tasks/wechat_notices.py
T

20 lines
655 B
Python

"""服务号审批 outbox 定时发送。"""
import logging
from app.core.config import settings
from app.core.database import SessionLocal
logger = logging.getLogger(__name__)
def deliver_wechat_notices():
if not settings.WECHAT_OA_ENABLED:
return
from app.services.wechat_approval_notices import deliver_pending
with SessionLocal() as db:
try:
deliver_pending(db)
except Exception:
db.rollback()
# 不输出异常原文,防止网络请求参数和绑定信息进入日志。
logger.error("服务号通知任务失败,请检查队列、配置及数据库状态")