Commission data processing method and device

By adopting the CQRS architecture and the separate storage solution of forward and inverted indexes in the e-commerce advertising alliance platform, the problems of slow MySQL query planning and downtime were solved, and the system stability and query speed were improved.

CN113326095BActive Publication Date: 2025-09-19BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110582366.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-05-26
Publication Date
2025-09-19
Estimated Expiration
2041-05-26

AI Technical Summary

Technical Problem

In the existing technology, slow MySQL query plans and possible downtime caused by user order operations affect the CPS business stability of e-commerce advertising alliance platforms.

Method used

The CQRS architecture is used to separate planned reads and writes, establish forward and inverted indexes, and store them in Redis and JVM, reducing the storage pressure of MySQL and the cache pressure of Redis through JVM, thereby improving system stability and availability.

Benefits of technology

By separating read and write operations, query time is reduced, MySQL downtime is avoided, system stability and availability are improved, and the growing promotion needs are met.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113326095B_ABST
    Figure CN113326095B_ABST
Patent Text Reader

Abstract

The present invention discloses a commission data processing method and device, which relates to the field of computer technology. A specific implementation of the method includes: after receiving an order operation for an item, obtaining the item promotion information and customer information in the order information, and querying the inverted index corresponding to the item promotion information and customer information; reading the plan identifier in the inverted index, determining the forward index corresponding to the plan identifier, obtaining the plan list in the forward index, and then filtering out multiple plans whose order time is within the plan start time and end time range; taking the plan with the highest priority among the multiple plans as the target plan, and calculating the commission amount paid to the customer based on the order amount and the commission ratio in the target plan. This implementation establishes a forward and inverted index, avoids one-by-one search and comparison, stores the index in Redis to reduce the storage pressure of MySQL, adds JVM to reduce the cache pressure of Redis, and improves the stability and availability of the system operation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a commission data processing method and device. Background Art

[0002] With the continuous development of e-commerce, the number of merchants has gradually increased, and their promotion needs have also continued to expand. To provide higher-quality services, an e-commerce advertising alliance platform has been launched to meet merchants' promotion needs. Advertisers use the e-commerce advertising alliance platform to promote products and stores, and promoters earn commissions by promoting products and stores using the e-commerce advertising alliance platform. CPS (Cost Per Sales) plan queries are a core component of this process. Essentially, they use business logic to match the promoter's promotional behavior with the advertiser who will pay the commission for that promotion.

[0003] The current implementation logic is as follows: After the advertiser creates a plan, it is stored in MySQL. When matching the plan, the plan in MySQL is read based on the information of the promoter and the promoted item. Then, the optimal plan is selected through business logic, that is, the optimal commission ratio, to determine the commission amount to be paid to the promoter.

[0004] In the process of implementing the present invention, the inventors found that the existing technology has at least the following problems: after the user places an order by clicking on the promotion information of the item, the order operation will be transmitted to MySQL to match the plan. Therefore, there are two obvious disadvantages. One is that the reading plan is too slow, and the other is that when the user places too many orders, it may cause MySQL to crash, affecting the entire CPS business. Summary of the Invention

[0005] In view of this, an embodiment of the present invention provides a commission data processing method and apparatus, which can at least solve the problem in the prior art that all order information is transmitted to MySQL for processing, resulting in slow query planning.

[0006] To achieve the above object, according to one aspect of an embodiment of the present invention, a commission data processing method is provided, comprising:

[0007] After receiving an order for an item, obtaining item promotion information and promoter information in the order information, and querying an inverted index corresponding to the item promotion information and the promoter information; wherein the access link for the item is obtained by clicking on a plan, which is created by an advertiser and promoted by a promoter;

[0008] Read the plan identifier in the inverted index, determine the forward index corresponding to the plan identifier, obtain the plan list in the forward index, and then filter out multiple plans whose order times are within the range of the plan start time and end time;

[0009] The plan with the highest priority among the multiple plans is used as the target plan to calculate the commission amount paid to the promoter based on the order amount and the commission ratio in the target plan.

[0010] Optionally, before querying the inverted index corresponding to the item promotion information and the referrer information, the method further includes:

[0011] Use the plan start time and end time as query conditions to query the plans currently in operation in the database;

[0012] For any plan, create an inverted index based on the item promotion information and plan identifier in the plan; and

[0013] Determine all plans corresponding to the identifier of any one of the plans, and create a forward index based on the plan identifiers;

[0014] Write the inverted index and forward index of each plan into the cache database.

[0015] Optionally, the plan includes at least one of the following: store plan, category plan, and hot product plan;

[0016] For the store plan, the key name of the inverted index is the store ID, and the key value is the list of store plan IDs corresponding to the store ID; the key name of the forward index is the store plan ID, and the key value is the list of store plans corresponding to the store plan ID;

