예제 #1
0
파일: district.py 프로젝트: liuzelei/walis
def set_is_valid(pk_or_pks, is_valid):
    pks = always_list(pk_or_pks)
    for pk in pks:
        district = thirdparty_svc.ers.TDistrict()
        district.is_valid = is_valid
        district = any_to_dic(district)
        post_or_put(pk, district)
예제 #2
0
def query_regions(region_ids=None,
                  city_ids=None,
                  type_codes=None,
                  search=None,
                  show_all=None):
    """

    :param region_ids:
    :param city_ids:
    :param type_codes: {CBD:1, SCHOOL:2}
    :param search: search by region_name
    :param show_all: whether show regions whose id < 0
    :return:
    """
    query = thirdparty_svc.ers.TRegionQuery()
    query.search = search
    query.show_all = show_all
    query.city_ids = city_ids
    query.region_ids = region_ids
    query.type_codes = type_codes

    with thrift_client('ers') as ers:
        result = ers.query_region(query)

    result = any_to_raw(result)
    result = any_to_dic(result)
    return result
예제 #3
0
def set_is_valid(pk_or_pks, is_valid):
    pks = always_list(pk_or_pks)
    for pk in pks:
        district = thirdparty_svc.ers.TDistrict()
        district.is_valid = is_valid
        district = any_to_dic(district)
        post_or_put(pk, district)
예제 #4
0
def set_is_valid(pk_or_pks, is_valid):
    pks = always_list(pk_or_pks)
    for pk in pks:
        zone = thirdparty_svc.ers.TZone()
        zone.is_valid = is_valid
        zone = any_to_dic(zone)
        post_or_put(pk,zone)
예제 #5
0
파일: entry.py 프로젝트: liuzelei/walis
def set_is_valid(pk_or_pks, is_valid):
    pks = always_list(pk_or_pks)
    for pk in pks:
        entry = thirdparty_svc.ers.TEntry()
        entry.is_valid = is_valid
        entry = any_to_dic(entry)
        post_or_put(pk,entry)
예제 #6
0
def get(pk_or_pks):
    with thrift_client('ers') as ers:
        if isinstance(pk_or_pks,(tuple,list)):
            result = map(ers.get_zone,[pk for pk in pk_or_pks])
        else:
            result = ers.get_zone(pk_or_pks)
    result = any_to_dic(result)
    return result
예제 #7
0
def get(pk_or_pks):
    """
    神zues-.-这个接口开了get不开mget-.-
    """
    with thrift_client('ers') as ers:
        if isinstance(pk_or_pks, (tuple, list)):
            result = map(ers.get_district, [pk for pk in pk_or_pks])
        else:
            result = ers.get_district(pk_or_pks)
    result = any_to_dic(result)
    return result
예제 #8
0
파일: district.py 프로젝트: liuzelei/walis
def get(pk_or_pks):
    """
    神zues-.-这个接口开了get不开mget-.-
    """
    with thrift_client("ers") as ers:
        if isinstance(pk_or_pks, (tuple, list)):
            result = map(ers.get_district, [pk for pk in pk_or_pks])
        else:
            result = ers.get_district(pk_or_pks)
    result = any_to_dic(result)
    return result
예제 #9
0
파일: region.py 프로젝트: liuzelei/walis
def get_regions_by_city_id(city_id, type_code=None, show_all=None):
    with thrift_client('ers') as ers:
        region_query = thirdparty_svc.ers.TRegionQuery()
        region_query.city_ids = [city_id,]

        if type_code is not None:
            region_query.type_codes = [type_code]

        if show_all is not None:
            region_query.show_all = show_all

        result = ers.query_region(region_query)
        result = any_to_raw(result)
    result = any_to_dic(result)
    return result
예제 #10
0
def get_regions_by_city_id(city_id, type_code=None, show_all=None):
    with thrift_client('ers') as ers:
        region_query = thirdparty_svc.ers.TRegionQuery()
        region_query.city_ids = [
            city_id,
        ]

        if type_code is not None:
            region_query.type_codes = [type_code]

        if show_all is not None:
            region_query.show_all = show_all

        result = ers.query_region(region_query)
        result = any_to_raw(result)
    result = any_to_dic(result)
    return result
예제 #11
0
파일: __init__.py 프로젝트: liuzelei/walis
def query_regions(region_ids=None, city_ids=None, type_codes=None, search=None,
                  show_all=None):
    """

    :param region_ids:
    :param city_ids:
    :param type_codes: {CBD:1, SCHOOL:2}
    :param search: search by region_name
    :param show_all: whether show regions whose id < 0
    :return:
    """
    query = thirdparty_svc.ers.TRegionQuery()
    query.search = search
    query.show_all = show_all
    query.city_ids = city_ids
    query.region_ids = region_ids
    query.type_codes = type_codes

    with thrift_client('ers') as ers:
        result = ers.query_region(query)

    result = any_to_raw(result)
    result = any_to_dic(result)
    return result
예제 #12
0
파일: region.py 프로젝트: liuzelei/walis
def get(pk):
    with thrift_client('ers') as ers:
        result = ers.get_region(pk)
        result = any_to_dic(result)
    result = any_to_dic(result)
    return result
예제 #13
0
def get(pk):
    with thrift_client('ers') as ers:
        result = ers.get_region(pk)
        result = any_to_dic(result)
    result = any_to_dic(result)
    return result