|
@@ -19,7 +19,7 @@ from Ansjer.config import OSS_STS_ACCESS_SECRET, OSS_STS_ACCESS_KEY
|
|
|
from Controller.DeviceConfirmRegion import Device_Region
|
|
|
from Model.models import Device_Info, UID_Bucket, UID_Preview, UidSetModel, UidChannelSetModel, \
|
|
|
iotdeviceInfoModel, UIDModel, Device_User, UserFamily, FamilyMember, FamilyMemberPermission, \
|
|
|
- FamilyRoomDevice, FamilyRoom, FamilyMemberJoin, GatewaySubDevice
|
|
|
+ FamilyRoomDevice, FamilyRoom, FamilyMemberJoin, GatewaySubDevice, CountryModel
|
|
|
from Object.ResponseObject import ResponseObject
|
|
|
from Object.TokenObject import TokenObject
|
|
|
from Service.CommonService import CommonService
|
|
@@ -197,6 +197,12 @@ class EquipmentFamilyView(View):
|
|
|
if not us_qs:
|
|
|
n_time = int(time.time())
|
|
|
ip = CommonService.get_ip_address(request)
|
|
|
+ ipInfo = CommonService.getIpIpInfo(ip, 'CN')
|
|
|
+ country_qs = CountryModel.objects.filter(country_code=ipInfo['country_code']).values('id')
|
|
|
+ if country_qs.exists():
|
|
|
+ country = country_qs[0]['id']
|
|
|
+ else:
|
|
|
+ country = '0'
|
|
|
region_id = Device_Region().get_device_region(ip)
|
|
|
region_alexa = 'CN' if region_id == 1 else 'ALL'
|
|
|
uid_set_create_dict = {
|
|
@@ -206,7 +212,8 @@ class EquipmentFamilyView(View):
|
|
|
'ip': CommonService.get_ip_address(request_dict),
|
|
|
'nickname': nick_name,
|
|
|
'region_alexa': region_alexa,
|
|
|
- 'device_type': device_type
|
|
|
+ 'device_type': device_type,
|
|
|
+ 'td_country': country
|
|
|
}
|
|
|
UidSetModel.objects.create(**uid_set_create_dict)
|
|
|
return response.json(0)
|