def do_queue():
    '''排队'''
    user_id = get_session_user()
    table_type_id = request.args.get('table_type_id')  # 得到前端用户选择桌型
    #user_id = int(request.args.get('user_id'))
    queue = do_queue_format(table_type_id, request, user_id)
    stores_id = queue.stores_id
    temp = get_queue_by_stores_id(stores_id)
    stores = get_stores_by_id(stores_id)
    coupons_name = DoCoupons.do_coupons(stores_id)
    user = get_user_by_id(user_id)

    id = []
    if user.coupons_id:
        id = user.coupons_id
        id = id.split(',')

    for a in coupons_name:
        sale = int(10 * a.cou_price / a.price)
        a.sale = sale
        message = '去领取'  #默认未领取
        if str(a.id) in id:
            message = '已领取'  #已领取
        a.message = message

    return render_template('reception/reserv_success.html',
                           queue=queue,
                           message=queue.message,
                           temp=temp,
                           stores=stores,
                           coupons_name=coupons_name)
def do_queue():
    '''排队'''
    user_id = get_session_user()
    table_type_id = request.args.get('table_type_id') # 得到前端用户选择桌型
    #user_id = int(request.args.get('user_id'))
    queue = do_queue_format(table_type_id, request, user_id)
    stores_id = queue.stores_id
    temp = get_queue_by_stores_id(stores_id)
    stores = get_stores_by_id(stores_id)
    coupons_name=DoCoupons.do_coupons(stores_id)
    user=get_user_by_id(user_id)

    id = []
    if user.coupons_id:
        id=user.coupons_id
        id=id.split(',')

    for a in coupons_name:
        sale=int(10*a.cou_price/a.price)
        a.sale=sale
        message = '去领取'    #默认未领取
        if str(a.id) in id:
            message = '已领取' #已领取
        a.message = message

    return render_template('reception/reserv_success.html',
                           queue=queue,
                           message=queue.message,
                           temp=temp,
                           stores=stores,
                           coupons_name=coupons_name)
def to_queue(stores_id):
    user_id = request.args.get('user_id')
    if user_id:
        set_session_user(user_id)
    else:
        user_id = get_session_user()
    mark_queue = request.args.get('mark_queue')
    set_session_mark_queue(mark_queue)  # 设置用户是否排队
    temp = get_queue_by_stores_id(stores_id)
    stores = get_stores_by_id(stores_id)
    another_stores = not_wait(stores.brand_id, stores_id)
    coupons_name = DoCoupons.do_coupons(stores_id)
    user = get_user_by_id(user_id)

    id = []
    if user.coupons_id:
        id = user.coupons_id
        id = id.split(',')

    for a in coupons_name:
        message = "去领取"
        if str(a.id) in id:
            message = "已领取"
        a.message = message
        sale = int((10 * a.cou_price / a.price))
        a.sale = sale
    stores_info = StoresInfo.query.filter(
        StoresInfo.stores_id == stores_id).first()
    picture_url = stores_info.rel_path + '/' + stores_info.picture_name
    stores.picture_url = picture_url
    count = len(coupons_name) + 2  #优惠券个数+推荐餐厅个数(1)

    not_brand = not_same_brand(stores.brand_id)

    return render_template('reception/reservation.html',
                           temp=temp,
                           stores=stores,
                           mark_queue=mark_queue,
                           another_stores=another_stores,
                           coupons_name=coupons_name,
                           count=count,
                           not_brand=not_brand)
def to_queue(stores_id):
    user_id = request.args.get('user_id')
    if user_id:
        set_session_user(user_id)
    else:
        user_id = get_session_user()
    mark_queue = request.args.get('mark_queue')
    set_session_mark_queue(mark_queue) # 设置用户是否排队
    temp = get_queue_by_stores_id(stores_id)
    stores = get_stores_by_id(stores_id)
    another_stores=not_wait(stores.brand_id,stores_id)
    coupons_name=DoCoupons.do_coupons(stores_id)
    user=get_user_by_id(user_id)

    id = []
    if user.coupons_id:
        id=user.coupons_id
        id=id.split(',')

    for a in coupons_name:
        message = "去领取"
        if str(a.id) in id:
            message = "已领取"
        a.message = message
        sale= int((10*a.cou_price / a.price))
        a.sale=sale
    stores_info = StoresInfo.query.filter(StoresInfo.stores_id == stores_id).first()
    picture_url = stores_info.rel_path+'/'+stores_info.picture_name
    stores.picture_url=picture_url
    count = len(coupons_name)+2        #优惠券个数+推荐餐厅个数(1)

    not_brand=not_same_brand(stores.brand_id)

    return render_template('reception/reservation.html',
                           temp=temp,
                           stores=stores,
                           mark_queue=mark_queue,
                           another_stores=another_stores,
                           coupons_name=coupons_name,
                           count=count,
                           not_brand=not_brand)