Home  >  Q&A  >  body text

电商 - 如何用 mysql 定时任务 处理订单超时 库存释放的问题?

高洛峰高洛峰2742 days ago629

reply all(2)I'll reply

  • 巴扎黑

    巴扎黑2017-04-17 15:09:37

    2 sets of plans:
    Plan 1: Self-closing:
    is to add a closing operation in the two stages of browsing the product and the customer browsing the order. Roughly speaking, every time you browse a product, you will find all unpaid orders for the product, which were created less than 15 minutes ago. . Close and add inventory; browse your order page and close all your orders placed 15 minutes ago~~

    Option 2: Scheduled shutdown of the system:
    Every time an order is created, a command is pushed to the queue to be executed in 15 minutes, and the command is closed after the payment is completed.
    If this command is still alive after 15 minutes, then check the corresponding order. If payment has not been made, close it~

    This is the plan. Mysql itself cannot implement the timing function.
    But you need 2 sets of detailed sql statements for the plan. . Let’s ask again. It’s relatively simple and the needs are different, so I won’t bother to comment

    reply
    0
  • 黄舟

    黄舟2017-04-17 15:09:37

    First use Visio to draw a flow chart.

    reply
    0
  • Cancelreply