|
@@ -54,7 +54,8 @@ class UnicomComboView(View):
|
|
response = ResponseObject('cn')
|
|
response = ResponseObject('cn')
|
|
return self.device_add(request_dict, response)
|
|
return self.device_add(request_dict, response)
|
|
elif operation == 'device-status':
|
|
elif operation == 'device-status':
|
|
- return self.update_device_status(request_dict, ResponseObject(lang='cn'))
|
|
|
|
|
|
+ response = ResponseObject('cn')
|
|
|
|
+ return self.update_device_status(request_dict, response)
|
|
else:
|
|
else:
|
|
token = TokenObject(request.META.get('HTTP_AUTHORIZATION'))
|
|
token = TokenObject(request.META.get('HTTP_AUTHORIZATION'))
|
|
lang = request_dict.get('lang', token.lang)
|
|
lang = request_dict.get('lang', token.lang)
|
|
@@ -129,17 +130,35 @@ class UnicomComboView(View):
|
|
@classmethod
|
|
@classmethod
|
|
def update_device_status(cls, request_dict, response):
|
|
def update_device_status(cls, request_dict, response):
|
|
"""
|
|
"""
|
|
- 修改设备状态
|
|
|
|
|
|
+ 测试完成恢复出厂设置,修改测试完成状态,删除体验流量包
|
|
@param request_dict:
|
|
@param request_dict:
|
|
- @param response:
|
|
|
|
|
|
+ @param request:
|
|
@return:
|
|
@return:
|
|
"""
|
|
"""
|
|
iccid = request_dict.get('iccid', None)
|
|
iccid = request_dict.get('iccid', None)
|
|
- if not iccid:
|
|
|
|
|
|
+ serial_no = request_dict.get('serialNo', None)
|
|
|
|
+ status = int(request_dict.get('status', None))
|
|
|
|
+
|
|
|
|
+ if not all(iccid, serial_no, status):
|
|
return response.json(444)
|
|
return response.json(444)
|
|
- if cls.user_activate_flow(iccid):
|
|
|
|
- return response.json(0)
|
|
|
|
- return response.json(177)
|
|
|
|
|
|
+
|
|
|
|
+ try:
|
|
|
|
+ if status == 0
|
|
|
|
+
|
|
|
|
+ # 测试完成状态
|
|
|
|
+ elif status == 1:
|
|
|
|
+ # 待添加代码,删除体验流量包
|
|
|
|
+
|
|
|
|
+ # 更改设备状态
|
|
|
|
+ UnicomDeviceInfo.objects.filter(iccid=iccid, serial_no=serial_no).update(status=status)
|
|
|
|
+
|
|
|
|
+ except Exception as e:
|
|
|
|
+ print(e)
|
|
|
|
+ return response.json(177, repr(e))
|
|
|
|
+
|
|
|
|
+ return response.json(0)
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
@classmethod
|
|
@classmethod
|
|
def user_activate_flow(cls, iccid):
|
|
def user_activate_flow(cls, iccid):
|
|
@@ -544,3 +563,34 @@ class UnicomComboView(View):
|
|
month_end = LocalDateTimeUtil.get_cur_month_end()
|
|
month_end = LocalDateTimeUtil.get_cur_month_end()
|
|
start_time, month_end_time = LocalDateTimeUtil.get_start_and_end_time(month_end, '%Y-%m-%d')
|
|
start_time, month_end_time = LocalDateTimeUtil.get_start_and_end_time(month_end, '%Y-%m-%d')
|
|
return zero_today, month_end_time
|
|
return zero_today, month_end_time
|
|
|
|
+
|
|
|
|
+ @staticmetho
|
|
|
|
+ def modify_status(cls, request_dict, request):
|
|
|
|
+ """
|
|
|
|
+ 测试完成恢复出厂设置,修改测试完成状态,删除体验流量包
|
|
|
|
+ @param request_dict:
|
|
|
|
+ @param request:
|
|
|
|
+ @return:
|
|
|
|
+ """
|
|
|
|
+ iccid = request_dict.get('iccid', None)
|
|
|
|
+ serial_no = request_dict.get('serialNo', None)
|
|
|
|
+ status = int(request_dict.get('status', None))
|
|
|
|
+
|
|
|
|
+ if not all(iccid, serial_no, status):
|
|
|
|
+ return response.json(444)
|
|
|
|
+
|
|
|
|
+ try:
|
|
|
|
+ if status == 0
|
|
|
|
+
|
|
|
|
+ # 测试完成状态
|
|
|
|
+ elif status == 1:
|
|
|
|
+ #待添加代码,删除体验流量包
|
|
|
|
+
|
|
|
|
+ # 更改设备状态
|
|
|
|
+ UnicomDeviceInfo.objects.filter(iccid=iccid, serial_no=serial_no).update(status=status)
|
|
|
|
+
|
|
|
|
+ except Exception as e:
|
|
|
|
+ print(e)
|
|
|
|
+ return response.json(177, repr(e))
|
|
|
|
+
|
|
|
|
+ return response.json(0)
|