From 5d0d18d917c694cce6566e35c57c4fbb5db8894b Mon Sep 17 00:00:00 2001 From: Ivan Office Date: Fri, 14 Feb 2025 16:57:53 +0800 Subject: [PATCH] opt import --- app_common/models/base.py | 3 +++ app_common/tools.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/app_common/models/base.py b/app_common/models/base.py index adde02be..3a3ff577 100644 --- a/app_common/models/base.py +++ b/app_common/models/base.py @@ -275,6 +275,9 @@ def get_ua_type(): # web 表示普通浏览器,后续更深入处理 utype = 'web' + if not ua: + return utype + # todo: 引入现成 py lib,处理企业微信 if 'MicroMessenger' in ua and 'webdebugger' not in ua \ and ('miniProgram' in ua or 'MiniProgram' in ua or 'MiniProgramEnv' in ua or 'wechatdevtools' in ua): diff --git a/app_common/tools.py b/app_common/tools.py index 227676e8..8fe46ac2 100644 --- a/app_common/tools.py +++ b/app_common/tools.py @@ -70,6 +70,9 @@ def get_ua_type(self): # web 表示普通浏览器,后续更深入处理 utype = 'web' + if not ua: + return utype + # todo: 引入现成 py lib,处理企业微信 if 'MicroMessenger' in ua and 'webdebugger' not in ua \ and ('miniProgram' in ua or 'MiniProgram' in ua or 'MiniProgramEnv' in ua or 'wechatdevtools' in ua):