Giter VIP home page Giter VIP logo

Comments (4)

SUTNB avatar SUTNB commented on May 16, 2024 3

@twocucao
个人拙见:
1.购物车校验是必须做的,除了购物车数据本身可能变化(比如多端操作,你女朋友在你下单前从另一端加了一个chanel包包),还有活动等价格信息也可能会有变化,比如提单瞬间活动时间到了,变回原价,这些都需要检验出来,并做拦截,提示用户,如果直接生成订单,用户体验是不太好的。
2.至于原文中的购物车锁,如果做了校验,确实可以不用加锁了,有任何变动都会提示用户,并且简单加锁是解决不了购物车数据变化这个问题的,必须进行校验,但是原文中的锁可以起到作用是防止极端情况下,一个购物车生成多笔订单,如果不考虑这个问题的话,不加锁也是可以的。

from manuals.

chunpat avatar chunpat commented on May 16, 2024 1

催更,23333 @TIGERB

from manuals.

chunpat avatar chunpat commented on May 16, 2024

2.至于原文中的购物车锁,如果做了校验,确实可以不用加锁了,有任何变动都会提示用户,并且简单加锁是解决不了购物车数据变化这个问题的,必须进行校验,但是原文中的锁可以起到作用是防止极端情况下,一个购物车生成多笔订单,如果不考虑这个问题的话,不加锁也是可以的。

加锁是为了校验的唯一性,假设校验a b c三个产品,你校验了a,还有b、c没校验,此时a的商品改了价格。那不就白校验了吗?

from manuals.

TIGERB avatar TIGERB commented on May 16, 2024

可以避免多端设备同时操作 比如网页和APP

from manuals.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.