Files
37duAutomation/plugins/xq0037/config/__init__.py
T
puddy 843ff244a6 feat: 新增多插件 UI 支持及运行日志集中回传功能
本次提交包含多项功能更新:
1. 为多个插件(xq0002/0003/0004/0008/0010/0011/0020/0031_xq0032/0033/0035/0037/0045_xq0046/0047/0048)新增 UI 界面及配置支持
2. 新增运行日志集中回传功能,客户端自动上传运行日志到中心机集中存储
3. 新增插件分类字段支持,用于场景库分组管理
4. 优化 xq0034/0037/0048 等插件的功能及描述
5. 修复控制面响应兼容问题,支持新旧版本数据格式
6. 新增 xq0033 插件的状态存储模块,用于历史记录管理
7. 优化 CRM 登录窗口模式,支持全屏置顶
2026-10-26 15:42:50 +08:00

60 lines
1.7 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 -*-
"""xq0037 插件配置与全局钩子。
会话/日志/路径集中转发:data 层业务模块只依赖本包,不直接 import 底座
(插件自包含约束);入口 __init__.py 在 run() 开始时注入。
"""
DEFAULT_PUSH_DIR = r"D:\资料\人资\调动改签离职电子签"
# ==================== 钉钉群通知(data/dingtalk_robot.py 使用) ====================
# prod=生产群 / dev=测试群(机器人 webhook 配置见 data/dingtalk_robot.py ENV_CONFIGS)
DINGTALK_ENV = "prod"
_LOG = None
_SESSION_FACTORY = None
_PUSH_DIR = DEFAULT_PUSH_DIR
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()
def set_push_dir(path):
global _PUSH_DIR
_PUSH_DIR = str(path or "").strip().strip('"') or DEFAULT_PUSH_DIR
def get_push_dir():
return _PUSH_DIR
# 内嵌的 XQ0035 公共模块(xq35_step1/xq35_step2)按「输出目录」取路径,
# 与本插件推送目录共用同一配置字段,保证单字段配置即可驱动全部模块。
def get_output_dir():
return _PUSH_DIR