E-commerce platform system based on microservice and tenant isolation

CN122989266APending Publication Date: 2026-10-27CHENGDU YIQU MENGHUA TECHNOLOGY CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202611161368.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-03
Publication Date
2026-10-27

AI Technical Summary

Technical Problem

[0003]为了解决现有微服务电商平台在多商户共用平台资源时存在的数据访问边界不清,以及订单、库存、优惠券、支付与结算状态衔接不一致的问题,本发明的目的是提供基于微服务与租户隔离的电商平台系统

Benefits of technology

1、本发明通过租户令牌将用户标识、商户标识与交易请求进行关联,并结合复合访问键和租户拦截器限定数据访问范围,使商户身份能够贯穿业务处理过程,明确不同商户之间的数据访问边界。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122989266A_ABST
    Figure CN122989266A_ABST
Patent Text Reader

Abstract

The application provides an e-commerce platform system based on micro-service and tenant isolation, receives a user transaction request, verifies login information and generates a tenant token containing a user identifier and a merchant identifier, forms a tenant transaction request; reads platform basic member data and merchant extended member data according to the user identifier and the merchant identifier respectively, and intercepts data requests that do not match the merchant identifier; completes merchant SKU verification, inventory pre-occupation, merchant order splitting, platform general coupon pre-occupation and amount calculation according to the tenant transaction data, generates a payment event after successful payment; completes platform general coupon cancellation and generates a merchant settlement adjustment order according to the payment event. The application makes the merchant identifier run through the whole process of authentication, data access, order processing and coupon account settlement, reduces cross-merchant data mixing, inventory overselling and repeated use of coupons, and improves the consistency of order, payment, cancellation, settlement and refund status.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of e-commerce platforms and computer data processing technology, specifically to an e-commerce platform system based on microservices and tenant isolation. Background Technology

[0002] As the number of merchants and transaction volume on e-commerce platforms increase, the platforms typically adopt a microservice architecture to handle membership, products, inventory, orders, coupons and settlement business separately. When multiple merchants share platform resources, business requests need to flow between multiple services, which puts forward higher requirements for data access boundaries and transaction status consistency. Chinese invention patent with publication number "CN107295077A" discloses a distributed cloud platform system based on microservice architecture. It realizes business authentication, service splitting and distributed data storage through interaction layer, interface layer, service layer and data layer to improve the platform's concurrent processing and scalability. However, when such general-purpose microservice platforms are applied to multi-merchant e-commerce transactions, the transfer of merchant identity information between different services can easily lead to unclear data access scope. At the same time, orders, inventory, coupons, and settlements are handled by different services, resulting in many asynchronous processing steps. This can easily cause inconsistencies in the connection between inventory status, coupon status, payment results, and settlement data, affecting the data security and business reliability of multi-merchant transactions. Therefore, this invention proposes an e-commerce platform system based on microservices and tenant isolation. Summary of the Invention

[0003] To address the issues of unclear data access boundaries and inconsistent connections between order, inventory, coupon, payment, and settlement statuses in existing microservice e-commerce platforms when multiple merchants share platform resources, the purpose of this invention is to provide an e-commerce platform system based on microservices and tenant isolation.

[0004] To achieve the above objectives, the present invention adopts the following technical solution: E-commerce platform systems based on microservices and tenant isolation include: M1: Tenant authentication module, receives user transaction requests, verifies login information, generates a tenant token containing user and merchant identifiers; associates product identifier, SKU identifier, and purchase quantity with the tenant token to generate a tenant transaction request; M2: Data isolation module, receives the tenant transaction request; reads the platform basic member data based on the user identifier, reads the merchant extended member data by forming a composite access key with the user identifier and the merchant identifier, intercepts data requests that do not match the merchant identifier, and generates tenant transaction data; M3: Order processing module, receives the tenant's transaction data; queries the merchant's SKU record based on the SKU identifier, splits sub-orders according to the merchant identifier, calculates the product amount, deduction amount, and settlement amount; generates a payment event after successful payment, and publishes the payment event to the message queue; M4: The coupon settlement module receives the payment event via the message queue, reads the merchant identifier, coupon identifier, and settlement amount from the payment event; redeems platform general coupons based on the merchant identifier and coupon identifier, and generates a redemption event; and generates a merchant settlement adjustment order in a pending settlement state based on the redemption event and the settlement amount.

