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):