1234567891011121314151617181920212223242526 |
- from base import init_env
- init_env(True)
- from bson import ObjectId
- from apps.web.dealer.proxy import DealerIncomeProxy
- from apps.web.report.models import DealerDailyStat
- #
- DealerDailyStat.get_collection().aggregate(
- [
- {
- "$match": {
- "dealerId": ObjectId("5b5e96538732d617d228588b"),
- "date": {"$gt": "2020-01-01"}
- }
- },
- {
- "$group": {
- "_id": "dealerId",
- "t1": {"$sum": "$daily.consumption.coin"},
- "t2": {"$sum": "$daily.totalIncome"}}
- }
- ]
- )
|