[0017] For the category plan, the key name of the inverted index is composed of the first-level category identifier, second-level category identifier, and third-level category identifier in the plan in sequence, and the key value is the category plan identifier list corresponding to the inverted index key name; the key name of the forward index is the category plan identifier, and the key value is the category plan list corresponding to the category plan identifier;

[0018] For the hot product plan, the key name of the inverted index is the item ID, and the key value is the hot product plan ID list corresponding to the item ID; the key name of the forward index is the hot product plan ID, and the key value is the hot product plan ID list corresponding to the hot product plan ID.

[0019] Optionally, after writing the inverted index and forward index of each plan into the cache database, the method further includes:

[0020] Writing the planned inverted index in the cache database to the virtual machine; and

[0021] The remaining resource size of the virtual machine after writing the planned inverted index is calculated. If the remaining resource size is greater than the resource size occupied by the planned forward index, the planned forward index in the cache database is written into the virtual machine, otherwise no processing is performed.

[0022] Optionally, the method further includes: adding a preset value to the previous version number to generate a current version number, adding the current version number to the key name of each inverted index, and storing the result.

[0023] Optionally, the method further includes: in the cache database, for a plan, determining whether a preset clearing time point of the plan has been reached; if so, filtering the plan.

[0024] Optionally, the method further includes: after writing the plan forward index into the cache database, representing the attributes of each plan using a preset data format type.

[0025] Optionally, it also includes the plan site owner binding relationship, which is used to store the binding relationship between the plan and the promoter;

[0026] The method further comprises:

[0027] Create an inverted index and a forward index of the planned webmaster binding relationship and write them into the cache database together; the key name of the inverted index is the pusher ID, and the key value is the list of plan IDs corresponding to the pusher ID; the key name of the forward index is the plan ID, and the key value is the list of planned webmaster binding relationships corresponding to the plan ID;

[0028] An intersection process is performed on the plan identifier list in the inverted index found according to the item promotion information and the plan identifier list in the inverted index found according to the promoter identifier.

[0029] Optionally, taking the plan with the highest priority among the multiple plans as the target plan includes:

[0030] Filtering a first plan with the highest priority from the multiple plans, and determining whether the number of the first plan is one;

[0031] If there is one, the first plan is used as the target plan. Otherwise, the second plan with the highest commission rate is selected from the first plan, and the number of the second plan is determined to be one.

[0032] If there is one, the second plan is used as the target plan; otherwise, the third plan with the earliest creation time is selected from the second plan, and the third plan is used as the target plan.

[0033] To achieve the above object, according to another aspect of an embodiment of the present invention, a commission data processing device is provided, comprising:

[0034] a query module configured to, upon receiving an order for an item, obtain item promotion information and promoter information in the order information, and query an inverted index corresponding to the item promotion information and promoter information; wherein the access link for the item is obtained by clicking on a plan, which is created by an advertiser and promoted by a promoter;

[0035] A screening module is configured to read the plan identifier in the inverted index, determine the forward index corresponding to the plan identifier, obtain a plan list in the forward index, and then screen out a plurality of plans whose order times fall within the range of the plan start time and end time;

[0036] The calculation module is used to take the plan with the highest priority among the multiple plans as the target plan, so as to calculate the commission amount paid to the promoter based on the order amount and the commission ratio in the target plan.

[0037] Optionally, it also includes an index creation module for:

[0038] Use the plan start time and end time as query conditions to query the plans currently in operation in the database;

[0039] For any plan, create an inverted index based on the item promotion information and plan identifier in the plan; and

[0040] Determine all plans corresponding to the identifier of any one of the plans, and create a forward index based on the plan identifiers;

[0041] Write the inverted index and forward index of each plan into the cache database.

[0042] Optionally, the plan includes at least one of the following: store plan, category plan, and hot product plan;

[0043] For the store plan, the key name of the inverted index is the store ID, and the key value is the list of store plan IDs corresponding to the store ID; the key name of the forward index is the store plan ID, and the key value is the list of store plans corresponding to the store plan ID;

[0044] For the category plan, the key name of the inverted index is composed of the first-level category identifier, second-level category identifier, and third-level category identifier in the plan in sequence, and the key value is the category plan identifier list corresponding to the inverted index key name; the key name of the forward index is the category plan identifier, and the key value is the category plan list corresponding to the category plan identifier;

[0045] For the hot product plan, the key name of the inverted index is the item ID, and the key value is the hot product plan ID list corresponding to the item ID; the key name of the forward index is the hot product plan ID, and the key value is the hot product plan ID list corresponding to the hot product plan ID.

[0046] Optionally, an index storage module is also included for:

[0047] Writing the planned inverted index in the cache database to the virtual machine; and

[0048] The remaining resource size of the virtual machine after writing the planned inverted index is calculated. If the remaining resource size is greater than the resource size occupied by the planned forward index, the planned forward index in the cache database is written into the virtual machine, otherwise no processing is performed.

