jack 1 month ago
parent
commit
b1a347accf

+ 0 - 0
message-email/anyknew.py → to_email/anyknew.py


+ 0 - 0
message-email/apprcn.py → to_email/apprcn.py


+ 0 - 0
message-email/chaincatcher.py → to_email/chaincatcher.py


+ 0 - 0
message-email/chiphell.py → to_email/chiphell.py


+ 1 - 6
message-email/dlt.py → to_email/dlt.py

@@ -3,15 +3,10 @@ import os
 import sys
 
 import threading
-from datetime import datetime
-import time
-import httpx
 
 sys.path.append(os.path.join(os.path.abspath(__file__).split('AutoInfo')[0] + 'AutoInfo'))
 
-from utils.utils_mongo_handle import MongoHandle
-from utils.utils_logs_handle import LogsHandle
-from utils.utils_send_email import SendEmail
+from utils.utils import *
 
 
 class GetData(object):

+ 2 - 2
message-email/hello_github.py → to_email/hello_github.py

@@ -133,8 +133,8 @@ class HelloGithub(object):
             text += '获取时间: {}\n'.format(data['create_datetime'])
             text += '********************************************************\n\n'
 
-        send_email = SendEmail(subject=subject, title=title, text=text)
-        send_email.send()
+        SendEmail(subject=subject, title=title, text=text).send()
+        # GotifyNotifier(title=title, message=text, token_name='news').send_message()
 
         self.logs_handle.logs_write('HelloGithub', f'{title}-发送邮件完成', 'done', False)
 

+ 0 - 0
message-email/rss_data.py → to_email/rss_data.py


+ 0 - 0
message-gotify/airdrop_tasks.py → to_gotify/airdrop_tasks.py


+ 0 - 0
message-gotify/coin_detail.py → to_gotify/coin_detail.py


+ 0 - 0
message-gotify/coin_world.py → to_gotify/coin_world.py


+ 0 - 0
message-gotify/weather7d.py → to_gotify/weather7d.py


+ 3 - 6
message-gotify/web3_news.py → to_gotify/web3_news.py

@@ -6,18 +6,15 @@
 import os
 import sys
 import threading
-import time
 
-import httpx
+from utils.utils import LoadConfig
 
 sys.path.append(os.path.join(os.path.abspath(__file__).split('AutoInfo')[0] + 'AutoInfo'))
 from html import unescape
-from datetime import datetime
 import re
-from utils.utils_mongo_handle import MongoHandle
-from base.base_load_config import load_config
+from utils.utils import *
 
-config_json = load_config()
+config_json = LoadConfig().load_config()
 DEFAULT_RE_PUSH_TIMES = config_json['DEFAULT_RE_PUSH_TIMES']
 
 

+ 61 - 29
tools/tools_ql_create_tasks.py

@@ -1,7 +1,6 @@
 # -*- coding: utf-8 -*-
 import os
-
-import requests
+import httpx
 
 # 青龙面板的地址
 url = "https://qinglong.erhe.link"
@@ -9,7 +8,7 @@ url = "https://qinglong.erhe.link"
 
 # 登录青龙面板
 def login():
-    response = requests.post(f"{url}/api/user/login", json={"username": "toor", "password": "!QAZ2wsx+0913"})
+    response = httpx.post(f"{url}/api/user/login", json={"username": "toor", "password": "!QAZ2wsx+0913"})
     print(response)
     if response.status_code != 200:
         print(response.status_code)
@@ -20,7 +19,7 @@ def login():
 
 # 获取任务列表
 def get_tasks(token):
-    response = requests.get(f"{url}/api/crons", headers={"Authorization": f"Bearer {token}"})
+    response = httpx.get(f"{url}/api/crons", headers={"Authorization": f"Bearer {token}"})
     return response.json()['data']['data']
 
 
@@ -36,7 +35,7 @@ def create_task(task_template, token):
         "Authorization": f"Bearer {token}",
         "Content-Type": "application/json"
     }
-    response = requests.post(f"{url}/api/crons", headers=headers, json=payload)
+    response = httpx.post(f"{url}/api/crons", headers=headers, json=payload)
     return response.json()
 
 
@@ -57,7 +56,7 @@ def create_view_type(token):
             "Authorization": f"Bearer {token}",
             "Content-Type": "application/json"
         }
-        response = requests.post(f"{url}/api/crons", headers=headers, json=payload)
+        response = httpx.post(f"{url}/api/crons", headers=headers, json=payload)
 
 
 # 主逻辑
