|
@@ -107,18 +107,19 @@ def getTZ(request):
|
|
|
if len(uid) == 20:
|
|
|
print(uid)
|
|
|
info = CommonService.getIpIpInfo(ip=ip, lang=lang)
|
|
|
- tz = info['utc_offset']
|
|
|
- # 增加GMT,且补:00
|
|
|
- if len(tz) == 5:
|
|
|
- gmtz = tz.replace('UTC-', 'GMT-0').replace('UTC+', 'GMT+0')
|
|
|
- if ':' not in gmtz:
|
|
|
- gmtz = gmtz + ':00'
|
|
|
- info['gmt_offset'] = gmtz
|
|
|
- elif len(tz) == 8:
|
|
|
- gmtz = tz.replace('UTC-', 'GMT-0').replace('UTC+', 'GMT+0')
|
|
|
- info['gmt_offset'] = gmtz
|
|
|
- else:
|
|
|
- return
|
|
|
+ try:
|
|
|
+ tz = info['utc_offset']
|
|
|
+ # 增加GMT,且补:00
|
|
|
+ if len(tz) == 5:
|
|
|
+ gmtz = tz.replace('UTC-', 'GMT-0').replace('UTC+', 'GMT+0')
|
|
|
+ if ':' not in gmtz:
|
|
|
+ gmtz = gmtz + ':00'
|
|
|
+ info['gmt_offset'] = gmtz
|
|
|
+ elif len(tz) == 8:
|
|
|
+ gmtz = tz.replace('UTC-', 'GMT-0').replace('UTC+', 'GMT+0')
|
|
|
+ info['gmt_offset'] = gmtz
|
|
|
+ except Exception as e:
|
|
|
+ pass
|
|
|
return JsonResponse(status=200, data={'code': 0, 'msg': 'success', 'data': info})
|
|
|
else:
|
|
|
return JsonResponse(status=200, data={'code': 404, 'msg': '令牌错误'})
|