[0049] Optionally, a version adding module is further included, which is used to: add a preset value to the previous version number to generate a current version number, add the current version number to the key name of each inverted index, and store it.

[0050] Optionally, an expired cleaning module is further included, which is used to: in the cache database, for a plan, determine whether the preset cleaning time point of the plan has been reached, and if so, filter the plan.

[0051] Optionally, a format changing module is further included, which is used to: after writing the plan forward index into the cache database, represent the attributes of each plan using a preset data format type.

[0052] Optionally, it also includes the plan site owner binding relationship, which is used to store the binding relationship between the plan and the promoter;

[0053] The device further comprises:

[0054] Create an inverted index and a forward index of the planned webmaster binding relationship and write them into the cache database together; the key name of the inverted index is the pusher ID, and the key value is the list of plan IDs corresponding to the pusher ID; the key name of the forward index is the plan ID, and the key value is the list of planned webmaster binding relationships corresponding to the plan ID;

[0055] An intersection process is performed on the plan identifier list in the inverted index found according to the item promotion information and the plan identifier list in the inverted index found according to the promoter identifier.

[0056] Optionally, the computing module is configured to:

[0057] Filtering a first plan with the highest priority from the multiple plans, and determining whether the number of the first plan is one;

[0058] If there is one, the first plan is used as the target plan. Otherwise, the second plan with the highest commission rate is selected from the first plan, and the number of the second plan is determined to be one.

[0059] If there is one, the second plan is used as the target plan; otherwise, the third plan with the earliest creation time is selected from the second plan, and the third plan is used as the target plan.

[0060] To achieve the above objective, according to another aspect of an embodiment of the present invention, a commission data processing electronic device is provided.

[0061] The electronic device of an embodiment of the present invention includes: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement any of the above-mentioned commission data processing methods.

[0062] To achieve the above-mentioned purpose, according to another aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored, and when the program is executed by a processor, any of the above-mentioned commission data processing methods is implemented.

[0063] According to the solution provided by the present invention, one embodiment of the above invention has the following advantages or beneficial effects: the planned reading and writing are separated through the CQRS architecture, which is easier to maintain, and the positive and inverted indexes are established to avoid the process of searching and comparing one by one. The positive and inverted indexes are stored in Redis to reduce the storage pressure of MySQL, and JVM is added to reduce the cache pressure of Redis, thereby improving the stability and availability of the system.

[0064] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0065] The accompanying drawings are provided for a better understanding of the present invention and are not intended to limit the present invention.

[0066] Figure 1 It is the three-tier architecture adopted by existing e-commerce advertising alliance platforms;

[0067] Figure 2 It is a planned read-write separation architecture that adopts the CQRS architecture diagram;

[0068] Figure 3 is a flowchart of a method for constructing a plan index according to an embodiment of the present invention;

[0069] Figure 4 This is a schematic diagram of the main flow of a commission data processing method according to an embodiment of the present invention;

[0070] Figure 5 This is a schematic diagram of main modules of a commission data processing device according to an embodiment of the present invention;

[0071] Figure 6 is an exemplary system architecture diagram in which embodiments of the present invention may be applied;

[0072] Figure 7 It is a schematic diagram of the structure of a computer system of a mobile device or server suitable for implementing the embodiments of the present invention. DETAILED DESCRIPTION

[0073] The following description of exemplary embodiments of the present invention is made in conjunction with the accompanying drawings, in which various details of the embodiments of the present invention are included to facilitate understanding. These details should be considered as merely exemplary. Therefore, it should be appreciated by those skilled in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0074] In the early days of the e-commerce advertising alliance platform, because it was not well known to the public, advertisers had fewer plans to launch, resulting in fewer promotional activities by promoters. With the rapid development of the business, the e-commerce advertising alliance platform has become more and more well-known to advertisers and promoters, advertisers have created more plans, and promoters have taken more promotional actions. Figure 1 As shown in the figure, the e-commerce advertising alliance platform adopts a traditional three-tier architecture, which divides the application into: display layer, application layer, and data access layer. The display layer is used to verify the information of customer promotion and query the optimal commission ratio. The application layer is used to match the plan. The data access layer is used to read the plan from MySQL.

[0075] The current plan is effective on d+1, that is, the plan created today will take effect tomorrow, so this solution uses the CQRS architecture diagram to Figure 1 The three-tier architecture in the is changed to a read-write separation architecture, which is easier to maintain. Figure 2 The upper part is used for scheduled loading, loading the planned inverted index and forward index into Redis. It is preferred to load the entire index once a day, which does not put pressure on MySQL. The lower part is used for scheduled reading, reading the plan from Redis or writing it to the JVM every 5 minutes (for example only), which does not put pressure on more order operations.

[0076] See also Figure 3 , which shows a main flow chart of a method for constructing a plan index provided by an embodiment of the present invention, including the following steps:

[0077] S301: Query the currently running plans in the database using the plan start time and end time as query conditions;

