本文整理汇总了Python中models.Order.get_my_active_orders方法的典型用法代码示例。如果您正苦于以下问题:Python Order.get_my_active_orders方法的具体用法?Python Order.get_my_active_orders怎么用?Python Order.get_my_active_orders使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Order
的用法示例。
在下文中一共展示了Order.get_my_active_orders方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GET
# 需要导入模块: from models import Order [as 别名]
# 或者: from models.Order import get_my_active_orders [as 别名]
def GET(self):
# 获取用户信息
try:
user = User.getBy(studentId=self.session.sid, studentName=self.session.name)
# 获取订单信息
if user == None:
return self.error("没有找到您的信息")
history_orders = Order.get_my_history_orders(user.id)
active_orders = Order.get_my_active_orders(user.id)
return render.order.orderinfo(page=self.page, user=user,
history_orders=history_orders, active_orders=active_orders)
except Exception as err:
return self.error(err)
示例2: get_my_order
# 需要导入模块: from models import Order [as 别名]
# 或者: from models.Order import get_my_active_orders [as 别名]
def get_my_order(message):
try:
user = User.getBy(weixinId=message.source)
if user == None:
return "您尚未注册, 请先注册."
my_orders = sorted(Order.get_my_active_orders(user.id), key=lambda x: str(x.birthday))
if len(my_orders) == 0:
return [[
template.page["info"].title,
"您当前没有未处理订单.",
site.image_url + "/thumbnail/" + template.page["info"].img,
site.root + template.page["info"].url + "?wid=" + str(message.source)
]]
msg = [model.print_my_orders(order) for order in my_orders]
return [[
template.page["info"].title,
"\n\n------\n\n".join(msg),
site.image_url + "/thumbnail/" + template.page["info"].img,
site.root + template.page["info"].url + "?wid=" + str(message.source)
]]
except Exception as err:
return 'Error occured'
return str(err)