mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-03 08:25:04 +00:00
perf: 优化消息通知 (#7024)
* perf: 优化系统用户列表 * stash * perf: 优化消息通知 * perf: 修改钉钉 * perf: 修改优化消息通知 * perf: 修改requirements * perf: 优化datetime Co-authored-by: ibuler <ibuler@qq.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from common.utils.timezone import now
|
||||
from common.utils.timezone import local_now
|
||||
|
||||
|
||||
def contains_time_period(time_periods):
|
||||
@@ -8,8 +8,8 @@ def contains_time_period(time_periods):
|
||||
if not time_periods:
|
||||
return False
|
||||
|
||||
current_time = now().strftime('%H:%M')
|
||||
today_time_period = next(filter(lambda x: str(x['id']) == now().strftime("%w"), time_periods))
|
||||
current_time = local_now().strftime('%H:%M')
|
||||
today_time_period = next(filter(lambda x: str(x['id']) == local_now().strftime("%w"), time_periods))
|
||||
for time in today_time_period['value'].split('、'):
|
||||
start, end = time.split('~')
|
||||
end = "24:00" if end == "00:00" else end
|
||||
|
@@ -20,14 +20,14 @@ def as_current_tz(dt: datetime.datetime):
|
||||
return astimezone(dt, dj_timezone.get_current_timezone())
|
||||
|
||||
|
||||
def utcnow():
|
||||
def utc_now():
|
||||
return dj_timezone.now()
|
||||
|
||||
|
||||
def now():
|
||||
return as_current_tz(utcnow())
|
||||
def local_now():
|
||||
return as_current_tz(utc_now())
|
||||
|
||||
|
||||
_rest_dt_field = DateTimeField()
|
||||
dt_parser = _rest_dt_field.to_internal_value
|
||||
dt_formater = _rest_dt_field.to_representation
|
||||
dt_formatter = _rest_dt_field.to_representation
|
||||
|
Reference in New Issue
Block a user