[0005] Furthermore, the tenant authentication module extracts target product information and target merchant information from the user transaction request, queries the platform SPU record based on the target product information, and reads the product identifier in the platform SPU record; it queries the merchant SKU record based on the SKU identifier and reads the associated product identifier and the owner merchant identifier in the merchant SKU record. The associated product identifier and the affiliated merchant identifier are compared with the product identifier and the target merchant identifier in the target merchant information, respectively. After the comparison is successful, the merchant identifier is determined as the merchant identifier. A tenant binding code is generated based on the user identifier, the merchant identifier, the token issuance time, and the request random number. A token signature value is generated based on the tenant binding code, the token expiration time, and the token signature key. The tenant binding code, the token expiration time, and the token signature value are then written into the tenant token.

[0006] Furthermore, the data isolation module verifies the tenant binding code, the token signature value, and the token expiration time to form a tenant access context; The data isolation module includes a tenant interceptor. The tenant interceptor reads the merchant identifier from the tenant access context, injects the query, update, and delete statements of the merchant's extended member table, merchant SKU table, sub-order table, coupon redemption table, and merchant settlement table with filtering conditions corresponding to the merchant identifier, and verifies whether the merchant identifier to be written in the write statement is consistent with the merchant identifier; if they are inconsistent, the write statement is intercepted.

[0007] Furthermore, the order processing module verifies whether the associated product identifier and the affiliated merchant identifier in the merchant SKU record are consistent with the product identifier and the merchant identifier in the tenant transaction data, and reads the sales unit price and the listing status; When the listing status is "listed", a Redis distributed lock is requested using the SKU identifier. After the Redis distributed lock is successfully requested, the available inventory is read, the inventory corresponding to the purchase quantity is marked as pre-reserved inventory, and an order item set is generated. When the purchase quantity is greater than the available inventory, the Redis distributed lock is released.

[0008] Furthermore, the order processing module groups the set of order items according to the merchant identifier, and generates the sub-order and sub-order identifier; For each sub-order, the platform general coupons that are unused, have not expired, have the merchant identifier in their applicable scope, and meet the usage threshold are selected from the merchant's extended membership data to form a candidate coupon set; the coupon identifier is determined from the candidate coupon set, the platform general coupon corresponding to the coupon identifier is updated to a pre-reserved state and bound to the sub-order identifier.

[0009] Furthermore, the system also includes inventory services and financial services; The payment event is of type ORDER_PAID and includes the user identifier, the sub-order identifier, the merchant identifier, the coupon identifier, the product amount, the deduction amount, and the settlement amount. The inventory service consumes the payment event, deducts the actual inventory, clears the pre-reserved inventory, and releases the Redis distributed lock in a MySQL transaction; when the payment fails or the payment times out, the order processing module does not generate the payment event, releases the pre-reserved inventory and the Redis distributed lock, and restores the platform general coupon to the unused state; The coupon settlement module verifies whether the platform general coupon is in the pre-reserved state, whether the validity period of the platform general coupon has expired, and whether the scope of application of the platform general coupon includes the merchant identifier. It then recalculates and verifies the deduction amount based on the coupon template corresponding to the platform general coupon. When the verified deduction amount matches the deduction amount, the platform general coupon is updated to the used state, and a redemption event with event type COUPON_USED and containing the settlement amount is generated. The coupon settlement module publishes the redemption event to the message queue. The financial service receives the redemption event through the message queue, reads the settlement amount from the redemption event, and generates the merchant settlement adjustment form and platform activity fund deduction record in the pending settlement state based on the redemption event and the settlement amount.

[0010] Furthermore, the system also includes a distribution service, which uses the sharing identifier as an index to record the sharer identifier, responder identifier, behavior type, behavior time, and network address in the distribution relationship table; the behavior types include clicking, registering, viewing products, purchasing products, viewing stores, shopping in stores, viewing advertisements, performing advertising tasks, viewing help links, completing help, viewing gift boxes, receiving gift boxes, viewing votes, and completing votes; When the behavior type is purchasing goods, the distribution service calculates the commission based on the settlement amount and commission ratio, and recovers the commission after receiving an order refund event.

[0011] Compared with the prior art, the advantages of the present invention are as follows: 1. This invention associates user identifiers, merchant identifiers and transaction requests with tenant tokens, and combines composite access keys and tenant interceptors to limit the scope of data access, so that merchant identity can run through the business process and the data access boundaries between different merchants are clearly defined.

