|
@@ -108,6 +108,7 @@ class SerialNumberView(View):
|
|
|
company_id = request_dict.get('company_id', None)
|
|
|
token = request_dict.get('token', None)
|
|
|
time_stamp = request_dict.get('time_stamp', None)
|
|
|
+ p2p_type = request_dict.get('p2p_type', None)
|
|
|
|
|
|
if token and time_stamp and quantity and company_id:
|
|
|
|
|
@@ -134,7 +135,8 @@ class SerialNumberView(View):
|
|
|
|
|
|
quantity = int(quantity)
|
|
|
|
|
|
- company_serial_qs = CompanySerialModel.objects.filter(company__secret=company_id, status=0)
|
|
|
+ company_serial_qs = CompanySerialModel.objects.filter(company__secret=company_id, status=0,
|
|
|
+ serial_number__p2p=p2p_type)
|
|
|
if not company_serial_qs.exists():
|
|
|
redisObject.rpush(key, value)
|
|
|
return response.json(373)
|
|
@@ -242,11 +244,13 @@ class SerialNumberView(View):
|
|
|
|
|
|
count = 0
|
|
|
while count < 3:
|
|
|
+ p2p = SerialNumberModel.objects.filter(serial_number=serial).values('p2p')
|
|
|
+ print('此序列号的p2p类型:', p2p[0]['p2p'])
|
|
|
uid_qs = UIDModel.objects.filter(vpg__company_id=company_serial.company.id, vpg__region_id=region['region_id'],
|
|
|
status=0)
|
|
|
+ # uid_qs:未进行绑定的uid列表
|
|
|
if uid_qs.exists():
|
|
|
uid = uid_qs[0]
|
|
|
- print(uid)
|
|
|
# uid.status = 2
|
|
|
# uid.update_time = int(time.time())
|
|
|
result = UIDModel.objects.filter(id=uid.id, status=0).update(**{
|
|
@@ -260,6 +264,7 @@ class SerialNumberView(View):
|
|
|
now_time = int(time.time())
|
|
|
uid_serial = UIDCompanySerialModel(uid_id=uid.id, company_serial_id=company_serial.id,
|
|
|
add_time=now_time, update_time=now_time)
|
|
|
+ exit()
|
|
|
uid_serial.save()
|
|
|
|
|
|
company_serial.status = 2
|