@@ -75,10 +74,11 @@ def main():
 
             project_path = '/ql/data/scripts/AutoInfo/'
             base_path = os.path.join(project_path, 'base')
-            message_path = os.path.join(project_path, 'message')
+            to_email_tasks_path = os.path.join(project_path, 'to_email')
+            to_gotify_tasks_path = os.path.join(project_path, 'to_gotify')
             manual_path = os.path.join(project_path, 'manual')
             tasks_template = [{
-                'base_tasks': [
+                'base': [
                     {
                         "name": "每天开始自动创建日志",
                         "command": "python3 {}/base_daily_logs_generate.py".format(base_path),
@@ -104,42 +104,74 @@ def main():
                         "labels": ["base"]
                     }
                 ],
-                'message_tasks': [
-                    {
-                        "name": "获取coin实时数据",
-                        "command": "python3 {}/message_coin_detail.py".format(message_path),
-                        "schedule": "0 * * * *",
-                        "labels": ["message"]
-                    },
+                'to-email': [
                     {
                         "name": "对比大乐透最新一期数据,匹配已购买号码,发送消息",
-                        "command": "python3 {}/message_dlt.py".format(message_path),
+                        "command": "python3 {}/dlt.py".format(to_email_tasks_path),
                         "schedule": "30 22 * * 1,3,6",
-                        "labels": ["message"]
+                        "labels": ["to-email"]
+                    },
+                    {
+                        "name": "链捕手快讯消息推送",
+                        "command": "python3 {}/chaincatcher.py".format(to_email_tasks_path),
+                        "schedule": "0 */2 * * *",
+                        "labels": ["to-email"]
+                    },
+                    {
+                        "name": "anyknew聚合新闻消息推送",
+                        "command": "python3 {}/anyknew.py".format(to_email_tasks_path),
+                        "schedule": "0 */3 * * *",
+                        "labels": ["to-email"]
+                    },
+                    {
+                        "name": "反斗限免消息推送",
+                        "command": "python3 {}/apprcn.py".format(to_email_tasks_path),
+                        "schedule": "0 */12 * * *",
+                        "labels": ["to-email"]
                     },
+                    {
+                        "name": "chiphell消息推送",
+                        "command": "python3 {}/chiphell.py".format(to_email_tasks_path),
+                        "schedule": "0 */12 * * *",
+                        "labels": ["to-email"]
+                    },
+                    {
+                        "name": "hello-github消息推送",
+                        "command": "python3 {}/hello_github.py".format(to_email_tasks_path),
+                        "schedule": "0 */12 * * *",
+                        "labels": ["to-email"]
+                    }
+                ],
+                'to-gotify': [
                     {
                         "name": "获取未来 7 天的天气预报",
-                        "command": "python3 {}/message_get_one_week_weather.py".format(message_path),
+                        "command": "python3 {}/weather7day.py".format(to_gotify_tasks_path),
                         "schedule": "0 0 6,22 * * *",
-                        "labels": ["message"]
+                        "labels": ["to-gotify"]
                     },
                     {
-                        "name": "从 freshrss-psql 数据库中读取数据并发送",
-                        "command": "python3 {}/message_rss_data_handel.py".format(message_path),
-                        "schedule": "30 6,9,12,18,22 * * *",
-                        "labels": ["message"]
+                        "name": "获取coin实时数据",
+                        "command": "python3 {}/coin_detail.py".format(to_gotify_tasks_path),
+                        "schedule": "0 * * * *",
+                        "labels": ["to-gotify"]
                     },
                     {
                         "name": "空投任务消息",
-                        "command": "python3 {}/message_airdrop_tasks.py".format(message_path),
+                        "command": "python3 {}/airdrop_tasks.py".format(to_gotify_tasks_path),
                         "schedule": "0 8,20 * * *",
-                        "labels": ["message"]
+                        "labels": ["to-gotify"]
                     },
                     {
-                        "name": "链捕手快讯消息推送",
-                        "command": "python3 {}/message_chaincatcher.py".format(message_path),
-                        "schedule": "0 */2 * * *",
-                        "labels": ["message"]
+                        "name": "币界网消息推送",
+                        "command": "python3 {}/coin_world.py".format(to_gotify_tasks_path),
+                        "schedule": "0 8,20 * * *",
+                        "labels": ["to-gotify"]
+                    },
+                    {
+                        "name": " web3新闻消息推送",
+                        "command": "python3 {}/web3_news.py".format(to_gotify_tasks_path),
+                        "schedule": "0 9,21 * * *",
+                        "labels": ["to-gotify"]
                     }
                 ],
                 'manual': [