[0012] 2. This invention links the status of products, inventory, orders and coupons by merchant SKU verification, inventory pre-allocation, merchant order splitting and platform general coupon pre-allocation, thereby reducing the problems of overselling inventory, duplicate use of coupons and mismatch of order status during concurrent transactions.

[0013] 3. This invention connects order processing, coupon redemption, and merchant settlement through payment events and redemption events, and adjusts settlement records and commission status according to refund results, so as to keep payment, redemption, settlement and refund processing consistent and improve the reliability of multi-service collaborative processing. Attached Figure Description

[0014] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0015] Figure 1 This is a diagram showing the overall architecture of the E-Cinema platform system of the present invention; Figure 2 This is a schematic diagram of the membership tiered information model and data isolation of the present invention; Figure 3 This is a product SPU / SKU hierarchical model and review flowchart of the present invention; Figure 4 This is the order state machine flow diagram of the present invention; Figure 5 This is a flowchart illustrating the entire process of configuring, approving, redeeming, and allocating the coupon templates according to the present invention. Figure 6 This is the distribution behavior link tracing graph (14 relationships) of the present invention. Detailed Implementation

[0016] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0017] To achieve the above objectives, the present invention provides an e-commerce platform system based on microservices and tenant isolation, such as... Figures 1-6 As shown, the system includes: M1: Tenant authentication module, receives user transaction requests, verifies login information, generates a tenant token containing user and merchant identifiers; associates product identifier, SKU identifier, and purchase quantity with the tenant token to generate a tenant transaction request.

[0018] M101 (Receive and Verify Transaction Request): Receives the user's transaction request, extracts the login information, target merchant information, target product information, SKU identifier, and purchase quantity from the user's transaction request; and sets the login... The information is matched with the platform's basic member data. If the match is successful, the user identifier in the platform's basic member data is read, and the purchase quantity is verified to be a positive integer. If the login information fails to match or the purchase quantity verification fails, the user's transaction request is terminated. M102 (Determine Tenant Product Relationship): Based on the target product information, query the platform SPU record and read the product identifier; based on the SKU identifier, query the merchant SKU record and read the product identifier and the owner merchant identifier bound to the merchant SKU record; extract the target merchant identifier from the target merchant information; compare the associated product identifier in the merchant SKU record with the product identifier in the platform SPU record, and compare the owner merchant identifier with the target merchant identifier; if both comparisons pass, determine the owner merchant identifier as the merchant identifier, and obtain the token issuance time and the request random number; if either comparison fails, terminate the user transaction request; if both comparisons pass, determine the owner merchant identifier as the merchant identifier, and obtain the token issuance time and the request random number; if either comparison fails, terminate the user transaction request. M103 (Generate Tenant Token): Concatenate the user identifier, the merchant identifier, the token issuance time, and the requested random number in sequence, perform a digest operation on the concatenation result, and obtain the tenant binding code. The calculation formula is: (Function M1-1) in, Indicates the tenant binding code; Indicates user identifier; Indicates merchant identification; Indicates the time when the token was issued; ∥ indicates a request for a random number; ∥ indicates concatenation according to field order; Hash indicates a digest function that converts the concatenated result into a fixed-length digest value. The token expiration time is determined based on the token issuance time and the token validity period; a message authentication operation is performed on the tenant binding code and the token expiration time using the token signature key to obtain the token signature value; the user identifier, the merchant identifier, the token issuance time, the request random number, the token expiration time, the tenant binding code, and the token signature value are encapsulated to generate the tenant token; M104 (Generate Tenant Transaction Request): Associate the product identifier, the SKU identifier, and the purchase quantity with the tenant token to generate the tenant transaction request; the tenant transaction request carries the tenant token, the product identifier, the SKU identifier, the purchase quantity, and the request random number; when the user transaction request contains multiple product items, determine the product identifier, SKU identifier, purchase quantity, and merchant identifier for each product item, and generate a corresponding tenant transaction request; each tenant transaction request belonging to the same settlement request carries the same request random number.

[0019] M2: Data isolation module, receives the tenant transaction request; reads the platform's basic member data based on the user identifier, reads the merchant's extended member data using a composite access key composed of the user identifier and the merchant identifier, intercepts data requests that do not match the merchant identifier, and generates tenant transaction data.