[0078] S302: For any plan, create an inverted index based on the item promotion information and plan identifier in the plan;

[0079] S303: Determine all plans corresponding to the identifier of any plan, and create a forward index based on the plan identifier;

[0080] S304: Write the inverted index and forward index of each plan into the cache database.

[0081] In the above implementation, for steps S301 to S302, the plan in this solution is a noun, an abstract concept that includes the start and end time of the plan, advertiser information, commission rate, plan type, etc. Items include products and stores. The information contained in the plan created by the advertiser is as follows:

[0082] 1) Store plan: planId (plan ID), popId (store ID), basicRatio (commission ratio), startDate (start date), endDate (end date).

[0083] 2) Category plan: planId (plan ID), cate1 (first-level category ID), cate2 (second-level category ID), cate3 (third-level category ID), commissionRatio (commission ratio), startDate (start date), endDate (end date).

[0084] 3) Hot product plan: planId (plan ID), skuId, commissionRatio (commission ratio), startDate (start date), endDate (end date).

[0085] Using the plan start time and plan end time as query conditions, and the additional condition that the plan is not paused, we query the MySQL database for all plans created by advertisers that meet the requirements, and then create indexes for each one. For any plan, we can create an inverted index based on the item promotion information and referral information in the plan:

[0086] 1) Store plan inverted index: Map <Long,List <long>>planBasicIndex (an inverted index structure), where the Map Key is popId and the Value is a list of store plan IDs corresponding to the popId.

[0087] 2) Category Plan Inverted Index: Map <Long,List <long>>planCateIndex, where the Map Key is cate1_cate2_cate3, and the Value is a list of category plan IDs corresponding to cate1_cate2_cate3.

[0088] 3) Inverted index of hot product plan: Map <Long,List <long>>planGoodsIndex, where the Map Key is skuId and the Value is a list of hot-product plan IDs corresponding to the skuId.

[0089] At the same time, create a plan positive index based on the plan ID:

[0090] 1) Store plan positive index: Map <Long,List <plan>>planBasicMap, where the key is the store plan ID and the value is the list of abstract plans corresponding to that store plan ID. Note that due to the variety of plan types, a single store plan ID may correspond to multiple store plans, so it's best to present them in list format. In practice, you can abstract the information into a unified plan model based on actual needs.

[0091] 2) Category plan positive index: Map <Long,List <plan>>planCateMap, where the Map Key is the category plan ID and the Value is the abstract plan list corresponding to the category plan ID.

[0092] 3) Hot product plan positive ranking index: Map <Long,List <plan>>planGoodsMap, where the Map Key is the hot product plan ID and the Value is the abstract plan list corresponding to the hot product plan ID.

[0093] In step S303, after creating the forward and inverted indexes for each plan, all forward and inverted indices are stored in Redis. To further improve the speed of plan reading, a virtual machine (JVM) is introduced on top of Redis to reduce cache pressure on Redis. Considering that the inverted index only stores keys and has a small amount of data, it does not require many resources, while the forward index stores all plan information and consumes a lot of resources. Therefore, it is preferable to write the plan inverted index in Redis to the JVM.

[0094] Furthermore, to address Redis key expiration, a version number (e.g., v1, v2, v3, etc.) can be added to each inverted index key. Each change accumulates the preset value to upgrade the version number, facilitating future cleanup. Key expiration is affected by the planned end time and is typically greater than it. For example, if the planned end time is 2021 / 04 / 03, the key expiration date would be set to 2021 / 04 / 04. If key expiration is not considered, the key will continue to occupy Redis resources, increasing resource costs. Furthermore, since the key of each generated inverted index is different, it will not affect the operation of existing online data.

[0095] For forward index plans, use JVM commands to check remaining JVM memory resources (e.g., by setting a visual interface). If sufficient JVM memory is available, write to the JVM to speed up plan acquisition. Furthermore, to minimize the use of Redis resources by forward indexes, it's best to represent all attributes in the forward index plan object using Java primitive data types.

[0096] When creating a plan, advertisers also need to create a plan-webmaster binding relationship for each plan, including planId (plan ID), unionId (promoter ID), startDate (start date), and endDate (end date). A plan can be promoted by multiple promoters, and each promoter can promote multiple plans, creating a many-to-many relationship. Therefore, for some plans, you can specify promoters for promotion, such as Plan 1 - Promoter 1, Promoter 2, Promoter 3. The plan information can include a list of promoters promoting the plan.

[0097] Considering that the planned webmaster binding relationship also needs to be stored in Redis, it is also necessary to generate the planned inverted index and forward index according to the above method. Usually, the planned webmaster binding relationship inverted index and forward index are generated:

[0098] 1) Plan the webmaster binding relationship inverted index: Map <Long,List <long>>planGoodsIndex, where the Map Key is unionId and the Value is a list of plan IDs corresponding to unionId.

