# Copyright (C) 2022 # # @Time : 2022/7/18 16:16 # @Author : ghl # @Email : Guanhailogn@asj6.wecom.work # @File : UnicomManageController.py # @Software: PyCharm import datetime import logging import time from django.db import transaction from django.db.models import Q from django.views import View from Model.models import UnicomComboOrderInfo, UnicomCombo, Order_Model, UnicomDeviceInfo from Object.ResponseObject import ResponseObject from Object.UnicomObject import UnicomObjeect class UnicomComboTaskView(View): def get(self, request, *args, **kwargs): request.encoding = 'utf-8' operation = kwargs.get('operation') return self.validation(request.GET, request, operation) def post(self, request, *args, **kwargs): request.encoding = 'utf-8' operation = kwargs.get('operation') return self.validation(request.POST, request, operation) def validation(self, request_dict, request, operation): response = ResponseObject() print(request) if operation == 'get/unicom/info': return self.get_unicom_info(request_dict, response) @staticmethod def get_unicom_info(request_dict, response): combo_id = request_dict.get('comboID',None) combo_qs = UnicomCombo.objects.filter(id=combo_id).filter() if not combo_qs.exists(): return response.json(444) try: combo_list = [] for combo_info in combo_qs: combo_qs.exists() combo_list.append(combo_info) res = {'combo_list':combo_list} return (0,res) except Exception as e: return response.json(500,e)