[0020] M201 (Receive and Verify Tenant Token): Receives the tenant transaction request, extracts the tenant token, the product identifier, the SKU identifier, the purchase quantity, and the request random number; extracts the user identifier, merchant identifier, token issuance time, token expiration time, tenant binding code, and token signature value from the tenant token; The verification binding code is recalculated based on function M1-1. Message authentication is performed on the tenant binding code and the token expiration time using the token signing key to obtain the verification signature value. When the verification binding code matches the tenant binding code, the verification signature value matches the token signature value, and the current time is earlier than the token expiration time, a tenant access context is formed. The tenant access context includes the user identifier and the merchant identifier. If any condition is not met, the current data request is terminated. M202 (Read Platform Member Data): Based on the user identifier in the tenant's access context, query the platform's basic member table and read the platform's basic member data that uniquely corresponds to the user identifier; the platform's basic member data includes username, mobile phone number, email address, nickname, avatar, and registration time; M203 (Read Merchant Extended Data): Construct a composite access key based on the user identifier and the merchant identifier, wherein the composite access key is composed in the order of user identifier first and merchant identifier last; query the merchant extended member table based on the composite access key, and read the merchant extended member data; the merchant extended member data includes member level, points balance, consumption records, coupon assets and merchant personalized data. A tenant interceptor is set up at the database access layer. The tenant interceptor reads the merchant identifier from the tenant access context and injects filtering conditions corresponding to the merchant identifier into query, update, and delete statements for the merchant extended member table, merchant SKU table, sub-order table, coupon redemption table, and merchant settlement table. For write statements, it verifies whether the merchant identifier to be written is consistent with the merchant identifier in the tenant access context, and writes the merchant identifier if the verification passes; if the verification fails, it intercepts the data request. M204 (Generate Tenant Transaction Data): Write the user identifier, merchant identifier, product identifier, SKU identifier, purchase quantity, request random number, composite access key, username, mobile phone number, email address, nickname, avatar, registration time, membership level, points balance, coupon assets, and merchant personalized data into the tenant transaction data; The username, mobile phone number, email address, nickname, avatar, and registration time are taken from the platform's basic member data, while the member level, points balance, coupon assets, and merchant personalized data are taken from the merchant's extended member data; the tenant transaction data is used as the output of the M2 data isolation module.

[0021] M3: Order processing module, receives the tenant's transaction data; queries the merchant's SKU record based on the SKU identifier, splits the sub-orders according to the merchant identifier, calculates the product amount, deduction amount and settlement amount; generates a payment event after successful payment, and publishes the payment event to the message queue.

