From 332ec4b33a96f5ad7e4fa31db6e4f040b5e025c6 Mon Sep 17 00:00:00 2001 From: pengshiyu <1940607002@qq.com> Date: Fri, 2 Feb 2024 10:21:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=B0=E6=9C=9F=E9=82=AE?= =?UTF-8?q?=E4=BB=B6=E5=8F=91=E9=80=81=E5=A4=B1=E8=B4=A5=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- domain_admin/service/notify_service.py | 5 +++-- domain_admin/utils/datetime_util.py | 2 +- tests/model/domain_info_model_test.py | 9 +++++++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/domain_admin/service/notify_service.py b/domain_admin/service/notify_service.py index 9c4833a768..b95ba453eb 100644 --- a/domain_admin/service/notify_service.py +++ b/domain_admin/service/notify_service.py @@ -150,12 +150,13 @@ def notify_all_event(): 触发所有通知事件 :return: int 成功数量 """ + # fix: TypeError: inner() takes 2 positional arguments but 3 were given rows = NotifyModel.select().where( NotifyModel.status == True, - NotifyModel.event_id.in_( + NotifyModel.event_id.in_([ EventEnum.SSL_CERT_EXPIRE, EventEnum.DOMAIN_EXPIRE - ) + ]) ) success = 0 diff --git a/domain_admin/utils/datetime_util.py b/domain_admin/utils/datetime_util.py index 67efd8a226..ad090a82e7 100644 --- a/domain_admin/utils/datetime_util.py +++ b/domain_admin/utils/datetime_util.py @@ -128,7 +128,7 @@ def microsecond_for_human(value): seconds, value = divmod(value, SECOND) lst.append(str(seconds) + 's') - if value >= 0: + if value > 0: lst.append(str(value) + 'ms') return ' '.join(lst) diff --git a/tests/model/domain_info_model_test.py b/tests/model/domain_info_model_test.py index 7f5c8d3678..a5e787de44 100644 --- a/tests/model/domain_info_model_test.py +++ b/tests/model/domain_info_model_test.py @@ -27,3 +27,12 @@ def test_order(self): ).order_by(SQL("`create_time` desc"))) # ('SELECT `t1`.`id`, `t1`.`create_time` FROM `tb_domain_info` AS `t1` ORDER BY `create_time` desc', []) + + def test_in(self): + rows = list(DomainInfoModel.select( + DomainInfoModel.id, DomainInfoModel.create_time + ).where( + DomainInfoModel.id.in_([1, 2, 3]) + )) + + # ('SELECT `t1`.`id`, `t1`.`create_time` FROM `tb_domain_info` AS `t1` WHERE (`t1`.`id` IN (%s, %s, %s))', [1, 2, 3])