diff --git a/ck_hlx.py b/ck_hlx.py index 42403b1..03cb646 100644 --- a/ck_hlx.py +++ b/ck_hlx.py @@ -2,7 +2,9 @@ import requests import os from checksendNotify import send - +from getENV import getENv +from checksendNotify import send +import json r = requests.Session() @@ -96,15 +98,13 @@ def hlx(user, passwd): def start(): - scriptName = '葫芦侠签到' - print(scriptName) - if "hlx_username" in os.environ and "hlx_password" in os.environ: - print('已经在环境中找到用户名和密码,开始执行程序') - res = hlx(os.environ['hlx_username'], os.environ['hlx_password']) - result = f' {scriptName} \n {res}' - send("葫芦侠", result) - else: - print('未找到用户名和密码停止执行') + getENv() + with open("/ql/config/check.json", "r", encoding="utf-8") as f: + datas = json.loads(f.read()) + _check_item = datas.get("HLX", [])[0] + res = hlx(user=_check_item.get('user'),passwd=_check_item.get('password')) + print(res) + send('葫芦侠', res) if __name__ == '__main__': diff --git a/ck_wzyd.py b/ck_wzyd.py index 0a1ed27..5dd3963 100644 --- a/ck_wzyd.py +++ b/ck_wzyd.py @@ -1,11 +1,11 @@ # -*- coding: utf-8 -*- -# 20 10 * * * import json import os -import time from urllib import parse -from checksendNotify import send + import requests +from getENV import getENv +from checksendNotify import send class WZYDCheckIn: @@ -25,7 +25,7 @@ class WZYDCheckIn: return msg def main(self): - wzyd_data = self.check_item + wzyd_data = self.check_item.get("wzyd_data") data = {k: v[0] for k, v in parse.parse_qs(wzyd_data).items()} try: user_id = data.get("userId", "") @@ -38,10 +38,10 @@ class WZYDCheckIn: if __name__ == "__main__": - if 'wzyd' in os.environ: - print('王者营地签到开始') - text = WZYDCheckIn(check_item=os.environ.get('wzyd')).main() - localtime = time.asctime(time.localtime(time.time())) - result=f'当前时间{localtime}\n结果:{text}' - send('王者营地签到',result) - else:print('未找到变量请填入') \ No newline at end of file + getENv() + with open("/ql/config/check.json", "r", encoding="utf-8") as f: + datas = json.loads(f.read()) + _check_item = datas.get("WZYD_DATA_LIST", [])[0] + res = WZYDCheckIn(check_item=_check_item).main() + print(res) + send('王者营地', res) diff --git a/config.json b/config.json index 604f95a..9035bac 100644 --- a/config.json +++ b/config.json @@ -274,5 +274,10 @@ { "womail_url": "多账号 url 填写,请参考上面,url 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)" } - ] + ], + "HLX": + { + "user": "", + "password": "" + } } \ No newline at end of file