[0022] M301 (Associated Merchant Product): Receives one or more tenant transaction data entries with the same random number as the request; reads the user identifier, merchant identifier, product identifier, SKU identifier, purchase quantity, and coupon asset from the tenant transaction data; queries the platform SPU record based on the product identifier, queries the merchant SKU record based on the SKU identifier, and verifies whether the associated product identifier and the affiliated merchant identifier in the merchant SKU record are consistent with the product identifier and merchant identifier in the tenant transaction data, respectively; after successful verification, reads the sales price and listing status. When the listing status is "listed", a Redis distributed lock is requested using the SKU identifier as the inventory lock key. After the Redis distributed lock is successfully requested, the available inventory is reread. If the purchase quantity is not greater than the available inventory, the inventory corresponding to the purchase quantity is marked as reserved inventory, and the SKU identifier, the merchant identifier, the sales price, and the purchase quantity are written into the order item set. If the purchase quantity is greater than the available inventory, the Redis distributed lock is released and the order processing for the corresponding item is terminated. If the verification fails, the listing status is not "listed", or the Redis distributed lock request fails, the order processing for the corresponding item is terminated. M302 (Split Merchant Sub-Order): Group the order item set according to the merchant identifier, write the order item in the same group into a sub-order, and generate a sub-order identifier for the sub-order; record the user identifier, the merchant identifier, and the SKU identifier, the selling price and the purchase quantity corresponding to the order item in the sub-order; For each sub-order, coupons that are platform general coupons, unused, valid, applicable to the merchant's identifier, and meet the usage threshold are selected from the coupon assets to form a candidate coupon set corresponding to the sub-order; M303 (Calculate Sub-order Amount): For the first... For each sub-order, the total amount is calculated based on its unit price and quantity. The formula is as follows: (Function M3-1) in, Indicates the first The total value of goods in a single order; Indicates the first Each sub-order contains a set of item serial numbers for the order items; Indicates the first The unit price of each item in an order; Indicates the first The quantity of each item purchased in a single order; Indicates the item number in the order; Indicates the sub-order number; The coupon identifier is determined from the candidate coupon set, and the coupon template is queried based on the coupon identifier. An update statement based on the coupon identifier and unused status is used to update the corresponding platform general coupon to a pre-reserved status and bind the sub-order identifier. If pre-reservation fails, the coupon identifier is deleted from the candidate coupon set, and a new coupon identifier is determined from the updated candidate coupon set. If the updated candidate coupon set is empty, the coupon identifier is recorded as null and the deduction amount is recorded as zero. After successful pre-reservation, the deduction amount is determined based on the face value, discount rate, package price, and usage threshold recorded in the coupon template, and the deduction amount is limited to no more than the product amount. If no coupon is selected, the coupon identifier is recorded as null and the deduction amount is recorded as zero. The settlement amount is calculated based on the value of the goods and the amount deducted, using the following formula: (Function M3-2) in, Indicates the first Settlement amount for each sub-order; Indicates the first The total value of goods in a single order; Indicates the first The amount deducted by coupons for individual orders; M304 (Generate Payment Event): Summarize the settlement amounts of each of the sub-orders and initiate a merged payment; receive a payment success callback, read the actual payment amount, and verify whether the actual payment amount is consistent with the sum of the settlement amounts of each of the sub-orders; after the verification is successful, update the status of each of the sub-orders to paid, and generate the payment event for each of the sub-orders. Set the event type of the payment event to ORDER_PAID, and write the user identifier, the sub-order identifier, the merchant identifier, the coupon identifier, the product amount, the deduction amount, and the settlement amount into the payment event, and publish the payment event to the message queue; The inventory service consumes the payment event, reads the corresponding order item based on the sub-order identifier, deducts the actual inventory in a MySQL transaction, clears the pre-held inventory, and releases the Redis distributed lock; the points service increases points based on the user identifier and the settlement amount; the distribution service queries the distribution relationship and calculates commissions based on the user identifier. If payment fails or times out, release the pre-held inventory and the Redis distributed lock, and restore the platform general coupons in the pre-held state to the unused state.

[0023] M4: The coupon settlement module receives the payment event via the message queue, reads the merchant identifier, coupon identifier, and settlement amount from the payment event; redeems platform general coupons based on the merchant identifier and coupon identifier, and generates a redemption event; and generates a merchant settlement adjustment order in a pending settlement state based on the redemption event and the settlement amount.

