diff --git a/untils/ad.py b/untils/ad.py new file mode 100644 index 0000000..0167609 --- /dev/null +++ b/untils/ad.py @@ -0,0 +1,21 @@ +# coding=utf-8 +""" +广告监测 +""" +import pyzbar.pyzbar as pyzbar +from PIL import Image + +def QRcode_detection(image: str) -> bool: + ''' + 判断图片是否存在二维码 + :param image: images的实际路径 + :return: True or False, True 说明发送图片有二维码信息 + ''' + + # image = "test.jpg" + img = Image.open(image) + barcodes = pyzbar.decode(img) + for barcode in barcodes: + return True + # barcodeData = barcode.data.decode("utf-8") + return False diff --git a/untils/scheduler.py b/untils/scheduler.py index 93bc19f..a959691 100644 --- a/untils/scheduler.py +++ b/untils/scheduler.py @@ -3,13 +3,14 @@ from apscheduler.schedulers.background import BackgroundScheduler from apscheduler.events import EVENT_JOB_EXECUTED, EVENT_JOB_ERROR from untils import config from coupon.tb import tb_share_text +from coupon.jd import jingfen_query def job_tasks(): scheduler = BackgroundScheduler(timezone="Asia/Shanghai") tb_job_tasks(scheduler) - # jd_job_task(scheduler) + jd_job_task(scheduler) # 加一个监控 scheduler.add_listener(scheduler_listener, EVENT_JOB_EXECUTED | EVENT_JOB_ERROR) @@ -47,14 +48,16 @@ def jd_job_task(scheduler): return app_key = conf.get('app_key') - appSecret = conf.get('appSecret') + app_secret = conf.get('app_secret') site_id = conf.get('') suo_im = conf.get('suo_im') chat_groups = conf.get('chat_groups') for chat_group in chat_groups: print(chat_group['group_name']) - scheduler.add_job(func=tb_share_text, + scheduler.add_job(func=jingfen_query, + kwargs={'group_name': chat_group['group_name'], 'material_id': chat_group['group_material_id'], + 'app_key': app_key, 'app_secret': app_secret, 'site_id': site_id, 'suo_im': suo_im}, trigger='cron', hour=f'''{chat_group['hour']}''', minute=f'''{chat_group['minute']}''', second=0, jitter=300, id=f'''{chat_group['group_name']}''') raise NotImplementedError