This commit is contained in:
MasonLiu committed 2024-12-25 18:40:20 +08:00
1 parent 163f6cf48d
commit 353f1db25d
19 files changed
+205 -118

No files matched your search

Binary file not shown.
+63
View File
@@ -0,0 +1,63 @@
import yaml
from loguru import logger
# 清除所有已有的日志记录器配置
logger.remove()
logger.add("./log/core.log",
format="{time:YYYY-MM-DD HH:mm:ss} - {level} - {name}:{function}:{line} - {message}",
rotation="100 MB",
compression="zip",
encoding="utf-8")
# shell终端打印日志
logger.add(lambda msg: print(msg),
format="{time:YYYY-MM-DD HH:mm:ss} - {level} - {name}:{function}:{line} - {message}")
def get_core_config():
# 加载参数
with open('./config/config.yaml', 'r', encoding="utf-8") as file:
config = yaml.safe_load(file)
logger.debug(f"Loaded config: {config}") # 输出加载的配置
choice = int(f"{config['circle']}")
e_hour = int(config.get('e_hour', '4')) # 默认循环时间为4小时
fs_activate = f"{config['fs_activate']}"
if fs_activate == "True":
fs_key = config.get('fs_key')
fs_secret = config.get('fs_secret')
if not fs_key or not fs_secret:
logger.error("飞书相关配置不能为空,请检查配置文件./config/config.yaml")
exit(5)
wx_activate = f"{config['wx_activate']}"
if wx_activate == "True":
wx_key = config.get('wx_key')
if not wx_key:
logger.error("企业微信相关配置不能为空,请检查配置文件./config/config.yaml")
exit(5)
ding_activate = f"{config['ding_activate']}"
if ding_activate == "True":
ding_key = config.get('ding_key')
if not ding_key:
logger.error("钉钉相关配置不能为空,请检查配置文件./config/config.yaml")
exit(5)
lx_activate = f"{config['lx_activate']}"
if lx_activate == "True":
lx_key = config.get('lx_key')
if not lx_key:
logger.error("蓝信相关配置不能为空,请检查配置文件./config/config.yaml")
exit(5)
url_web = f"{config['url']}"
return e_hour, choice, fs_activate, wx_activate, ding_activate, lx_activate, url_web
def get_debug_config():
with open('./config/config.yaml', 'r', encoding="utf-8") as file:
config = yaml.safe_load(file)
debug = f"{config['debug']}"
return debug
+32
View File
@@ -0,0 +1,32 @@
# 飞书相关配置信息
fs_activate: True
fs_key: aa04a02f-d7bf-4279-bd48-44c4f28c8f74 # 此处填写token,记得冒号后空一格,如aa04a02f-d7bf-4279-bd48-44c4f28c8f74
fs_secret: 4tq65T4jm1MO2IlxvHxBWe # 此处填写签名密钥,记得冒号后空一格,如4tq65T4jm1MO2IlxvHxBWe
# 企业微信相关配置信息
wx_activate: False
wx_key: # 此处填写token,记得冒号后空一格,如9a3dd6ff-75d6-4208-bc4b-77724a5805d6
# 钉钉相关配置信息
ding_activate: False
ding_key:
# 蓝信相关配置信息
lx_activate: False
lx_key:
# 邮件配置,邮件推送正在完善中
mail_host: smtp.masonliu.com #设置服务器
mail_user: test@masonliu.com #用户名
mail_pass: Test123456 #口令
sender: test@masonliu.com
receivers: ['2857911564@qq.com']
# 结算时间范围
e_hour: 4 # 程序运行时间间隔
circle: 0 # 是否启用循环,设置为0后将设置为特定时间点运行
# 网址配置
url: https://info.masonliu.com/ # 请设置为您自己反代的域名,或者改为 http://127.0.0.1:5000 或者对应IP域名
# 调试模式
debug: True