mirror of
https://github.com/xingsu1021/pthelper.git
synced 2026-12-01 00:14:33 +08:00
修改提示
This commit is contained in:
@@ -483,7 +483,7 @@ class ExcelStorage(FileSystemStorage):
|
||||
#调用父类方法
|
||||
return super(ExcelStorage, self)._save(name, content)
|
||||
|
||||
def send_email(mail_type,smtp_user,smtp_password,receiver_users = [],send_data = [] ,isTest=False):
|
||||
def send_email(mail_type,smtp_user,smtp_password,receiver_users = [],send_data = [] ,isTest=False, title='PT助手提示'):
|
||||
"""
|
||||
发送邮件
|
||||
"""
|
||||
@@ -512,7 +512,7 @@ def send_email(mail_type,smtp_user,smtp_password,receiver_users = [],send_data =
|
||||
''' % (time,"<br>".join(send_data))
|
||||
|
||||
|
||||
title = "PT助手"
|
||||
#title = "PT助手"
|
||||
#receiver = ["249545020@qq.com"]
|
||||
receiver = receiver_users
|
||||
msg = ''
|
||||
@@ -549,7 +549,7 @@ def send_email(mail_type,smtp_user,smtp_password,receiver_users = [],send_data =
|
||||
|
||||
return True,"发送成功"
|
||||
|
||||
def send_telegram(tg_chat_id,tg_token,send_data = [] ,isTest=False):
|
||||
def send_telegram(tg_chat_id,tg_token,send_data = [] ,isTest=False, title='PT助手提示'):
|
||||
|
||||
|
||||
bot = telegram.Bot(token = tg_token)
|
||||
@@ -582,7 +582,7 @@ def send_telegram(tg_chat_id,tg_token,send_data = [] ,isTest=False):
|
||||
|
||||
return True,"发送成功"
|
||||
|
||||
def send_iyuu(iyuu_key,send_data = [] ,isTest=False):
|
||||
def send_iyuu(iyuu_key,send_data = [] ,isTest=False, title='PT助手提示'):
|
||||
|
||||
user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36'
|
||||
|
||||
@@ -600,7 +600,7 @@ def send_iyuu(iyuu_key,send_data = [] ,isTest=False):
|
||||
sen_url = api + '?text='+ parse.quote('测试提示') + '&desp=' + now_time + send_txts
|
||||
else:
|
||||
send_txts = parse.quote('<br>'.join(send_data))
|
||||
sen_url = api + '?text='+ parse.quote('签到提示') + '&desp=' + now_time + send_txts
|
||||
sen_url = api + '?text='+ parse.quote(title) + '&desp=' + now_time + send_txts
|
||||
|
||||
try:
|
||||
response = requests.get(sen_url, headers=headers ,verify=False)
|
||||
@@ -616,7 +616,7 @@ def send_iyuu(iyuu_key,send_data = [] ,isTest=False):
|
||||
|
||||
return True,"发送成功"
|
||||
|
||||
def send_enwechat(corp_id = None, agent_id = None, agent_secret = None, user_ids = [], send_data = [] ,isTest=False):
|
||||
def send_enwechat(corp_id = None, agent_id = None, agent_secret = None, user_ids = [], send_data = [] ,isTest=False, title='PT助手提示'):
|
||||
"""发送企业微信消息"""
|
||||
|
||||
weclient = EnWechat(corp_id=corp_id, agent_id=agent_id, agent_secret=agent_secret)
|
||||
|
||||
@@ -184,7 +184,7 @@ def sign(crontab_id):
|
||||
send_data.append(data)
|
||||
|
||||
#发送消息
|
||||
send_msg(crontab_id, send_data)
|
||||
send_msg(crontab_id, send_data, title='签到提示')
|
||||
|
||||
return
|
||||
|
||||
@@ -241,7 +241,7 @@ def signonekey():
|
||||
send_data.append(data)
|
||||
|
||||
#发送消息
|
||||
send_msg(crontab_id, send_data)
|
||||
send_msg(crontab_id, send_data, title='签到提示')
|
||||
|
||||
return
|
||||
|
||||
@@ -301,11 +301,11 @@ def re_fail_sign(crontab_id):
|
||||
if len(send_data) != 0:
|
||||
|
||||
#发送消息
|
||||
send_msg(crontab_id, send_data)
|
||||
send_msg(crontab_id, send_data, title='补签提示')
|
||||
|
||||
return
|
||||
|
||||
def send_msg(crontab_id = None, send_data = []):
|
||||
def send_msg(crontab_id = None, send_data = [], title='PT助手提示'):
|
||||
"""
|
||||
发送消息
|
||||
"""
|
||||
@@ -317,13 +317,13 @@ def send_msg(crontab_id = None, send_data = []):
|
||||
|
||||
iyuu_ormdata = NotifyConfig.objects.get(name='iyuu')
|
||||
|
||||
flag,msg = send_iyuu(iyuu_ormdata.iyuu_key, send_data)
|
||||
flag,msg = send_iyuu(iyuu_ormdata.iyuu_key, send_data, title = title)
|
||||
logger.info("-------------iyuu-------------------")
|
||||
logger.info(msg)
|
||||
|
||||
if 'telegram' in notify_ormdata.notifys:
|
||||
tg_ormdata = NotifyConfig.objects.get(name='telegram')
|
||||
flag,msg = send_telegram(tg_ormdata.tg_chat_id,tg_ormdata.tg_token,send_data)
|
||||
flag,msg = send_telegram(tg_ormdata.tg_chat_id,tg_ormdata.tg_token,send_data, title = title)
|
||||
logger.info("-------------telegram-------------------")
|
||||
logger.info(msg)
|
||||
|
||||
@@ -331,7 +331,7 @@ def send_msg(crontab_id = None, send_data = []):
|
||||
email_ormdata = NotifyConfig.objects.get(name='email')
|
||||
|
||||
receiver_users = [x for x in email_ormdata.receive_user.split(',')]
|
||||
flag,msg = send_email(email_ormdata.mail_type,email_ormdata.smtp_user,email_ormdata.smtp_password,receiver_users,send_data)
|
||||
flag,msg = send_email(email_ormdata.mail_type,email_ormdata.smtp_user,email_ormdata.smtp_password,receiver_users,send_data, title = title)
|
||||
logger.info("-------------email-------------------")
|
||||
logger.info(msg)
|
||||
|
||||
@@ -343,7 +343,8 @@ def send_msg(crontab_id = None, send_data = []):
|
||||
agent_id=enwechat_ormdata.enwechat_agent_id,
|
||||
agent_secret=enwechat_ormdata.enwechat_agent_secret,
|
||||
user_ids = receiver_users,
|
||||
send_data = send_data
|
||||
send_data = send_data,
|
||||
title = title
|
||||
)
|
||||
|
||||
logger.info("-------------enwechat-------------------")
|
||||
@@ -482,7 +483,7 @@ def rss(crontab_id):
|
||||
#将电影名加入发送
|
||||
send_data.append(seed_name)
|
||||
#发送通知
|
||||
send_msg(crontab_id,send_data)
|
||||
send_msg(crontab_id, send_data, title='RSS订阅提示')
|
||||
|
||||
return
|
||||
|
||||
|
||||
@@ -53,9 +53,11 @@ INSTALLED_APPS = [
|
||||
'myauth',
|
||||
'index',
|
||||
'dashboard',
|
||||
'sites',
|
||||
'sites', #站点信息
|
||||
'cron', #计划任务
|
||||
'notify', #消息通知
|
||||
'rss', #RSS订阅
|
||||
'download', #下载工具
|
||||
'initdata', #数据初始化
|
||||
]
|
||||
|
||||
@@ -177,7 +179,7 @@ DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||
#模板使用变量
|
||||
SITE_NAME = 'PT助手'
|
||||
SITE_URL = 'https://github.com/xingsu1021/pthelper'
|
||||
SITE_VERSION = 'Version 2.1.0'
|
||||
SITE_VERSION = 'Version 2.2.0'
|
||||
SITE_COPYRIGHT = 'copyright © 2022'
|
||||
SITE_NAME_COPYRIGHT = 'copyright © 2022 PT助手'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user