Direct discounts for product promotions (giving a discount rate, goods are discounted) fixed amount (directly giving a fixed amount for a product) (directly reducing the price for a single product) discount gift (how many items are purchased for a single item, and how many gifts are sent) buy a gift (buy M for a single item to send N) Buy a group (package, a combination of multiple items... product promotions
Direct discount (for a discount rate, goods are discounted)
Fixed Amount (a fixed amount for a product)
Price reduction (direct product price reduction)
Offer gifts (how many items are purchased for a single item and give a gift)
Buy and give (buy M for a single item to get N)
Group Buying (package, combining multiple items with one package price)
Snap-up (a single item is specified for a total of M items, each user has a separate limit of 1)
These promotions,How to design the best table structure. One person completed in one and a half months. Yes? Visual testing is not acceptable. XX manager!
Reply content: product promotions
Direct discount (for a discount rate, goods are discounted)
Fixed Amount (a fixed amount for a product)
Price reduction (direct product price reduction)
Offer gifts (how many items are purchased for a single item and give a gift)
Buy and give (buy M for a single item to get N)
Group Buying (package, combining multiple items with one package price)
Snap-up (a single item is specified for a total of M items, each user has a separate limit of 1)
These promotions,How to design the best table structure. One person completed in one and a half months. Yes? Visual testing is not acceptable. XX manager!
It depends on your access traffic. If the access traffic is small, do not consider the design. It should also be done.
However, if the concurrency is large,
I think so.
And products in the item table or item subtable
Direct discount (for a discount rate, goods are discounted)
Fixed Amount (a fixed amount for a product)
Price reduction (direct product price reduction)
These items and items have a product table.
Offer gifts (how many items are purchased for a single item and give a gift)
Buy and give (buy M for a single item to get N)
Order-related storage order table
Design independent modules related to multiple tables
Group Buying (package, combining multiple items with one package price) Group Buying Module
Snap-up (a single item is specified for a total of M items, each user has a separate limit of 1) snap-up module
Add attributes related to scheduled task maintenance time.
Let's take a look at the design patterns, such as encapsulating the price generation method. That is, different prices are returned for different activities. Simply put, you still need to understand the design mode.
The product table is associated with a promotion rule field, and the following ID is associated
There are many rules in the promotion rule table that can be directly added, deleted, modified, and queried, including all the rules you mentioned.
Id, discount type, direct discount, fixed amount .. Buy M and give N (this becomes two fields )..... These
Direct discount (giving a discount rate, goods are discounted) fixed amount (directly giving a fixed amount to a commodity) discounts (directly reducing the price of a single product) discounts to send gifts (how many items are purchased for a single commodity, buy a gift) buy a gift (buy a single product M send N) Buy a group (package, multiple items combined with a package price) Buy (a single item specified total buy M pieces, each user has a separate purchase limit of 1)
Another user purchases a detail table ()
UserId, promotion rule ID, order number ........
The first two are joint primary keys. In this way, adding different rules for different products will not affect the purchase restriction.
You can also add restrictions on orders.
Write a computing method class
Calculation based on the Rule ID (easy to modify in a unified manner). For example, you can further query the restrictions on User purchase details
To be honest, if you have such a clear requirement, simply do it. One month and a half ??? No overtime work is required for one week. This includes tests.
What I mentioned above can be used to cope with the same direct discount, but different products have different discounts. Just add a new rule above.
If you want to promote a specific category, you can perform logic processing on the computing side.