From cb1e19d28f1f9587a4477348a16858cb35c811ad Mon Sep 17 00:00:00 2001 From: ibuler Date: Thu, 14 Feb 2019 15:47:55 +0800 Subject: [PATCH] =?UTF-8?q?[Update]=20=E4=BF=AE=E6=94=B9=E5=BD=95=E5=83=8F?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E4=BD=BF=E7=94=A8utc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/terminal/models.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/terminal/models.py b/apps/terminal/models.py index ac912e82a..32166bf9f 100644 --- a/apps/terminal/models.py +++ b/apps/terminal/models.py @@ -168,7 +168,7 @@ class Session(OrgModelMixin): upload_to = 'replay' ACTIVE_CACHE_KEY_PREFIX = 'SESSION_ACTIVE_{}' - def get_rel_replay_path(self, version=2): + def get_rel_replay_path(self, version=3): """ 获取session日志的文件路径 :param version: 原来后缀是 .gz,为了统一新版本改为 .replay.gz @@ -177,10 +177,13 @@ class Session(OrgModelMixin): suffix = '.replay.gz' if version == 1: suffix = '.gz' - date = self.date_start.strftime('%Y-%m-%d') + if version <= 2: + date = self.date_start.strftime('%Y-%m-%d') + else: + date = self.date_start.utcnow().strftime('%Y-%m-%d') return os.path.join(date, str(self.id) + suffix) - def get_local_path(self, version=2): + def get_local_path(self, version=3): rel_path = self.get_rel_replay_path(version=version) if version == 2: local_path = os.path.join(self.upload_to, rel_path)