Files
37duAutomation/plugins/xq0034/config/__init__.py
T
puddy 612df5531c feat: 新增续签电子签插件及多插件钉钉通知功能
- 新增 xq0034 续签电子签插件,包含核心流程与钉钉通知能力
- 为 xq0035、xq0008、xq0009、xq0010、xq0011、xq0031_xq0032、xq0037、xq0038、xq0045_xq0046 插件添加钉钉群通知配置
- 优化续签电子签执行结果日志,减少重复名单输出
- 桌面端插件列表新增分页功能,优化长列表展示
2026-10-16 13:11:30 +08:00

43 lines
1.2 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
"""xq0034 插件配置与全局钩子。
会话/日志集中转发:data 层业务模块只依赖本包,不直接 import 底座
(插件自包含约束);入口 __init__.py 在 run() 开始时注入。
"""
_LOG = None
_SESSION_FACTORY = None
# ==================== 钉钉群通知(data/dingtalk_robot.py 使用) ====================
# prod=生产群 / dev=测试群(机器人 webhook 配置见 data/dingtalk_robot.py ENV_CONFIGS)
DINGTALK_ENV = "prod"
def set_log(fn):
"""注入日志函数(ctx.log),业务模块经 log() 输出。"""
global _LOG
_LOG = fn
def log(msg, level="INFO"):
if _LOG is not None:
try:
_LOG(str(msg), level)
except Exception:
pass
else:
print(msg)
def set_session_factory(fn):
"""注入会话工厂(lambda: ctx.get_session("hr"))。"""
global _SESSION_FACTORY
_SESSION_FACTORY = fn
def get_session():
"""获取底座注入的共享 HR 会话;未注入/不可用时抛错由业务层转「请重新登录」提示。"""
if _SESSION_FACTORY is None:
raise RuntimeError("HR 登录态未注入,请通过壳子运行插件并先登录 HR 平台")
return _SESSION_FACTORY()