[0099] 2) Plan the webmaster binding relationship positive index: Map <Long,List <unionplan>>unionPlanMap, where the Map Key is the plan ID and the Value is a list of plan site owner binding relationships corresponding to the plan ID.

[0100] Without the CQRS architecture, building the planned inverted and forward indexes would consume significant JVM resources. If high traffic and concurrency occur, the system could crash due to JVM resource exhaustion. Therefore, relying on a Redis cluster reduces JVM resource usage and prevents system crashes. Using the CRQS architecture separates planned read and write operations, with read operations performed by one application and write operations by another, with Redis used in between for data storage and retrieval.

[0101] In the method provided in the above embodiment, Redis is designed based on memory. Compared with MySQL, it can carry more order information and bear some of the pressure on MySQL. Considering that the virtual machine has faster reading and writing speed than Redis, a virtual machine is further introduced to reduce the cache pressure of Redis.

[0102] See also Figure 4 , which shows a main flow chart of a commission data processing method provided by an embodiment of the present invention, including the following steps:

[0103] S401: After receiving an order for an item, obtain item promotion information and promoter information in the order information, and query an inverted index corresponding to the item promotion information and promoter information; wherein the access link for the item is obtained by clicking on a plan, which is created by an advertiser and promoted by a promoter;

[0104] S402: Read the plan identifier in the inverted index, determine the forward index corresponding to the plan identifier, obtain the plan list in the forward index, and then filter out multiple plans whose order times fall within the range of the plan start time and end time;

[0105] S403: The plan with the highest priority among the multiple plans is used as the target plan to calculate the commission amount to be paid to the promoter based on the order amount and the commission ratio in the target plan.

[0106] In the above embodiment, for step S401, the promoter promotes the item information to the user through the promotion plan. The user clicks on the item information and can access the item through the access link therein. If the user then places an order, a certain commission must be paid to the promoter. The order information includes:

[0107] 1) Item information: skuId, venderId (store ID), cate1 (first-level category), cate2 (second-level category), cate3 (third-level category), pop (whether it is a pop product)

[0108] 2) Customer information: unionId (customer ID), unionUserLevel (level)

[0109] 3) Order information: orderId, orderTime (order time)

[0110] The e-commerce advertising alliance platform establishes a communication link with the e-commerce platform. After receiving a user's order for a promoted item, it can obtain the recommended customer information and the promoted item information from the order information. Then, using the item information as the key, it searches the corresponding inverted index. The key here can include one or more of the item's store ID, category ID, and skuId. The inverted index here is read from the JVM:

[0111] 1) Store plan inverted index: Map <Long,List <long>>planBasicIndex (an inverted index structure), where the Map Key is popId and the Value is a list of store plan IDs corresponding to the popId.

[0112] 2) Category Plan Inverted Index: Map <Long,List <long>>planCateIndex, where the Map Key is cate1_cate2_cate3, and the Value is a list of category plan IDs corresponding to cate1_cate2_cate3.

[0113] 3) Inverted index of hot product plan: Map <Long,List <long>>planGoodsIndex, where the Map Key is skuId and the Value is a list of hot-product plan IDs corresponding to the skuId.

[0114] You can also use the pusher ID as the key to find the corresponding inverted index: Plan the webmaster binding relationship inverted index: Map <Long,List <long>>planGoodsIndex, where the Map Key is unionId and the Value is a list of plan IDs corresponding to unionId.

[0115] For step S402, the plan identifier list in the inverted index found according to the item promotion information and the plan identifier in the inverted index found according to the promoter identifier are intersected to obtain the plan id for subsequent use. The plan id is the key of the forward index, so the value of the forward index, that is, the plan list, can be obtained. For example, the planId in planBasicIndex is read according to the popId (store id) in the item promotion information, and then the corresponding plan list is obtained from planBasicMap through planId. It should be noted that the forward index will be stored in the JVM if the JVM resources are sufficient, otherwise it will remain in Redis, so the forward index here can be obtained from Redis or JVM.

[0116] The order information includes the order time, and the end time of some plans may be earlier than the order time, or the start time may be later than the order time. Therefore, after obtaining the plan list, multiple plans whose order times are within the start and end time range of the plan are filtered out.

[0117] In step S403, when advertisers create plans, they set different priorities based on different plan types, such as hot products > categories > stores, hot products > stores > categories. Therefore, the list of qualified plans that are screened out is sorted by priority, etc. If there is only one first plan with the highest priority, then that first plan is used as the target plan. Otherwise, the screening continues. The commission ratio is prioritized, and the second plan with the highest commission ratio is screened out from the first plan. If there is only one second plan, then that second plan is used as the target plan. Otherwise, the screening continues, and the third plan with the earliest creation time is selected as the target plan.

[0118] Each plan includes the start and end time of the plan, advertiser information, commission rate, plan type, etc. Therefore, by multiplying the commission rate in the target plan by the user's order amount, you can get the commission amount to be paid to the promoter.

