from django.core.paginator import Paginator
from oss2.exceptions import status

from DCbackend.utils.common import success, fail, pageData
from backend.models import Admin, Document, Template, Product


class IndexService:
    #首页统计数量
    @staticmethod
    def statistics(request):
        admin_count = Admin.objects.exclude(status=4).count()
        document_coutn  = Document.objects.exclude(status=4).count()
        template_count = Template.objects.exclude(status=4).count()
        product_count = Product.objects.exclude(status=4).count()

        count = {
            'admin_count': admin_count,
            'document_coutn': document_coutn,
            'template_count': template_count,
            'product_count': product_count
        }
        return success(count)
