mirror of
https://github.com/ngfchl/ptools
synced 2023-07-10 13:41:22 +08:00
优化广告语选择,以及预留广告获取接口
This commit is contained in:
@@ -124,14 +124,18 @@ class PtSpider:
|
||||
'mobile': False
|
||||
}, delay=delay)
|
||||
|
||||
def send_text(self, message: str, title: str = '', url: str = None):
|
||||
"""通知分流"""
|
||||
ad = [
|
||||
def select_ad(self):
|
||||
# res = requests.get('http://api.ptools.fun/select_ad')
|
||||
ads = [
|
||||
'PTools目前开发遇到困难,开发电脑性能不足,时常崩溃,欢迎赞助!<img src="http://img.ptools.fun/pay.png" width="100%" align="center">',
|
||||
'为补贴开发,努力卖点农副产品,自家生纯净榨核桃油,如有需要欢迎联系我!<img src="http://img.ptools.fun/wechat.png" width="100%" align="center">',
|
||||
'广告位招租哟,欢迎投放广告!<img src="http://img.ptools.fun/wechat.png" width="100%" align="center">',
|
||||
]
|
||||
message = f'{ad[random.randint(0, len(ad)-1)]}\n{"*" * 30}\n{message}'
|
||||
return random.choice(ads)
|
||||
|
||||
def send_text(self, message: str, title: str = '', url: str = None):
|
||||
"""通知分流"""
|
||||
message = f'{self.select_ad()}\n{"*" * 30}\n{message}'
|
||||
notifies = Notify.objects.filter(enable=True).all()
|
||||
res = '你还没有配置通知参数哦!'
|
||||
if len(notifies) <= 0:
|
||||
|
||||
Reference in New Issue
Block a user