def zone_my_get(): r = gmhttp.get(url=g.host + g.get_info('api_info', 'zone_my')).json() if not r['data']['my_tags']: _, zone_id = question_id_get() post_data = {'tag_id': zone_id} gmhttp.post(url=g.host + g.get_info('api_info', 'zone_follow'), data=post_data).json() r = gmhttp.get(url=g.host + g.get_info('api_info', 'zone_my')).json() tag_name = r['data']['my_tags'][0]['name'] tag_id = r['data']['my_tags'][0]['tag_id'] return tag_id, tag_name
def answer_id_get(): post_data = { 'question_id': str(question_id_get()), 'content': '[{"content":"美分美分美分","type":0}]' } gmhttp.post(url=g.host + '/api/question/create_answer', data=post_data) r = gmhttp.get(url=g.host + '/api/user/my_answer').json() return r['data'][0]['answer_id']
def shopcart_info_get(): url = g.host + g.get_info('api_info', 'shopcart_list_v2') gmhttp.params.update({'count_only': 0}) r = gmhttp.get(url).json() if not r['data']['cart']: *_, service_item_id = service_id_get() post_data = {'number': '1', 'service_item_id': service_item_id} gmhttp.post(url=g.host + g.get_info('api_info', 'shopcart_add_v1'), data=post_data).json() r = gmhttp.get(url).json() gmhttp.reset() service_item_id = r['data']['cart'][0]['services'][0]['service_item_id'] myid = r['data']['cart'][0]['services'][0]['id'] # 获取购物车物品id service_id = r['data']['cart'][0]['services'][0]['service_id'] transparent_key = r['data']['interesting'][0]['gm_url'].split('=')[2] return myid, service_item_id, service_id, transparent_key
def live_topic_id_get(): uri = g.get_info('api_info', 'live_list') url = g.host + uri r = gmhttp.get(url).json() topic_list = list( map(lambda x: x.get('topic_id'), filter(lambda x: x.get('status') == 0, r.get('data'))))[0] return topic_list
def diary_id_get(): api_setup_1 = g.get_info('api_info', 'user_my_diary_v2') url = g.host + api_setup_1 r = gmhttp.get(url).json() diary_id = r['data']['diaries'][0]['id'] if r['data']['diaries'] else False # ============================================= if not diary_id: diary_id = create_diary() return diary_id
def sign_activity_id_get(): url = g.host + g.get_info('api_info', 'sign_detail') r = gmhttp.get(url).json() activity_id = r.get('data').get('id') status = r.get('data').get('is_remind') sign_status = r.get('data').get('sign_status') total_days = r.get('data').get('total_days') return activity_id, status, sign_status, total_days
def order_settlement_id_get(): # 订单和付款单 uri = g.get_info('api_info', 'orders_my_v2') url = g.host + uri r = gmhttp.get(url).json() order_id = settlement_id = None for item in r['data']['orders']: order_id = item['order']['order_id'] settlement_id = item['order']['settlement_id'] break return order_id, settlement_id
def service_id_get(): service_id = 5450353 # 获取医生id和医院id gmhttp.params.update({"service_id": service_id}) url = g.host + g.get_info('api_info', 'service_detail_v1') r = gmhttp.get(url).json() gmhttp.reset() doctor_id = r.get('data').get('service_hospital').get('doctor_id') hospital_id = r.get('data').get('service_hospital').get('hospital_id') sku_id = r.get('data').get('normal_sku_list')[0].get('service_item_id') return service_id, hospital_id, doctor_id, sku_id
def diary_id_others_get(): url = g.host + g.get_info('api_info', 'index_v6') r = gmhttp.get(url).json() diary_id = r.get('data').get('features')[0].get('id') return diary_id
def customer_srv_id_get(): r = gmhttp.get(url=g.host + '/api/customer_srv/is_direct_talk').json() entry_id = r['data']['entry_id'] user_key = r['data']['user_key'] return entry_id, user_key
def uid_get(): url = g.host + g.get_info('api_info', 'user_info') r = gmhttp.get(url).json() user_id = r.get('data').get('uid') return user_id
def reason_id_get(): url = g.host + g.get_info('api_info', 'report_reason') r = gmhttp.get(url).json() reason_id = r.get('data')[0].get('reason_id') return reason_id
def question_id_get(): r = gmhttp.get(url=g.host + g.get_info('api_info', 'question_index_v2')).json() question_id = r['data']['topics'][0]['question_id'] zone_id = r['data']['recommend_zones'][0]['zone_id'] return question_id, zone_id