[0119] The method provided in the above embodiment establishes forward and inverted indexes of plans, avoiding the process of searching and comparing one by one, thereby improving the query speed; even if multiple plans are queried, they will continue to be screened by the plan start and end time, priority level, commission ratio, and creation time, thereby improving the accuracy of the calculation of the commission amount.

[0120] The method provided in the embodiment of the present invention addresses the problem that the existing MySQL has too many stored plans, resulting in slow plan queries and possible crashes. A plan query solution based on forward and inverted indexes and a CQRS architecture is proposed:

[0121] 1) The CQRS architecture separates the read and write operations of the plan, making it easier to maintain.

[0122] 2) Establishing forward and inverted indexes avoids the process of searching and comparing one by one;

[0123] 3) When there is less planning information and sufficient JVM resources, the forward index can also be written to memory to improve interface performance. Otherwise, only the inverted index is stored in the JVM. Although some performance is lost, the stability and availability of the system are improved. In the face of growing promotion, there will be no storage bottleneck.

[0124] See also Figure 5 , which shows a schematic diagram of the main modules of a commission data processing device 500 provided by an embodiment of the present invention, including:

[0125] Query module 501 is configured to, upon receiving an order for an item, obtain item promotion information and promoter information from the order information, and query an inverted index corresponding to the item promotion information and promoter information; wherein the access link for the item is obtained by clicking on a plan, which is created by an advertiser and promoted by a promoter;

[0126] A screening module 502 is configured to read the plan identifier in the inverted index, determine the forward index corresponding to the plan identifier, obtain a plan list in the forward index, and then screen out multiple plans whose order times fall within the range of the plan start and end times;

[0127] The calculation module 503 is used to use the plan with the highest priority among the multiple plans as the target plan to calculate the commission amount paid to the promoter based on the order amount and the commission ratio in the target plan.

[0128] The implementation device of the present invention also includes an index creation module, which is used to:

[0129] Use the plan start time and end time as query conditions to query the plans currently in operation in the database;

[0130] For any plan, create an inverted index based on the item promotion information and plan identifier in the plan; and

[0131] Determine all plans corresponding to the identifier of any one of the plans, and create a forward index based on the plan identifiers;

[0132] Write the inverted index and forward index of each plan into the cache database.

[0133] In the implementation device of the present invention, the plan includes at least one of a store plan, a category plan, and a hot product plan;

[0134] For the store plan, the key name of the inverted index is the store ID, and the key value is the list of store plan IDs corresponding to the store ID; the key name of the forward index is the store plan ID, and the key value is the list of store plans corresponding to the store plan ID;

[0135] For the category plan, the key name of the inverted index is composed of the first-level category identifier, second-level category identifier, and third-level category identifier in the plan in sequence, and the key value is the category plan identifier list corresponding to the inverted index key name; the key name of the forward index is the category plan identifier, and the key value is the category plan list corresponding to the category plan identifier;

[0136] For the hot product plan, the key name of the inverted index is the item ID, and the key value is the hot product plan ID list corresponding to the item ID; the key name of the forward index is the hot product plan ID, and the key value is the hot product plan ID list corresponding to the hot product plan ID.

[0137] The implementation device of the present invention also includes an index storage module for:

[0138] Writing the planned inverted index in the cache database to the virtual machine; and

[0139] The remaining resource size of the virtual machine after writing the planned inverted index is calculated. If the remaining resource size is greater than the resource size occupied by the planned forward index, the planned forward index in the cache database is written into the virtual machine, otherwise no processing is performed.

[0140] The implementation device of the present invention also includes a version adding module for:

[0141] A preset value is accumulated to the previous version number to generate the current version number, and the current version number is added to the key name of each inverted index and stored.

[0142] The implementation device of the present invention also includes an expired cleaning module for:

[0143] In the cache database, for a plan, it is determined whether a preset clearing time point of the plan has been reached. If so, the plan is filtered.

[0144] The implementation device of the present invention further includes a format changing module, which is used to:

[0145] After the plan forward index is written to the cache database, the attributes of each plan are represented using a preset data format type.

[0146] The implementation device of the present invention also includes a plan station owner binding relationship, which is used to store the binding relationship between the plan and the promoter;

[0147] The device further comprises:

[0148] Create an inverted index and a forward index of the planned webmaster binding relationship and write them into the cache database together; the key name of the inverted index is the pusher ID, and the key value is the list of plan IDs corresponding to the pusher ID; the key name of the forward index is the plan ID, and the key value is the list of planned webmaster binding relationships corresponding to the plan ID;

[0149] An intersection process is performed on the plan identifier list in the inverted index found according to the item promotion information and the plan identifier list in the inverted index found according to the promoter identifier.

[0150] In the embodiment of the present invention, the calculation module 503 is used to:

[0151] Filtering a first plan with the highest priority from the multiple plans, and determining whether the number of the first plan is one;

