当前位置: 首页>>代码示例>>Python>>正文


Python Order.find_by_id方法代码示例

本文整理汇总了Python中models.Order.find_by_id方法的典型用法代码示例。如果您正苦于以下问题:Python Order.find_by_id方法的具体用法?Python Order.find_by_id怎么用?Python Order.find_by_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Order的用法示例。


在下文中一共展示了Order.find_by_id方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: order_refund_by_admin

# 需要导入模块: from models import Order [as 别名]
# 或者: from models.Order import find_by_id [as 别名]
def order_refund_by_admin(order_id):
    order = Order.find_by_id(order_id)

    if not order:
        return render.not_found()

    reason = json.loads(request.data).get('reason', CANCEL_REASON_ADMIN)
    refund_money = json.loads(request.data).get('money')

    if refund_money is None:
        return render.error('missing argument: money')

    refund_money = int_money(refund_money)
    if refund_money == 0:
        return render.error('Refund money can not be 0')

    remained_money = order.cash_amount - Refund.order_refund_total(order.id)
    if refund_money > remained_money:
        return render.error('not enough money to refund')

    # refund
    if not refund_order(order, refund_money, reason, [], charge):
        return render.error('refund error')

    return render.ok('refund successfully')
开发者ID:shanggaohui,项目名称:20151124,代码行数:27,代码来源:order.py

示例2: order_confirm_by_admin

# 需要导入模块: from models import Order [as 别名]
# 或者: from models.Order import find_by_id [as 别名]
def order_confirm_by_admin(order_id):
    order = Order.find_by_id(order_id)
    if not order:
        return render.not_found()
    order.confirm()

    return render.ok('CONFIRMED')
开发者ID:shanggaohui,项目名称:20151124,代码行数:9,代码来源:order.py

示例3: order_start_deliver

# 需要导入模块: from models import Order [as 别名]
# 或者: from models.Order import find_by_id [as 别名]
def order_start_deliver(order_id):
    order = Order.find_by_id(order_id)
    if not order:
        return render.not_found()
    try:
        order.depart()
    except:
        return render.error("not able to depart")
    return render.ok('IN_DELIVERY')
开发者ID:shanggaohui,项目名称:20151124,代码行数:11,代码来源:order.py

示例4: order_cancel_by_admin

# 需要导入模块: from models import Order [as 别名]
# 或者: from models.Order import find_by_id [as 别名]
def order_cancel_by_admin(order_id):
    order = Order.find_by_id(order_id)

    if not order:
        return render.not_found()

    reason = json.loads(request.data).get('reason', CANCEL_REASON_ADMIN)
    cancel_order(order, charge, reason)

    return render.ok()
开发者ID:shanggaohui,项目名称:20151124,代码行数:12,代码来源:order.py

示例5: order_receive_express

# 需要导入模块: from models import Order [as 别名]
# 或者: from models.Order import find_by_id [as 别名]
def order_receive_express(order_id):
    order = Order.find_by_id(order_id)
    if not order:
        return render.not_found()
    # code = json.loads(request.data).get('code', None)

    # TODO: when need authorize order.code, change it.
    # if code == order.code:
    if True:
        order.delivered()
        return render.ok('DELIVERED')
    else:
        return render.error('wrong code')
开发者ID:shanggaohui,项目名称:20151124,代码行数:15,代码来源:order.py

示例6: order_show

# 需要导入模块: from models import Order [as 别名]
# 或者: from models.Order import find_by_id [as 别名]
def order_show(order_id):
    order = Order.find_by_id(order_id)
    return render.ok(order.details())
开发者ID:shanggaohui,项目名称:20151124,代码行数:5,代码来源:order.py


注:本文中的models.Order.find_by_id方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。