123456789101112131415161718192021222324252627282930313233343536 |
- # -*- coding: utf-8 -*-
- # !/usr/bin/env python
- import datetime
- import os
- import sys
- PROJECT_ROOT = os.path.join(os.path.abspath(os.path.split(os.path.realpath(__file__))[0] + "/.."), '..')
- sys.path.insert(0, PROJECT_ROOT)
- from script.base import init_env
- os.environ["DJANGO_SETTINGS_MODULE"] = "configs.production"
- init_env(False)
- from apilib.monetary import RMB
- from apps.web.core.db import copy_document_classes
- from apps.web.user.models import RechargeRecord
- end = datetime.datetime(2089, 1, 1, 0, 0, 0)
- check_date = datetime.datetime(2022, 6, 1, 0, 0, 0)
- if __name__ == '__main__':
- ownerId = sys.argv[1]
- online = RechargeRecord.objects(ownerId = ownerId, via = 'redpack').sum('money')
- print online
- his_model_cls = copy_document_classes(RechargeRecord, '{}_his'.format(RechargeRecord.__name__),
- 'default_his')
- history = his_model_cls.objects(ownerId = ownerId, via = 'redpack').sum('money')
- print history
- print RMB(online) + RMB(history)
|