def __init__(self, arr, user_id): self.creator_id = user_id self.name = require_value_from_dict(arr, "name") self.area = require_value_from_dict(arr, "area") self.address = require_value_from_dict(arr, "address") self.city = get_value_from_dict(arr, "city", "北京") self.lat = require_value_from_dict(arr, "lat") self.lng = require_value_from_dict(arr, "lng") self.phone = get_value_from_dict(arr, "phone", "") self.way = get_value_from_dict(arr, "way", "")
def __init__(self, user_arr, user_id): self.id = user_id self.mobile = require_value_from_dict(user_arr, "mobile") self.name = require_value_from_dict(user_arr, "name") self.sex = require_value_from_dict(user_arr, "sex") self.birthday = get_value_from_dict(user_arr, "birthday", None) self.city = get_value_from_dict(user_arr, "city", None) self.head_img_url = get_value_from_dict(user_arr, "head_img_url", None) self.password = '' self.clubs = [] self.clusters = [] self.devices = [] self.messages = [] self.wechat = {} self.create_time = int(time.time())
def get_ebay_items_list_from_ebay_response(ebay_response): if ebay_response: ebay_items_list = get_value_from_dict( ebay_response, ["ActiveList", "ItemArray", "Item"]) if not isinstance(ebay_items_list, list): ebay_items_list = [ebay_items_list] return ebay_items_list
def __init__(self, club_arr, user_id): # self.id = int(require_value_from_dict(club_arr, "id")) # 数字id,为关系型数据库 self.name = require_value_from_dict(club_arr, "name") self.logo_url = get_value_from_dict(club_arr, "logo_url", "") self.bg_img_url = get_value_from_dict(club_arr, "bg_img_url", "") self.tags = get_value_from_dict(club_arr, "tags", "足球") # self.city = get_value_from_dict(club_arr, "city", "") self.bind_qq = get_value_from_dict(club_arr, "bind_qq", "") # 俱乐部创建者 self.creator_id = user_id self.create_time = int(time.time()) self.status = 0 self.members_count = 1 self.members = [{"id": user_id, "role": 0, "join_time": int(time.time())}] # 俱乐部创始人 self.events_count = 0 self.follow_members_count = 0
def get_total_no_of_pages(ebay_handler): o = ebay_handler.get_all_items() no_of_pages = get_value_from_dict( o, ["ActiveList", "PaginationResult", "TotalNumberOfPages"]) return no_of_pages
def __init__(self, arr, user_id, is_update=False): if not is_update: self.id = int(require_value_from_dict(arr, "id")) # 数字id,为关系型数据库 self.club_id = int(require_value_from_dict(arr, "club_id")) self.status = 0 self.creator_id = user_id self.create_time = int(time.time()) self.members_count = 0 self.members_count_limit = int(get_value_from_dict(arr, "members_count_limit", 0)) self.members = [] # 开始为空,创建者不一定是参加者 self.type = "event" # 以下信息可修改 self.name = require_value_from_dict(arr, "name") # 默认开放 self.category = get_value_from_dict(arr, "category", u"足球") self.is_cycle = get_value_from_dict(arr, "is_cycle", "false") self.start_time = int(require_value_from_dict(arr, "start_time")) self.end_time = int(require_value_from_dict(arr, "end_time")) self.weekday = date.weekday(date.fromtimestamp(float(self.start_time))) if self.is_cycle == "true" and get_value_from_dict(arr, "days", False): self.days = [] days = get_value_from_dict(arr, "days", "").split(',') for day in days: self.days.append(int(day)) # 场馆信息 self.venue = { "title": get_value_from_dict(arr, "venue_title", ""), "address": get_value_from_dict(arr, "venue_address", ""), "phone": get_value_from_dict(arr, "venue_phone", ""), "city": get_value_from_dict(arr, "venue_city", ""), "coordinate": [ get_value_from_dict(arr, "venue_lng", 0), get_value_from_dict(arr, "venue_lat", 0) ] } self.fee = int(get_value_from_dict(arr, "fee", 0)) self.is_aa = get_value_from_dict(arr, "is_aa", "true") self.place_num = get_value_from_dict(arr, "place_num", "") self.mobile = get_value_from_dict(arr, "mobile", 0) self.members_count_limit = int(get_value_from_dict(arr, "members_count_limit", 0)) if arr.get("clusters"): self.clusters = arr.get("clusters").split(',') else: self.clusters = [] self.introduce = get_value_from_dict(arr, "introduce", "")