From f5c097c2772462a932d5859dab81c63b90a61fbe Mon Sep 17 00:00:00 2001 From: nero Date: Mon, 13 Nov 2023 16:22:38 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=B7=BB=E5=8A=A0=E6=B3=A8?= =?UTF-8?q?=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/bk-user/bkuser/apps/tenant/tasks.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bk-user/bkuser/apps/tenant/tasks.py b/src/bk-user/bkuser/apps/tenant/tasks.py index 117c45587..c23d36e56 100644 --- a/src/bk-user/bkuser/apps/tenant/tasks.py +++ b/src/bk-user/bkuser/apps/tenant/tasks.py @@ -51,7 +51,8 @@ def notify_expiring_tenant_user(): tenant_id, remind_before_expire = item["tenant_id"], item["remind_before_expire"] # DateTimeField 使用__date__xx的orm查询,orm会将相应字段的进行转换时区. - # mysql 数据库需要加载系统的时区表 + # mysql 数据库需要加载系统的时区表, 可以通过下面的sql,来确认是否加载了 + # SELECT CONVERT_TZ("2023-11-18 06:38:32.000000", 'UTC', 'Asia/Shanghai') # https://docs.djangoproject.com/en/3.2/ref/models/querysets/#database-time-zone-definitions # https://dev.mysql.com/doc/refman/8.2/en/mysql-tzinfo-to-sql.html tenant_users = TenantUser.objects.filter(account_expired_at__date__gt=now.date(), tenant_id=tenant_id)