예제 #1
0
def get_all_sub_users():
    ''' 获取所有用仓用户 '''
    resp = get(settings.GET_ALL_SUB_USERS)
    if resp and resp['result'] is not None:
        return [transfer_user(_) for _ in resp['result']]
    else:
        return None
예제 #2
0
def get_all_user_warehouse():
    ''' 获取所有用仓用户,计算仓储费 '''
    resp = get(settings.GET_ALL_USER_WAREHOUSES)
    if resp and resp['result'] is not None:
        return [transfer_user_warehouse(_) for _ in resp['result']]
    else:
        return None
예제 #3
0
def get_user_info(user_id):
    url = settings.GET_USER_INFO_URL + str(user_id)
    resp = get(url)
    if resp and resp['result'] is not None:
        return transfer_user(resp['result'])
    elif not resp['result']:
        return {}
    return None
예제 #4
0
def list_own_warehouse(token):
    headers = {'token': token}
    resp = get(settings.LIST_AVAILABLIE_WAREHOUSE_URL, headers=headers)
    if resp and resp['result'] is not None:
        return [transfer_warehouse(_)
                for _ in resp['result']['available_warehouses']]
    else:
        return None
예제 #5
0
def get_warehouse_by_id(warehouse_id, token=None):
    headers = {}
    if token:
        headers = {'token': token}
    resp = get(settings.GET_WAREHOUSE_BY_ID_URL + warehouse_id, headers=headers)
    if resp and resp['result'] is not None:
        return transfer_warehouse(resp['result'])
    elif not resp['result']:
        raise CustomException(10010, '获取不到仓库信息')
    return None