def zeus_query(service, func_name, query_type, **kwargs): """ 这个-.-额.等把第一个参数和第二个参数和在一起把... """ with thrift_client(service) as client: func = getattr(client, func_name) q = dic_to_tobj(kwargs, query_type) result = func(q) result = any_to_raw(result) return result
def post_or_put(pk=None, dic=None): tobj = dic_to_tobj(dic, thirdparty_svc.ers.TCity, True) if not tobj.pinyin: tobj.pinyin = ''.join(lazy_pinyin(tobj.name, errors='ignore')) if not tobj.abbr: tobj.abbr = ''.join( lazy_pinyin(tobj.name, style=FIRST_LETTER, errors='ignore')).upper() if not tobj.sort: tobj.sort = 2000 with thrift_client('ers') as ers: result = ers.save_city(pk, tobj) return result
def put(pk, dic=None): tobj = dic_to_tobj(dic, thirdparty_svc.ers.TRegion, True) with thrift_client('ers') as ers: result = ers.save_region(pk, tobj) return result
def post_or_put(pk=None, dic=None): tobj = dic_to_tobj(dic, thirdparty_svc.ers.TDistrict, True) with thrift_client('ers') as ers: result = ers.save_district(pk, tobj) return result
def post_or_put(pk=None, dic=None): tobj = dic_to_tobj(dic, thirdparty_svc.ers.TDistrict, True) with thrift_client("ers") as ers: result = ers.save_district(pk, tobj) return result
def post_or_put(pk=None,dic=None): tobj = dic_to_tobj(dic,thirdparty_svc.ers.TZone) with thrift_client('ers') as ers: result = ers.save_zone(pk,tobj) return result