# -*- 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 apps.web.dealer.models import Dealer from apilib.monetary import RMB # from apps.web.user.models import RechargeRecord, RefundMoneyRecord # # for item in RechargeRecord.objects(ownerId = '613706d4003048141c44563b').all(): # refund_order = RefundMoneyRecord.objects(rechargeObjId = item.id).first() # if refund_order: # print str(item.id), str(refund_order.id) skip = 0 limit = 2000 while True: query = Dealer.objects().only('id', 'deviceBalance').skip(skip).limit(limit) if len(query) <= 0: break for dealer in query: if not dealer.deviceBalance: continue for source_key, balance in dealer.deviceBalance.iteritems(): if balance.balance < RMB(0): print '{}'.format(str(dealer.id)) break skip = skip + limit from apps.web.dealer.proxy import DealerIncomeProxy # for proxy in DealerIncomeProxy.objects(partition__id = '613706d4003048141c44563b').all(): # if len(proxy.dealerIds) != 1 or str(proxy.dealerIds[0]) != '613706d4003048141c44563b': # print str(proxy.id) # from apps.web.common.proxy import ClientDealerIncomeModelProxy # # proxyModel = ClientDealerIncomeModelProxy(st = datetime.datetime(2017, 1, 1, 0, 0, 0), # et = datetime.datetime(2022, 3, 1, 0, 0, 0)) # for proxy in proxyModel.all(**{'partition__id': '613706d4003048141c44563b'}): # if len(proxy.dealerIds) != 1 or str(proxy.dealerIds[0]) != '613706d4003048141c44563b': # print str(proxy.id)