|
@@ -129,7 +129,7 @@ class SerialNumberView(View):
|
|
|
|
|
|
def do_attach_uid(self, request_dict, response, request):
|
|
def do_attach_uid(self, request_dict, response, request):
|
|
serial_number = request_dict.get('serial_number', None)
|
|
serial_number = request_dict.get('serial_number', None)
|
|
- country_id = request_dict.get('country_id', None)
|
|
|
|
|
|
+ region_id = request_dict.get('country_id', None)
|
|
company_id = request_dict.get('company_id', None)
|
|
company_id = request_dict.get('company_id', None)
|
|
token = request_dict.get('token', None)
|
|
token = request_dict.get('token', None)
|
|
time_stamp = request_dict.get('time_stamp', None)
|
|
time_stamp = request_dict.get('time_stamp', None)
|
|
@@ -150,9 +150,14 @@ class SerialNumberView(View):
|
|
p2p_type = serial_number[9:10]
|
|
p2p_type = serial_number[9:10]
|
|
|
|
|
|
try:
|
|
try:
|
|
- if not country_id:
|
|
|
|
|
|
+ p2p_type = int(p2p_type)
|
|
|
|
+ if not region_id:
|
|
# 根据配置信息确定region_id
|
|
# 根据配置信息确定region_id
|
|
- country_id = CommonService.confirm_region_id(request)
|
|
|
|
|
|
+ region_id = CommonService.confirm_region_id(request)
|
|
|
|
+
|
|
|
|
+ # 尚云: 地区为亚洲分配美洲的uid
|
|
|
|
+ if p2p_type == 1 and region_id == 2:
|
|
|
|
+ region_id = 3
|
|
|
|
|
|
# 判断序列号是否已和企业关联
|
|
# 判断序列号是否已和企业关联
|
|
company_serial_qs = CompanySerialModel.objects.filter(company__secret=company_id, serial_number=serial)
|
|
company_serial_qs = CompanySerialModel.objects.filter(company__secret=company_id, serial_number=serial)
|
|
@@ -177,7 +182,7 @@ class SerialNumberView(View):
|
|
while count < 3:
|
|
while count < 3:
|
|
# 查询是否存在未绑定序列号的uid
|
|
# 查询是否存在未绑定序列号的uid
|
|
uid_qs = UIDModel.objects.filter(vpg__company_id=company_serial.company.id,
|
|
uid_qs = UIDModel.objects.filter(vpg__company_id=company_serial.company.id,
|
|
- vpg__region_id=country_id, status=0, p2p_type=p2p_type). \
|
|
|
|
|
|
+ vpg__region_id=region_id, status=0, p2p_type=p2p_type). \
|
|
order_by('id')
|
|
order_by('id')
|
|
if not uid_qs.exists():
|
|
if not uid_qs.exists():
|
|
return response.json(375)
|
|
return response.json(375)
|