Talking about the Design of Coupon System

Talking about the Design of Coupon System

March 09, 2018 10:51:54

I. Overview

Use your spare time to summarize the design and precautions of some business and technical solutions of the coupon system. Build a secure and highly available coupon system from the perspective of business and technology

Our Goals: Secure, Scalable, High Availability

2. Coupon business structure

Types of coupons:

  1. Full discount coupons: If the amount is 100-10, the full 2 ​​pieces will be reduced by 10 yuan
  2. Discount Coupon: 10% off if you spend over 100

Coupon related concepts:

  1. Rule definition: the part involved in calculation, scope of action: commodity, merchant, category, calculation method: whether to accumulate, whether to mutually exclusive, etc.
  2. Coupon definition, template: Issuance validity period, Use validity period, Use channel, Issuance channel, Coupon type: merchant coupon, platform coupon
  3. Coupons: Coupons issued to users

Coupon usage:

1. Coupon issuance: The business side adjusts the issuance interface to issue coupons, and the operation background guides designated users in batches. The issuance of coupons is often used for relatively high-value coupons.

  1. Coupon: Create a coupon template by the operation, configure it on the activity page or product details page, let users take the initiative to receive coupons, coupons are often used for coupons with relatively low value, and users can get them by themselves

3. Use coupons: After consumers receive the coupons, they can select the coupons from the coupon list on the checkout page and use them.

How to use the coupon:

  1. Configuring Coupon Definitions (Coupon Templates)
  2. Operation to issue coupons to users/users to actively collect coupons
  3. User voucher
  4. Verification, refund, etc.
  5. Coupon data statistics: By reading the records of online coupon issuance and use, the data analysis team creates a data report and provides it to the big data team for analysis. Through analysis, coupon issuance can also be done to thousands of people.

Coupon issuance restrictions:

  1. Specific business parties, such as activation center, novice coupons, order coupons, user birthday coupons
  2. Specific release time: such as 2017-09-01 to 2017-09-10
  3. Specific events, such as Double Eleven
  4. specific locations, such as Shanghai
  5. specific groups of people, such as men

Coupon usage restrictions:

  1. threshold
  2. condition
  3. Validity period
  4. business channel

There are three types of validity period:

  1. Template fixed validity period
  2. Template dynamic validity period
  3. Specify the validity period when issuing the voucher

How to issue coupons:

  1. Synchronize
  2. asynchronous

Quantity limit issued:

  1. Coupon stock limit
  2. Total number of users
  3. User daily limit

method to informe:

  1. SMS notification
  2. E-mail notification
  3. app message notification

Call the police:

  1. Coupon Inventory Alert
  2. Coupon usage time alert

Main business parties:

1. User terminal: coupons on business details page, coupons on store page, coupons on event page

2. Backstage system: Distribute coupons in batches

3. Lottery coupons

4. New user registration coupon

5. Order Rebates

  1. Evaluate coupons

Non-functional features:

  1. Idempotency: Issuing coupons and using coupons must ensure idempotency, not receiving coupons.
  2. High performance: Business scenarios such as coupon collection on the event page must have high performance, and the service can be extended horizontally
  3. Scalability: Rapid expansion of new coupon methods, and quick docking of coupons from external channels

3. Technical Architecture Design

1. Overall architecture: The coupon system belongs to the underlying system and needs to deal with high concurrency. The service must support horizontal expansion and distributed deployment

2. Table Design

Rule definition table: Since the rules corresponding to the recorded coupons are related, the calculation script, etc.

Coupon definition table (template table): Because of recording the relevant attributes of the coupon template, the distribution is related, and the use is related

Coupon instance table: send coupons to user accounts to record the relationship between coupons and users

As a basic platform, coupons are divided into the following basic interfaces according to their functional characteristics

  1. Coupon template query interface: business that needs to display coupon details
  2. User coupon interface: users can receive coupons on the event page or business details page
  3. Batch issuance interface (synchronization): business party RPC call
  4. Batch coupon issuance interface (asynchronous), suitable for seckill, coupon grabbing and other event scenarios
  5. Query user coupon interface: My Coupon
  6. Business details page interface: Provide a list of available coupons for product query for users to collect.
  7. Order page interface: query the list of available coupons based on user id and product list, merchant, and category
  8. coupon interface

4. Coupon calculation

The calculation of coupons adopts a rule engine and uses groovy script as the core calculation algorithm. For details, see Promotion calculation

Precautions:

  1. Do not use the self-incrementing id as a business id to prevent users from trying to forge ids to receive coupons on the business details page or event page
  2. Do not expose the user's coupon code to prevent users from using the coupon by trying to forge the code on the order page
Original text; https://blog.csdn.net/usst_lidawei/article/details/79494386



Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325617519&siteId=291194637