|
@@ -50,7 +50,13 @@ class CustomCustomerView(View):
|
|
|
custom_customer = CustomCustomerOrderInfo.objects.filter(order_number=order_number).first()
|
|
|
if not custom_customer:
|
|
|
return response.json(173)
|
|
|
- custom_customer_data = {'cId': custom_customer.id}
|
|
|
+ device_count = CustomCustomerDevice.objects.filter(c_id=custom_customer.id).count()
|
|
|
+ custom_customer_data = {
|
|
|
+ 'cId': custom_customer.id,
|
|
|
+ 'quantity': custom_customer.quantity,
|
|
|
+ 'existsDeviceCount': device_count,
|
|
|
+ 'unexistsDeviceCount': custom_customer.quantity - device_count
|
|
|
+ }
|
|
|
return response.json(0, custom_customer_data)
|
|
|
except Exception as e:
|
|
|
return response.json(500, 'error_line:{}, error_msg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
|
|
@@ -126,7 +132,11 @@ class CustomCustomerView(View):
|
|
|
created_time=int(time.time()),
|
|
|
updated_time=int(time.time())
|
|
|
)
|
|
|
- return response.json(0)
|
|
|
+ device_count = CustomCustomerDevice.objects.filter(c_id=c_id).count()
|
|
|
+ return response.json(0, {
|
|
|
+ 'existsDeviceCount': device_count,
|
|
|
+ 'unexistsDeviceCount': custom_customer.quantity - device_count
|
|
|
+ })
|
|
|
except Exception as e:
|
|
|
return response.json(500, 'error_line:{}, error_msg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
|
|
|
|