12345678910111213141516 |
- # -*- coding: utf-8 -*-
- #!/usr/bin/env python
- from apilib.utils_datetime import to_datetime
- from apps.web.user.models import ConsumeRecord
- from apps.web.agent.models import Agent
- from apps.web.dealer.models import Dealer
- agentIds =[ str(_.id) for _ in Agent.objects.filter(managerId = '59974b4b8732d6480fb699e5')]
- dealerIds = [str(_.id) for _ in Dealer.objects.filter(agentId__in = agentIds)]
- count = ConsumeRecord.objects.filter(dateTimeAdded__gte = to_datetime('2019-06-04 00:00:00'),
- dateTimeAdded__lte = to_datetime('2019-06-05 00:00:00'),
- isNormal = True,
- ownerId__in = dealerIds).count()
- print count
- print 'finished'
|