|
@@ -178,7 +178,30 @@ class UnicomComboView(View):
|
|
|
|
|
|
@classmethod
|
|
@classmethod
|
|
def update_device_status(cls, request_dict, response):
|
|
def update_device_status(cls, request_dict, response):
|
|
- pass
|
|
|
|
|
|
+ """
|
|
|
|
+ 修改绑定设备状态
|
|
|
|
+ @param request_dict:
|
|
|
|
+ @param response:
|
|
|
|
+ @return:
|
|
|
|
+ """
|
|
|
|
+ serial_no = request_dict.get('serialNo', None)
|
|
|
|
+ iccid = request_dict.get('iccid', None)
|
|
|
|
+ time_stamp = request_dict.get('timeStamp', None)
|
|
|
|
+ sign = request_dict.get('sign', None)
|
|
|
|
+ if not all([iccid, serial_no, sign, time_stamp]):
|
|
|
|
+ return response.json(444)
|
|
|
|
+ try:
|
|
|
|
+ if not CommonService.check_time_stamp_token(sign, time_stamp):
|
|
|
|
+ return response.json(13)
|
|
|
|
+ now_time = int(time.time())
|
|
|
|
+ with transaction.atomic():
|
|
|
|
+ device_info_qs = UnicomDeviceInfo.objects.filter(iccid=iccid, serial_no=serial_no)
|
|
|
|
+ if device_info_qs.exists():
|
|
|
|
+ device_info_qs.update(status=1, updated_time=now_time)
|
|
|
|
+ return response.json(0)
|
|
|
|
+ except Exception as e:
|
|
|
|
+ print(e)
|
|
|
|
+ return response.json(177, repr(e))
|
|
|
|
|
|
@classmethod
|
|
@classmethod
|
|
def get_device_info(cls, request_dict, response):
|
|
def get_device_info(cls, request_dict, response):
|