Method and device for updating rights and interests data
By determining the equity data change flow in the points update and processing detailed updates asynchronously, the problems of low points update efficiency and long response time are solved, and more efficient and stable equity data updates are achieved.
Patent Information
- Application Number
- CN202311303759.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-10
- Publication Date
- 2025-04-11
AI Technical Summary
The amount of data involved in points update is large, resulting in low efficiency of points update and too long response time.
By responding to the received order information, the target user's equity data change flow is determined, and the user's equity data flow and quota is updated according to the flow, and the write-off message is pushed to the message queue, and the update of the equity data details is processed asynchronously.
It improves the efficiency of equity data update, ensures the stability of equity data update services, reduces response time, and optimizes the user experience.
Smart Images

Figure CN119807208A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of big data technology, and in particular to a method and device for updating equity data. Background Art
[0002] Points are a kind of user rights data. In some e-commerce scenarios, users can use points to redeem goods or deduct part of the price of goods. For example, in order to protect the health of employees, companies regularly issue health points to employees, and employees can use health points to buy daily necessities, make appointments for physical examinations, etc. After using points, you need to update the points and write off the used points. The used points usually include multiple point details. For example, if a user uses points from multiple issuance batches to purchase goods, each issuance batch of points corresponds to a point detail. After purchasing goods, you need to update the points from multiple issuance batches.
[0003] In the process of implementing the present invention, the inventors found that the prior art has at least the following problems:
[0004] The amount of data involved in the integral update is large, the integral update efficiency is low, and the response time is too long. Summary of the invention
[0005] In view of this, an embodiment of the present invention provides a method and device for updating equity data, which can improve the efficiency of equity data updating and ensure the stability of equity data updating service.
[0006] To achieve the above objective, according to a first aspect of an embodiment of the present invention, a method for updating equity data is provided, comprising:
[0007] In response to receiving the order information of the target user, determining the equity data change flow corresponding to the order information, and updating the equity data flow and equity data quota of the target user according to the equity data change flow;
[0008] Pushing the equity data write-off message corresponding to the order information to the message queue;
[0009] In response to receiving a rights and interests data write-off request, obtaining a rights and interests data write-off message corresponding to the order information from the message queue, querying the rights and interests data change flow according to the rights and interests data write-off message, and updating the rights and interests data details of the target user according to the rights and interests data change flow.
[0010] Optionally, updating the rights and interests data details of the target user according to the rights and interests data change flow includes:
[0011] sorting the equity data details according to the expiration time points of the equity data details;
[0012] Obtaining a target equity data detail from the sorted equity data details, wherein the equity data amount of the target equity data detail is equal to the equity data amount of the equity data change flow;
[0013] The target equity data details are written off.
[0014] Optionally, the target equity data details are obtained from the sorted equity data details, including:
[0015] Repeat the amount comparison step until the equity data amount of the acquired equity data detail is greater than or equal to the equity data amount of the equity data change flow:
[0016] The amount comparison step includes:
[0017] According to the preset equity data detail acquisition amount, a corresponding number of equity data details are acquired from the sorted equity data details, and the equity data amount of the acquired equity data details is compared with the equity data amount of the equity data change flow;
[0018] When the equity data amount of the acquired equity data details is equal to the equity data amount of the equity data change flow, the acquired equity data details are used as the target equity data details;
[0019] In the case where the equity data amount of the acquired equity data details is greater than the equity data amount of the equity data change flow, based on the expiration time point of the equity data details, some equity data details are removed from the most recently acquired equity data details, so that the equity data amount of the remaining acquired equity data details is equal to the equity data amount of the equity data change flow, and the remaining acquired equity data details are used as the target equity data details.
[0020] Optionally, the method further comprises:
[0021] In response to receiving a request for timed write-off of equity data, obtaining a target equity data change flow of equity data details that have not been written off within a preset write-off period;
[0022] The corresponding equity data details are updated according to the target equity data change flow.
[0023] Optionally, the order information includes product information; before determining the equity data change flow corresponding to the order information, the method further includes:
[0024] Filtering target product information that matches a preset data information association set from the product information;
[0025] The equity data type corresponding to the target product information is determined according to a preset equity data type set, and the target product information and the equity data type are used to determine the equity data change flow corresponding to the order information.
[0026] Optionally, before determining the equity data change flow corresponding to the order information, the method further includes:
[0027] A preset update responsibility chain is used to determine whether the order information has passed verification, wherein the update responsibility chain includes multiple verification tasks, and each verification task includes multiple verification nodes.
[0028] Optionally, the method further comprises:
[0029] Before determining the equity data change flow corresponding to the order information, obtaining a first distributed lock, and after updating the equity data flow and equity data quota of the target user according to the equity data change flow, releasing the first distributed lock;
[0030] Before querying the equity data change flow according to the equity data cancellation message, a second distributed lock is acquired, and after updating the equity data details of the target user according to the equity data change flow, the second distributed lock is released.
[0031] According to a second aspect of an embodiment of the present invention, there is provided a device for updating equity data, comprising:
[0032] A first updating module, configured to, in response to receiving order information of a target user, determine a rights and interests data change flow corresponding to the order information, and update the rights and interests data flow and rights and interests data quota of the target user according to the rights and interests data change flow;
[0033] A message push module, used to push the equity data write-off message corresponding to the order information to a message queue;
[0034] The second update module is used to obtain the equity data cancellation message corresponding to the order information from the message queue in response to receiving the equity data cancellation request, query the equity data change flow according to the equity data cancellation message, and update the equity data details of the target user according to the equity data change flow.
[0035] Optionally, updating the rights and interests data details of the target user according to the rights and interests data change flow includes:
[0036] sorting the equity data details according to the expiration time points of the equity data details;
[0037] Obtaining a target equity data detail from the sorted equity data details, wherein the equity data amount of the target equity data detail is equal to the equity data amount of the equity data change flow;
[0038] The target equity data details are written off.
[0039] Optionally, the target equity data details are obtained from the sorted equity data details, including:
[0040] Repeat the amount comparison step until the equity data amount of the acquired equity data detail is greater than or equal to the equity data amount of the equity data change flow:
[0041] The amount comparison step includes:
[0042] According to the preset equity data detail acquisition amount, a corresponding number of equity data details are acquired from the sorted equity data details, and the equity data amount of the acquired equity data details is compared with the equity data amount of the equity data change flow;
[0043] When the equity data amount of the acquired equity data details is equal to the equity data amount of the equity data change flow, the acquired equity data details are used as the target equity data details;
[0044] In the case where the equity data amount of the acquired equity data details is greater than the equity data amount of the equity data change flow, based on the expiration time point of the equity data details, some equity data details are removed from the most recently acquired equity data details, so that the equity data amount of the remaining acquired equity data details is equal to the equity data amount of the equity data change flow, and the remaining acquired equity data details are used as the target equity data details.
[0045] Optionally, the device further comprises:
[0046] A flow acquisition module, for, in response to receiving a request for timed write-off of equity data, acquiring a target equity data change flow of equity data details that have not been written off within a preset write-off period;
[0047] The third updating module is used to update the corresponding equity data details according to the target equity data change flow.
[0048] Optionally, the order information includes commodity information; and the device further includes:
[0049] A screening module, used to screen out target product information matching a preset data information association set from the product information;
[0050] The determination module is used to determine the equity data type corresponding to the target product information according to a preset equity data type set, and the target product information and the equity data type are used to determine the equity data change flow corresponding to the order information.
[0051] Optionally, the device further comprises:
[0052] The verification module is used to determine whether the order information passes the verification by using a preset update responsibility chain, wherein the update responsibility chain includes a plurality of verification tasks, and each verification task includes a plurality of verification nodes.
[0053] Optionally, the device further comprises:
[0054] A first locking module, configured to obtain a first distributed lock before determining the equity data change flow corresponding to the order information, and release the first distributed lock after updating the equity data flow and equity data quota of the target user according to the equity data change flow;
[0055] The second locking module is used to obtain a second distributed lock before querying the equity data change flow according to the equity data cancellation message, and release the second distributed lock after updating the equity data details of the target user according to the equity data change flow.
[0056] According to a third aspect of an embodiment of the present invention, there is provided an electronic device, including:
[0057] one or more processors;
[0058] a storage device for storing one or more programs,
[0059] When the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any one of the above embodiments.
[0060] According to a fourth 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, the method described in any one of the above embodiments is implemented.
[0061] An embodiment of the above invention has the following advantages or beneficial effects: asynchronously updating the equity data flow and the equity data details, delaying the processing of the equity data details with a large amount of data, which can improve the efficiency of the equity data update, ensure the stability of the equity data update service, reduce the response time of the equity data update, and optimize the user experience; sorting the equity data details according to the expiration time point of the equity data details, can use the equity data details that are about to expire, avoid the equity data from being unusable due to expiration, effectively guarantee the user's rights, and further optimize the user experience; repeatedly obtaining a fixed number of equity data details and comparing them with the equity data flow, avoid obtaining a large amount of data at one time, and can ensure the updating of the equity data details. Improve the interface performance, improve the response efficiency and the accuracy of the equity data update; regularly write off the target equity data change flow for the equity data details that have not been written off, avoid missing some equity data details update operations due to database write timeouts, message queue consumption exceptions, etc., accurately update the equity data, and effectively guarantee user rights; determine the goods suitable for equity data redemption, and use the update responsibility chain to verify the order information, which can improve the accuracy and security of the equity data update and avoid the theft of equity data; use multiple distributed locks to control the equity data update process to ensure that only serial updates of the same user's equity data are allowed, improve the accuracy of the equity data update, and avoid repeated updates of the equity data.
[0062] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0064] Figure 1 is a schematic diagram of the main process of the method for updating equity data according to an embodiment of the present invention;
[0065] Figure 2 is a schematic diagram of an update responsibility chain of a method for updating equity data according to a reference embodiment of the present invention;
[0066] Figure 3 is a schematic diagram of the overall process of a method for updating equity data according to a reference embodiment of the present invention;
[0067] Figure 4 is a schematic diagram of the technical process of a method for updating equity data according to a reference embodiment of the present invention;
[0068] Figure 5 is a schematic diagram of the main process of a method for updating equity data according to a reference embodiment of the present invention;
[0069] Figure 6 is a schematic diagram of the main process of a method for updating equity data according to another reference embodiment of the present invention;
[0070] Figure 7 is a schematic diagram of the main process of a method for updating equity data according to yet another reference embodiment of the present invention;
[0071] Figure 8 is a schematic diagram of main modules of a device for updating equity data according to an embodiment of the present invention;
[0072] Fig. 9 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0073] Fig.10 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0074] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill 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 clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0075] It should be noted that in the technical solution of the present invention, the collection, use, storage, sharing and transfer of user personal information involved are in compliance with the provisions of relevant laws and regulations, and it is necessary to inform the user and obtain the user's consent or authorization. When applicable, the user's personal information is de-identified and / or anonymized and / or encrypted.
[0076] Points are a kind of rights and interests data of users. In some e-commerce scenarios, users can use points to redeem goods or deduct part of the price of goods. For example, in order to protect the health of employees, companies regularly issue health points to employees, and employees can use health points to buy daily necessities, make appointments for physical examinations, etc. After using points, you need to update the points and write off the used points. The used points usually include multiple rights and interests data details. For example, if a user uses points from multiple issuance batches to purchase goods, each issuance batch of points corresponds to a rights and interests data detail. After purchasing goods, you need to update the points from multiple issuance batches.
[0077] The amount of data involved in the point update is large, the point update efficiency is low, and the response time is too long. In addition, when updating a large number of point details, the interface performance is poor and the database reading and writing efficiency is low.
[0078] In view of this, according to a first aspect of an embodiment of the present invention, a method for updating equity data is provided.
[0079] Figure 1 FIG. 1 is a schematic diagram of the main process of the method for updating equity data according to an embodiment of the present invention. Figure 1 As shown, the method for updating equity data according to the embodiment of the present invention mainly includes the following steps S101 to S103.
[0080] Step S101, in response to receiving order information of a target user, determining a rights and interests data change flow corresponding to the order information, and updating the rights and interests data flow and rights and interests data quota of the target user according to the rights and interests data change flow.
[0081] The target user purchases goods on e-commerce platforms, points malls and other platforms. The platform generates order information based on the goods purchased by the target user, and then sends the order information to the executive body of the embodiment of the present invention. After receiving the order information, the executive body of the embodiment of the present invention parses the order information to determine the goods that can be exchanged with the equity data or the goods that can be deducted from the price of the goods with the equity data. The equity data change flow is determined based on the above-mentioned goods. The equity data change flow includes: the amount before the equity data change, the amount after the equity data change, the amount of this equity data change, the equity data change type, etc., among which the equity data change type includes: equity data issuance, consumption deduction, cancellation and return, etc.
[0082] The target user's identity information is determined based on the order information, such as the target user's user name, user code, etc. The target user's equity data quota and equity data flow are determined based on the target user's identity information, wherein the equity data quota indicates the total equity data quota owned by the target user, and the equity data flow indicates the update status of the equity data quota owned by the target user. For example, the target user's equity data quota is 500 points, and the target user's equity data flow includes: issuing equity data 600 points, deducting 100 points for consumption, etc. According to the previously determined equity data change flow, the target user's equity data quota is updated, and the equity data change flow is written into the target user's equity data flow.
[0083] After determining the equity data change flow, determine the corresponding deduction amount, and determine the amount paid by the target user based on the deduction amount and the total amount included in the order information. Return the deduction amount corresponding to the equity data change flow, the updated target user's equity data quota, and equity data flow to the target user so that the target user can understand the use of the equity data. It should be noted that this step does not update the equity data details, that is, there is no need to determine which equity data to write off and which equity data to retain. Only the equity data quota and equity data flow are updated, and the update step of the equity data details is postponed.
[0084] Exemplarily, the order information of the target user includes: {'userId':'1'; 'item1':'A1'; '*item2':'A2'}, wherein "'userId':'1'" indicates that the user code of the target user is "1", and "'item1':'A1'; 'item2':'*A2'" indicates that the order information includes two commodities, namely, commodity A1 and commodity A2, wherein commodity A2 has an asterisk "*", indicating that the commodity is a commodity that uses equity data to offset the commodity price; querying the price deduction rules, determining that the equity data used is 50 points, and 100 points are stored in the equity data account of the target user, therefore, determining that the equity data change flow of the target user includes: the amount before the equity data change is 100 points, the amount after the equity data change is 50 points, the amount of this equity data change is 50 points, and the equity data change type is consumption deduction. Add the above equity data change flow to the target user's equity data flow, and update the target user's equity data quota from 100 points to 50 points.
[0085] According to the order information, the target user's equity data change flow is quickly determined, and the target user's equity data quota and equity data flow are updated. Compared with the equity data details, the equity data quota and equity data flow have a smaller amount of data. The post-update operation of the equity data details can enable users to pay the required amount of the order in time, understand the usage of equity data, reduce the time users wait for payment, and optimize the user experience.
[0086] According to a reference embodiment of the present invention, the order information includes one or more product information; before determining the rights and interests data change flow corresponding to the order information, the method further includes: filtering out target product information that matches the pre-set data information association set from the product information, specifically, the product that can be exchanged with the rights and interests data or the product price can be deducted with the rights and interests data as the rights and interests data product, and the data information association set is a collection of associations between the rights and interests data and the product information. The data information association set is queried using the product information included in the order information, and if the data information association set includes the product information, it is determined that the product information successfully matches the data information association set, and the product information is used as the target product information, otherwise, it is determined that the product information fails to match the data information association set.
[0087] Equity data is divided into multiple types. For example, from the perspective of equity data issuance, equity data can be divided into: full-reduction equity data, additional purchase equity data, discount equity data, etc. From the perspective of the validity period of equity data, equity data can be divided into: single-month equity data, quarterly equity data, half-year equity data, annual equity data, etc. From the perspective of the type of redeemed goods, equity data can be divided into: food equity data, clothing equity data, home appliance equity data, etc. The pre-set equity data type set includes the association between goods and equity data types, that is, what type of equity data can be used to redeem or deduct the price of each equity data commodity. Use the target product information to search in the equity data type set to determine the equity data type corresponding to the target product information. After determining the target product information and the equity data type, query the equity data type of the target user. If the target user's equity data type includes the equity data type corresponding to the target product information and the equity data amount also meets the requirements, generate the equity data change flow corresponding to the order information.
[0088] For example, the order information includes: product information B1, product information B2 and product information B3. The pre-set data information association set is queried to obtain "{'product information B2', 'product information B3', 'product information B4'}", so product information B2 and product information B3 are used as target product information; the pre-set rights and interests data type set is queried to obtain "{'B2':'food,80'; 'B3':'clothing,70'}", where "'B2':'food,80'" indicates the rights and interests corresponding to product information B2. The benefit data type is food benefit data, and the corresponding benefit data amount is 80 points. "'B3':'clothing,70'" indicates that the benefit data type corresponding to product information B3 is clothing benefit data, and the corresponding benefit data amount is 70 points. Since the target user only has 100 food benefit data, the benefit data change flow corresponding to the generated order information includes: the amount before the benefit data change is 100 points, the amount after the benefit data change is 20 points, the amount of this benefit data change is 80 points, and the benefit data change type is food consumption deduction.
[0089] Determine the target product information from the product information, and generate the equity data change flow according to the equity data type and equity data amount of the target product information, so as to improve the accuracy of equity data update, flexibly update the equity data owned by the target user according to the order, and ensure the rights and interests of the target user and the platform.
[0090] According to another reference embodiment of the present invention, before determining the equity data change flow corresponding to the order information, the method further includes: using a preset update responsibility chain to determine whether the order information has passed the verification. Specifically, the update responsibility chain includes multiple verification tasks, such as: equity data quota query verification, equity data transaction risk control verification, equity data transaction validity verification, target user identity verification, target user qualification verification, commodity quantity purchase limit verification, etc. Each verification task includes multiple verification nodes. For example, the equity data quota query verification includes: querying the equity data quota, querying the equity data status (for example, normal, locked, expired, etc.), and temporarily storing the queried equity data quota. Multiple verification nodes are interconnected, and multiple verification tasks are interconnected through verification nodes; according to the arrangement order of the verification nodes, the steps corresponding to each verification node are executed in sequence until the steps corresponding to all verification nodes are executed. In the case of failure in step execution, it is determined that the equity data update process has not passed the verification, the equity data is stopped from being updated, and the verification result is returned to the target user so that the target user understands the verification result and is prompted that the target user cannot use the equity data to redeem goods or deduct the price of goods.
[0091] Figure 2is a schematic diagram of an update responsibility chain of a method for updating equity data according to a reference embodiment of the present invention. For example, Figure 2 It shows an update responsibility chain for order information including drugs. Specifically, the update responsibility chain includes: equity data quota query verification, equity data update risk control verification, equity data update validity verification, prescription drug user verification, consignee purchase limit verification, commodity catalog purchase limit verification and other verification tasks. Each verification task includes multiple verification nodes. For example, the verification task "equity data update risk control verification" includes: verification of whether the target user is locked, verification of whether the target user's equity data quota is locked, verification of whether the target user's enterprise is locked, verification of whether the equity data update interface is locked and other verification nodes. After a certain verification node fails to execute, the subsequent verification nodes are stopped and the verification result is returned, prompting the target user that the equity data cannot be used to redeem goods or deduct the price of goods.
[0092] Using the update responsibility chain to verify order information can improve the accuracy and security of equity data updates and prevent equity data from being stolen or false equity data from being used.
[0093] Step S102: Push the equity data write-off message corresponding to the order information to a message queue.
[0094] After determining the rights and interests data change flow corresponding to the order information, a rights and interests data write-off message corresponding to the order information is generated. The rights and interests data write-off message indicates a message for writing off the rights and interests data of the target user and updating the rights and interests data details of the target user. The rights and interests data write-off message includes: the business code of the rights and interests data change flow, the order code corresponding to the order information, the identity information of the target user, etc. The corresponding rights and interests data change flow and the target user can be determined according to the rights and interests data write-off message. The rights and interests data write-off message of the order information is pushed to a pre-set message queue. The message queue is used to temporarily store the rights and interests data write-off message. After the rights and interests data details corresponding to the rights and interests data write-off message are updated, the rights and interests data write-off message is deleted from the message queue. Message queues applicable to embodiments of the present invention include: Kafka, ActiveMQ (i.e., Apache ActiveMQ, a message middleware developed by the Apache Software Foundation), RocketMQ (i.e., Apache RocketMQ, a distributed messaging system), etc.
[0095] Exemplarily, before updating the target user's equity data limit and equity data flow, equity data write-off information corresponding to the order information is generated, and the equity data write-off information includes "{'billId':'bill11'; 'orderId':'order21'; 'userId':'user31'}", wherein "'billId':'bill11'" indicates that the business code of the equity data change flow is "bill11", "'orderId':'order21'" indicates that the order code corresponding to the order information is "order21", and "'userId':'user31'" indicates that the user code of the target user is "user31"; the above equity data write-off message is pushed to the message queue.
[0096] The equity data write-off message is used to associate the equity data change flow of the order information with the equity data details of the target user, so as to facilitate the asynchronous execution of the equity data details update steps, avoid updating a large amount of equity data details in a short period of time, and effectively ensure the efficiency of equity data update.
[0097] Step S103, in response to receiving the equity data write-off request, obtaining the equity data write-off message corresponding to the order information from the message queue, querying the equity data change flow according to the equity data write-off message, and updating the equity data details of the target user according to the equity data change flow.
[0098] The equity data write-off request may be initiated automatically or manually. For example, after the equity data write-off message is pushed to the message queue for a period of time, the equity data write-off request is automatically generated, or when the staff finds that a certain order information that uses equity data has not been written off, the equity data write-off request is sent to the execution subject of the embodiment of the present invention. The execution subject of the embodiment of the present invention parses the received equity data write-off request, determines the order code corresponding to the order information, obtains the corresponding equity data write-off information from the message queue according to the order code, obtains the business code of the equity data change flow from the equity data write-off message, and obtains the equity data change flow corresponding to the order information from the database or cache according to the business code of the equity data change flow.
[0099] After obtaining the equity data change flow, the equity data of the target user is written off and the equity data details of the target user are updated according to the amount of the equity data change flow. Specifically, the equity data details represent the amount of different types of equity data of the target user. For example, the equity data details of the target user include: 50 points for food equity data, 70 points for clothing equity data, 90 points for home appliance equity data, etc. The target user includes one or more equity data details. The equity data amount to be written off is determined according to the equity data change flow, and the target equity data details for writing off are screened out from the equity data details of the target user, and the target equity data details are written off, thereby updating the equity data details of the target user.
[0100] Exemplarily, 10 seconds after the rights and interests data cancellation message is pushed to the message queue, a rights and interests data cancellation request is generated, the rights and interests data cancellation request is parsed to obtain the order code "order22", the rights and interests data cancellation message with the order code "order22" is searched from the message queue, and the business code of the rights and interests data change flow is determined to be "bill13" according to the found rights and interests data cancellation message, and the database is queried to detect the rights and interests data change flow with the business code "bill13", and the rights and interests data change flow is obtained, including "the amount of this rights and interests data change is 60 points, and the type of rights and interests data change is travel consumption deduction"; the target user has three rights and interests data details: accommodation rights and interests data 50 points, travel rights and interests data 70 points, and catering rights and interests data 90 points. Since the type of rights and interests data change is travel consumption deduction, 60 points of the target user's travel rights and interests data are cancelled, and the updated rights and interests data details of the target user include: accommodation rights and interests data 50 points, travel rights and interests data 10 points, and catering rights and interests data 90 points. After updating the rights and interests data details of the target user, the corresponding rights and interests data write-off message in the message queue is deleted.
[0101] Separating the steps of updating equity data details from the steps of updating equity data amounts and equity data flows, and delaying the processing of equity data details with larger data volumes, will help target users pay order amounts in a timely and accurate manner, understand the overall status of equity data updates, avoid users waiting for too long, optimize user experience, and improve the efficiency of updating equity data details and the stability of equity data update services.
[0102] According to a reference embodiment of the present invention, each equity data detail has a corresponding validity period. When the equity data details of the target user are updated according to the equity data change flow, the expiration time point of each equity data detail is determined according to the equity data issuance time and the validity period of the equity data. The equity data details are sorted according to the expiration time point of the equity data details. Specifically, the equity data details are sorted from the nearest to the farthest expiration time point. The target equity data details are obtained from the sorted equity data details, so that the equity data amount of the target equity data details is equal to the equity data amount of the equity data change flow. For example, one equity data detail is obtained each time until the sum of the equity data amounts of the acquired equity data details is equal to the equity data amount of the equity data change flow. After determining the target equity data details, the target equity data details are written off.
[0103] For example, the target user has five equity data details, including: equity data detail C1 (expiration time is 1 day later, equity data quota is 30 points), equity data detail C2 (expiration time is 5 days later, equity data quota is 40 points), equity data detail C3 (expiration time is 3 days later, equity data quota is 20 points), equity data detail C4 (expiration time is 2 days later, equity data quota is 50 points), equity data detail C5 (expiration time is 4 days later, equity data quota is 10 points); sort the equity data details from recent to far according to the expiration time point, and get "equity data quota". "Equity data detail C1, equity data detail C4, equity data detail C3, equity data detail C5, equity data detail C2"; the equity data amount of the equity data change flow is 80 points, and the equity data details are obtained in sequence according to the above sorting, and the target equity data details are determined to be equity data detail C1 and equity data detail C4, and the equity data amount of the target equity data details is equal to 80 points; the equity data of the target user is written off according to the target equity data details, and the updated equity data details of the target user include: equity data detail C2, equity data detail C3 and equity data detail C5.
[0104] By sorting the equity data details according to the expiration time point, the equity data details that are about to expire can be written off first, avoiding the retention of expired and unusable equity data, effectively protecting user rights and optimizing user experience.
[0105] According to another reference embodiment of the present invention, when obtaining the target equity data details from the sorted equity data details, a pre-set equity data detail acquisition amount is set, and the equity data detail acquisition amount represents the number of equity data details of the target user obtained each time when the target equity data details are determined, and the following steps are repeated until the equity data amount of the acquired equity data details is greater than or equal to the equity data amount of the equity data change flow: according to the pre-set equity data detail acquisition amount, a corresponding number of equity data details are acquired from the sorted equity data details, the equity data amounts of the acquired equity data details are summed to obtain a cumulative equity data amount, and the cumulative equity data amount is compared with the equity data amount of the equity data change flow; when the cumulative equity data amount is greater than or equal to the equity data amount of the equity data change flow, the above-mentioned cycle steps are stopped, and at this time, the amount of the equity data details acquired has met the equity data write-off requirement.
[0106] When the equity data amount of the acquired equity data details is equal to the equity data amount of the equity data change flow, the acquired equity data details are directly used as the target equity data details. When the equity data amount of the acquired equity data details is greater than the equity data amount of the equity data change flow, according to the expiration time point of the equity data details, some equity data details are removed from the most recently acquired equity data details, so that the equity data amount of the remaining acquired equity data details is equal to the equity data amount of the equity data change flow, and the remaining acquired equity data details are used as the target equity data details.
[0107] Exemplarily, the equity data details of the target user are sorted according to the expiration time point to obtain "equity data details D1 (equity data quota 20 points), equity data details D2 (equity data quota 40 points), equity data details D3 (equity data quota 60 points), equity data details D4 (equity data quota 10 points), equity data details D5 (equity data quota 30 points), equity data details D6 (equity data quota 50 points)"; the equity data quota of the equity data change flow is 120 points, and the preset equity data detail acquisition quantity is 2, that is, two equity data details of the target user are acquired each time; the first acquisition of equity data details Detail D1 and equity data detail D2, the cumulative equity data amount is 20+40=60 points, which is less than 120 points; the equity data detail D3 and equity data detail D4 are obtained for the second time, and the cumulative equity data amount is 60+60+10=130 points, which is greater than 120 points; therefore, stop obtaining the equity data details of the target user, remove the equity data detail D4 from the equity data details obtained for the second time, so that the cumulative equity data amount is 130-10=120 points, which is equal to the equity data amount of the equity data change flow, therefore, take the equity data details D1, equity data details D2 and equity data details D3 as the target equity data details.
[0108] Repeatedly obtaining a fixed number of equity data details and comparing them with the equity data flow can avoid obtaining a large amount of data at one time, which can ensure the interface performance of updating equity data details and improve response efficiency and the accuracy of equity data updates.
[0109] According to another reference embodiment of the present invention, the method further includes: in response to receiving a timed write-off request for equity data, obtaining a target equity data change flow for which the equity data details have not been written off within a preset write-off period. In the case where the message queue does not consume the equity data write-off request normally or the database times out to submit a transaction for updating the equity data quota or updating the equity data flow, the equity data details cannot be updated normally. Therefore, it is necessary to obtain the target equity data change flow for which the equity data details have not been written off regularly. Specifically, the timed write-off request for equity data is automatically initiated regularly. For example, a timed write-off request for equity data is automatically initiated every hour to obtain the target equity data change flow for which the equity data details have not been written off in time within the past hour. After obtaining the target equity data change flow, the corresponding equity data details are updated according to the target equity data change flow. The specific content of updating the equity data details has been described in detail in other embodiments of the present invention and will not be repeated here. Exemplarily, a timing task is set using the timing framework Quartz to search for target equity data change flow for write-off of unfinished equity data details once every hour; and the searched target equity data change flow is used to update the corresponding equity data details.
[0110] The target equity data change flow for which equity data details have not been written off is regularly written off to avoid missing some equity data details update operations due to database write timeouts, message queue consumption anomalies, etc., effectively ensuring the accuracy of equity data updates and user rights.
[0111] According to another reference embodiment of the present invention, the method further includes: before determining the equity data change flow corresponding to the order information, obtaining a first distributed lock, and after updating the equity data flow and equity data quota of the target user according to the equity data change flow, releasing the first distributed lock. Before querying the equity data change flow according to the equity data cancellation message, obtaining a second distributed lock, and after updating the equity data details of the target user according to the equity data change flow, releasing the second distributed lock. The lock used to update the equity data flow and equity data quota of the target user and the lock used to update the equity data details of the target user are different distributed locks. Each time the equity data account of the target user is locked, it is ensured that only one thread updates the equity data account of the target user at the same time.
[0112] Exemplarily, the update operation of the target user's equity data flow and equity data quota corresponds to an operation code "update#123", and the update operation of the target user's equity data details corresponds to another operation code "update#456"; before determining the equity data change flow corresponding to the order information, a distributed lock E1 is created in the Redis cache according to the operation code "update#123" and the target user's equity data account code, and after the target user's equity data flow and equity data quota are updated according to the equity data change flow, the first distributed lock E1 is released. Before querying the equity data change flow according to the equity data write-off message, a distributed lock E2 is created in the Redis cache according to the operation code "update#456" and the target user's equity data account code, and after the target user's equity data details are updated according to the equity data change flow, the second distributed lock E2 is released.
[0113] Use multiple distributed locks to control the rights and interests data update process, ensure that only serial updates of the rights and interests data of the same user are allowed, improve the accuracy of rights and interests data updates, avoid repeated updates of rights and interests data, and protect the rights and interests of users.
[0114] Figure 3 FIG. 1 is a schematic diagram of the overall process of a method for updating equity data according to a reference embodiment of the present invention. Figure 3As shown, after receiving the order information, the order parameters included in the order information are checked, for example, whether the order parameters are complete, whether the format meets the requirements, etc.; then the order information and the target user are checked using the update responsibility chain, and each check task included in the update responsibility chain is executed in turn. If the check fails, the equity data update process ends. If all the checks are successful, Redis distributed lock 1 is obtained, the equity data change flow is determined, the equity data cancellation message is pushed to the message queue, the equity data flow and equity data quota of the target user are updated, and Redis distributed lock 1 is released. At this time, the update operation of the equity data quota and equity data flow has been completed, and the amount to be paid and the equity data change are returned to the user. After a delay of 10 seconds, Redis distributed lock 2 is obtained, the equity data details of the target user are queried according to the expiration time point, the target equity data details are determined, the equity data details of the target user are updated, and Redis distributed lock 2 is released to determine whether the equity data details have been updated. If so, the equity data update process ends. Otherwise, Redis distributed lock 2 is continued to be obtained, and the execution is cyclic until the equity data details are updated. In addition, a scheduled task is started to obtain the target equity data change details every 2 hours, and then the corresponding equity data details are updated according to the target equity data change flow.
[0115] Figure 4 FIG. 1 is a schematic diagram of a technical process of a method for updating equity data according to a reference embodiment of the present invention. For example, Figure 4 As shown, the update steps of the equity data quota and equity data flow are executed from "Start 1". Specifically, Redis distributed lock 1 is obtained, the equity data change flow is determined, the transaction is started, the equity data quota and equity data flow are updated, the equity data write-off message is pushed, and the Redis distributed lock 1 is released. At this point, the equity data quota and equity data flow have been updated. Then, the update steps of the equity data details are executed from "Start 2". It should be noted that there is a time difference between the above two update steps, which belongs to asynchronous execution. Specifically, Redis distributed lock 2 is obtained, the equity data flow is queried, the equity data details are queried, the target equity data details are screened, the transaction is started, the equity data details are updated, the Redis distributed lock 2 is released, and the corresponding equity data write-off message is consumed. At this point, the equity data details have been updated. In order to prevent the database write timeout or the message queue consumption message abnormality, the update operation is performed on the equity data details that have not completed the update operation from "Start 3" every once in a while. The specific process is the same as the update step indicated by "Start 2". It should be noted that the dotted lines in the figure represent the objects of the equity data update operation, including: Redis cache, database, equity data quota table in the database, equity data flow table, equity data detail table and message queue, etc.
[0116] Figure 5 FIG. 1 is a schematic diagram of the main process of a method for updating equity data according to a reference embodiment of the present invention. Figure 5 As shown, the method for updating the equity data may include:
[0117] Step S501, in response to receiving the order information of the target user, determining the equity data change flow corresponding to the order information, and updating the equity data flow and equity data quota of the target user according to the equity data change flow;
[0118] Step S502, pushing the equity data write-off message corresponding to the order information to the message queue;
[0119] Step S503, in response to receiving the equity data write-off request, obtaining the equity data write-off message corresponding to the order information from the message queue, and querying the equity data change flow according to the equity data write-off message;
[0120] Step S504, sorting the equity data details according to their expiration time points;
[0121] Step S505, obtaining a target equity data detail from the sorted equity data details, the equity data amount of the target equity data detail is equal to the equity data amount of the equity data change flow, and the equity data detail is written off;
[0122] Step S506, in response to receiving the equity data scheduled write-off request, obtaining the target equity data change flow of the equity data details that have not been written off within the preset write-off period, and updating the equity data details according to the target equity data change flow.
[0123] The specific implementation content of the method for updating equity data of the above-mentioned reference embodiment of the present invention has been described in detail in the above-mentioned method for updating equity data, so the repeated content will not be described here.
[0124] Figure 6 FIG. 1 is a schematic diagram of the main process of a method for updating equity data according to another reference embodiment of the present invention. Figure 6 As shown, the method for updating the equity data may include:
[0125] Step S601, in response to receiving order information of a target user, obtaining a first distributed lock;
[0126] Step S602, determining the equity data change flow corresponding to the order information, and updating the equity data flow and equity data quota of the target user according to the equity data change flow;
[0127] Step S603, releasing the first distributed lock;
[0128] Step S604, pushing the equity data write-off message corresponding to the order information to the message queue;
[0129] Step S605, in response to receiving the equity data write-off request, obtaining the corresponding equity data write-off message from the message queue, and obtaining the second distributed lock;
[0130] Step S606, querying the equity data change flow according to the equity data write-off message;
[0131] Step S607, sorting the equity data details according to their expiration time points;
[0132] Step S608, according to the preset equity data detail acquisition quantity, acquiring a corresponding quantity of equity data details from the sorted equity data details;
[0133] Step S609, summing up the equity data amounts of the acquired equity data details;
[0134] Step S611, determine whether the sum result is equal to the equity data amount of the equity data change flow, if so, jump to step S605, otherwise, jump to step S612;
[0135] Step S611, taking the acquired equity data details as target equity data details;
[0136] Step S612, judging whether the sum result is greater than the equity data amount of the equity data change flow, if so, jumping to step S613, otherwise, jumping to step S608;
[0137] Step S613, removing some equity data details from the most recently acquired equity data details, so that the equity data amount of the remaining acquired equity data details is equal to the equity data amount of the equity data change flow, and taking the remaining acquired equity data details as the target equity data details;
[0138] Step S614, write off the target equity data details;
[0139] Step S615: releasing the first distributed lock.
[0140] The specific implementation content of the method for updating equity data of another reference embodiment of the present invention has been described in detail in the above-mentioned method for updating equity data, so the repeated content will not be described here.
[0141] Figure 7 FIG. 1 is a schematic diagram of the main process of a method for updating equity data according to another reference embodiment of the present invention. Figure 7 As shown, the method for updating the equity data may include:
[0142] Step S701, in response to receiving the order information of the target user, using a preset update responsibility chain to determine whether the order information passes verification;
[0143] Step S702, filtering out target product information that matches a preset data information association set from the product information;
[0144] Step S703, determining the equity data type corresponding to the target product information according to a preset equity data type set;
[0145] Step S704, determining the equity data change flow corresponding to the order information according to the target product information and the equity data type, and updating the equity data flow and equity data quota of the target user according to the equity data change flow;
[0146] Step S705, pushing the equity data write-off message corresponding to the order information to the message queue;
[0147] Step S706, in response to receiving the equity data write-off request, obtaining the equity data write-off message corresponding to the order information from the message queue, and querying the equity data change flow according to the equity data write-off message;
[0148] Step S707, sorting the equity data details according to their expiration time points;
[0149] Step S708, obtaining a target equity data detail from the sorted equity data details, the equity data amount of the target equity data detail is equal to the equity data amount of the equity data change flow, and the equity data detail is written off;
[0150] Step S709, in response to receiving the equity data scheduled write-off request, obtaining the target equity data change flow of the equity data details that have not been written off within the preset write-off period, and updating the equity data details according to the target equity data change flow.
[0151] The specific implementation content of the method for updating equity data of another reference embodiment of the present invention has been described in detail in the above-mentioned method for updating equity data, so the repeated content will not be described here.
[0152] According to a second aspect of an embodiment of the present invention, a device for updating equity data is provided.
[0153] Figure 8 is a schematic diagram of the main modules of the device for updating equity data according to an embodiment of the present invention, such as Figure 8 As shown, the device 800 for updating equity data mainly includes:
[0154] The first updating module 801 is used to determine the equity data change flow corresponding to the order information in response to receiving the order information of the target user, and update the equity data flow and equity data quota of the target user according to the equity data change flow;
[0155] A message push module 802 is used to push the equity data write-off message corresponding to the order information to a message queue;
[0156] The second update module 803 is used to obtain the equity data cancellation message corresponding to the order information from the message queue in response to receiving the equity data cancellation request, query the equity data change flow according to the equity data cancellation message, and update the equity data details of the target user according to the equity data change flow.
[0157] According to a reference embodiment of the present invention, updating the rights and interests data details of the target user according to the rights and interests data change flow includes:
[0158] sorting the equity data details according to the expiration time points of the equity data details;
[0159] Obtaining a target equity data detail from the sorted equity data details, wherein the equity data amount of the target equity data detail is equal to the equity data amount of the equity data change flow;
[0160] The target equity data details are written off.
[0161] According to another reference embodiment of the present invention, obtaining target equity data details from the sorted equity data details includes:
[0162] Repeat the amount comparison step until the equity data amount of the acquired equity data detail is greater than or equal to the equity data amount of the equity data change flow:
[0163] The amount comparison step includes:
[0164] According to the preset equity data detail acquisition amount, a corresponding number of equity data details are acquired from the sorted equity data details, and the equity data amount of the acquired equity data details is compared with the equity data amount of the equity data change flow;
[0165] When the equity data amount of the acquired equity data details is equal to the equity data amount of the equity data change flow, the acquired equity data details are used as the target equity data details;
[0166] In the case where the equity data amount of the acquired equity data details is greater than the equity data amount of the equity data change flow, based on the expiration time point of the equity data details, some equity data details are removed from the most recently acquired equity data details, so that the equity data amount of the remaining acquired equity data details is equal to the equity data amount of the equity data change flow, and the remaining acquired equity data details are used as the target equity data details.
[0167] According to another reference embodiment of the present invention, the equity data updating device 800 further includes:
[0168] A flow acquisition module, for, in response to receiving a request for timed write-off of equity data, acquiring a target equity data change flow of equity data details that have not been written off within a preset write-off period;
[0169] The third updating module is used to update the corresponding equity data details according to the target equity data change flow.
[0170] According to another reference embodiment of the present invention, the order information includes product information; the equity data updating device 800 further includes:
[0171] A screening module, used to screen out target product information matching a preset data information association set from the product information;
[0172] The determination module is used to determine the equity data type corresponding to the target product information according to a preset equity data type set, and the target product information and the equity data type are used to determine the equity data change flow corresponding to the order information.
[0173] According to another reference embodiment of the present invention, the equity data updating device 800 further includes:
[0174] The verification module is used to determine whether the order information passes the verification by using a preset update responsibility chain, wherein the update responsibility chain includes a plurality of verification tasks, and each verification task includes a plurality of verification nodes.
[0175] According to a reference embodiment of the present invention, the device 800 for updating equity data further includes:
[0176] A first locking module, configured to obtain a first distributed lock before determining the equity data change flow corresponding to the order information, and release the first distributed lock after updating the equity data flow and equity data quota of the target user according to the equity data change flow;
[0177] The second locking module is used to obtain a second distributed lock before querying the equity data change flow according to the equity data cancellation message, and release the second distributed lock after updating the equity data details of the target user according to the equity data change flow.
[0178] It should be noted that the specific implementation content of the device for updating the rights and interests data in the embodiment of the present invention has been described in detail in the method for updating the rights and interests data described above, so the repeated content will not be described again here.
[0179] According to the technical solution of the embodiment of the present invention, the equity data flow and the equity data details are updated asynchronously, and the equity data details with a large amount of data are processed with delay, which can improve the efficiency of equity data update, ensure the stability of the equity data update service, reduce the response time of equity data update, and optimize the user experience; the equity data details are sorted according to the expiration time point of the equity data details, so that the equity data details that are about to expire can be used to avoid the equity data from being unusable due to expiration, effectively guarantee the user's rights and interests, and further optimize the user experience; repeatedly obtain a fixed number of equity data details and compare them with the equity data flow, avoid obtaining a large amount of data at one time, and ensure the interface performance of updating the equity data details. It can improve the response efficiency and accuracy of equity data updates; regularly write off the target equity data change flow for the unfinished equity data details to avoid missing some equity data details update operations due to database write timeouts, message queue consumption exceptions, etc., accurately update the equity data, and effectively guarantee user rights; determine the goods suitable for equity data redemption and use the update responsibility chain to verify the order information, which can improve the accuracy and security of equity data updates and avoid the theft of equity data; use multiple distributed locks to control the equity data update process to ensure that only serial updates of the same user's equity data are allowed, improve the accuracy of equity data updates, and avoid repeated updates of equity data.
[0180] According to a third aspect of an embodiment of the present invention, there is provided an electronic device, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method provided by the first aspect of the embodiment of the present invention.
[0181] According to a fourth 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, the method provided by the first aspect of the embodiment of the present invention is implemented.
[0182] Fig. 9 An exemplary system architecture 900 is shown to which the method for updating equity data or the apparatus for updating equity data according to the embodiment of the present invention can be applied.
[0183] like Fig. 9 As shown, system architecture 900 may include terminal devices 901, 902, 903, network 904 and server 905. Network 904 is used to provide a medium for communication links between terminal devices 901, 902, 903 and server 905. Network 904 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0184] Users can use terminal devices 901, 902, 903 to interact with server 905 through network 904 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 901, 902, 903, such as: equity data update applications, equity data query applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).
[0185] The terminal devices 901 , 902 , and 903 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers, etc.
[0186] Server 905 may be a server that provides various services, such as a background management server that provides support for the request for updating the equity data sent by the upstream terminal devices 901, 902, and 903 (for example only). In response to receiving the order information of the target user, the background management server may determine the equity data change flow corresponding to the order information, and update the equity data flow and equity data quota of the target user according to the equity data change flow; push the equity data write-off message corresponding to the order information to the message queue; in response to receiving the equity data write-off request, obtain the equity data write-off message corresponding to the order information from the message queue, query the equity data change flow according to the equity data write-off message, and update the equity data details of the target user according to the equity data change flow; and feedback the equity data update situation (for example only) to the terminal device.
[0187] It should be noted that the method for updating the rights and interests data provided in the embodiment of the present invention is generally executed by the server 905, and accordingly, the updating device of the rights and interests data is generally set in the server 905. The method for updating the rights and interests data provided in the embodiment of the present invention can also be executed by the terminal devices 901, 902, and 903, and accordingly, the updating device of the rights and interests data can be set in the terminal devices 901, 902, and 903.
[0188] It should be understood that Fig. 9 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to the implementation requirements.
[0189] Reference below Fig.10 , which shows a schematic diagram of the structure of a computer system 1000 of a terminal device suitable for implementing an embodiment of the present invention. Fig.10 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.
[0190] like Fig.10 As shown, the computer system 1000 includes a central processing unit (CPU) 1001, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage part 1008 into a random access memory (RAM) 1003. In the RAM 1003, various programs and data required for the operation of the system 1000 are also stored. The CPU 1001, the ROM 1002, and the RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.
[0191] The following components are connected to the I / O interface 1005: an input section 1006 including a keyboard, a mouse, etc.; an output section 1007 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1008 including a hard disk, etc.; and a communication section 1009 including a network interface card such as a LAN card, a modem, etc. The communication section 1009 performs communication processing via a network such as the Internet. A drive 1010 is also connected to the I / O interface 1005 as needed. A removable medium 1011, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1010 as needed, so that a computer program read therefrom is installed into the storage section 1008 as needed.
[0192] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 1009, and / or installed from the removable medium 1011. When the computer program is executed by the central processing unit (CPU) 1001, the above-mentioned functions defined in the system of the embodiment of the present invention are executed.
[0193] It should be noted that the computer-readable medium shown in the embodiment of the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In an embodiment of the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In an embodiment of the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0194] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order 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 flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0195] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be set in a processor, for example, it may be described as: a processor includes a first update module, a message push module, and a second update module, wherein the names of these modules do not constitute a limitation on the modules themselves under certain circumstances, for example, the first update module may also be described as a "module for updating the equity data flow and equity data amount of the target user".
[0196] As another aspect, an embodiment of the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently and not be assembled into the device. The above computer-readable medium carries one or more programs. When the above one or more programs are executed by a device, the device implements the following method: in response to receiving the order information of the target user, determining the equity data change flow corresponding to the order information, updating the equity data flow and equity data quota of the target user according to the equity data change flow; pushing the equity data cancellation message corresponding to the order information to the message queue; in response to receiving the equity data cancellation request, obtaining the equity data cancellation message corresponding to the order information from the message queue, querying the equity data change flow according to the equity data cancellation message, and updating the equity data details of the target user according to the equity data change flow.
[0197] According to the technical solution of the embodiment of the present invention, the equity data flow and the equity data details are updated asynchronously, and the equity data details with a large amount of data are processed with delay, which can improve the efficiency of equity data update, ensure the stability of the equity data update service, reduce the response time of equity data update, and optimize the user experience; the equity data details are sorted according to the expiration time point of the equity data details, so that the equity data details that are about to expire can be used to avoid the equity data from being unusable due to expiration, effectively guarantee the user's rights and interests, and further optimize the user experience; repeatedly obtain a fixed number of equity data details and compare them with the equity data flow, avoid obtaining a large amount of data at one time, and ensure the interface performance of updating the equity data details. It can improve the response efficiency and accuracy of equity data updates; regularly write off the target equity data change flow for the unfinished equity data details to avoid missing some equity data details update operations due to database write timeouts, message queue consumption exceptions, etc., accurately update the equity data, and effectively guarantee user rights; determine the goods suitable for equity data redemption and use the update responsibility chain to verify the order information, which can improve the accuracy and security of equity data updates and avoid the theft of equity data; use multiple distributed locks to control the equity data update process to ensure that only serial updates of the same user's equity data are allowed, improve the accuracy of equity data updates, and avoid repeated updates of equity data.
[0198] The above specific implementations do not constitute a limitation on the protection scope of the embodiments of the present invention. It should be understood by those skilled in the art 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 embodiments of the present invention should be included in the protection scope of the embodiments of the present invention.
Claims
1. A method for updating equity data, characterized in that: include: In response to receiving the order information of the target user, determining the equity data change flow corresponding to the order information, and updating the equity data flow and equity data quota of the target user according to the equity data change flow; Pushing the equity data write-off message corresponding to the order information to the message queue; In response to receiving a rights and interests data write-off request, obtaining a rights and interests data write-off message corresponding to the order information from the message queue, querying the rights and interests data change flow according to the rights and interests data write-off message, and updating the rights and interests data details of the target user according to the rights and interests data change flow.
2. The method according to claim 1, characterized in that: Updating the rights and interests data details of the target user according to the rights and interests data change flow, including: sorting the equity data details according to the expiration time points of the equity data details; Obtaining a target equity data detail from the sorted equity data details, wherein the equity data amount of the target equity data detail is equal to the equity data amount of the equity data change flow; The target equity data details are written off.
3. The method according to claim 2, characterized in that Obtain target equity data details from the sorted equity data details, including: Repeat the amount comparison step until the equity data amount of the acquired equity data detail is greater than or equal to the equity data amount of the equity data change flow; The amount comparison step includes: According to the preset equity data detail acquisition amount, a corresponding number of equity data details are acquired from the sorted equity data details, and the equity data amount of the acquired equity data details is compared with the equity data amount of the equity data change flow; When the equity data amount of the acquired equity data details is equal to the equity data amount of the equity data change flow, the acquired equity data details are used as the target equity data details; In the case where the equity data amount of the acquired equity data details is greater than the equity data amount of the equity data change flow, based on the expiration time point of the equity data details, some equity data details are removed from the most recently acquired equity data details, so that the equity data amount of the remaining acquired equity data details is equal to the equity data amount of the equity data change flow, and the remaining acquired equity data details are used as the target equity data details.
4. The method according to claim 1, characterized in that The method further comprises: In response to receiving a request for timed write-off of equity data, obtaining a target equity data change flow of equity data details that have not been written off within a preset write-off period; The corresponding equity data details are updated according to the target equity data change flow.
5. The method according to claim 1, characterized in that: The order information includes product information; before determining the equity data change flow corresponding to the order information, the method further includes: Filtering target product information that matches a preset data information association set from the product information; The equity data type corresponding to the target product information is determined according to a preset equity data type set, and the target product information and the equity data type are used to determine the equity data change flow corresponding to the order information.
6. The method according to claim 1, characterized in that Before determining the equity data change flow corresponding to the order information, the method further includes: A preset update responsibility chain is used to determine whether the order information has passed verification, wherein the update responsibility chain includes multiple verification tasks, and each verification task includes multiple verification nodes.
7. The method according to claim 1, characterized in that The method further comprises: Before determining the equity data change flow corresponding to the order information, obtaining a first distributed lock, and after updating the equity data flow and equity data quota of the target user according to the equity data change flow, releasing the first distributed lock; Before querying the equity data change flow according to the equity data cancellation message, a second distributed lock is acquired, and after updating the equity data details of the target user according to the equity data change flow, the second distributed lock is released.
8. A device for updating equity data, characterized in that: include: A first updating module, configured to, in response to receiving order information of a target user, determine a rights and interests data change flow corresponding to the order information, and update the rights and interests data flow and rights and interests data quota of the target user according to the rights and interests data change flow; A message push module, used to push the equity data write-off message corresponding to the order information to a message queue; The second update module is used to obtain the equity data cancellation message corresponding to the order information from the message queue in response to receiving the equity data cancellation request, query the equity data change flow according to the equity data cancellation message, and update the equity data details of the target user according to the equity data change flow.
9. 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 7.
10. 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 7 is implemented.