def card_out_yesterday(self): from gamecard.utils.dbutils import get_mongodb_collect from gamecard.utils.strutils import get_collect_name collect = get_mongodb_collect(get_collect_name(self.item.id)) start = datetime.now() - timedelta(days=1) end = datetime.now() card_out = collect.find({"status":'used',"get_time":{"$gt":start,"$lt":end}}).count() return card_out
def card_left(self): from gamecard.utils.dbutils import get_mongodb_collect from gamecard.utils.strutils import get_collect_name collect = get_mongodb_collect(get_collect_name(self.item.id)) left_now = collect.find({"status":'normal'}).count() return left_now