在数据库中发布库存的最佳做法 [英] Best practice for releasing inventory in a database

查看:123
本文介绍了在数据库中发布库存的最佳做法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想知道,我正在建立一个售票应用程序,该应用程序跟踪车票的库存,当特定车票售完时,取消激活。当订单在中途被放弃时,最佳做法是将库存发回商店。



当前流程:




  • 用户将项目添加到订单 line_items 订单在成功付款时被标记为已完成

  • 项目有一个 quantity_available ,根据他们的 line_items

  • 我定期扫描订单,在> 20分钟内没有动作,删除这些订单 line_item s和更新 quantity_available



感觉就像我错过了这个。一方面,我失去了详细审查放弃订单的能力(我仍然有任何付款/拒绝等...但没有订单项)。如果用户在21分钟后尝试恢复旧订单,则必须重启。



相反,它会将库存关联20分钟,这可能会导致销售额几乎售罄。



<任何见解都将不胜感激。谢谢。

解决方案

如何引入不同的标签:保留或什么。当订单处理时,您可以标记保留的票据减少总库存数量。但是你现在知道有多少门票在四通八达。



在您的20分钟长订单中,如果手头物品数量非常低或为空,您可以向用户发送更新。 订单已停滞5分钟,售票正在快速进行,请尽快完成订单,以确保您的机票仍然可用。



您还可以告诉潜在买家有可能会有x个保留的门票可用,所以他们应该检查一下。也许他们可以注册接收电子邮件,如果保留的票返回系统。


I'm building a ticket-selling application which tracks an inventory of tickets, de-activating them when a particular ticket is sold out.

I'm wondering what the best practice is for releasing inventory back into the store when an order is abandoned mid-way through.

The current flow:

  • Users add items to an order as line_items and the order is marked as completed on successful payment
  • items has a quantity_available that's updated based on their line_items
  • I sweep periodically for orders with no action in > 20 minutes, delete those orders' line_items and update the quantity_available

It feels like I'm missing something with this. For one, I lose the ability to review abandoned orders in detail (I still have any payments/declines, etc... but no line items). And if a user tries to resume an old order after 21 minutes they'll have to start fresh.

Conversely, it ties up inventory for 20 minutes which could lose us sales when a show is nearly sold out.

Any insight would be much appreciated. Thanks.

解决方案

How about introducing a different tag: reserved or something. While an order is processing, you can mark the ticket reserved which decrements the total inventory count. But you now know exactly how many tickets are in limbo.

During your 20 minute long order, if the number of on-hand items is very low or empty, you can send updates to the user. "Order has been stagnant for 5 minutes. Ticket sales are going fast, please complete your order soon to ensure your ticket is still available."

You can also tell potential buyers that there are x number of reserved tickets that may become available, so they should check back or something. Maybe they could sign up to receive an email if a reserved ticket comes back into the system.

这篇关于在数据库中发布库存的最佳做法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