|
@@ -1869,6 +1869,7 @@ class InitInfoView(View):
|
|
# country = CommonService.getAddr(ip)
|
|
# country = CommonService.getAddr(ip)
|
|
# redisObject.set_data(key=key, val=country, expire=3600)
|
|
# redisObject.set_data(key=key, val=country, expire=3600)
|
|
country = ''
|
|
country = ''
|
|
|
|
+ user_ex = None
|
|
if user_ex_qs.exists():
|
|
if user_ex_qs.exists():
|
|
update_dict = {
|
|
update_dict = {
|
|
'updTime': now_time,
|
|
'updTime': now_time,
|
|
@@ -1877,6 +1878,7 @@ class InitInfoView(View):
|
|
'country': country
|
|
'country': country
|
|
}
|
|
}
|
|
user_ex_qs.update(**update_dict)
|
|
user_ex_qs.update(**update_dict)
|
|
|
|
+ user_ex = user_ex_qs[0]
|
|
else:
|
|
else:
|
|
create_dict = {
|
|
create_dict = {
|
|
'addTime': now_time,
|
|
'addTime': now_time,
|
|
@@ -1886,9 +1888,9 @@ class InitInfoView(View):
|
|
'region': lang,
|
|
'region': lang,
|
|
'country': country
|
|
'country': country
|
|
}
|
|
}
|
|
- user_ex_qs = UserExModel.objects.create(**create_dict)
|
|
|
|
|
|
+ user_ex = UserExModel.objects.create(**create_dict)
|
|
|
|
|
|
- country_ip_qs = CountryIPModel.objects.filter(user_ex_id=user_ex_qs[0].id)
|
|
|
|
|
|
+ country_ip_qs = CountryIPModel.objects.filter(user_ex_id=user_ex.id)
|
|
if not country_ip_qs.exists():
|
|
if not country_ip_qs.exists():
|
|
countryIp = CountryIPModel(
|
|
countryIp = CountryIPModel(
|
|
ip=CommonService.get_ip_address(request),
|
|
ip=CommonService.get_ip_address(request),
|