mirror of
https://github.com/CHERWING/CHERWIN_SCRIPTS.git
synced 2024-11-22 09:04:11 +08:00
修复定时错误,好像本月就结束了
This commit is contained in:
parent
acaae6eb85
commit
45efde9da1
29
TYQH_JK.py
29
TYQH_JK.py
@ -3,7 +3,7 @@
|
|||||||
# -------------------------------
|
# -------------------------------
|
||||||
# @Author : cherwin
|
# @Author : cherwin
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
# cron "59 9 * 2-6 * *" script-path=xxx.py,tag=匹配cron用
|
# cron "59 59 9 1 2-7 *" script-path=xxx.py,tag=匹配cron用
|
||||||
# const $ = new Env('统一茄皇监控')
|
# const $ = new Env('统一茄皇监控')
|
||||||
import hashlib
|
import hashlib
|
||||||
import json
|
import json
|
||||||
@ -23,15 +23,19 @@ requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
|||||||
IS_DEV = False
|
IS_DEV = False
|
||||||
if os.path.isfile('DEV_ENV.py'):
|
if os.path.isfile('DEV_ENV.py'):
|
||||||
import DEV_ENV
|
import DEV_ENV
|
||||||
|
|
||||||
IS_DEV = True
|
IS_DEV = True
|
||||||
|
|
||||||
if os.path.isfile('notify.py'):
|
if os.path.isfile('notify.py'):
|
||||||
from notify import send
|
from notify import send
|
||||||
|
|
||||||
print("加载通知服务成功!")
|
print("加载通知服务成功!")
|
||||||
else:
|
else:
|
||||||
print("加载通知服务失败!")
|
print("加载通知服务失败!")
|
||||||
send_msg = ''
|
send_msg = ''
|
||||||
one_msg = ''
|
one_msg = ''
|
||||||
|
|
||||||
|
|
||||||
def Log(cont=''):
|
def Log(cont=''):
|
||||||
global send_msg, one_msg
|
global send_msg, one_msg
|
||||||
print(cont)
|
print(cont)
|
||||||
@ -39,8 +43,10 @@ def Log(cont=''):
|
|||||||
one_msg += f'{cont}\n'
|
one_msg += f'{cont}\n'
|
||||||
send_msg += f'{cont}\n'
|
send_msg += f'{cont}\n'
|
||||||
|
|
||||||
|
|
||||||
USER_INFO = {}
|
USER_INFO = {}
|
||||||
|
|
||||||
|
|
||||||
class RUN:
|
class RUN:
|
||||||
def __init__(self, info, index):
|
def __init__(self, info, index):
|
||||||
global one_msg
|
global one_msg
|
||||||
@ -157,7 +163,8 @@ class RUN:
|
|||||||
"slidingImage": slidingImage,
|
"slidingImage": slidingImage,
|
||||||
"backImage": backImage
|
"backImage": backImage
|
||||||
}
|
}
|
||||||
response = requests.post(f"{dddddocr_api}/capcode", data=json.dumps(data),headers={'Content-Type': 'application/json'})
|
response = requests.post(f"{dddddocr_api}/capcode", data=json.dumps(data),
|
||||||
|
headers={'Content-Type': 'application/json'})
|
||||||
print(response.json())
|
print(response.json())
|
||||||
self.capcode = response.json().get('result', '')
|
self.capcode = response.json().get('result', '')
|
||||||
if self.capcode:
|
if self.capcode:
|
||||||
@ -266,14 +273,12 @@ class RUN:
|
|||||||
|
|
||||||
def userTask(self):
|
def userTask(self):
|
||||||
print('\n--------------- 开始日常任务 ---------------')
|
print('\n--------------- 开始日常任务 ---------------')
|
||||||
wait_time = random.randint(1000, 3000) / 1000.0 # 转换为秒
|
|
||||||
if not self.Login_res:
|
if not self.Login_res:
|
||||||
return False
|
return False
|
||||||
self.exchange_find()
|
self.exchange_find()
|
||||||
|
time.sleep(0.5)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def sendMsg(self, help=False):
|
def sendMsg(self, help=False):
|
||||||
if self.send_UID:
|
if self.send_UID:
|
||||||
push_res = CHERWIN_TOOLS.wxpusher(self.send_UID, one_msg, APP_NAME, help)
|
push_res = CHERWIN_TOOLS.wxpusher(self.send_UID, one_msg, APP_NAME, help)
|
||||||
@ -306,17 +311,23 @@ def down_file(filename, file_url):
|
|||||||
print(f'【{filename}】下载失败:{str(e)}')
|
print(f'【{filename}】下载失败:{str(e)}')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def import_Tools():
|
def import_Tools():
|
||||||
global CHERWIN_TOOLS, ENV, APP_INFO, TIPS, TIPS_HTML, AuthorCode
|
global CHERWIN_TOOLS, ENV, APP_INFO, TIPS, TIPS_HTML, AuthorCode
|
||||||
import CHERWIN_TOOLS
|
import CHERWIN_TOOLS
|
||||||
ENV, APP_INFO, TIPS, TIPS_HTML, AuthorCode = CHERWIN_TOOLS.main(APP_NAME, local_script_name, ENV_NAME,local_version)
|
ENV, APP_INFO, TIPS, TIPS_HTML, AuthorCode = CHERWIN_TOOLS.main(APP_NAME, local_script_name, ENV_NAME,
|
||||||
|
local_version)
|
||||||
|
|
||||||
|
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
|
|
||||||
def execute_task(infos, index):
|
def execute_task(infos, index):
|
||||||
run_result = RUN(infos, index).userTask()
|
run_result = RUN(infos, index).userTask()
|
||||||
if not run_result:
|
if not run_result:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
APP_NAME = '统一茄皇监控'
|
APP_NAME = '统一茄皇监控'
|
||||||
ENV_NAME = 'TYQH_JK'
|
ENV_NAME = 'TYQH_JK'
|
||||||
@ -331,12 +342,12 @@ export OCR_API= 'http://localhost:3721'
|
|||||||
✨ 由于青龙python版本问题无法直接使用dddocr需要自行搭建API,搭建方式:https://github.com/CHERWING/CHERWIN_OCR
|
✨ 由于青龙python版本问题无法直接使用dddocr需要自行搭建API,搭建方式:https://github.com/CHERWING/CHERWIN_OCR
|
||||||
✨ 如果你的环境可以安装dddocr库则可以替换代码内的【self.get_CapCode】为【self.get_CapCode_local】
|
✨ 如果你的环境可以安装dddocr库则可以替换代码内的【self.get_CapCode】为【self.get_CapCode_local】
|
||||||
export SCRIPT_UPDATE = 'False' 关闭脚本自动更新,默认开启
|
export SCRIPT_UPDATE = 'False' 关闭脚本自动更新,默认开启
|
||||||
✨ 推荐定时:*/10 9:59 1-31 2-6 * * 2-6月每月1日9点55到10点1分,每10秒执行一次
|
✨ 推荐定时:59 59 9 1 2-7 * (2-7月每月1日9点59)
|
||||||
✨ 第一个账号助力作者,其余互助
|
✨ 第一个账号助力作者,其余互助
|
||||||
✨✨✨ @Author CHERWIN✨✨✨
|
✨✨✨ @Author CHERWIN✨✨✨
|
||||||
''')
|
''')
|
||||||
local_script_name = os.path.basename(__file__)
|
local_script_name = os.path.basename(__file__)
|
||||||
local_version = '2024.05.15'
|
local_version = '2024.06.02'
|
||||||
if IS_DEV:
|
if IS_DEV:
|
||||||
import_Tools()
|
import_Tools()
|
||||||
else:
|
else:
|
||||||
@ -389,11 +400,9 @@ export SCRIPT_UPDATE = 'False' 关闭脚本自动更新,默认开启
|
|||||||
thread = threading.Thread(target=execute_task, args=(infos, index))
|
thread = threading.Thread(target=execute_task, args=(infos, index))
|
||||||
threads.append(thread)
|
threads.append(thread)
|
||||||
thread.start()
|
thread.start()
|
||||||
|
|
||||||
for thread in threads:
|
for thread in threads:
|
||||||
thread.join()
|
thread.join()
|
||||||
elif current_time.tm_hour == 10 and current_time.tm_min > 5:
|
elif current_time.tm_hour == 10 and current_time.tm_min > 5:
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user