[Lilishop Mall] No3-7. Detailed design of modules, detailed design of order module-1 (shopping cart, cash register)

   Only the backend is involved, see the top column for all directories, codes, documents, and interface paths are: 

[Lilishop Mall] Record the study notes of the B2B2C mall system~


The whole article will combine the business introduction to focus on the design logic, including the interface class and business class. The specific combination of source code analysis is not complicated to read~

Caution: Some comments in the source code are wrong, some comments have completely opposite meanings, and some comments are not correct. I updated them during the reading process and added new comments where I did not know. So be careful when reading the source code!

Table of contents

A1. Shopping cart

B1.B end (belongs to explicit operation) 

A2. Cash register

B1. The simple process of selecting a third-party payment for an order

B2. Simple business logic call for order payment

B3. Terminal B (belongs to explicit operations)

B4. M terminal (belongs to explicit operation)


The shopping cart belongs to the operation of the buyer’s B side, and belongs to the front desk of the platform. I originally wanted to say that the front desk of the platform should be placed at the end, but because this is an indispensable part of the business, we should design it here according to the normal business process~

A1. Shopping cart

Let me talk about the business logic first. From browsing the product sku to generating the order, there are 1. Purchase immediately when browsing the product sku; 2. Add to the shopping cart and purchase in the shopping cart; the first method can also be understood as adding to the shopping cart and then Buy.

In the shop project, these two methods are added to the shopping cart interface, and are distinguished by type. If it is an immediate purchase, it will follow the logic of immediate purchase, and if it is a shopping cart purchase, it will follow the logic of shopping cart purchase;

With the above business logic, when a product SKU is added to the B-side shopping cart, the shopping cart list will be updated and stored in the redis cache (different types are cached separately). There will also be some other logic, such as calculating the total amount of the checked product sku, calculating coupons, and so on. It is equivalent to operating in advance, so you don’t need to calculate when you enter the shopping cart next time.

Therefore, the shopping cart information is stored in redis, and the business logic involved in it is complex (various processing, promotions, coupons, product inspection, etc.), which will be explained later in development~ 

B1.B end (belongs to explicit operation) 

Create a transaction interface Here, you will directly create transaction orders, orders, and sub-orders, and then wait for payment. The payment is at the cashier~

  • Add a product sku to the shopping cart, get the shopping cart details on the shopping cart page, and get the number of shopping carts
  • Update the quantity of a single product in the shopping cart, update whether a single product in the shopping cart is selected, update whether all products in the shopping cart are selected, update whether a merchant’s product in the shopping cart is selected or not
  • Empty cart, remove one or more products from cart
  • Get the shopping cart details on the checkout page, switch the delivery address, edit the invoice information, and select coupons
  • create transaction

 

A2. Cash register

On the one hand, the cash register involves the cash register configuration of the operation, and on the other hand, it involves the third-party payment method

(The payment method should be counted in the architecture, and I will study and record it in detail in the No2 architecture later. Here, I will first understand the payment method, and I will not describe it here in detail).

Before starting, you need to understand the payment business logic ~

[The payment here will use a third-party payment, and then it will be integrated with the balance payment, so you need to know the third-party payment tool to be used. Generally speaking, you will use Alipay, WeChat, etc. These processes are similar~]

B1. The simple process of selecting a third-party payment for an order

I won’t describe it in detail, the picture is quite clear, you can also see the process of the shop

B2. Simple business logic call for order payment

Here is a brief description first, and then detailed records later~ 

B3. Terminal B (belongs to explicit operations)

The buyer's B side makes the payment directly

  • Obtain payment details, obtain payment details of a certain payment method, payment callback, payment asynchronous notification, query payment results

B4. M terminal (belongs to explicit operation)

The operation M terminal can control the offline payment, and control it in the order, so I won’t talk about it here, I will explain it in the order~

Guess you like

Origin blog.csdn.net/vaevaevae233/article/details/128286617