示例#1
0
def confirm_email(user_id, key):
    if not serv.check_lock_request(user_id, key):
        return woops(u"该验证邮箱url已经过期")
    session["user_id"] = ""
    ul = g.db.query(UserLogin).get(user_id)
    if not ul:
        return woops(u"用户不存在")
    ul.login_name = ul.profile.email
    ul.profile.val_email = True
    try:
        g.db.flush()
        g.db.commit()
    except Exception, e:
        log.error(e.message)
        return woops(u"未知异常")
示例#2
0
def confirm_email(user_id,key):
    if not serv.check_lock_request(user_id, key):
        return woops(u"该验证邮箱url已经过期")
    session["user_id"] = ""
    ul = g.db.query(UserLogin).get(user_id)
    if not ul:
        return woops(u"用户不存在")
    ul.login_name = ul.profile.email
    ul.profile.val_email = True
    try:
        g.db.flush()
        g.db.commit()
    except Exception, e:
        log.error(e.message)
        return woops(u"未知异常")
示例#3
0
def create_one_order():
    try:
        user = get_user_login(g.current_login_id)
        order = serv.create_oneitem(user, request.form["key"], int(request.form["pay_type"]),int(request.form["pay_count"]),int(request.form["count"]))
        return redirect(url_for("product.order_done",order_id=order.id))
    except Exception, e:
        g.db.rollback()
        log.error(print_debug(e))
        return woops(u"创建订单失败")
示例#4
0
def operate_order(order_id):
    action = int(request.args.get("status"))
    order = g.db.query(Order).filter(Order.serial_number == order_id).one()
    if action == 2:
        try:
            serv.finish_order(order)
            return "ok"
        except Exception, e:
            g.db.rollback()
            log.error(print_debug(e))
            return woops(u"完成订单失败")
示例#5
0
def operate_order(order_id):
    action = int(request.args.get("status"))
    order = g.db.query(Order).filter(Order.serial_number==order_id).one()
    if action==2:
        try:
            serv.finish_order(order)
            return "ok"
        except Exception, e:
            g.db.rollback()
            log.error(print_debug(e))
            return woops(u"完成订单失败")
示例#6
0
def create_one_order():
    try:
        user = get_user_login(g.current_login_id)
        order = serv.create_oneitem(user, request.form["key"],
                                    int(request.form["pay_type"]),
                                    int(request.form["pay_count"]),
                                    int(request.form["count"]))
        return redirect(url_for("product.order_done", order_id=order.id))
    except Exception, e:
        g.db.rollback()
        log.error(print_debug(e))
        return woops(u"创建订单失败")
示例#7
0
def create_order():
    try:
        user = get_user_login(g.current_login_id)
        cards = serv.Cards()
        cards.from_session()
        order_id = cards.create_order(user)
        cards.clear()
        return redirect(url_for("product.order_done", order_id=order_id))
    except Exception, e:
        g.db.rollback()
        log.error(print_debug(e))
        return woops(u"创建订单失败")
示例#8
0
def create_order():
    try:
        user = get_user_login(g.current_login_id)
        cards = serv.Cards()
        cards.from_session()
        order_id = cards.create_order(user)
        cards.clear()
        return redirect(url_for("product.order_done",order_id=order_id))
    except Exception, e:
        g.db.rollback()
        log.error(print_debug(e))
        return woops(u"创建订单失败")