[0152] If there is one, the first plan is used as the target plan. Otherwise, the second plan with the highest commission rate is selected from the first plan, and the number of the second plan is determined to be one.

[0153] If there is one, the second plan is used as the target plan; otherwise, the third plan with the earliest creation time is selected from the second plan, and the third plan is used as the target plan.

[0154] In addition, the specific implementation content of the device in the embodiment of the present invention has been described in detail in the above method, so the repeated content will not be described again here.

[0155] Figure 6 An exemplary system architecture 600 to which embodiments of the present invention may be applied is shown, including terminal devices 601 , 602 , 603 , a network 604 and a server 605 (only an example).

[0156] Terminal devices 601, 602, and 603 can be various electronic devices with display screens and support web browsing, and are installed with various communication client applications. Users can use terminal devices 601, 602, and 603 to interact with server 605 through network 604 to receive or send messages, etc.

[0157] The network 604 is used to provide a medium for communication links between the terminal devices 601, 602, 603 and the server 605. The network 604 may include various connection types, such as wired or wireless communication links or fiber optic cables.

[0158] The server 605 may be a server that provides various services, and is used to perform operations such as receiving order information, querying forward and reverse indexes, screening target plans, and calculating payment commissions.

[0159] It should be noted that the method provided in the embodiment of the present invention is generally executed by the server 605 , and accordingly, the device is generally set in the server 605 .

[0160] It should be understood that Figure 6 The number of terminal devices, networks and servers in the embodiment is merely illustrative. Any number of terminal devices, networks and servers may be provided as required.

[0161] Reference below Figure 7 , which shows a schematic structural diagram of a computer system 700 of a terminal device suitable for implementing an embodiment of the present invention. Figure 7 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0162] like Figure 7 As shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage unit 708 into a random access memory (RAM) 703. Various programs and data required for the operation of the system 700 are also stored in the RAM 703. The CPU 701, ROM 702, and RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0163] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, and the like; an output section 707 including devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), and a speaker; a storage section 708 including a hard disk; and a communication section 709 including a network interface card such as a LAN card or a modem. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, or a semiconductor memory, is installed in the drive 710 as needed, so that computer programs read therefrom can be installed into the storage section 708 as needed.

[0164] In particular, according to the embodiments disclosed in the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, the embodiments disclosed in the present invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program comprising program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 709, and / or installed from a removable medium 711. When the computer program is executed by the central processing unit (CPU) 701, the above-mentioned functions defined in the system of the present invention are executed.

[0165] It should be noted that the computer-readable medium described in the present invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media can include, but are not limited to, an electrical connection having one or more conductors, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. This propagated data signal can take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. Program code embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wireline, optical fiber cable, RF, or any suitable combination thereof.

[0166] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the above-mentioned module, program segment, or a part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0167] The modules described in the embodiments of the present invention may be implemented in software or hardware. The modules described may also be located within a processor. For example, a processor may be described as including a query module, a screening module, and a calculation module. The names of these modules do not, in some cases, limit the modules themselves. For example, a calculation module may also be described as a "commission calculation module."

[0168] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiments, or may exist independently without being incorporated into the device. The computer-readable medium carries one or more programs, and when the one or more programs are executed by the device, the device includes:

[0169] After receiving an order for an item, obtaining item promotion information and promoter information in the order information, and querying an inverted index corresponding to the item promotion information and the promoter information; wherein the access link for the item is obtained by clicking on a plan, which is created by an advertiser and promoted by a promoter;

[0170] Read the plan identifier in the inverted index, determine the forward index corresponding to the plan identifier, obtain the plan list in the forward index, and then filter out multiple plans whose order times are within the range of the plan start time and end time;

[0171] The plan with the highest priority among the multiple plans is used as the target plan to calculate the commission amount paid to the promoter based on the order amount and the commission ratio in the target plan.

[0172] According to the technical solution of the embodiment of the present invention, to address the problem that the existing MySQL stores too many plans, resulting in slow plan queries and possible crashes, a plan query solution based on forward and inverted indexes and CQRS architecture is proposed:

[0173] 1) The CQRS architecture separates the read and write operations of the plan, making it easier to maintain.

[0174] 2) Establishing forward and inverted indexes avoids the process of searching and comparing one by one;

[0175] 3) When there is less planning information and sufficient JVM resources, the forward index can also be written to memory to improve interface performance. Otherwise, only the inverted index is stored in the JVM. Although some performance is lost, the stability and availability of the system are improved. In the face of growing promotion, there will be no storage bottleneck.

[0176] The above specific embodiments do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.< / long> < / long> < / long> < / long> < / unionplan> < / long> < / plan> < / plan> < / plan> < / long> < / long> < / long>

Claims

