修复json配置读取失败的问题

dependabot/npm_and_yarn/fir_admin/url-parse-1.5.10
nineven 3 years ago
parent 9ba02e449d
commit c4fd9aa793
  1. 9
      fir_ser/api/utils/sysconfig.py

@ -33,7 +33,14 @@ class ConfigCacheBase(object):
def get_value_from_db(self, key): def get_value_from_db(self, key):
sys_obj = SystemConfig.objects.filter(key=key).first() sys_obj = SystemConfig.objects.filter(key=key).first()
return SystemConfigSerializer(sys_obj).data data = SystemConfigSerializer(sys_obj).data
value = data.get('value', '')
if value:
try:
data['value'] = json.loads(value)
except Exception as e:
logger.warning(f"db config - json loads failed {e}")
return data
def get_value(self, key, data=None): def get_value(self, key, data=None):
if data is None: if data is None:

Loading…
Cancel
Save