|  | @@ -115,9 +115,8 @@ class UnicomComboView(View):
 | 
	
		
			
				|  |  |                  # 待完善代码 根据uid与用户id验证系统设备
 | 
	
		
			
				|  |  |                  unicom_device_qs = UnicomDeviceInfo.objects.filter(iccid=iccid)
 | 
	
		
			
				|  |  |                  if unicom_device_qs.exists():
 | 
	
		
			
				|  |  | -                    return response.json(174)
 | 
	
		
			
				|  |  | -                unicom_device_serial_qs = UnicomDeviceInfo.objects.filter(serial_no=serial_no)
 | 
	
		
			
				|  |  | -                if unicom_device_serial_qs.exists():
 | 
	
		
			
				|  |  | +                    if unicom_device_qs.first().status == 1 and unicom_device_qs.first().serial_no == serial_no:
 | 
	
		
			
				|  |  | +                        cls.user_activate_flow(iccid)
 | 
	
		
			
				|  |  |                      return response.json(174)
 | 
	
		
			
				|  |  |                  unicom_obj = UnicomObjeect()
 | 
	
		
			
				|  |  |                  result = unicom_obj.verify_device(iccid=iccid)
 | 
	
	
		
			
				|  | @@ -128,9 +127,8 @@ class UnicomComboView(View):
 | 
	
		
			
				|  |  |                              return response.json(173)
 | 
	
		
			
				|  |  |                          params = {'iccid': iccid, 'serial_no': serial_no, 'updated_time': n_time,
 | 
	
		
			
				|  |  |                                    'created_time': n_time}
 | 
	
		
			
				|  |  | +                        cls.is_activate(iccid)
 | 
	
		
			
				|  |  |                          UnicomDeviceInfo.objects.create(**params)
 | 
	
		
			
				|  |  | -                        # 自动激活1G套餐
 | 
	
		
			
				|  |  | -                        cls.user_activate_flow(iccid)
 | 
	
		
			
				|  |  |                      return response.json(0)
 | 
	
		
			
				|  |  |                  else:
 | 
	
		
			
				|  |  |                      return response.json(173)
 | 
	
	
		
			
				|  | @@ -542,6 +540,25 @@ class UnicomComboView(View):
 | 
	
		
			
				|  |  |          start_time, month_end_time = LocalDateTimeUtil.get_start_and_end_time(month_end, '%Y-%m-%d')
 | 
	
		
			
				|  |  |          return zero_today, month_end_time
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @staticmethod
 | 
	
		
			
				|  |  | +    def is_activate(iccid):
 | 
	
		
			
				|  |  | +        """
 | 
	
		
			
				|  |  | +        根据iccid判断是否激活,未激活则修改为激活状态
 | 
	
		
			
				|  |  | +        @param iccid:
 | 
	
		
			
				|  |  | +        @return:
 | 
	
		
			
				|  |  | +        """
 | 
	
		
			
				|  |  | +        if iccid:
 | 
	
		
			
				|  |  | +            unicom_api = UnicomObjeect()
 | 
	
		
			
				|  |  | +            re_data = {'iccid': iccid}
 | 
	
		
			
				|  |  | +            result = unicom_api.query_device_status(**re_data)
 | 
	
		
			
				|  |  | +            res_dict = unicom_api.get_text_dict(result)
 | 
	
		
			
				|  |  | +            # 状态不等于1(激活)时进行激活 1:激活;2:停用
 | 
	
		
			
				|  |  | +            if res_dict['data']['status'] != 1:
 | 
	
		
			
				|  |  | +                re_data = {"iccid": iccid, "status": 1}
 | 
	
		
			
				|  |  | +                unicom_api.update_device_state(**re_data)
 | 
	
		
			
				|  |  | +                return True
 | 
	
		
			
				|  |  | +        return None
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      @classmethod
 | 
	
		
			
				|  |  |      def get_test_sign(cls, request_dict, response):
 | 
	
		
			
				|  |  |          """
 |