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 get_card_relative_userinfo(item_id): from gamecard.utils.strutils import get_user_pic,get_collect_name collect = get_mongodb_collect(get_collect_name(item_id)) records = collect.find({"status":'used','uid':{"$ne":None}},limit=16).sort("get_time",DESCENDING) user_info = [] for r in records: info = (r['username'],r['uid'],get_user_pic(r['uid'])) if info not in user_info: user_info.append(info) return user_info
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