[0024] M401 (Receive Payment Event): Receives the payment event output by the M3 order processing module through the message queue, and reads the sub-order identifier, merchant identifier, coupon identifier, product amount, deduction amount, and settlement amount from the payment event; using the sub-order identifier as the idempotent key, writes a processing record to the payment event processing table. If the writing is successful, the status of the processing record is set to "processing in progress" and subsequent processing begins; if the writing fails because the idempotent key already exists, it reads the existing processing record. If the status of the existing processing record is "processing completed" or "processing in progress," it stops repeated processing; if the status of the existing processing record is "processing abnormal," it re-enters subsequent processing. When the coupon identifier is empty and the deduction amount is zero, a regular merchant settlement record is generated based on the settlement amount, and the status of the processing record is updated to the processing completed status; when the coupon identifier is not empty, the platform's general coupon redemption process is initiated. M402 (General Coupon for Redemption Platform): Based on the coupon identifier, query the coupon record and the coupon template, verify that the coupon record is in the pre-reserved state, the validity period has not expired, and the sub-order identifier bound to the coupon record is consistent with the sub-order identifier; verify the applicable scope recorded in the coupon template based on the merchant identifier, and verify the usage threshold recorded in the coupon template based on the product amount; recalculate and verify the deduction amount based on the face value, discount rate, or package price recorded in the coupon template, and verify the consistency between the verified deduction amount and the deduction amount in the payment event; If the verification passes, the status of the coupon record is updated to "used" based on the condition that the coupon record is in the pre-reserved state, and a redemption record containing the sub-order identifier, the coupon identifier, the merchant identifier, and the deduction amount is generated; if the verification fails, a redemption exception record is generated, the settlement processing of the corresponding sub-order is stopped, and the status of the processing record is updated to the processing exception state. M403 (Generate Reconciliation Event): Generate the reconciliation event based on the reconciliation record, set the event type of the reconciliation event to COUPON_USED, and write the sub-order identifier, the merchant identifier, the coupon identifier, the deduction amount, and the settlement amount into the reconciliation event; publish the reconciliation event to the message queue, and have the financial service consume the reconciliation event; M404 (Generate Settlement Adjustment Order): In this embodiment, the platform bears all the deduction costs of the platform's general coupon; the financial service receives the reimbursement event, adds the settlement amount in the reimbursement event to the deduction amount, and obtains the amount to be settled by the merchant, calculated as follows: (Function M4-1) in, Indicates the first The amount that the merchant should settle for each sub-order; Indicates the first Settlement amount for each sub-order; Indicates the first The amount deducted by using the platform's general coupon for each sub-order; Indicates the sub-order number; The sub-order identifier, merchant identifier, coupon identifier, settlement amount, deduction amount, and merchant settlement amount are written into the merchant settlement adjustment form. The status of the merchant settlement adjustment form is set to pending settlement. The deduction amount is deducted from the platform activity fund account, and a platform activity fund deduction record is generated, which records the coupon identifier, the deduction amount, and the deduction time. After the sub-order is completed and the after-sales period expires, the status of the merchant settlement adjustment form is updated to settleable, and the merchant settlement adjustment form is output as the M4 coupon settlement module. The refund processing procedure includes: receiving an order refund event through the message queue; reading the sub-order identifier and refund amount from the order refund event; querying the payment event and the merchant settlement adjustment order based on the sub-order identifier; and querying the redemption record and the platform activity fund deduction record when the payment event contains the coupon identifier. When the refund amount equals the settlement amount in the payment event, the status of the platform general coupon is restored to unused, or updated to expired when the validity period expires, and the platform activity fund deduction record is cancelled; when the refund amount is less than the settlement amount, the used status of the platform general coupon is maintained, and the merchant's settlement amount and the platform's deduction cost are reduced according to the proportion of the refund amount to the settlement amount. The merchant settlement adjustment order that is in the pending settlement state will be updated to the cancelled or amount adjusted state, and a refund settlement adjustment record will be generated; the points service and the distribution service will perform points recovery and commission collection according to the proportion of the refund amount to the settlement amount; The distribution service uses the sharing identifier as an index and records the sharer identifier, responder identifier, behavior type, behavior time, and network address in the distribution relationship table. The behavior types include clicking, registering, viewing products, purchasing products, viewing stores, shopping in stores, viewing advertisements, performing advertising tasks, viewing help links, completing help, viewing gift boxes, receiving gift boxes, viewing votes, and completing votes. When the behavior type is purchasing products, the distribution service calculates the commission based on the settlement amount and commission ratio in the payment event and recovers the corresponding commission after receiving an order refund event.

[0025] In another implementation, the platform and the merchant share the deduction cost of the platform's general coupons according to a preset sharing ratio; the financial service determines the amount borne by the platform and the amount borne by the merchant based on the preset sharing ratio, includes the amount borne by the platform in the amount to be settled by the merchant, and deducts the amount borne by the merchant from the amount of the goods, generating a corresponding merchant settlement adjustment form and a platform activity fund deduction record.

[0026] This embodiment provides two examples: Example 1 (Merchant Onboarding and Product Listing): An eyewear store submits its store name, manager information, business address, contact number, business license, legal representative's identity certificate, and corporate account information through the merchant portal to form a merchant onboarding application. The platform operations department reviews the merchant onboarding application, and after approval, generates a merchant identifier 3001, creates a merchant backend and merchant account corresponding to the merchant identifier, and initializes the withdrawable balance, frozen funds, marketing account balance, and security deposit account. The optical shop enters the product management page, selects the platform SPU record corresponding to "1.60 anti-blue light lenses" from the platform SPU library, and reads the product identifier 5001; the optical shop fills in the sales price of 880 yuan, the market price of 1280 yuan, the inventory quantity of 50 lenses, as well as the refractive index, coating type and lens color, generates SKU identifier 5001001, and binds the SKU identifier, the product identifier and the merchant identifier 3001.

