A control method, device, equipment and storage medium for receiving virtual rights
By verifying the client's identity and qualification token and performing atomic operations on inventory balances under high concurrency, the problem of over-claiming of virtual rights is solved, improving system stability and user experience.
Patent Information
- Application Number
- CN202411879079.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-19
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2044-12-19
AI Technical Summary
In high-concurrency situations, existing technologies cannot effectively prevent virtual rights from being over-claimed, resulting in degraded system performance and poor user experience.
By verifying the identity token and qualification token received from the client, the inventory balance is determined in combination with the equity primary key. After the verification is passed, secondary balance verification and atomic operations of inventory deduction are performed to ensure the consistency of inventory data.
It improves the concurrent processing performance of the business system, avoids the problem of over-claiming of virtual rights, ensures system stability and user experience, and reduces the risk of malicious wool-pulling.
Smart Images

Figure CN119788358B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of Internet technology, and in particular to a control method, device, equipment and storage medium for claiming virtual rights and interests. Background Art
[0002] In modern e-commerce, electronic virtual benefits are a key means of attracting users. However, in high-concurrency scenarios, such as at the start of an online marketing campaign, the system faces a massive pressure from user requests. In such situations, the system may experience over-claiming of virtual benefits, where users rapidly and repeatedly submit requests to obtain more than the intended amount of virtual benefits.
[0003] To solve the above problems, existing technologies have proposed some solutions, but they still have many shortcomings, such as the inability to effectively handle high-concurrency requests, resulting in system performance degradation or poor user experience. Summary of the Invention
[0004] The purpose of this application is to provide a control method, device, electronic device and storage medium for the collection of virtual rights, which can effectively prevent the excessive collection of virtual rights in high-concurrency situations, thereby improving the stability of the business system and user experience.
[0005] In a first aspect, an embodiment of the present application provides a method for controlling the collection of virtual rights and interests, including:
[0006] Receive a request for claiming a target virtual equity from a client, wherein the request carries the client's identity token, qualification token, and the equity primary key of the target virtual equity;
[0007] Verifying the validity of the identity token and qualification token;
[0008] If the verification is successful, the inventory balance of the target virtual equity is obtained based on the equity primary key. If the balance is sufficient, a secondary balance verification and an atomic operation of inventory deduction are performed. After the inventory deduction is successful, the user equity claim record is cached and a prompt message indicating that the equity claim is successful is returned to the client.
[0009] If the verification fails, a prompt message indicating that the rights collection failed will be returned to the client.
[0010] In a possible implementation, before receiving the request for claiming the target virtual rights and interests from the client, the method further includes:
[0011] Receive an identity authentication request from a client, which contains an IP address and a mobile phone number.
[0012] Generate and cache a unique and time-sensitive identity token based on the IP and mobile phone number, and return the identity token to the client;
[0013] Receive a qualification authentication request from the client, which contains the identity token, IP address, mobile phone number address, and user permissions;
[0014] If the identity token, IP location, mobile phone number location and user permissions all meet the requirements, a unique and time-limited qualification token is generated and cached, and the qualification token is returned to the client.
[0015] In a possible implementation, before receiving the request for claiming the target virtual rights and interests from the client, the method further includes:
[0016] Receive an update request for the target virtual equity inventory, wherein the update request carries the equity primary key of the target virtual equity and its corresponding equity quantity and update method;
[0017] The inventory of the target virtual equity is updated according to the update request.
[0018] In a possible implementation, the updating method is increasing or decreasing.
[0019] In a second aspect, an embodiment of the present application provides a control device for claiming virtual rights, including:
[0020] A receiving module, configured to receive a claim request for a target virtual equity from a client, wherein the claim request carries the client's identity token, qualification token, and the equity primary key of the target virtual equity;
[0021] A verification module, used to verify the validity of the identity token and qualification token;
[0022] The operation module is used to obtain the inventory balance of the target virtual equity according to the equity primary key if the verification is successful. If the balance is sufficient, it performs secondary balance verification and atomic inventory deduction operations. After the inventory deduction is successful, it caches the user equity claim record and returns a prompt message indicating that the equity claim is successful to the client. If the verification fails, it returns a prompt message indicating that the equity claim has failed to be claimed to the client.
[0023] In a possible implementation, the receiving module is further configured to:
[0024] Before receiving the request for claiming the target virtual rights and interests from the client, receive an identity authentication request from the client, wherein the identity authentication request carries the network address IP and mobile phone number;
[0025] Generate and cache a unique and time-sensitive identity token based on the IP and mobile phone number, and return the identity token to the client;
[0026] Receive a qualification authentication request from the client, which contains the identity token, IP address, mobile phone number address, and user permissions;
[0027] If the identity token, IP location, mobile phone number location and user permissions all meet the requirements, a unique and time-limited qualification token is generated and cached, and the qualification token is returned to the client.
[0028] In a possible implementation, the receiving module is further configured to:
[0029] Before receiving a request from a client to claim a target virtual equity, receiving an update request for the target virtual equity inventory, wherein the update request carries the equity primary key of the target virtual equity, its corresponding equity quantity, and an update method;
[0030] The inventory of the target virtual equity is updated according to the update request.
[0031] In a possible implementation, the updating method is increasing or decreasing.
[0032] In a third aspect, an embodiment of the present application provides an electronic device comprising: a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes the computer program to implement the method described in the first aspect.
[0033] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having computer-readable instructions stored thereon, and the computer-readable instructions can be executed by a processor to implement the method described in the first aspect.
[0034] Compared with the existing technology, the control method for the collection of virtual rights provided by the present application receives a collection request for the target virtual rights sent by the client, wherein the collection request carries the client's identity token, qualification token and the rights primary key of the target virtual rights; verifies the validity of the identity token and qualification token; if the verification is successful, obtains the inventory balance of the target virtual rights according to the rights primary key, and if the balance is sufficient, performs a secondary balance verification and an atomic operation of inventory deduction. After the inventory deduction is successful, the user's rights collection record is cached, and a prompt message of successful rights collection is returned to the client; if the verification fails, a prompt message of failed rights collection is returned to the client. Compared with the existing technology, the present application avoids a lot of time-consuming and repetitive verification processing through a series of qualification authentications under high concurrency, and improves the concurrent processing performance of the business system; the use of atomic operations for the judgment and deduction of virtual rights inventory balances can avoid dirty reading and operation of inventory under high concurrency, and can effectively solve the problem of over-collection of virtual rights under high concurrency, ensure the stability of the business system, improve the security of user information and user experience, and reduce the risk of malicious plundering of the business system. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Various other advantages and benefits will become apparent to those skilled in the art upon reading the detailed description of the preferred embodiment below. The accompanying drawings are for illustration purposes only and are not to be considered as limiting the present application. The same reference symbols are used throughout the drawings to represent the same components. In the drawings:
[0036] Figure 1 A flowchart of a method for controlling the collection of virtual benefits provided in an embodiment of the present application is shown;
[0037] Figure 2 A flowchart of the interaction between a specific business system and a client provided in an embodiment of the present application is shown;
[0038] Figure 3 A schematic diagram of a control device for claiming virtual benefits provided in an embodiment of the present application is shown;
[0039] Figure 4 A schematic diagram of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0040] Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments described herein. Rather, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0041] It should be noted that, unless otherwise specified, the technical or scientific terms used in this application should have the common meanings understood by those skilled in the art to which this application belongs.
[0042] In addition, the terms "first" and "second" are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or elements is not limited to the listed steps or elements, but may optionally include steps or elements not listed, or may optionally include other steps or elements inherent to the process, method, product, or apparatus.
[0043] Please refer to Figure 1 , Figure 1 This is a flowchart of a control method for claiming virtual rights and interests provided by an embodiment of the present application. The present application can be applied to a business system. The method includes the following steps S101 to S104:
[0044] S101: Receive a request for claiming a target virtual benefit from a client, where the request carries the client's identity token, qualification token, and the primary key of the target virtual benefit;
[0045] An identity token is a digital credential used to verify a user's identity. It's generated during the authentication process and contains user-related information. It's securely transferred between different system components or services to prove the user's identity. Much like an ID card, it's presented when verification is needed to demonstrate the legitimacy of one's identity.
[0046] User identification information is the core part of the identity token and is used to uniquely identify the user. It usually includes user ID, username, network address, mobile phone number or email address. To ensure security, identity tokens generally have an expiration date. It will include the token generation time and expiration date. Setting an expiration date can prevent the token from being used indefinitely, reducing security risks. Identity tokens usually include a signature part to ensure the integrity and authenticity of the token. The signature is obtained by processing other parts of the token (such as user identification and expiration date) using an encryption algorithm. When the system receives the identity token, it will use the same algorithm and key to verify whether the signature is correct to determine whether the token has been tampered with.
[0047] A qualification token is a digital credential used to prove the holder's qualifications for a specific domain, system, or activity. Unlike identity tokens, which primarily verify identity, qualification tokens focus on indicating whether a user meets specific requirements or conditions, thereby qualifying them to perform certain actions, access specific resources, or participate in specific transactions. Qualification tokens also have an expiration date, which specifies the timeframe within which they are valid.
[0048] The equity primary key is like an ID number for a virtual equity, accurately locating and distinguishing each individual virtual equity. The most important characteristic of an equity primary key is that it must be unique across the entire set of equity records. This ensures that each virtual equity can be clearly identified within the database or system, preventing confusion.
[0049] Specifically, in the control method for claiming virtual rights provided by the present application, before step S101 of receiving a claim request for a target virtual right sent by a client, the method further includes:
[0050] Receive an identity authentication request from a client, which carries an IP address and a mobile phone number; generate and cache a unique and time-limited identity token based on the IP address and mobile phone number, and return the identity token to the client;
[0051] Receive a qualification authentication request sent by the client, which carries an identity token, IP location, mobile phone number location, and user permissions; if the identity token, IP location, mobile phone number location, and user permissions all meet the requirements, generate and cache a unique and time-limited qualification token, and return the qualification token to the client, otherwise return a prompt message to the client that it is not eligible to receive benefits.
[0052] Specifically, the business system can include an identity module for generating and verifying identity tokens. The business system can also include a qualification module for generating and verifying qualification tokens. For example, the validity period of an identity token can be set to 5 minutes, while the validity period of a qualification token can be set to 1 minute. This avoids time-consuming and repetitive verification processes during the validity period, prevents repeated authentication and consumes server resources, and improves the concurrent processing performance of the business system.
[0053] S102: Verify the validity of the identity token and the qualification token; for example, verify whether the token is within the validity period and verify the authenticity of the token.
[0054] S103. If the verification passes, the inventory balance of the target virtual equity is obtained based on the equity primary key. If the balance is sufficient, a secondary balance verification and an atomic inventory deduction operation are performed. After the inventory deduction is successful, the user equity claim record is cached, and a prompt message indicating that the equity claim is successful is returned to the client.
[0055] Business systems can experience dirty reads and operations on inventory data under high concurrency. In a high-concurrency environment, a dirty read occurs when one transaction reads data from another uncommitted transaction. In inventory management, when multiple users are performing inventory operations simultaneously, a situation may arise where one transaction is modifying inventory data (such as deducting inventory) but has not yet committed the change, while another transaction reads this uncommitted inventory data, resulting in a dirty read.
[0056] In scenarios such as inventory management systems, secondary stock verification and inventory deduction are critical operations. Secondary stock verification reconfirms whether inventory is sufficient to meet an order after a user places an order. Inventory deduction involves subtracting the order quantity from the inventory quantity of the corresponding item after verification. These two operations are closely linked, and in concurrent environments (such as multiple users placing orders for the same item simultaneously), atomicity must be guaranteed to avoid data inconsistencies such as overselling. If secondary stock verification and inventory deduction operations are not atomic, a situation may arise where multiple users pass stock verification simultaneously (because inventory is sufficient at the time of verification), but during inventory deduction, excessive inventory may be deducted due to the non-atomic operation, resulting in overselling. For example, if only one item is left in stock and two users place orders simultaneously, without atomicity, both users may believe their purchases were successful, which is obviously unreasonable. At the database level, inventory data accuracy is crucial. Atomic operations can ensure that the secondary balance verification and inventory deduction are either all successful (sufficient inventory and successful deduction) or not executed at all (no deduction if insufficient inventory), thereby ensuring the consistency of inventory data and order data.
[0057] Specifically, an inventory module can be set up in the business system to manage the inventory of virtual rights and interests.
[0058] This application uses atomic operations for the judgment and deduction of equity inventory balances, which can avoid dirty reading and operations of inventory under high concurrency, effectively solve the problem of over-claim of virtual equity under high concurrency, and ensure the stability of the business system.
[0059] S104. If the verification fails, a prompt message indicating that the rights collection failed is returned to the client;
[0060] In some embodiments, the above-mentioned method for controlling the claiming of virtual rights may further include the following steps before step S101 of receiving the claiming request for the target virtual rights sent by the client:
[0061] An update request for the target virtual equity inventory is received, wherein the update request carries an equity primary key of the target virtual equity and its corresponding equity quantity and update method; and the inventory of the target virtual equity is updated according to the update request.
[0062] Specifically, the update method is to increase or decrease. For example, the inventory quantity of the target virtual equity is increased according to the update request; or the inventory quantity of the target virtual equity is decreased according to the update request.
[0063] For ease of understanding, this application also provides Figure 2 As shown in the flowchart of a specific business system and client interaction, the business system includes the above-mentioned identity module, qualification module and inventory module, such as Figure 2 As shown, the following steps are included:
[0064] Step 1: The client initiates an identity authentication request to the business system. The business system first authenticates the identity through the identity module. If the identity is valid, an identity token is generated and a success message is returned. Otherwise, a failure message is returned. After the business system passes the identity authentication, the client caches the authentication result in a cache system (such as Redis). The cache time is set to 5 minutes to reduce the burden of repeated authentication.
[0065] Step 2: The client initiates a qualification authentication request for virtual rights to the business system, including identity token, IP address, mobile phone number address, user permissions, etc., to determine whether the user meets the conditions for receiving the rights. If the user is eligible, a qualification token is generated and a qualification authentication success message is returned; otherwise, a qualification authentication failure message is returned. The business system caches the qualification authentication result in the cache system, and the cache time is set to 1 minute to avoid repeated verification;
[0066] Step 3: If the client's virtual equity claim qualification authentication is successful, the inventory module uses atomic operations to update the inventory quantity in the storage system. Atomic operations can include database transactions or distributed locks to ensure the accuracy of inventory data. If authentication or qualification fails, or if there is insufficient inventory, the inventory module returns a failure response. The inventory deduction operation record is asynchronously sent to a message queue system (such as RabbitMQ or Kafka), which asynchronously processes the record and inserts it into a persistent storage system (such as a relational database) to reduce latency in the main operation.
[0067] The control method for the collection of virtual rights provided in the embodiment of the present application receives a collection request for the target virtual rights sent by the client, wherein the collection request carries the client's identity token, qualification token and the rights primary key of the target virtual rights; verifies the validity of the identity token and qualification token; if the verification is successful, obtains the inventory balance of the target virtual rights according to the rights primary key, and if the balance is sufficient, performs a secondary balance verification and an atomic operation of inventory deduction, caches the user rights collection record after the inventory deduction is successful, and returns a prompt message of successful rights collection to the client; if the verification fails, returns a prompt message of failed rights collection to the client. Compared with the prior art, the present application avoids a lot of time-consuming and repeated verification processing through a series of qualification authentications under high concurrency, and improves the concurrent processing performance of the business system; adopts atomic operations for the judgment and deduction of virtual rights inventory balance, which can avoid dirty reading and operation of inventory under high concurrency, and can effectively solve the problem of over-collection of virtual rights under high concurrency, ensure the stability of the business system, improve the security of user information and user experience, and reduce the risk of malicious plundering of the business system.
[0068] In the above embodiment, a control method for collecting virtual rights and interests is provided. Correspondingly, the present application also provides a control device for collecting virtual rights and interests. The control device for collecting virtual rights and interests provided in the embodiment of the present application can implement the control method for collecting virtual rights and interests. The control device for collecting virtual rights and interests can be implemented by software, hardware, or a combination of software and hardware. For example, the control device for collecting virtual rights and interests can include integrated or separate functional modules or units to perform the corresponding steps in the above methods. Please refer to Figure 3 As shown, the control device 10 for claiming virtual rights of the present application includes:
[0069] Receiving module 101, configured to receive a claim request for a target virtual equity from a client, wherein the claim request carries the client's identity token, qualification token, and the equity primary key of the target virtual equity;
[0070] Verification module 102, used to verify the validity of the identity token and qualification token;
[0071] Operation module 103 is used to obtain the inventory balance of the target virtual equity based on the equity primary key if the verification is successful. If the balance is sufficient, secondary balance verification and atomic inventory deduction operations are performed. After the inventory deduction is successful, the user equity claim record is cached and a prompt message indicating that the equity claim is successful is returned to the client. If the verification fails, a prompt message indicating that the equity claim has failed is returned to the client.
[0072] In a possible implementation, the receiving module 101 is further configured to:
[0073] Before receiving the request for claiming the target virtual rights and interests from the client, receive an identity authentication request from the client, wherein the identity authentication request carries the network address IP and mobile phone number;
[0074] Generate and cache a unique and time-sensitive identity token based on the IP and mobile phone number, and return the identity token to the client;
[0075] Receive a qualification authentication request from the client, which contains the identity token, IP address, mobile phone number address, and user permissions;
[0076] If the identity token, IP location, mobile phone number location and user permissions all meet the requirements, a unique and time-limited qualification token is generated and cached, and the qualification token is returned to the client.
[0077] In a possible implementation, the receiving module 101 is further configured to:
[0078] Before receiving a request from a client to claim a target virtual equity, receiving an update request for the target virtual equity inventory, wherein the update request carries the equity primary key of the target virtual equity, its corresponding equity quantity, and an update method;
[0079] The inventory of the target virtual equity is updated according to the update request.
[0080] In a possible implementation, the updating method is increasing or decreasing.
[0081] The control device for claiming virtual rights and interests provided in the embodiment of the present application and the control method for claiming virtual rights and interests provided in the embodiment of the present application are based on the same inventive concept and have the same beneficial effects as the methods adopted, operated or implemented therein.
[0082] An embodiment of the present application also provides an electronic device corresponding to the method provided in the aforementioned embodiment. The electronic device may be an electronic device for a client, such as a mobile phone, a laptop computer, a tablet computer, a desktop computer, etc., to execute the above-mentioned control method for collecting virtual rights.
[0083] Please refer to Figure 4 , which shows a schematic diagram of an electronic device provided by some embodiments of the present application. Figure 4As shown, the electronic device 20 includes: a processor 200, a memory 201, a bus 202 and a communication interface 203, and the processor 200, the communication interface 203 and the memory 201 are connected through the bus 202; the memory 201 stores a computer program that can be run on the processor 200, and when the processor 200 runs the computer program, it executes the control method for collecting virtual rights and interests provided in any of the aforementioned embodiments of the present application.
[0084] The memory 201 may include high-speed random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage. The system network element communicates with at least one other network element via at least one communication interface 203 (which may be wired or wireless), and may utilize the Internet, a wide area network, a local area network, a metropolitan area network, or the like.
[0085] Bus 202 can be an ISA bus, a PCI bus, or an EISA bus. Such buses can be divided into address buses, data buses, and control buses. Memory 201 is used to store programs, and processor 200 executes such programs upon receiving execution instructions. The control method for claiming virtual benefits disclosed in any of the aforementioned embodiments of this application can be applied to or implemented by processor 200.
[0086] The processor 200 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by hardware integrated logic circuits in the processor 200 or by software instructions. The above processor 200 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), an off-the-shelf field programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in conjunction with the embodiments of this application can be directly implemented and executed by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium mature in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. The storage medium is located in the memory 201 , and the processor 200 reads the information in the memory 201 and completes the steps of the above method in combination with its hardware.
[0087] The electronic device provided in the embodiment of the present application and the control method for receiving virtual benefits provided in the embodiment of the present application are based on the same inventive concept and have the same beneficial effects as the methods adopted, operated or implemented therein.
[0088] An embodiment of the present application also provides a computer-readable storage medium corresponding to the control method for collecting virtual rights and interests provided in the aforementioned embodiment, on which a computer program (i.e., a program product) is stored. When the computer program is run by a processor, it will execute the control method for collecting virtual rights and interests provided in any of the aforementioned embodiments.
[0089] It should be noted that examples of the computer-readable storage medium may also include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other optical or magnetic storage media, which are not listed here one by one.
[0090] The computer-readable storage medium provided in the above-mentioned embodiments of the present application and the control method for collecting virtual rights and interests provided in the embodiments of the present application are based on the same inventive concept and have the same beneficial effects as the methods adopted, run or implemented by the application programs stored therein.
[0091] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some or all of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application, and they should all be included in the scope of the claims and description of the present application.
Claims
1. A method for controlling the collection of virtual rights, characterized in that: Applied to a business system, the control method includes: Receive a request for claiming a target virtual equity from a client, wherein the request carries the client's identity token, qualification token, and the equity primary key of the target virtual equity; Verifying the validity of the identity token and qualification token; If the verification is successful, the inventory balance of the target virtual equity is obtained based on the equity primary key. If the balance is sufficient, a secondary balance verification and atomic inventory deduction operation are performed. Atomic operations include database transactions or distributed locks. After the inventory deduction is successful, the user equity claim record is cached and a prompt message indicating that the equity claim is successful is returned to the client. If the verification fails, a message indicating that the rights claim failed will be returned to the client; Before receiving the request for claiming the target virtual rights and interests sent by the client, the method further includes: Receive an identity authentication request from a client, which contains an IP address and a mobile phone number. Generate and cache a unique and time-sensitive identity token based on the IP and mobile phone number, and return the identity token to the client; Receive a qualification authentication request from the client, which contains the identity token, IP address, mobile phone number address, and user permissions; If the identity token, IP address, mobile phone number address, and user permissions all meet the requirements, a unique and time-sensitive qualification token is generated and cached, and the qualification token is returned to the client; Before receiving the request for claiming the target virtual rights and interests sent by the client, the method further includes: Receive an update request for the target virtual equity inventory, wherein the update request carries the equity primary key of the target virtual equity and its corresponding equity quantity and update method; The inventory of the target virtual equity is updated according to the update request, and the updating method includes increasing the inventory quantity of the target virtual equity according to the update request; or decreasing the inventory quantity of the target virtual equity according to the update request.
2. A control device for receiving virtual rights, characterized in that: Applied to a business system, the control device includes: A receiving module, configured to receive a claim request for a target virtual equity from a client, wherein the claim request carries the client's identity token, qualification token, and the equity primary key of the target virtual equity; A verification module, used to verify the validity of the identity token and qualification token; An operation module is used to obtain the inventory balance of the target virtual equity based on the equity primary key if the verification is successful. If the balance is sufficient, a secondary balance verification and an atomic operation of inventory deduction are performed. The atomic operation includes a database transaction or a distributed lock. After the inventory deduction is successful, the user equity claim record is cached and a prompt message indicating that the equity claim is successful is returned to the client. If the verification fails, a message indicating that the rights claim failed will be returned to the client; The receiving module is further configured to: Before receiving the request for claiming the target virtual rights and interests from the client, receive an identity authentication request from the client, wherein the identity authentication request carries the network address IP and mobile phone number; Generate and cache a unique and time-sensitive identity token based on the IP and mobile phone number, and return the identity token to the client; Receive a qualification authentication request from the client, which contains the identity token, IP address, mobile phone number address, and user permissions; If the identity token, IP address, mobile phone number address, and user permissions all meet the requirements, a unique and time-sensitive qualification token is generated and cached, and the qualification token is returned to the client; The receiving module is further configured to: Before receiving the request for claiming the target virtual equity from the client, receiving an update request for the target virtual equity inventory, wherein the update request carries the equity primary key of the target virtual equity and its corresponding equity quantity and update method; The inventory of the target virtual equity is updated according to the update request, and the updating method includes increasing the inventory quantity of the target virtual equity according to the update request; or decreasing the inventory quantity of the target virtual equity according to the update request.
3. An electronic device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method according to claim 1 when executing the computer program.
4. A computer-readable storage medium, characterized in that Computer-readable instructions are stored thereon, and the computer-readable instructions can be executed by a processor to implement the method according to claim 1.
Citation Information
Patent Citations
Discount coupon receiving system in high concurrency scene
CN112613912A
Resource processing method and device, electronic equipment and storage medium
CN116149837A