1. A commission data processing method, characterized in that: include: After receiving an order for an item, obtaining item promotion information and promoter information in the order information, and querying an inverted index corresponding to the item promotion information and the promoter information; wherein the access link for the item is obtained by clicking on a plan, which is created by an advertiser and promoted by a promoter; Reading the plan identifier in the inverted index, determining the forward index corresponding to the plan identifier, obtaining a plan list in the forward index, and then filtering out multiple plans whose order times fall within the range of the plan start time and end time; wherein, the plan identifier in the inverted index found based on the product promotion information and the plan identifier in the inverted index found based on the customer promotion information are intersected to obtain the plan identifier; The plan with the highest priority among the multiple plans is used as the target plan to calculate the commission amount paid to the promoter based on the order amount and the commission ratio in the target plan.

2. The method according to claim 1, characterized in that Before querying the inverted index corresponding to the item promotion information and the referrer information, the method further includes: Use the plan start time and end time as query conditions to query the plans currently in operation in the database; For any plan, create an inverted index based on the item promotion information and plan identifier in the plan; and Determine all plans corresponding to the identifier of any one of the plans, and create a forward index based on the plan identifiers; Write the inverted index and forward index of each plan into the cache database.

3. The method according to claim 2, characterized in that The plan includes at least one of the following: store plan, category plan, and hot product plan; For the store plan, the key name of the inverted index is the store ID, and the key value is the list of store plan IDs corresponding to the store ID; the key name of the forward index is the store plan ID, and the key value is the list of store plans corresponding to the store plan ID; For the category plan, the key name of the inverted index is composed of the first-level category identifier, second-level category identifier, and third-level category identifier in the plan in sequence, and the key value is the category plan identifier list corresponding to the inverted index key name; the key name of the forward index is the category plan identifier, and the key value is the category plan list corresponding to the category plan identifier; For the hot product plan, the key name of the inverted index is the item ID, and the key value is the list of hot product plan IDs corresponding to the item ID; The key name of the forward index is the hot product plan ID, and the key value is the hot product plan list corresponding to the hot product plan ID.

4. The method according to claim 2 or 3, characterized in that After writing the inverted index and forward index of each plan into the cache database, the following steps are also included: Writing the planned inverted index in the cache database to the virtual machine; and The remaining resource size of the virtual machine after writing the planned inverted index is calculated. If the remaining resource size is greater than the resource size occupied by the planned forward index, the planned forward index in the cache database is written into the virtual machine, otherwise no processing is performed.

5. The method according to claim 2 or 3, characterized in that Also includes: A preset value is accumulated to the previous version number to generate the current version number, and the current version number is added to the key name of each inverted index and stored.

6. The method according to claim 2 or 3, characterized in that Also includes: In the cache database, for a plan, it is determined whether a preset clearing time point of the plan has been reached. If so, the plan is filtered.

7. The method according to claim 2 or 3, characterized in that Also includes: After the plan forward index is written to the cache database, the attributes of each plan are represented using a preset data format type.

8. The method according to claim 1, characterized in that It also includes the plan site owner binding relationship, which is used to store the binding relationship between the plan and the promoter; The method further comprises: Create an inverted index and a forward index of the planned webmaster binding relationship and write them into the cache database together; the key name of the inverted index is the pusher ID, and the key value is the list of plan IDs corresponding to the pusher ID; the key name of the forward index is the plan ID, and the key value is the list of planned webmaster binding relationships corresponding to the plan ID; An intersection process is performed on the plan identifier list in the inverted index found according to the item promotion information and the plan identifier list in the inverted index found according to the promoter identifier.

9. The method according to claim 1, characterized in that The step of taking the plan with the highest priority among the multiple plans as the target plan includes: Filtering a first plan with the highest priority from the multiple plans, and determining whether the number of the first plan is one; If there is one, the first plan is used as the target plan. Otherwise, the second plan with the highest commission rate is selected from the first plan, and the number of the second plan is determined to be one. If there is one, the second plan is used as the target plan; otherwise, the third plan with the earliest creation time is selected from the second plan, and the third plan is used as the target plan.

10. A commission data processing device, characterized in that: include: a query module configured to, upon receiving an order for an item, obtain item promotion information and promoter information in the order information, and query an inverted index corresponding to the item promotion information and promoter information; wherein the access link for the item is obtained by clicking on a plan, which is created by an advertiser and promoted by a promoter; a screening module configured to read the plan identifier in the inverted index, determine the forward index corresponding to the plan identifier, obtain a plan list in the forward index, and then screen out a plurality of plans whose order times fall within the range of the planned start time and end time; wherein the plan identifier in the inverted index found based on the product promotion information and the plan identifier in the inverted index found based on the customer promotion information are intersected to obtain the plan identifier; The calculation module is used to take the plan with the highest priority among the multiple plans as the target plan, so as to calculate the commission amount paid to the promoter based on the order amount and the commission ratio in the target plan.

11. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 9.

12. A computer-readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.

Citation Information

Patent Citations

  • Data indexing method and device and computer readable storage medium

    CN111625617A