[0027] Example 2 (Cinema Ticket Purchase and Platform Universal Coupon Settlement): Users access the cinema store corresponding to merchant identifier 2001 through the platform mini-program; the unified authentication center verifies the user login information, reads user identifier 10001, and generates a tenant token containing the user identifier 10001 and the merchant identifier 2001. The user selects the movie showtime corresponding to product identifier 6001 and SKU identifier 6001003, and purchases 2 items. The system associates product identifier 6001, SKU identifier 6001003, and purchase quantity 2 with the tenant token to generate a tenant transaction request. The data isolation module reads the platform's basic member data based on user identifier 10001, reads the merchant's extended member data based on the composite key composed of user identifier 10001 and merchant identifier 2001, and generates tenant transaction data. The order processing module reads the sales price of 100 yuan, available inventory, and shelf status based on the SKU identifier 6001003; after successfully applying for the Redis distributed lock corresponding to the SKU identifier, it marks the inventory corresponding to the two seats as pre-reserved inventory; the system generates a sub-order with a product amount of 200 yuan, and determines a platform general coupon of 20 yuan off for purchases over 100 yuan from the coupon asset; the platform general coupon is updated from unused status to pre-reserved status, and the deduction amount of 20 yuan and the settlement amount of 180 yuan are calculated; After the user completes the payment of 180 yuan, the order service updates the sub-order to a paid status, generates a payment event of type ORDER_PAID, and publishes it to the message queue; the inventory service consumes the payment event, deducts the inventory of 2 seats corresponding to the SKU identifier in a MySQL transaction, clears the pre-reserved inventory, and releases the Redis distributed lock; the points service adds points corresponding to the settlement amount; and the distribution service calculates commissions when a valid distribution relationship is found. The coupon settlement module consumes the payment event, verifies that the platform general coupon is in a pre-reserved state, the validity period has not expired, the applicable scope includes the merchant identifier 2001, and the deduction amount is 20 yuan; after the verification is passed, the platform general coupon is updated to the used state, and a redemption record and a redemption event of event type COUPON_USED are generated; For the reimbursement event of the financial service consumption, the settlement amount of 180 yuan is added to the platform's deduction amount of 20 yuan to determine the merchant's settlement amount as 200 yuan; a merchant settlement adjustment order in the pending settlement status is generated, 20 yuan is deducted from the platform's activity fund account, and a platform activity fund deduction record is generated; after the sub-order is completed and the 7-day after-sales period expires, the merchant settlement adjustment order is updated to the settlement status, and 200 yuan is transferred to the cashable account corresponding to merchant identifier 2001; The eyewear store submits a product review application. The platform's operations team verifies the product title, product images, sales price, specifications, and business qualifications. After the review is approved, the merchant SKU record corresponding to SKU identifier 5001001 is updated to an "on-demand" status. When a user visits the eyewear store, the platform queries the corresponding merchant SKU record based on merchant identifier 3001 and displays the sales price, specifications, and inventory quantity.

[0028] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0029] In conclusion, the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. An e-commerce platform system based on microservices and tenant isolation, characterized in that, include: M1: Tenant authentication module, which receives user transaction requests, verifies login information, and generates a tenant token containing user and merchant identifiers; Associate the product identifier, SKU identifier, and purchase quantity with the tenant token to generate a tenant transaction request; M2: Data isolation module, receives the tenant transaction request; reads the platform basic member data based on the user identifier, reads the merchant extended member data by forming a composite access key with the user identifier and the merchant identifier, intercepts data requests that do not match the merchant identifier, and generates tenant transaction data; M3: Order processing module, receives the tenant's transaction data; queries the merchant's SKU record based on the SKU identifier, splits sub-orders according to the merchant identifier, calculates the product amount, deduction amount, and settlement amount; generates a payment event after successful payment, and publishes the payment event to the message queue; M4: Coupon and account settlement module, which receives the payment event through the message queue and reads the merchant identifier, coupon identifier and settlement amount from the payment event; A redemption event is generated based on the merchant identifier and the coupon identifier to redeem a platform-wide coupon; Based on the reversal event and the settlement amount, a merchant settlement adjustment order in the pending settlement status is generated.

