search

Home  >  Q&A  >  body text

php - 如果库存中有10件商品 却有100人购买 如何解决

请大神描述的具体点,谢谢

ringa_leeringa_lee2739 days ago404

reply all(4)I'll reply

  • 某草草

    某草草2017-05-16 13:04:46

    Can be achieved through database lock

    1. Open business

    2. select * for update

    3. update inventory

    4. Submit transaction

    reply
    0
  • 迷茫

    迷茫2017-05-16 13:04:46

    http://www.cnblogs.com/viaiu/...

    reply
    0
  • 習慣沉默

    習慣沉默2017-05-16 13:04:46

    Use a queue to execute, limited to 10, and push into the stack according to time. Set the expiration time, and if the order is not completed within the limited time, it will be removed from the stack. Re-retrieve the missing number of people from subsequent users. Those who complete the order are placed in another queue for later synchronization of the database. (This is just a general idea)

    reply
    0
  • 迷茫

    迷茫2017-05-16 13:04:46

    You yourself are too lazy to describe the problem clearly, but you want the respondent to describe the problem more specifically? All I can tell you is that the remaining 90 people can’t buy it

    reply
    0
  • Cancelreply