2. The e-commerce platform system based on microservices and tenant isolation according to claim 1, characterized in that, The tenant authentication module extracts target product information and target merchant information from the user transaction request, queries the platform SPU record based on the target product information, and reads the product identifier in the platform SPU record. Based on the SKU identifier, query the merchant SKU record and read the associated product identifier and the merchant identifier in the merchant SKU record; The associated product identifier and the affiliated merchant identifier are compared with the product identifier and the target merchant identifier in the target merchant information, respectively. After the comparison is successful, the merchant identifier is determined as the merchant identifier. A tenant binding code is generated based on the user identifier, the merchant identifier, the token issuance time, and the request random number. A token signature value is generated based on the tenant binding code, the token expiration time, and the token signature key. The tenant binding code, the token expiration time, and the token signature value are then written into the tenant token.

3. The e-commerce platform system based on microservices and tenant isolation according to claim 2, characterized in that, The data isolation module verifies the tenant binding code, the token signature value, and the token expiration time to form a tenant access context. The data isolation module includes a tenant interceptor. The tenant interceptor reads the merchant identifier from the tenant access context, injects the query, update, and delete statements of the merchant's extended member table, merchant SKU table, sub-order table, coupon redemption table, and merchant settlement table with filtering conditions corresponding to the merchant identifier, and verifies whether the merchant identifier to be written in the write statement is consistent with the merchant identifier; if they are inconsistent, the write statement is intercepted.

4. The e-commerce platform system based on microservices and tenant isolation according to claim 3, characterized in that, The order processing module verifies whether the associated product identifier and the affiliated merchant identifier in the merchant SKU record are consistent with the product identifier and merchant identifier in the tenant transaction data, and reads the sales price and listing status. When the listing status is "listed", a Redis distributed lock is requested using the SKU identifier. After the Redis distributed lock is successfully requested, the available inventory is read, the inventory corresponding to the purchase quantity is marked as pre-reserved inventory, and an order item set is generated. When the purchase quantity is greater than the available inventory, the Redis distributed lock is released.

5. The e-commerce platform system based on microservices and tenant isolation according to claim 4, characterized in that, The order processing module groups the set of order items according to the merchant identifier, and generates the sub-order and sub-order identifier; For each sub-order, the platform general coupons that are unused, have not expired, have the merchant identifier in their applicable scope, and meet the usage threshold are selected from the merchant's extended membership data to form a candidate coupon set; the coupon identifier is determined from the candidate coupon set, the platform general coupon corresponding to the coupon identifier is updated to a pre-reserved state and bound to the sub-order identifier.

6. The e-commerce platform system based on microservices and tenant isolation according to claim 5, characterized in that, The system also includes inventory services and financial services; The payment event is of type ORDER_PAID and includes the user identifier, the sub-order identifier, the merchant identifier, the coupon identifier, the product amount, the deduction amount, and the settlement amount. The inventory service consumes the payment event, deducts the actual inventory, clears the pre-held inventory, and releases the Redis distributed lock in a MySQL transaction; In the event of payment failure or payment timeout, the order processing module does not generate the payment event, releases the pre-held inventory and the Redis distributed lock, and restores the platform general coupon to the unused state. The coupon settlement module verifies whether the platform general coupon is in the pre-reserved state, whether the validity period of the platform general coupon has expired, and whether the scope of application of the platform general coupon includes the merchant identifier. It then recalculates and verifies the deduction amount based on the coupon template corresponding to the platform general coupon. When the verified deduction amount is consistent with the deduction amount, the platform general coupon is updated to the used state, and a redemption event with event type COUPON_USED and containing the settlement amount is generated. The coupon settlement module publishes the reversal event to the message queue. The financial service receives the reversal event through the message queue, reads the settlement amount from the reversal event, and generates the merchant settlement adjustment order and platform activity fund deduction record in the pending settlement status based on the reversal event and the settlement amount.

7. The e-commerce platform system based on microservices and tenant isolation according to claim 6, characterized in that, The system also includes a distribution service, which uses a sharing identifier as an index to record the sharer identifier, responder identifier, behavior type, behavior time, and network address in a distribution relationship table; the behavior types include clicking, registering, viewing products, purchasing products, viewing stores, shopping in stores, viewing advertisements, performing advertising tasks, viewing help links, completing help, viewing gift boxes, receiving gift boxes, viewing votes, and completing votes. When the behavior type is purchasing goods, the distribution service calculates the commission based on the settlement amount and commission ratio, and recovers the commission after receiving an order refund event.

Citation Information

Patent Citations

  • Distribution-type cloud platform system based on micro-service-oriented architecture

    CN107295077A